Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sdks/php/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,6 @@ apisupport@hellosign.com
This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: `3.0.0`
- Package version: `1.8-dev`
- Generator version: `7.8.0`
- Package version: `1.8.1-dev`
- Generator version: `7.12.0`
- Build package: `org.openapitools.codegen.languages.PhpClientCodegen`
2 changes: 1 addition & 1 deletion sdks/php/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.8-dev
1.8.1-dev
64 changes: 64 additions & 0 deletions sdks/php/bin/copy-constants.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/env php
<?php

require_once __DIR__ . '/../vendor/autoload.php';

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

set_error_handler(function ($level, $msg) {
echo "Error: {$msg}";
exit(1);
});

/**
* Between openapi-generator v7.8.0 and v7.12.0 a change was made to the way
* a few generators create constant names from values. The original way was
* actually broken. For example "change-field-visibility" would generate a
* constant name of "TYPE_FIELD_VISIBILITY", dropping the "change" part.
*
* The fix now generates the correct name, "TYPE_CHANGE_FIELD_VISIBILITY".
* However, the fix also gets rid of the previous (incorrect) constant names,
* making the fix a BC break.
*
* This simple script just adds the old constant names back, alongside the new
* ones.
*/
class CopyConstants
{
public function run(): void
{
$file = __DIR__ . '/../src/Model/SubFormFieldRuleAction.php';
$contents = file_get_contents($file);

$constant_1 = " public const TYPE_CHANGE_FIELD_VISIBILITY = 'change-field-visibility';";
$replace_1 = implode("\n", [
$constant_1,
' public const TYPE_FIELD_VISIBILITY = self::TYPE_CHANGE_FIELD_VISIBILITY;',
]);

$constant_2 = " public const TYPE_CHANGE_GROUP_VISIBILITY = 'change-group-visibility';";
$replace_2 = implode("\n", [
$constant_2,
' public const TYPE_GROUP_VISIBILITY = self::TYPE_CHANGE_GROUP_VISIBILITY;',
]);

$contents = str_replace(
$constant_1,
$replace_1,
$contents,
);

$contents = str_replace(
$constant_2,
$replace_2,
$contents,
);

file_put_contents($file, $contents);
}
}

$copier = new CopyConstants();
$copier->run();
2 changes: 1 addition & 1 deletion sdks/php/openapi-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ generatorName: php
additionalProperties:
packageName: dropbox/sign
packageVersion: "^1.8.0"
artifactVersion: 1.8-dev
artifactVersion: 1.8.1-dev
invokerPackage: "Dropbox\\Sign"
sortModelPropertiesByRequiredFlag: true
srcBasePath: src
Expand Down
5 changes: 4 additions & 1 deletion sdks/php/run-build
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ rm -f "${DIR}/src/Model/"*.php
docker run --rm \
-v "${DIR}/:/local" \
-v "${DIR}/openapi-sdk.yaml:/local/openapi-sdk.yaml" \
openapitools/openapi-generator-cli:v7.8.0 generate \
openapitools/openapi-generator-cli:v7.12.0 generate \
-i "/local/openapi-sdk.yaml" \
-c "/local/openapi-config.yaml" \
-t "/local/templates" \
Expand Down Expand Up @@ -48,6 +48,9 @@ docker run --rm \
-w "${WORKING_DIR}" \
perl bash ./bin/scan_for

printf "Adding old-style constant names ...\n"
bash "${DIR}/bin/php-8" ./bin/copy-constants.php

# avoid docker messing with permissions
if [[ -z "$GITHUB_ACTIONS" ]]; then
chmod 644 "${DIR}/README.md"
Expand Down
150 changes: 75 additions & 75 deletions sdks/php/src/Api/AccountApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* The version of the OpenAPI document: 3.0.0
* Contact: apisupport@hellosign.com
* Generated by: https://openapi-generator.tech
* Generator version: 7.8.0
* Generator version: 7.12.0
*/

