forked from hellosign/hellosign-openapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApiAppCreate.php
42 lines (32 loc) · 1.3 KB
/
ApiAppCreate.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
require_once __DIR__ . "/vendor/autoload.php";
$config = HelloSignSDK\Configuration::getDefaultConfiguration();
// Configure HTTP basic authorization: api_key
$config->setUsername("YOUR_API_KEY");
// or, configure Bearer (JWT) authorization: oauth2
// $config->setAccessToken("YOUR_ACCESS_TOKEN");
$api = new HelloSignSDK\Api\ApiAppApi($config);
$oauth = new HelloSignSDK\Model\SubOAuth();
$oauth->setCallbackUrl("https://example.com/oauth")
->setScopes([
HelloSignSDK\Model\SubOAuth::SCOPES_BASIC_ACCOUNT_INFO,
HelloSignSDK\Model\SubOAuth::SCOPES_REQUEST_SIGNATURE,
]);
$whiteLabelingOptions = new HelloSignSDK\Model\SubWhiteLabelingOptions();
$whiteLabelingOptions->setPrimaryButtonColor("#00b3e6")
->setPrimaryButtonTextColor("#ffffff");
$customLogoFile = new SplFileObject(__DIR__ . "/CustomLogoFile.png");
$data = new HelloSignSDK\Model\ApiAppCreateRequest();
$data->setName("My Production App")
->setDomains(["example.com"])
->setOauth($oauth)
->setWhiteLabelingOptions($whiteLabelingOptions)
->setCustomLogoFile($customLogoFile);
try {
$result = $api->apiAppCreate($data);
print_r($result);
} catch (HelloSignSDK\ApiException $e) {
$error = $e->getResponseObject();
echo "Exception when calling HelloSign API: "
. print_r($error->getError());
}