Skip to content

Commit

Permalink
Merge pull request #34 from dubinc/speakeasy-sdk-regen-1727482725
Browse files Browse the repository at this point in the history
chore: 🐝 Update SDK - Generate 0.6.7
  • Loading branch information
devkiran committed Sep 28, 2024
2 parents 71ae82a + dd212a4 commit dbe7a88
Show file tree
Hide file tree
Showing 21 changed files with 563 additions and 509 deletions.
16 changes: 8 additions & 8 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
lockVersion: 2.0.0
id: 43187d3e-7c3c-4c11-b5d4-4b2334fb6d96
management:
docChecksum: b6e0f68b0350f243f5aab5565767940a
docChecksum: 596f43d83d9b42d6000040c93ba5018d
docVersion: 0.0.1
speakeasyVersion: 1.403.3
generationVersion: 2.424.0
releaseVersion: 0.6.6
configChecksum: b87c0196f770c36646da5e05c86328b0
speakeasyVersion: 1.404.5
generationVersion: 2.426.2
releaseVersion: 0.6.7
configChecksum: cb77160f7624eac61ecd226acdc78be6
repoURL: https://github.com/dubinc/dub-php.git
installationURL: https://github.com/dubinc/dub-php
published: true
features:
php:
core: 3.4.7
core: 3.4.8
deprecations: 2.81.1
errors: 0.1.2
errors: 0.1.3
examples: 2.81.3
flattening: 2.81.1
globalSecurity: 2.81.7
Expand Down Expand Up @@ -533,7 +533,7 @@ examples:
parameters:
query:
linkId: "clux0rgak00011..."
externalId: "ext_123456"
externalId: "123456"
responses:
"400":
application/json: {"error": {"code": "bad_request", "message": "The requested resource was not found.", "doc_url": "https://dub.co/docs/api-reference/errors#bad-request"}}
Expand Down
2 changes: 1 addition & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ generation:
auth:
oAuth2ClientCredentialsEnabled: true
php:
version: 0.6.6
version: 0.6.7
clientServerStatusCodesAsErrors: true
flattenGlobalSecurity: true
imports:
Expand Down
12 changes: 6 additions & 6 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
speakeasyVersion: 1.403.3
speakeasyVersion: 1.404.5
sources:
dub:
sourceNamespace: dub
sourceRevisionDigest: sha256:b9e250813759983008c55439db8fc0c91da3af5a4615ad765f043f4ecfe1420b
sourceBlobDigest: sha256:2592d77c93d3b8cc433a92436afaffa9e860f35c87ea2a84818c607be2f58756
sourceRevisionDigest: sha256:24ba9227109c62730b9f941165a301495f3fa6ada40c8af08ec535f0608c9db0
sourceBlobDigest: sha256:fd97b5bd68e7b5f7887af4893ca679d585e1467dab07717e190f05da32d3dee8
tags:
- latest
- main
targets:
my-first-target:
source: dub
sourceNamespace: dub
sourceRevisionDigest: sha256:b9e250813759983008c55439db8fc0c91da3af5a4615ad765f043f4ecfe1420b
sourceBlobDigest: sha256:2592d77c93d3b8cc433a92436afaffa9e860f35c87ea2a84818c607be2f58756
sourceRevisionDigest: sha256:24ba9227109c62730b9f941165a301495f3fa6ada40c8af08ec535f0608c9db0
sourceBlobDigest: sha256:fd97b5bd68e7b5f7887af4893ca679d585e1467dab07717e190f05da32d3dee8
codeSamplesNamespace: code-samples-php-my-first-target
codeSamplesRevisionDigest: sha256:5b6b121af744f8c8692d04e8a25126f53a7bdf6f956e33051729c7ffc654d35c
codeSamplesRevisionDigest: sha256:3fcc5cc90a8227577c1c8e0df53fa074b2bfe08c59c41f4918889bc5cd1b654c
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
Expand Down
154 changes: 122 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Dub.co API: Dub is link management infrastructure for companies to create market
* [SDK Installation](#sdk-installation)
* [SDK Example Usage](#sdk-example-usage)
* [Available Resources and Operations](#available-resources-and-operations)
* [Error Handling](#error-handling)
* [Server Selection](#server-selection)
<!-- End Table of Contents [toc] -->

Expand Down Expand Up @@ -49,23 +50,21 @@ use Dub\Models\Operations;
$security = 'DUB_API_KEY';

$sdk = Dub\Dub::builder()->setSecurity($security)->build();
try {
$request = new Operations\CreateLinkRequestBody(
url: 'https://google.com',
tagIds: [
'clux0rgak00011...',
],
externalId: '123456',
);
$response = $sdk.links->create(
request: $request
);

if ($response->linkSchema !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
$request = new Operations\CreateLinkRequestBody(
url: 'https://google.com',
tagIds: [
'clux0rgak00011...',
],
externalId: '123456',
);

$response = $sdk->links->create(
request: $request
);

if ($response->linkSchema !== null) {
// handle response
}
```

Expand All @@ -82,23 +81,21 @@ use Dub\Models\Operations;
$security = 'DUB_API_KEY';

$sdk = Dub\Dub::builder()->setSecurity($security)->build();
try {
$request = new Operations\UpsertLinkRequestBody(
url: 'https://google.com',
tagIds: [
'clux0rgak00011...',
],
externalId: '123456',
);
$response = $sdk.links->upsert(
request: $request
);

if ($response->linkSchema !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
$request = new Operations\UpsertLinkRequestBody(
url: 'https://google.com',
tagIds: [
'clux0rgak00011...',
],
externalId: '123456',
);

$response = $sdk->links->upsert(
request: $request
);

if ($response->linkSchema !== null) {
// handle response
}
```
<!-- End SDK Example Usage [usage] -->
Expand Down Expand Up @@ -167,6 +164,99 @@ try {
</details>
<!-- End Available Resources and Operations [operations] -->

<!-- Start Error Handling [errors] -->
## Error Handling

Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an exception.

By default an API error will raise a `Errors\SDKException` exception, which has the following properties:

| Property | Type | Description |
|----------------|-----------------------------------------|-----------------------|
| `$message` | *string* | The error message |
| `$statusCode` | *int* | The HTTP status code |
| `$rawResponse` | *?\Psr\Http\Message\ResponseInterface* | The raw HTTP response |
| `$body` | *string* | The response content |

When custom error responses are specified for an operation, the SDK may also throw their associated exception. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `create` method throws the following exceptions:

| Error Object | Status Code | Content Type |
| ------------------------------ | ------------------------------ | ------------------------------ |
| Errors\BadRequest | 400 | application/json |
| Errors\Unauthorized | 401 | application/json |
| Errors\Forbidden | 403 | application/json |
| Errors\NotFound | 404 | application/json |
| Errors\Conflict | 409 | application/json |
| Errors\InviteExpired | 410 | application/json |
| Errors\UnprocessableEntity | 422 | application/json |
| Errors\RateLimitExceeded | 429 | application/json |
| Errors\InternalServerError | 500 | application/json |
| Dub\Models\Errors.SDKException | 4xx-5xx | */* |

### Example

```php
declare(strict_types=1);

require 'vendor/autoload.php';

use Dub;
use Dub\Models\Operations;

$security = 'DUB_API_KEY';

$sdk = Dub\Dub::builder()->setSecurity($security)->build();

try {
$request = new Operations\CreateLinkRequestBody(
url: 'https://google.com',
tagIds: [
'clux0rgak00011...',
],
externalId: '123456',
);

$response = $sdk->links->create(
request: $request
);

if ($response->linkSchema !== null) {
// handle response
}
} catch (Errors\BadRequestThrowable $e) {
// handle $e->$container data
throw $e;
} catch (Errors\UnauthorizedThrowable $e) {
// handle $e->$container data
throw $e;
} catch (Errors\ForbiddenThrowable $e) {
// handle $e->$container data
throw $e;
} catch (Errors\NotFoundThrowable $e) {
// handle $e->$container data
throw $e;
} catch (Errors\ConflictThrowable $e) {
// handle $e->$container data
throw $e;
} catch (Errors\InviteExpiredThrowable $e) {
// handle $e->$container data
throw $e;
} catch (Errors\UnprocessableEntityThrowable $e) {
// handle $e->$container data
throw $e;
} catch (Errors\RateLimitExceededThrowable $e) {
// handle $e->$container data
throw $e;
} catch (Errors\InternalServerErrorThrowable $e) {
// handle $e->$container data
throw $e;
} catch (Errors\SDKException $e) {
// handle default exception
throw $e;
}
```
<!-- End Error Handling [errors] -->

<!-- Start Server Selection [server] -->
## Server Selection

Expand Down
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,4 +260,14 @@ Based on:
### Generated
- [php v0.6.6] .
### Releases
- [Composer v0.6.6] https://packagist.org/packages/dub/dub-php#v0.6.6 - .
- [Composer v0.6.6] https://packagist.org/packages/dub/dub-php#v0.6.6 - .

## 2024-09-28 00:18:40
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.404.5 (2.426.2) https://github.com/speakeasy-api/speakeasy
### Generated
- [php v0.6.7] .
### Releases
- [Composer v0.6.7] https://packagist.org/packages/dub/dub-php#v0.6.7 - .
64 changes: 30 additions & 34 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,21 @@ use Dub\Models\Operations;
$security = 'DUB_API_KEY';

$sdk = Dub\Dub::builder()->setSecurity($security)->build();
try {
$request = new Operations\CreateLinkRequestBody(
url: 'https://google.com',
tagIds: [
'clux0rgak00011...',
],
externalId: '123456',
);
$response = $sdk.links->create(
request: $request
);

if ($response->linkSchema !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception

$request = new Operations\CreateLinkRequestBody(
url: 'https://google.com',
tagIds: [
'clux0rgak00011...',
],
externalId: '123456',
);

$response = $sdk->links->create(
request: $request
);

if ($response->linkSchema !== null) {
// handle response
}
```

Expand All @@ -41,23 +39,21 @@ use Dub\Models\Operations;
$security = 'DUB_API_KEY';

$sdk = Dub\Dub::builder()->setSecurity($security)->build();
try {
$request = new Operations\UpsertLinkRequestBody(
url: 'https://google.com',
tagIds: [
'clux0rgak00011...',
],
externalId: '123456',
);
$response = $sdk.links->upsert(
request: $request
);

if ($response->linkSchema !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception

$request = new Operations\UpsertLinkRequestBody(
url: 'https://google.com',
tagIds: [
'clux0rgak00011...',
],
externalId: '123456',
);

$response = $sdk->links->upsert(
request: $request
);

if ($response->linkSchema !== null) {
// handle response
}
```
<!-- End SDK Example Usage [usage] -->
Loading

0 comments on commit dbe7a88

Please sign in to comment.