/**
Expand Down Expand Up @@ -88,9 +88,9 @@ class AccountApi
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
Configuration $config = null,
ClientInterface $client = null,
HeaderSelector $selector = null,
?Configuration $config = null,
?ClientInterface $client = null,
?HeaderSelector $selector = null,
int $hostIndex = 0
) {
$this->client = $client ?: new Client();
Expand Down Expand Up @@ -194,19 +194,6 @@ public function accountCreateWithHttpInfo(Model\AccountCreateRequest $account_cr

$statusCode = $response->getStatusCode();

if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string)$request->getUri()
),
$statusCode,
$response->getHeaders(),
(string)$response->getBody()
);
}

$result = $this->handleRangeCodeResponse(
$response,
'4XX',
Expand Down Expand Up @@ -246,6 +233,19 @@ public function accountCreateWithHttpInfo(Model\AccountCreateRequest $account_cr
];
}

if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string)$request->getUri()
),
$statusCode,
$response->getHeaders(),
(string)$response->getBody()
);
}

$returnType = '\Dropbox\Sign\Model\AccountCreateResponse';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); // stream goes to serializer
Expand Down Expand Up @@ -481,14 +481,14 @@ public function accountCreateRequest(Model\AccountCreateRequest $account_create_
*
* Get Account
*
* @param string $account_id &#x60;account_id&#x60; or &#x60;email_address&#x60; is required. If both are provided, the account id prevails. The ID of the Account. (optional)
* @param string $email_address &#x60;account_id&#x60; or &#x60;email_address&#x60; is required, If both are provided, the account id prevails. The email address of the Account. (optional)
* @param string|null $account_id &#x60;account_id&#x60; or &#x60;email_address&#x60; is required. If both are provided, the account id prevails. The ID of the Account. (optional)
* @param string|null $email_address &#x60;account_id&#x60; or &#x60;email_address&#x60; is required, If both are provided, the account id prevails. The email address of the Account. (optional)
*
* @return Model\AccountGetResponse
* @throws ApiException on non-2xx response or if the response body is not in the expected format
* @throws InvalidArgumentException
*/
public function accountGet(string $account_id = null, string $email_address = null)
public function accountGet(?string $account_id = null, ?string $email_address = null)
{
list($response) = $this->accountGetWithHttpInfo($account_id, $email_address);
return $response;
Expand All @@ -499,16 +499,16 @@ public function accountGet(string $account_id = null, string $email_address = nu
*
* Get Account
*
* @param string $account_id &#x60;account_id&#x60; or &#x60;email_address&#x60; is required. If both are provided, the account id prevails. The ID of the Account. (optional)
* @param string $email_address &#x60;account_id&#x60; or &#x60;email_address&#x60; is required, If both are provided, the account id prevails. The email address of the Account. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountGet'] to see the possible values for this operation
* @param string|null $account_id &#x60;account_id&#x60; or &#x60;email_address&#x60; is required. If both are provided, the account id prevails. The ID of the Account. (optional)
* @param string|null $email_address &#x60;account_id&#x60; or &#x60;email_address&#x60; is required, If both are provided, the account id prevails. The email address of the Account. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountGet'] to see the possible values for this operation
*
* @return array of Model\AccountGetResponse, HTTP status code, HTTP response headers (array of strings)
* @throws ApiException on non-2xx response or if the response body is not in the expected format
* @throws InvalidArgumentException
* @deprecated Prefer to use ::accountGet. This method will eventually become unavailable
*/
public function accountGetWithHttpInfo(string $account_id = null, string $email_address = null, string $contentType = self::contentTypes['accountGet'][0])
public function accountGetWithHttpInfo(?string $account_id = null, ?string $email_address = null, string $contentType = self::contentTypes['accountGet'][0])
{
$request = $this->accountGetRequest($account_id, $email_address, $contentType);

Expand All @@ -535,19 +535,6 @@ public function accountGetWithHttpInfo(string $account_id = null, string $email_

$statusCode = $response->getStatusCode();

if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string)$request->getUri()
),
$statusCode,
$response->getHeaders(),
(string)$response->getBody()
);
}

$result = $this->handleRangeCodeResponse(
$response,
'4XX',
Expand Down Expand Up @@ -587,6 +574,19 @@ public function accountGetWithHttpInfo(string $account_id = null, string $email_
];
}

if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string)$request->getUri()
),
$statusCode,
$response->getHeaders(),
(string)$response->getBody()
);
}

$returnType = '\Dropbox\Sign\Model\AccountGetResponse';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); // stream goes to serializer
Expand Down Expand Up @@ -637,15 +637,15 @@ public function accountGetWithHttpInfo(string $account_id = null, string $email_
*
* Get Account
*
* @param string $account_id &#x60;account_id&#x60; or &#x60;email_address&#x60; is required. If both are provided, the account id prevails. The ID of the Account. (optional)
* @param string $email_address &#x60;account_id&#x60; or &#x60;email_address&#x60; is required, If both are provided, the account id prevails. The email address of the Account. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountGet'] to see the possible values for this operation
* @param string|null $account_id &#x60;account_id&#x60; or &#x60;email_address&#x60; is required. If both are provided, the account id prevails. The ID of the Account. (optional)
* @param string|null $email_address &#x60;account_id&#x60; or &#x60;email_address&#x60; is required, If both are provided, the account id prevails. The email address of the Account. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountGet'] to see the possible values for this operation
*
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @deprecated Prefer to use ::accountGet. This method will eventually become unavailable
*/
public function accountGetAsync(string $account_id = null, string $email_address = null, string $contentType = self::contentTypes['accountGet'][0])
public function accountGetAsync(?string $account_id = null, ?string $email_address = null, string $contentType = self::contentTypes['accountGet'][0])
{
return $this->accountGetAsyncWithHttpInfo($account_id, $email_address, $contentType)
->then(
Expand All @@ -660,15 +660,15 @@ function ($response) {
*
* Get Account
*
* @param string $account_id &#x60;account_id&#x60; or &#x60;email_address&#x60; is required. If both are provided, the account id prevails. The ID of the Account. (optional)
* @param string $email_address &#x60;account_id&#x60; or &#x60;email_address&#x60; is required, If both are provided, the account id prevails. The email address of the Account. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountGet'] to see the possible values for this operation
* @param string|null $account_id &#x60;account_id&#x60; or &#x60;email_address&#x60; is required. If both are provided, the account id prevails. The ID of the Account. (optional)
* @param string|null $email_address &#x60;account_id&#x60; or &#x60;email_address&#x60; is required, If both are provided, the account id prevails. The email address of the Account. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountGet'] to see the possible values for this operation
*
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @deprecated Prefer to use ::accountGet. This method will eventually become unavailable
*/
public function accountGetAsyncWithHttpInfo(string $account_id = null, string $email_address = null, string $contentType = self::contentTypes['accountGet'][0])
public function accountGetAsyncWithHttpInfo(?string $account_id = null, ?string $email_address = null, string $contentType = self::contentTypes['accountGet'][0])
{
$returnType = '\Dropbox\Sign\Model\AccountGetResponse';
$request = $this->accountGetRequest($account_id, $email_address, $contentType);
Expand Down Expand Up @@ -712,15 +712,15 @@ function ($exception) {
/**
* Create request for operation 'accountGet'
*
* @param string $account_id &#x60;account_id&#x60; or &#x60;email_address&#x60; is required. If both are provided, the account id prevails. The ID of the Account. (optional)
* @param string $email_address &#x60;account_id&#x60; or &#x60;email_address&#x60; is required, If both are provided, the account id prevails. The email address of the Account. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountGet'] to see the possible values for this operation
* @param string|null $account_id &#x60;account_id&#x60; or &#x60;email_address&#x60; is required. If both are provided, the account id prevails. The ID of the Account. (optional)
* @param string|null $email_address &#x60;account_id&#x60; or &#x60;email_address&#x60; is required, If both are provided, the account id prevails. The email address of the Account. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountGet'] to see the possible values for this operation
*
* @return Request
* @throws InvalidArgumentException
* @deprecated Prefer to use ::accountGet. This method will eventually become unavailable
*/
public function accountGetRequest(string $account_id = null, string $email_address = null, string $contentType = self::contentTypes['accountGet'][0])
public function accountGetRequest(?string $account_id = null, ?string $email_address = null, string $contentType = self::contentTypes['accountGet'][0])
{
$resourcePath = '/account';
$formParams = [];
Expand Down Expand Up @@ -873,19 +873,6 @@ public function accountUpdateWithHttpInfo(Model\AccountUpdateRequest $account_up

$statusCode = $response->getStatusCode();

if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string)$request->getUri()
),
$statusCode,
$response->getHeaders(),
(string)$response->getBody()
);
}

$result = $this->handleRangeCodeResponse(
$response,
'4XX',
Expand Down Expand Up @@ -925,6 +912,19 @@ public function accountUpdateWithHttpInfo(Model\AccountUpdateRequest $account_up
];
}

if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string)$request->getUri()
),
$statusCode,
$response->getHeaders(),
(string)$response->getBody()
);
}

$returnType = '\Dropbox\Sign\Model\AccountGetResponse';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); // stream goes to serializer
Expand Down Expand Up @@ -1212,19 +1212,6 @@ public function accountVerifyWithHttpInfo(Model\AccountVerifyRequest $account_ve

$statusCode = $response->getStatusCode();

if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string)$request->getUri()
),
$statusCode,
$response->getHeaders(),
(string)$response->getBody()
);
}

$result = $this->handleRangeCodeResponse(
$response,
'4XX',
Expand Down Expand Up @@ -1264,6 +1251,19 @@ public function accountVerifyWithHttpInfo(Model\AccountVerifyRequest $account_ve
];
}

if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string)$request->getUri()
),
$statusCode,
$response->getHeaders(),
(string)$response->getBody()
);
}

$returnType = '\Dropbox\Sign\Model\AccountVerifyResponse';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); // stream goes to serializer
Expand Down
Loading