From f441b8f4db044aeba2692856374c37c249395c8b Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Sat, 21 Sep 2024 00:19:11 +0000 Subject: [PATCH] ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.401.2 --- .speakeasy/gen.lock | 14 +-- .speakeasy/gen.yaml | 2 +- .speakeasy/workflow.lock | 12 +-- README.md | 14 +-- RELEASES.md | 12 ++- codeSamples.yaml | 6 +- docs/sdks/domains/README.md | 108 +++++++++++----------- docs/sdks/links/README.md | 158 ++++++++++++++++----------------- docs/sdks/qrcodes/README.md | 2 +- docs/sdks/tags/README.md | 80 ++++++++--------- docs/sdks/track/README.md | 2 +- src/Domains.php | 140 ++++++++++++++--------------- src/Links.php | 172 ++++++++++++++++++------------------ src/SDKConfiguration.php | 6 +- src/Tags.php | 110 +++++++++++------------ 15 files changed, 424 insertions(+), 414 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 56b3bed..337f337 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,18 +1,18 @@ lockVersion: 2.0.0 id: 43187d3e-7c3c-4c11-b5d4-4b2334fb6d96 management: - docChecksum: 81fbec1fddce6a9104ba0a932fec5804 + docChecksum: bf87a4d4951f97782f297e956ac66cd2 docVersion: 0.0.1 - speakeasyVersion: 1.398.0 - generationVersion: 2.415.8 - releaseVersion: 0.6.2 - configChecksum: 9f0ea9d997909f14d40050547eeba01b + speakeasyVersion: 1.401.2 + generationVersion: 2.421.3 + releaseVersion: 0.6.3 + configChecksum: 76b632191a82c9205ed829803d966d32 repoURL: https://github.com/dubinc/dub-php.git installationURL: https://github.com/dubinc/dub-php published: true features: php: - core: 3.4.3 + core: 3.4.4 deprecations: 2.81.1 errors: 0.1.2 examples: 2.81.3 @@ -24,7 +24,7 @@ features: nameOverrides: 2.81.2 nullables: 1.0.0 responseFormat: 0.1.0 - unions: 0.1.2 + unions: 0.1.3 generatedFiles: - .gitattributes - CONTRIBUTING.md diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index c6408da..90bd1b0 100755 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -12,7 +12,7 @@ generation: auth: oAuth2ClientCredentialsEnabled: true php: - version: 0.6.2 + version: 0.6.3 clientServerStatusCodesAsErrors: true flattenGlobalSecurity: true imports: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 75b8206..47cd151 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,9 +1,9 @@ -speakeasyVersion: 1.398.0 +speakeasyVersion: 1.401.2 sources: dub: sourceNamespace: dub - sourceRevisionDigest: sha256:bd32ec6ff7e825cc3f42918ff96557b51d46196407611ef0eb42edf2d47a8d10 - sourceBlobDigest: sha256:fcdaff285860be87d8acd3091214b153f70d1a94b7ab7b1d9e99e96188670c8a + sourceRevisionDigest: sha256:095dde9547071c29e0634366a5012a7a978a7ea363661e1b0868f06d4b8d1324 + sourceBlobDigest: sha256:84a1a763ef07a877a2379985c2bcec00b6c5cfcc6f774399c51bc37d710908fe tags: - latest - main @@ -11,10 +11,10 @@ targets: my-first-target: source: dub sourceNamespace: dub - sourceRevisionDigest: sha256:bd32ec6ff7e825cc3f42918ff96557b51d46196407611ef0eb42edf2d47a8d10 - sourceBlobDigest: sha256:fcdaff285860be87d8acd3091214b153f70d1a94b7ab7b1d9e99e96188670c8a + sourceRevisionDigest: sha256:095dde9547071c29e0634366a5012a7a978a7ea363661e1b0868f06d4b8d1324 + sourceBlobDigest: sha256:84a1a763ef07a877a2379985c2bcec00b6c5cfcc6f774399c51bc37d710908fe codeSamplesNamespace: code-samples-php-my-first-target - codeSamplesRevisionDigest: sha256:553d4ffe4f2d287ed62911887de66bd825999b4ac0b91b3d015eeb47a19de028 + codeSamplesRevisionDigest: sha256:5ee8f8376b73da64a4800c84cf2a5b4e08040e07c9189e0cefa2a3a4da05934f workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index 9193994..5972375 100644 --- a/README.md +++ b/README.md @@ -117,10 +117,10 @@ try { ### [Domains](docs/sdks/domains/README.md) -* [list](docs/sdks/domains/README.md#list) - Retrieve a list of domains * [create](docs/sdks/domains/README.md#create) - Create a domain -* [delete](docs/sdks/domains/README.md#delete) - Delete a domain +* [list](docs/sdks/domains/README.md#list) - Retrieve a list of domains * [update](docs/sdks/domains/README.md#update) - Update a domain +* [delete](docs/sdks/domains/README.md#delete) - Delete a domain ### [Events](docs/sdks/events/README.md) @@ -129,15 +129,15 @@ try { ### [Links](docs/sdks/links/README.md) -* [list](docs/sdks/links/README.md#list) - Retrieve a list of links * [create](docs/sdks/links/README.md#create) - Create a new link +* [list](docs/sdks/links/README.md#list) - Retrieve a list of links * [count](docs/sdks/links/README.md#count) - Retrieve links count * [get](docs/sdks/links/README.md#get) - Retrieve a link -* [delete](docs/sdks/links/README.md#delete) - Delete a link * [update](docs/sdks/links/README.md#update) - Update a link +* [delete](docs/sdks/links/README.md#delete) - Delete a link * [createMany](docs/sdks/links/README.md#createmany) - Bulk create links -* [deleteMany](docs/sdks/links/README.md#deletemany) - Bulk delete links * [updateMany](docs/sdks/links/README.md#updatemany) - Bulk update links +* [deleteMany](docs/sdks/links/README.md#deletemany) - Bulk delete links * [upsert](docs/sdks/links/README.md#upsert) - Upsert a link ### [Metatags](docs/sdks/metatags/README.md) @@ -150,10 +150,10 @@ try { ### [Tags](docs/sdks/tags/README.md) -* [list](docs/sdks/tags/README.md#list) - Retrieve a list of tags * [create](docs/sdks/tags/README.md#create) - Create a new tag -* [delete](docs/sdks/tags/README.md#delete) - Delete a tag +* [list](docs/sdks/tags/README.md#list) - Retrieve a list of tags * [update](docs/sdks/tags/README.md#update) - Update a tag +* [delete](docs/sdks/tags/README.md#delete) - Delete a tag ### [Track](docs/sdks/track/README.md) diff --git a/RELEASES.md b/RELEASES.md index d574924..8c04c6e 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -220,4 +220,14 @@ Based on: ### Generated - [php v0.6.2] . ### Releases -- [Composer v0.6.2] https://packagist.org/packages/dub/dub-php#v0.6.2 - . \ No newline at end of file +- [Composer v0.6.2] https://packagist.org/packages/dub/dub-php#v0.6.2 - . + +## 2024-09-21 00:17:54 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.401.2 (2.421.3) https://github.com/speakeasy-api/speakeasy +### Generated +- [php v0.6.3] . +### Releases +- [Composer v0.6.3] https://packagist.org/packages/dub/dub-php#v0.6.3 - . \ No newline at end of file diff --git a/codeSamples.yaml b/codeSamples.yaml index 0e5e044..1df8ad0 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -80,7 +80,7 @@ actions: "x-codeSamples": - "lang": "php" "label": "getLinkInfo" - "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Dub;\nuse Dub\\Models\\Components;\n\n$security = new Components\\Security(\n token: \"DUB_API_KEY\",\n);\n\n$sdk = Dub\\Dub::builder()->setSecurity($security)->build();\n\ntry {\n\n $response = $sdk->links->get('ringed-blow.name', '', 'clux0rgak00011...', 'ext_123456');\n\n if ($response->linkSchema !== null) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}" + "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Dub;\nuse Dub\\Models\\Components;\n\n$security = new Components\\Security(\n token: \"DUB_API_KEY\",\n);\n\n$sdk = Dub\\Dub::builder()->setSecurity($security)->build();\n\ntry {\n\n $response = $sdk->links->get('rural-mathematics.name', '', 'clux0rgak00011...', 'ext_123456');\n\n if ($response->linkSchema !== null) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}" - target: $["paths"]["/links/upsert"]["put"] update: "x-codeSamples": @@ -110,7 +110,7 @@ actions: "x-codeSamples": - "lang": "php" "label": "getQRCode" - "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Dub;\nuse Dub\\Models\\Components;\nuse Dub\\Models\\Operations;\n\n$security = new Components\\Security(\n token: \"DUB_API_KEY\",\n);\n\n$sdk = Dub\\Dub::builder()->setSecurity($security)->build();\n\ntry {\n $request = new Operations\\GetQRCodeRequest(\n url: 'https://brief-micronutrient.org',\n );\n $response = $sdk->qrCodes->get($request);\n\n if ($response->res !== null) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}" + "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Dub;\nuse Dub\\Models\\Components;\nuse Dub\\Models\\Operations;\n\n$security = new Components\\Security(\n token: \"DUB_API_KEY\",\n);\n\n$sdk = Dub\\Dub::builder()->setSecurity($security)->build();\n\ntry {\n $request = new Operations\\GetQRCodeRequest(\n url: 'https://normal-making.name',\n );\n $response = $sdk->qrCodes->get($request);\n\n if ($response->res !== null) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}" - target: $["paths"]["/tags"]["get"] update: "x-codeSamples": @@ -152,7 +152,7 @@ actions: "x-codeSamples": - "lang": "php" "label": "trackSale" - "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Dub;\nuse Dub\\Models\\Components;\nuse Dub\\Models\\Operations;\n\n$security = new Components\\Security(\n token: \"DUB_API_KEY\",\n);\n\n$sdk = Dub\\Dub::builder()->setSecurity($security)->build();\n\ntry {\n $request = new Operations\\TrackSaleRequestBody(\n customerId: '',\n amount: 996500,\n paymentProcessor: Operations\\PaymentProcessor::Shopify,\n eventName: 'Purchase',\n );\n $response = $sdk->track->sale($request);\n\n if ($response->object !== null) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}" + "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Dub;\nuse Dub\\Models\\Components;\nuse Dub\\Models\\Operations;\n\n$security = new Components\\Security(\n token: \"DUB_API_KEY\",\n);\n\n$sdk = Dub\\Dub::builder()->setSecurity($security)->build();\n\ntry {\n $request = new Operations\\TrackSaleRequestBody(\n customerId: '',\n amount: 996500,\n paymentProcessor: Operations\\PaymentProcessor::Paddle,\n eventName: 'Purchase',\n );\n $response = $sdk->track->sale($request);\n\n if ($response->object !== null) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}" - target: $["paths"]["/workspaces/{idOrSlug}"]["get"] update: "x-codeSamples": diff --git a/docs/sdks/domains/README.md b/docs/sdks/domains/README.md index cd59d89..f36c73f 100644 --- a/docs/sdks/domains/README.md +++ b/docs/sdks/domains/README.md @@ -4,14 +4,14 @@ ### Available Operations -* [list](#list) - Retrieve a list of domains * [create](#create) - Create a domain -* [delete](#delete) - Delete a domain +* [list](#list) - Retrieve a list of domains * [update](#update) - Update a domain +* [delete](#delete) - Delete a domain -## list +## create -Retrieve a list of domains associated with the authenticated workspace. +Create a domain for the authenticated workspace. ### Example Usage @@ -22,6 +22,7 @@ require 'vendor/autoload.php'; use Dub; use Dub\Models\Components; +use Dub\Models\Operations; $security = new Components\Security( token: "DUB_API_KEY", @@ -30,10 +31,15 @@ $security = new Components\Security( $sdk = Dub\Dub::builder()->setSecurity($security)->build(); try { + $request = new Operations\CreateDomainRequestBody( + slug: 'acme.com', + archived: false, + expiredUrl: 'https://acme.com/expired', + placeholder: 'https://dub.co/help/article/what-is-dub', + ); + $response = $sdk->domains->create($request); - $response = $sdk->domains->list(false, '', 1, 50); - - if ($response->domainSchemas !== null) { + if ($response->domainSchema !== null) { // handle response } } catch (Throwable $e) { @@ -43,16 +49,13 @@ try { ### Parameters -| Parameter | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | -| `archived` | *bool* | :heavy_minus_sign: | Whether to include archived domains in the response. Defaults to `false` if not provided. | | -| `search` | *string* | :heavy_minus_sign: | The search term to filter the domains by. | | -| `page` | *float* | :heavy_minus_sign: | The page number for pagination. | 1 | -| `pageSize` | *float* | :heavy_minus_sign: | The number of items per page. | 50 | +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `$request` | [Operations\CreateDomainRequestBody](../../Models/Operations/CreateDomainRequestBody.md) | :heavy_check_mark: | The request object to use for the request. | ### Response -**[?Operations\ListDomainsResponse](../../Models/Operations/ListDomainsResponse.md)** +**[?Operations\CreateDomainResponse](../../Models/Operations/CreateDomainResponse.md)** ### Errors @@ -70,9 +73,9 @@ try { | Dub\Models\Errors.SDKException | 4xx-5xx | */* | -## create +## list -Create a domain for the authenticated workspace. +Retrieve a list of domains associated with the authenticated workspace. ### Example Usage @@ -83,7 +86,6 @@ require 'vendor/autoload.php'; use Dub; use Dub\Models\Components; -use Dub\Models\Operations; $security = new Components\Security( token: "DUB_API_KEY", @@ -92,15 +94,10 @@ $security = new Components\Security( $sdk = Dub\Dub::builder()->setSecurity($security)->build(); try { - $request = new Operations\CreateDomainRequestBody( - slug: 'acme.com', - archived: false, - expiredUrl: 'https://acme.com/expired', - placeholder: 'https://dub.co/help/article/what-is-dub', - ); - $response = $sdk->domains->create($request); - if ($response->domainSchema !== null) { + $response = $sdk->domains->list(false, '', 1, 50); + + if ($response->domainSchemas !== null) { // handle response } } catch (Throwable $e) { @@ -110,13 +107,16 @@ try { ### Parameters -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `$request` | [Operations\CreateDomainRequestBody](../../Models/Operations/CreateDomainRequestBody.md) | :heavy_check_mark: | The request object to use for the request. | +| Parameter | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | +| `archived` | *bool* | :heavy_minus_sign: | Whether to include archived domains in the response. Defaults to `false` if not provided. | | +| `search` | *string* | :heavy_minus_sign: | The search term to filter the domains by. | | +| `page` | *float* | :heavy_minus_sign: | The page number for pagination. | 1 | +| `pageSize` | *float* | :heavy_minus_sign: | The number of items per page. | 50 | ### Response -**[?Operations\CreateDomainResponse](../../Models/Operations/CreateDomainResponse.md)** +**[?Operations\ListDomainsResponse](../../Models/Operations/ListDomainsResponse.md)** ### Errors @@ -134,9 +134,9 @@ try { | Dub\Models\Errors.SDKException | 4xx-5xx | */* | -## delete +## update -Delete a domain from a workspace. It cannot be undone. This will also delete all the links associated with the domain. +Update a domain for the authenticated workspace. ### Example Usage @@ -147,6 +147,7 @@ require 'vendor/autoload.php'; use Dub; use Dub\Models\Components; +use Dub\Models\Operations; $security = new Components\Security( token: "DUB_API_KEY", @@ -155,10 +156,15 @@ $security = new Components\Security( $sdk = Dub\Dub::builder()->setSecurity($security)->build(); try { + $requestBody = new Operations\UpdateDomainRequestBody( + slug: 'acme.com', + archived: false, + expiredUrl: 'https://acme.com/expired', + placeholder: 'https://dub.co/help/article/what-is-dub', + ); + $response = $sdk->domains->update('acme.com', $requestBody); - $response = $sdk->domains->delete('acme.com'); - - if ($response->object !== null) { + if ($response->domainSchema !== null) { // handle response } } catch (Throwable $e) { @@ -168,13 +174,14 @@ try { ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | -| `slug` | *string* | :heavy_check_mark: | The domain name. | acme.com | +| Parameter | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `slug` | *string* | :heavy_check_mark: | The domain name. | acme.com | +| `requestBody` | [Operations\UpdateDomainRequestBody](../../Models/Operations/UpdateDomainRequestBody.md) | :heavy_minus_sign: | N/A | | ### Response -**[?Operations\DeleteDomainResponse](../../Models/Operations/DeleteDomainResponse.md)** +**[?Operations\UpdateDomainResponse](../../Models/Operations/UpdateDomainResponse.md)** ### Errors @@ -192,9 +199,9 @@ try { | Dub\Models\Errors.SDKException | 4xx-5xx | */* | -## update +## delete -Update a domain for the authenticated workspace. +Delete a domain from a workspace. It cannot be undone. This will also delete all the links associated with the domain. ### Example Usage @@ -205,7 +212,6 @@ require 'vendor/autoload.php'; use Dub; use Dub\Models\Components; -use Dub\Models\Operations; $security = new Components\Security( token: "DUB_API_KEY", @@ -214,15 +220,10 @@ $security = new Components\Security( $sdk = Dub\Dub::builder()->setSecurity($security)->build(); try { - $requestBody = new Operations\UpdateDomainRequestBody( - slug: 'acme.com', - archived: false, - expiredUrl: 'https://acme.com/expired', - placeholder: 'https://dub.co/help/article/what-is-dub', - ); - $response = $sdk->domains->update('acme.com', $requestBody); - if ($response->domainSchema !== null) { + $response = $sdk->domains->delete('acme.com'); + + if ($response->object !== null) { // handle response } } catch (Throwable $e) { @@ -232,14 +233,13 @@ try { ### Parameters -| Parameter | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `slug` | *string* | :heavy_check_mark: | The domain name. | acme.com | -| `requestBody` | [Operations\UpdateDomainRequestBody](../../Models/Operations/UpdateDomainRequestBody.md) | :heavy_minus_sign: | N/A | | +| Parameter | Type | Required | Description | Example | +| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | +| `slug` | *string* | :heavy_check_mark: | The domain name. | acme.com | ### Response -**[?Operations\UpdateDomainResponse](../../Models/Operations/UpdateDomainResponse.md)** +**[?Operations\DeleteDomainResponse](../../Models/Operations/DeleteDomainResponse.md)** ### Errors diff --git a/docs/sdks/links/README.md b/docs/sdks/links/README.md index ac9b20f..c3e15df 100644 --- a/docs/sdks/links/README.md +++ b/docs/sdks/links/README.md @@ -4,20 +4,20 @@ ### Available Operations -* [list](#list) - Retrieve a list of links * [create](#create) - Create a new link +* [list](#list) - Retrieve a list of links * [count](#count) - Retrieve links count * [get](#get) - Retrieve a link -* [delete](#delete) - Delete a link * [update](#update) - Update a link +* [delete](#delete) - Delete a link * [createMany](#createmany) - Bulk create links -* [deleteMany](#deletemany) - Bulk delete links * [updateMany](#updatemany) - Bulk update links +* [deleteMany](#deletemany) - Bulk delete links * [upsert](#upsert) - Upsert a link -## list +## create -Retrieve a paginated list of links for the authenticated workspace. +Create a new link for the authenticated workspace. ### Example Usage @@ -37,13 +37,14 @@ $security = new Components\Security( $sdk = Dub\Dub::builder()->setSecurity($security)->build(); try { - $request = new Operations\GetLinksRequest( - page: 1, - pageSize: 50, + $request = new Operations\CreateLinkRequestBody( + url: 'https://google.com', + tagIds: '...', + externalId: '123456', ); - $response = $sdk->links->list($request); + $response = $sdk->links->create($request); - if ($response->linkSchemas !== null) { + if ($response->linkSchema !== null) { // handle response } } catch (Throwable $e) { @@ -53,13 +54,13 @@ try { ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | -| `$request` | [Operations\GetLinksRequest](../../Models/Operations/GetLinksRequest.md) | :heavy_check_mark: | The request object to use for the request. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `$request` | [Operations\CreateLinkRequestBody](../../Models/Operations/CreateLinkRequestBody.md) | :heavy_check_mark: | The request object to use for the request. | ### Response -**[?Operations\GetLinksResponse](../../Models/Operations/GetLinksResponse.md)** +**[?Operations\CreateLinkResponse](../../Models/Operations/CreateLinkResponse.md)** ### Errors @@ -77,9 +78,9 @@ try { | Dub\Models\Errors.SDKException | 4xx-5xx | */* | -## create +## list -Create a new link for the authenticated workspace. +Retrieve a paginated list of links for the authenticated workspace. ### Example Usage @@ -99,14 +100,13 @@ $security = new Components\Security( $sdk = Dub\Dub::builder()->setSecurity($security)->build(); try { - $request = new Operations\CreateLinkRequestBody( - url: 'https://google.com', - tagIds: '...', - externalId: '123456', + $request = new Operations\GetLinksRequest( + page: 1, + pageSize: 50, ); - $response = $sdk->links->create($request); + $response = $sdk->links->list($request); - if ($response->linkSchema !== null) { + if ($response->linkSchemas !== null) { // handle response } } catch (Throwable $e) { @@ -116,13 +116,13 @@ try { ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `$request` | [Operations\CreateLinkRequestBody](../../Models/Operations/CreateLinkRequestBody.md) | :heavy_check_mark: | The request object to use for the request. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `$request` | [Operations\GetLinksRequest](../../Models/Operations/GetLinksRequest.md) | :heavy_check_mark: | The request object to use for the request. | ### Response -**[?Operations\CreateLinkResponse](../../Models/Operations/CreateLinkResponse.md)** +**[?Operations\GetLinksResponse](../../Models/Operations/GetLinksResponse.md)** ### Errors @@ -221,7 +221,7 @@ $sdk = Dub\Dub::builder()->setSecurity($security)->build(); try { - $response = $sdk->links->get('ringed-blow.name', '', 'clux0rgak00011...', 'ext_123456'); + $response = $sdk->links->get('rural-mathematics.name', '', 'clux0rgak00011...', 'ext_123456'); if ($response->linkSchema !== null) { // handle response @@ -260,9 +260,9 @@ try { | Dub\Models\Errors.SDKException | 4xx-5xx | */* | -## delete +## update -Delete a link for the authenticated workspace. +Update a link for the authenticated workspace. If there's no change, returns it as it is. ### Example Usage @@ -273,6 +273,7 @@ require 'vendor/autoload.php'; use Dub; use Dub\Models\Components; +use Dub\Models\Operations; $security = new Components\Security( token: "DUB_API_KEY", @@ -281,10 +282,16 @@ $security = new Components\Security( $sdk = Dub\Dub::builder()->setSecurity($security)->build(); try { + $requestBody = new Operations\UpdateLinkRequestBody( + url: 'https://google.com', + tagIds: [ + '', + ], + externalId: '123456', + ); + $response = $sdk->links->update('', $requestBody); - $response = $sdk->links->delete(''); - - if ($response->object !== null) { + if ($response->linkSchema !== null) { // handle response } } catch (Throwable $e) { @@ -296,11 +303,12 @@ try { | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | -| `linkId` | *string* | :heavy_check_mark: | The id of the link to delete. You may use either `linkId` (obtained via `/links/info` endpoint) or `externalId` prefixed with `ext_`. | +| `linkId` | *string* | :heavy_check_mark: | The id of the link to update. You may use either `linkId` (obtained via `/links/info` endpoint) or `externalId` prefixed with `ext_`. | +| `requestBody` | [Operations\UpdateLinkRequestBody](../../Models/Operations/UpdateLinkRequestBody.md) | :heavy_minus_sign: | N/A | ### Response -**[?Operations\DeleteLinkResponse](../../Models/Operations/DeleteLinkResponse.md)** +**[?Operations\UpdateLinkResponse](../../Models/Operations/UpdateLinkResponse.md)** ### Errors @@ -318,9 +326,9 @@ try { | Dub\Models\Errors.SDKException | 4xx-5xx | */* | -## update +## delete -Update a link for the authenticated workspace. If there's no change, returns it as it is. +Delete a link for the authenticated workspace. ### Example Usage @@ -331,7 +339,6 @@ require 'vendor/autoload.php'; use Dub; use Dub\Models\Components; -use Dub\Models\Operations; $security = new Components\Security( token: "DUB_API_KEY", @@ -340,16 +347,10 @@ $security = new Components\Security( $sdk = Dub\Dub::builder()->setSecurity($security)->build(); try { - $requestBody = new Operations\UpdateLinkRequestBody( - url: 'https://google.com', - tagIds: [ - '', - ], - externalId: '123456', - ); - $response = $sdk->links->update('', $requestBody); - if ($response->linkSchema !== null) { + $response = $sdk->links->delete(''); + + if ($response->object !== null) { // handle response } } catch (Throwable $e) { @@ -361,12 +362,11 @@ try { | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | -| `linkId` | *string* | :heavy_check_mark: | The id of the link to update. You may use either `linkId` (obtained via `/links/info` endpoint) or `externalId` prefixed with `ext_`. | -| `requestBody` | [Operations\UpdateLinkRequestBody](../../Models/Operations/UpdateLinkRequestBody.md) | :heavy_minus_sign: | N/A | +| `linkId` | *string* | :heavy_check_mark: | The id of the link to delete. You may use either `linkId` (obtained via `/links/info` endpoint) or `externalId` prefixed with `ext_`. | ### Response -**[?Operations\UpdateLinkResponse](../../Models/Operations/UpdateLinkResponse.md)** +**[?Operations\DeleteLinkResponse](../../Models/Operations/DeleteLinkResponse.md)** ### Errors @@ -445,9 +445,9 @@ try { | Dub\Models\Errors.SDKException | 4xx-5xx | */* | -## deleteMany +## updateMany -Bulk delete up to 100 links for the authenticated workspace. +Bulk update up to 100 links with the same data for the authenticated workspace. ### Example Usage @@ -458,6 +458,7 @@ require 'vendor/autoload.php'; use Dub; use Dub\Models\Components; +use Dub\Models\Operations; $security = new Components\Security( token: "DUB_API_KEY", @@ -466,13 +467,18 @@ $security = new Components\Security( $sdk = Dub\Dub::builder()->setSecurity($security)->build(); try { + $request = new Operations\BulkUpdateLinksRequestBody( + linkIds: [ + '', + ], + data: new Operations\Data( + url: 'https://google.com', + tagIds: '...', + ), + ); + $response = $sdk->links->updateMany($request); - $response = $sdk->links->deleteMany([ - 'clux0rgak00011...', - 'clux0rgak00022...', -]); - - if ($response->object !== null) { + if ($response->linkSchemas !== null) { // handle response } } catch (Throwable $e) { @@ -482,13 +488,13 @@ try { ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | -| `linkIds` | array<*string*> | :heavy_check_mark: | Comma-separated list of link IDs to delete. Maximum of 100 IDs. Non-existing IDs will be ignored. | [
"clux0rgak00011...",
"clux0rgak00022..."
] | +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `$request` | [Operations\BulkUpdateLinksRequestBody](../../Models/Operations/BulkUpdateLinksRequestBody.md) | :heavy_check_mark: | The request object to use for the request. | ### Response -**[?Operations\BulkDeleteLinksResponse](../../Models/Operations/BulkDeleteLinksResponse.md)** +**[?Operations\BulkUpdateLinksResponse](../../Models/Operations/BulkUpdateLinksResponse.md)** ### Errors @@ -506,9 +512,9 @@ try { | Dub\Models\Errors.SDKException | 4xx-5xx | */* | -## updateMany +## deleteMany -Bulk update up to 100 links with the same data for the authenticated workspace. +Bulk delete up to 100 links for the authenticated workspace. ### Example Usage @@ -519,7 +525,6 @@ require 'vendor/autoload.php'; use Dub; use Dub\Models\Components; -use Dub\Models\Operations; $security = new Components\Security( token: "DUB_API_KEY", @@ -528,18 +533,13 @@ $security = new Components\Security( $sdk = Dub\Dub::builder()->setSecurity($security)->build(); try { - $request = new Operations\BulkUpdateLinksRequestBody( - linkIds: [ - '', - ], - data: new Operations\Data( - url: 'https://google.com', - tagIds: '...', - ), - ); - $response = $sdk->links->updateMany($request); - if ($response->linkSchemas !== null) { + $response = $sdk->links->deleteMany([ + 'clux0rgak00011...', + 'clux0rgak00022...', +]); + + if ($response->object !== null) { // handle response } } catch (Throwable $e) { @@ -549,13 +549,13 @@ try { ### Parameters -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `$request` | [Operations\BulkUpdateLinksRequestBody](../../Models/Operations/BulkUpdateLinksRequestBody.md) | :heavy_check_mark: | The request object to use for the request. | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `linkIds` | array<*string*> | :heavy_check_mark: | Comma-separated list of link IDs to delete. Maximum of 100 IDs. Non-existing IDs will be ignored. | [
"clux0rgak00011...",
"clux0rgak00022..."
] | ### Response -**[?Operations\BulkUpdateLinksResponse](../../Models/Operations/BulkUpdateLinksResponse.md)** +**[?Operations\BulkDeleteLinksResponse](../../Models/Operations/BulkDeleteLinksResponse.md)** ### Errors diff --git a/docs/sdks/qrcodes/README.md b/docs/sdks/qrcodes/README.md index 4748883..96b74d1 100644 --- a/docs/sdks/qrcodes/README.md +++ b/docs/sdks/qrcodes/README.md @@ -29,7 +29,7 @@ $sdk = Dub\Dub::builder()->setSecurity($security)->build(); try { $request = new Operations\GetQRCodeRequest( - url: 'https://brief-micronutrient.org', + url: 'https://normal-making.name', ); $response = $sdk->qrCodes->get($request); diff --git a/docs/sdks/tags/README.md b/docs/sdks/tags/README.md index e92adf1..74fe14e 100644 --- a/docs/sdks/tags/README.md +++ b/docs/sdks/tags/README.md @@ -4,14 +4,14 @@ ### Available Operations -* [list](#list) - Retrieve a list of tags * [create](#create) - Create a new tag -* [delete](#delete) - Delete a tag +* [list](#list) - Retrieve a list of tags * [update](#update) - Update a tag +* [delete](#delete) - Delete a tag -## list +## create -Retrieve a list of tags for the authenticated workspace. +Create a new tag for the authenticated workspace. ### Example Usage @@ -22,6 +22,7 @@ require 'vendor/autoload.php'; use Dub; use Dub\Models\Components; +use Dub\Models\Operations; $security = new Components\Security( token: "DUB_API_KEY", @@ -30,9 +31,10 @@ $security = new Components\Security( $sdk = Dub\Dub::builder()->setSecurity($security)->build(); try { - $response = $sdk->tags->list(); + $request = new Operations\CreateTagRequestBody(); + $response = $sdk->tags->create($request); - if ($response->tagSchemas !== null) { + if ($response->tagSchema !== null) { // handle response } } catch (Throwable $e) { @@ -40,9 +42,15 @@ try { } ``` +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `$request` | [Operations\CreateTagRequestBody](../../Models/Operations/CreateTagRequestBody.md) | :heavy_check_mark: | The request object to use for the request. | + ### Response -**[?Operations\GetTagsResponse](../../Models/Operations/GetTagsResponse.md)** +**[?Operations\CreateTagResponse](../../Models/Operations/CreateTagResponse.md)** ### Errors @@ -60,9 +68,9 @@ try { | Dub\Models\Errors.SDKException | 4xx-5xx | */* | -## create +## list -Create a new tag for the authenticated workspace. +Retrieve a list of tags for the authenticated workspace. ### Example Usage @@ -73,7 +81,6 @@ require 'vendor/autoload.php'; use Dub; use Dub\Models\Components; -use Dub\Models\Operations; $security = new Components\Security( token: "DUB_API_KEY", @@ -82,10 +89,9 @@ $security = new Components\Security( $sdk = Dub\Dub::builder()->setSecurity($security)->build(); try { - $request = new Operations\CreateTagRequestBody(); - $response = $sdk->tags->create($request); + $response = $sdk->tags->list(); - if ($response->tagSchema !== null) { + if ($response->tagSchemas !== null) { // handle response } } catch (Throwable $e) { @@ -93,15 +99,9 @@ try { } ``` -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| `$request` | [Operations\CreateTagRequestBody](../../Models/Operations/CreateTagRequestBody.md) | :heavy_check_mark: | The request object to use for the request. | - ### Response -**[?Operations\CreateTagResponse](../../Models/Operations/CreateTagResponse.md)** +**[?Operations\GetTagsResponse](../../Models/Operations/GetTagsResponse.md)** ### Errors @@ -119,9 +119,9 @@ try { | Dub\Models\Errors.SDKException | 4xx-5xx | */* | -## delete +## update -Delete a tag from the workspace. All existing links will still work, but they will no longer be associated with this tag. +Update a tag in the workspace. ### Example Usage @@ -132,6 +132,7 @@ require 'vendor/autoload.php'; use Dub; use Dub\Models\Components; +use Dub\Models\Operations; $security = new Components\Security( token: "DUB_API_KEY", @@ -140,10 +141,10 @@ $security = new Components\Security( $sdk = Dub\Dub::builder()->setSecurity($security)->build(); try { + $requestBody = new Operations\UpdateTagRequestBody(); + $response = $sdk->tags->update('', $requestBody); - $response = $sdk->tags->delete(''); - - if ($response->object !== null) { + if ($response->tagSchema !== null) { // handle response } } catch (Throwable $e) { @@ -153,13 +154,14 @@ try { ### Parameters -| Parameter | Type | Required | Description | -| ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- | -| `id` | *string* | :heavy_check_mark: | The ID of the tag to delete. | +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `id` | *string* | :heavy_check_mark: | The ID of the tag to update. | +| `requestBody` | [Operations\UpdateTagRequestBody](../../Models/Operations/UpdateTagRequestBody.md) | :heavy_minus_sign: | N/A | ### Response -**[?Operations\DeleteTagResponse](../../Models/Operations/DeleteTagResponse.md)** +**[?Operations\UpdateTagResponse](../../Models/Operations/UpdateTagResponse.md)** ### Errors @@ -177,9 +179,9 @@ try { | Dub\Models\Errors.SDKException | 4xx-5xx | */* | -## update +## delete -Update a tag in the workspace. +Delete a tag from the workspace. All existing links will still work, but they will no longer be associated with this tag. ### Example Usage @@ -190,7 +192,6 @@ require 'vendor/autoload.php'; use Dub; use Dub\Models\Components; -use Dub\Models\Operations; $security = new Components\Security( token: "DUB_API_KEY", @@ -199,10 +200,10 @@ $security = new Components\Security( $sdk = Dub\Dub::builder()->setSecurity($security)->build(); try { - $requestBody = new Operations\UpdateTagRequestBody(); - $response = $sdk->tags->update('', $requestBody); - if ($response->tagSchema !== null) { + $response = $sdk->tags->delete(''); + + if ($response->object !== null) { // handle response } } catch (Throwable $e) { @@ -212,14 +213,13 @@ try { ### Parameters -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| `id` | *string* | :heavy_check_mark: | The ID of the tag to update. | -| `requestBody` | [Operations\UpdateTagRequestBody](../../Models/Operations/UpdateTagRequestBody.md) | :heavy_minus_sign: | N/A | +| Parameter | Type | Required | Description | +| ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- | +| `id` | *string* | :heavy_check_mark: | The ID of the tag to delete. | ### Response -**[?Operations\UpdateTagResponse](../../Models/Operations/UpdateTagResponse.md)** +**[?Operations\DeleteTagResponse](../../Models/Operations/DeleteTagResponse.md)** ### Errors diff --git a/docs/sdks/track/README.md b/docs/sdks/track/README.md index 1f6972d..d02a13e 100644 --- a/docs/sdks/track/README.md +++ b/docs/sdks/track/README.md @@ -96,7 +96,7 @@ try { $request = new Operations\TrackSaleRequestBody( customerId: '', amount: 996500, - paymentProcessor: Operations\PaymentProcessor::Shopify, + paymentProcessor: Operations\PaymentProcessor::Paddle, eventName: 'Purchase', ); $response = $sdk->track->sale($request); diff --git a/src/Domains.php b/src/Domains.php index d7f069c..ba18e11 100644 --- a/src/Domains.php +++ b/src/Domains.php @@ -23,51 +23,42 @@ public function __construct(SDKConfiguration $sdkConfig) } /** - * Retrieve a list of domains + * Create a domain * - * Retrieve a list of domains associated with the authenticated workspace. + * Create a domain for the authenticated workspace. * - * @param ?bool $archived - * @param ?string $search - * @param ?float $page - * @param ?float $pageSize - * @return Operations\ListDomainsResponse + * @param Operations\CreateDomainRequestBody $request + * @return Operations\CreateDomainResponse * @throws \Dub\Models\Errors\SDKException */ - public function list( - ?bool $archived = null, - ?string $search = null, - ?float $page = null, - ?float $pageSize = null, - ): Operations\ListDomainsResponse { - $request = new Operations\ListDomainsRequest( - archived: $archived, - search: $search, - page: $page, - pageSize: $pageSize, - ); + public function create( + ?Operations\CreateDomainRequestBody $request, + ): Operations\CreateDomainResponse { $baseUrl = $this->sdkConfiguration->getServerUrl(); $url = Utils\Utils::generateUrl($baseUrl, '/domains'); $options = ['http_errors' => false]; - $options = array_merge_recursive($options, Utils\Utils::getQueryParams(Operations\ListDomainsRequest::class, $request)); + $body = Utils\Utils::serializeRequestBody($request, 'request', 'json'); + if ($body !== null) { + $options = array_merge_recursive($options, $body); + } $options['headers']['Accept'] = 'application/json'; $options['headers']['user-agent'] = $this->sdkConfiguration->userAgent; - $httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url); + $httpRequest = new \GuzzleHttp\Psr7\Request('POST', $url); $httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options); $contentType = $httpResponse->getHeader('Content-Type')[0] ?? ''; $statusCode = $httpResponse->getStatusCode(); - if ($statusCode == 200) { + if ($statusCode == 201) { if (Utils\Utils::matchContentType($contentType, 'application/json')) { $serializer = Utils\JSON::createSerializer(); - $obj = $serializer->deserialize((string) $httpResponse->getBody(), 'array<\Dub\Models\Components\DomainSchema>', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); - $response = new Operations\ListDomainsResponse( + $obj = $serializer->deserialize((string) $httpResponse->getBody(), '\Dub\Models\Components\DomainSchema', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + $response = new Operations\CreateDomainResponse( statusCode: $statusCode, contentType: $contentType, rawResponse: $httpResponse, - domainSchemas: $obj); + domainSchema: $obj); return $response; } else { @@ -153,42 +144,51 @@ public function list( } /** - * Create a domain + * Retrieve a list of domains * - * Create a domain for the authenticated workspace. + * Retrieve a list of domains associated with the authenticated workspace. * - * @param Operations\CreateDomainRequestBody $request - * @return Operations\CreateDomainResponse + * @param ?bool $archived + * @param ?string $search + * @param ?float $page + * @param ?float $pageSize + * @return Operations\ListDomainsResponse * @throws \Dub\Models\Errors\SDKException */ - public function create( - ?Operations\CreateDomainRequestBody $request, - ): Operations\CreateDomainResponse { + public function list( + ?bool $archived = null, + ?string $search = null, + ?float $page = null, + ?float $pageSize = null, + ): Operations\ListDomainsResponse { + $request = new Operations\ListDomainsRequest( + archived: $archived, + search: $search, + page: $page, + pageSize: $pageSize, + ); $baseUrl = $this->sdkConfiguration->getServerUrl(); $url = Utils\Utils::generateUrl($baseUrl, '/domains'); $options = ['http_errors' => false]; - $body = Utils\Utils::serializeRequestBody($request, 'request', 'json'); - if ($body !== null) { - $options = array_merge_recursive($options, $body); - } + $options = array_merge_recursive($options, Utils\Utils::getQueryParams(Operations\ListDomainsRequest::class, $request)); $options['headers']['Accept'] = 'application/json'; $options['headers']['user-agent'] = $this->sdkConfiguration->userAgent; - $httpRequest = new \GuzzleHttp\Psr7\Request('POST', $url); + $httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url); $httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options); $contentType = $httpResponse->getHeader('Content-Type')[0] ?? ''; $statusCode = $httpResponse->getStatusCode(); - if ($statusCode == 201) { + if ($statusCode == 200) { if (Utils\Utils::matchContentType($contentType, 'application/json')) { $serializer = Utils\JSON::createSerializer(); - $obj = $serializer->deserialize((string) $httpResponse->getBody(), '\Dub\Models\Components\DomainSchema', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); - $response = new Operations\CreateDomainResponse( + $obj = $serializer->deserialize((string) $httpResponse->getBody(), 'array<\Dub\Models\Components\DomainSchema>', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + $response = new Operations\ListDomainsResponse( statusCode: $statusCode, contentType: $contentType, rawResponse: $httpResponse, - domainSchema: $obj); + domainSchemas: $obj); return $response; } else { @@ -274,26 +274,33 @@ public function create( } /** - * Delete a domain + * Update a domain * - * Delete a domain from a workspace. It cannot be undone. This will also delete all the links associated with the domain. + * Update a domain for the authenticated workspace. * * @param string $slug - * @return Operations\DeleteDomainResponse + * @param ?Operations\UpdateDomainRequestBody $requestBody + * @return Operations\UpdateDomainResponse * @throws \Dub\Models\Errors\SDKException */ - public function delete( + public function update( string $slug, - ): Operations\DeleteDomainResponse { - $request = new Operations\DeleteDomainRequest( + ?Operations\UpdateDomainRequestBody $requestBody = null, + ): Operations\UpdateDomainResponse { + $request = new Operations\UpdateDomainRequest( slug: $slug, + requestBody: $requestBody, ); $baseUrl = $this->sdkConfiguration->getServerUrl(); - $url = Utils\Utils::generateUrl($baseUrl, '/domains/{slug}', Operations\DeleteDomainRequest::class, $request); + $url = Utils\Utils::generateUrl($baseUrl, '/domains/{slug}', Operations\UpdateDomainRequest::class, $request); $options = ['http_errors' => false]; + $body = Utils\Utils::serializeRequestBody($request, 'requestBody', 'json'); + if ($body !== null) { + $options = array_merge_recursive($options, $body); + } $options['headers']['Accept'] = 'application/json'; $options['headers']['user-agent'] = $this->sdkConfiguration->userAgent; - $httpRequest = new \GuzzleHttp\Psr7\Request('DELETE', $url); + $httpRequest = new \GuzzleHttp\Psr7\Request('PATCH', $url); $httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options); @@ -303,12 +310,12 @@ public function delete( if ($statusCode == 200) { if (Utils\Utils::matchContentType($contentType, 'application/json')) { $serializer = Utils\JSON::createSerializer(); - $obj = $serializer->deserialize((string) $httpResponse->getBody(), '\Dub\Models\Operations\DeleteDomainResponseBody', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); - $response = new Operations\DeleteDomainResponse( + $obj = $serializer->deserialize((string) $httpResponse->getBody(), '\Dub\Models\Components\DomainSchema', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + $response = new Operations\UpdateDomainResponse( statusCode: $statusCode, contentType: $contentType, rawResponse: $httpResponse, - object: $obj); + domainSchema: $obj); return $response; } else { @@ -394,33 +401,26 @@ public function delete( } /** - * Update a domain + * Delete a domain * - * Update a domain for the authenticated workspace. + * Delete a domain from a workspace. It cannot be undone. This will also delete all the links associated with the domain. * * @param string $slug - * @param ?Operations\UpdateDomainRequestBody $requestBody - * @return Operations\UpdateDomainResponse + * @return Operations\DeleteDomainResponse * @throws \Dub\Models\Errors\SDKException */ - public function update( + public function delete( string $slug, - ?Operations\UpdateDomainRequestBody $requestBody = null, - ): Operations\UpdateDomainResponse { - $request = new Operations\UpdateDomainRequest( + ): Operations\DeleteDomainResponse { + $request = new Operations\DeleteDomainRequest( slug: $slug, - requestBody: $requestBody, ); $baseUrl = $this->sdkConfiguration->getServerUrl(); - $url = Utils\Utils::generateUrl($baseUrl, '/domains/{slug}', Operations\UpdateDomainRequest::class, $request); + $url = Utils\Utils::generateUrl($baseUrl, '/domains/{slug}', Operations\DeleteDomainRequest::class, $request); $options = ['http_errors' => false]; - $body = Utils\Utils::serializeRequestBody($request, 'requestBody', 'json'); - if ($body !== null) { - $options = array_merge_recursive($options, $body); - } $options['headers']['Accept'] = 'application/json'; $options['headers']['user-agent'] = $this->sdkConfiguration->userAgent; - $httpRequest = new \GuzzleHttp\Psr7\Request('PATCH', $url); + $httpRequest = new \GuzzleHttp\Psr7\Request('DELETE', $url); $httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options); @@ -430,12 +430,12 @@ public function update( if ($statusCode == 200) { if (Utils\Utils::matchContentType($contentType, 'application/json')) { $serializer = Utils\JSON::createSerializer(); - $obj = $serializer->deserialize((string) $httpResponse->getBody(), '\Dub\Models\Components\DomainSchema', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); - $response = new Operations\UpdateDomainResponse( + $obj = $serializer->deserialize((string) $httpResponse->getBody(), '\Dub\Models\Operations\DeleteDomainResponseBody', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + $response = new Operations\DeleteDomainResponse( statusCode: $statusCode, contentType: $contentType, rawResponse: $httpResponse, - domainSchema: $obj); + object: $obj); return $response; } else { diff --git a/src/Links.php b/src/Links.php index 7cd0c44..9c84617 100644 --- a/src/Links.php +++ b/src/Links.php @@ -23,24 +23,27 @@ public function __construct(SDKConfiguration $sdkConfig) } /** - * Retrieve a list of links + * Create a new link * - * Retrieve a paginated list of links for the authenticated workspace. + * Create a new link for the authenticated workspace. * - * @param Operations\GetLinksRequest $request - * @return Operations\GetLinksResponse + * @param Operations\CreateLinkRequestBody $request + * @return Operations\CreateLinkResponse * @throws \Dub\Models\Errors\SDKException */ - public function list( - ?Operations\GetLinksRequest $request, - ): Operations\GetLinksResponse { + public function create( + ?Operations\CreateLinkRequestBody $request, + ): Operations\CreateLinkResponse { $baseUrl = $this->sdkConfiguration->getServerUrl(); $url = Utils\Utils::generateUrl($baseUrl, '/links'); $options = ['http_errors' => false]; - $options = array_merge_recursive($options, Utils\Utils::getQueryParams(Operations\GetLinksRequest::class, $request)); + $body = Utils\Utils::serializeRequestBody($request, 'request', 'json'); + if ($body !== null) { + $options = array_merge_recursive($options, $body); + } $options['headers']['Accept'] = 'application/json'; $options['headers']['user-agent'] = $this->sdkConfiguration->userAgent; - $httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url); + $httpRequest = new \GuzzleHttp\Psr7\Request('POST', $url); $httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options); @@ -50,12 +53,12 @@ public function list( if ($statusCode == 200) { if (Utils\Utils::matchContentType($contentType, 'application/json')) { $serializer = Utils\JSON::createSerializer(); - $obj = $serializer->deserialize((string) $httpResponse->getBody(), 'array<\Dub\Models\Components\LinkSchema>', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); - $response = new Operations\GetLinksResponse( + $obj = $serializer->deserialize((string) $httpResponse->getBody(), '\Dub\Models\Components\LinkSchema', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + $response = new Operations\CreateLinkResponse( statusCode: $statusCode, contentType: $contentType, rawResponse: $httpResponse, - linkSchemas: $obj); + linkSchema: $obj); return $response; } else { @@ -141,27 +144,24 @@ public function list( } /** - * Create a new link + * Retrieve a list of links * - * Create a new link for the authenticated workspace. + * Retrieve a paginated list of links for the authenticated workspace. * - * @param Operations\CreateLinkRequestBody $request - * @return Operations\CreateLinkResponse + * @param Operations\GetLinksRequest $request + * @return Operations\GetLinksResponse * @throws \Dub\Models\Errors\SDKException */ - public function create( - ?Operations\CreateLinkRequestBody $request, - ): Operations\CreateLinkResponse { + public function list( + ?Operations\GetLinksRequest $request, + ): Operations\GetLinksResponse { $baseUrl = $this->sdkConfiguration->getServerUrl(); $url = Utils\Utils::generateUrl($baseUrl, '/links'); $options = ['http_errors' => false]; - $body = Utils\Utils::serializeRequestBody($request, 'request', 'json'); - if ($body !== null) { - $options = array_merge_recursive($options, $body); - } + $options = array_merge_recursive($options, Utils\Utils::getQueryParams(Operations\GetLinksRequest::class, $request)); $options['headers']['Accept'] = 'application/json'; $options['headers']['user-agent'] = $this->sdkConfiguration->userAgent; - $httpRequest = new \GuzzleHttp\Psr7\Request('POST', $url); + $httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url); $httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options); @@ -171,12 +171,12 @@ public function create( if ($statusCode == 200) { if (Utils\Utils::matchContentType($contentType, 'application/json')) { $serializer = Utils\JSON::createSerializer(); - $obj = $serializer->deserialize((string) $httpResponse->getBody(), '\Dub\Models\Components\LinkSchema', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); - $response = new Operations\CreateLinkResponse( + $obj = $serializer->deserialize((string) $httpResponse->getBody(), 'array<\Dub\Models\Components\LinkSchema>', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + $response = new Operations\GetLinksResponse( statusCode: $statusCode, contentType: $contentType, rawResponse: $httpResponse, - linkSchema: $obj); + linkSchemas: $obj); return $response; } else { @@ -510,26 +510,33 @@ public function get( } /** - * Delete a link + * Update a link * - * Delete a link for the authenticated workspace. + * Update a link for the authenticated workspace. If there's no change, returns it as it is. * * @param string $linkId - * @return Operations\DeleteLinkResponse + * @param ?Operations\UpdateLinkRequestBody $requestBody + * @return Operations\UpdateLinkResponse * @throws \Dub\Models\Errors\SDKException */ - public function delete( + public function update( string $linkId, - ): Operations\DeleteLinkResponse { - $request = new Operations\DeleteLinkRequest( + ?Operations\UpdateLinkRequestBody $requestBody = null, + ): Operations\UpdateLinkResponse { + $request = new Operations\UpdateLinkRequest( linkId: $linkId, + requestBody: $requestBody, ); $baseUrl = $this->sdkConfiguration->getServerUrl(); - $url = Utils\Utils::generateUrl($baseUrl, '/links/{linkId}', Operations\DeleteLinkRequest::class, $request); + $url = Utils\Utils::generateUrl($baseUrl, '/links/{linkId}', Operations\UpdateLinkRequest::class, $request); $options = ['http_errors' => false]; + $body = Utils\Utils::serializeRequestBody($request, 'requestBody', 'json'); + if ($body !== null) { + $options = array_merge_recursive($options, $body); + } $options['headers']['Accept'] = 'application/json'; $options['headers']['user-agent'] = $this->sdkConfiguration->userAgent; - $httpRequest = new \GuzzleHttp\Psr7\Request('DELETE', $url); + $httpRequest = new \GuzzleHttp\Psr7\Request('PATCH', $url); $httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options); @@ -539,12 +546,12 @@ public function delete( if ($statusCode == 200) { if (Utils\Utils::matchContentType($contentType, 'application/json')) { $serializer = Utils\JSON::createSerializer(); - $obj = $serializer->deserialize((string) $httpResponse->getBody(), '\Dub\Models\Operations\DeleteLinkResponseBody', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); - $response = new Operations\DeleteLinkResponse( + $obj = $serializer->deserialize((string) $httpResponse->getBody(), '\Dub\Models\Components\LinkSchema', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + $response = new Operations\UpdateLinkResponse( statusCode: $statusCode, contentType: $contentType, rawResponse: $httpResponse, - object: $obj); + linkSchema: $obj); return $response; } else { @@ -630,33 +637,26 @@ public function delete( } /** - * Update a link + * Delete a link * - * Update a link for the authenticated workspace. If there's no change, returns it as it is. + * Delete a link for the authenticated workspace. * * @param string $linkId - * @param ?Operations\UpdateLinkRequestBody $requestBody - * @return Operations\UpdateLinkResponse + * @return Operations\DeleteLinkResponse * @throws \Dub\Models\Errors\SDKException */ - public function update( + public function delete( string $linkId, - ?Operations\UpdateLinkRequestBody $requestBody = null, - ): Operations\UpdateLinkResponse { - $request = new Operations\UpdateLinkRequest( + ): Operations\DeleteLinkResponse { + $request = new Operations\DeleteLinkRequest( linkId: $linkId, - requestBody: $requestBody, ); $baseUrl = $this->sdkConfiguration->getServerUrl(); - $url = Utils\Utils::generateUrl($baseUrl, '/links/{linkId}', Operations\UpdateLinkRequest::class, $request); + $url = Utils\Utils::generateUrl($baseUrl, '/links/{linkId}', Operations\DeleteLinkRequest::class, $request); $options = ['http_errors' => false]; - $body = Utils\Utils::serializeRequestBody($request, 'requestBody', 'json'); - if ($body !== null) { - $options = array_merge_recursive($options, $body); - } $options['headers']['Accept'] = 'application/json'; $options['headers']['user-agent'] = $this->sdkConfiguration->userAgent; - $httpRequest = new \GuzzleHttp\Psr7\Request('PATCH', $url); + $httpRequest = new \GuzzleHttp\Psr7\Request('DELETE', $url); $httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options); @@ -666,12 +666,12 @@ public function update( if ($statusCode == 200) { if (Utils\Utils::matchContentType($contentType, 'application/json')) { $serializer = Utils\JSON::createSerializer(); - $obj = $serializer->deserialize((string) $httpResponse->getBody(), '\Dub\Models\Components\LinkSchema', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); - $response = new Operations\UpdateLinkResponse( + $obj = $serializer->deserialize((string) $httpResponse->getBody(), '\Dub\Models\Operations\DeleteLinkResponseBody', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + $response = new Operations\DeleteLinkResponse( statusCode: $statusCode, contentType: $contentType, rawResponse: $httpResponse, - linkSchema: $obj); + object: $obj); return $response; } else { @@ -878,27 +878,27 @@ public function createMany( } /** - * Bulk delete links + * Bulk update links * - * Bulk delete up to 100 links for the authenticated workspace. + * Bulk update up to 100 links with the same data for the authenticated workspace. * - * @param array $linkIds - * @return Operations\BulkDeleteLinksResponse + * @param Operations\BulkUpdateLinksRequestBody $request + * @return Operations\BulkUpdateLinksResponse * @throws \Dub\Models\Errors\SDKException */ - public function deleteMany( - array $linkIds, - ): Operations\BulkDeleteLinksResponse { - $request = new Operations\BulkDeleteLinksRequest( - linkIds: $linkIds, - ); + public function updateMany( + ?Operations\BulkUpdateLinksRequestBody $request, + ): Operations\BulkUpdateLinksResponse { $baseUrl = $this->sdkConfiguration->getServerUrl(); $url = Utils\Utils::generateUrl($baseUrl, '/links/bulk'); $options = ['http_errors' => false]; - $options = array_merge_recursive($options, Utils\Utils::getQueryParams(Operations\BulkDeleteLinksRequest::class, $request)); + $body = Utils\Utils::serializeRequestBody($request, 'request', 'json'); + if ($body !== null) { + $options = array_merge_recursive($options, $body); + } $options['headers']['Accept'] = 'application/json'; $options['headers']['user-agent'] = $this->sdkConfiguration->userAgent; - $httpRequest = new \GuzzleHttp\Psr7\Request('DELETE', $url); + $httpRequest = new \GuzzleHttp\Psr7\Request('PATCH', $url); $httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options); @@ -908,12 +908,12 @@ public function deleteMany( if ($statusCode == 200) { if (Utils\Utils::matchContentType($contentType, 'application/json')) { $serializer = Utils\JSON::createSerializer(); - $obj = $serializer->deserialize((string) $httpResponse->getBody(), '\Dub\Models\Operations\BulkDeleteLinksResponseBody', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); - $response = new Operations\BulkDeleteLinksResponse( + $obj = $serializer->deserialize((string) $httpResponse->getBody(), 'array<\Dub\Models\Components\LinkSchema>', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + $response = new Operations\BulkUpdateLinksResponse( statusCode: $statusCode, contentType: $contentType, rawResponse: $httpResponse, - object: $obj); + linkSchemas: $obj); return $response; } else { @@ -999,27 +999,27 @@ public function deleteMany( } /** - * Bulk update links + * Bulk delete links * - * Bulk update up to 100 links with the same data for the authenticated workspace. + * Bulk delete up to 100 links for the authenticated workspace. * - * @param Operations\BulkUpdateLinksRequestBody $request - * @return Operations\BulkUpdateLinksResponse + * @param array $linkIds + * @return Operations\BulkDeleteLinksResponse * @throws \Dub\Models\Errors\SDKException */ - public function updateMany( - ?Operations\BulkUpdateLinksRequestBody $request, - ): Operations\BulkUpdateLinksResponse { + public function deleteMany( + array $linkIds, + ): Operations\BulkDeleteLinksResponse { + $request = new Operations\BulkDeleteLinksRequest( + linkIds: $linkIds, + ); $baseUrl = $this->sdkConfiguration->getServerUrl(); $url = Utils\Utils::generateUrl($baseUrl, '/links/bulk'); $options = ['http_errors' => false]; - $body = Utils\Utils::serializeRequestBody($request, 'request', 'json'); - if ($body !== null) { - $options = array_merge_recursive($options, $body); - } + $options = array_merge_recursive($options, Utils\Utils::getQueryParams(Operations\BulkDeleteLinksRequest::class, $request)); $options['headers']['Accept'] = 'application/json'; $options['headers']['user-agent'] = $this->sdkConfiguration->userAgent; - $httpRequest = new \GuzzleHttp\Psr7\Request('PATCH', $url); + $httpRequest = new \GuzzleHttp\Psr7\Request('DELETE', $url); $httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options); @@ -1029,12 +1029,12 @@ public function updateMany( if ($statusCode == 200) { if (Utils\Utils::matchContentType($contentType, 'application/json')) { $serializer = Utils\JSON::createSerializer(); - $obj = $serializer->deserialize((string) $httpResponse->getBody(), 'array<\Dub\Models\Components\LinkSchema>', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); - $response = new Operations\BulkUpdateLinksResponse( + $obj = $serializer->deserialize((string) $httpResponse->getBody(), '\Dub\Models\Operations\BulkDeleteLinksResponseBody', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + $response = new Operations\BulkDeleteLinksResponse( statusCode: $statusCode, contentType: $contentType, rawResponse: $httpResponse, - linkSchemas: $obj); + object: $obj); return $response; } else { diff --git a/src/SDKConfiguration.php b/src/SDKConfiguration.php index da59a6e..ac06b14 100644 --- a/src/SDKConfiguration.php +++ b/src/SDKConfiguration.php @@ -27,11 +27,11 @@ class SDKConfiguration public string $openapiDocVersion = '0.0.1'; - public string $sdkVersion = '0.6.2'; + public string $sdkVersion = '0.6.3'; - public string $genVersion = '2.415.8'; + public string $genVersion = '2.421.3'; - public string $userAgent = 'speakeasy-sdk/php 0.6.2 2.415.8 0.0.1 dub/dub-php'; + public string $userAgent = 'speakeasy-sdk/php 0.6.3 2.421.3 0.0.1 dub/dub-php'; public function getServerUrl(): string { diff --git a/src/Tags.php b/src/Tags.php index 82f06aa..4df0ebe 100644 --- a/src/Tags.php +++ b/src/Tags.php @@ -23,36 +23,42 @@ public function __construct(SDKConfiguration $sdkConfig) } /** - * Retrieve a list of tags + * Create a new tag * - * Retrieve a list of tags for the authenticated workspace. + * Create a new tag for the authenticated workspace. * - * @return Operations\GetTagsResponse + * @param Operations\CreateTagRequestBody $request + * @return Operations\CreateTagResponse * @throws \Dub\Models\Errors\SDKException */ - public function list( - ): Operations\GetTagsResponse { + public function create( + ?Operations\CreateTagRequestBody $request, + ): Operations\CreateTagResponse { $baseUrl = $this->sdkConfiguration->getServerUrl(); $url = Utils\Utils::generateUrl($baseUrl, '/tags'); $options = ['http_errors' => false]; + $body = Utils\Utils::serializeRequestBody($request, 'request', 'json'); + if ($body !== null) { + $options = array_merge_recursive($options, $body); + } $options['headers']['Accept'] = 'application/json'; $options['headers']['user-agent'] = $this->sdkConfiguration->userAgent; - $httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url); + $httpRequest = new \GuzzleHttp\Psr7\Request('POST', $url); $httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options); $contentType = $httpResponse->getHeader('Content-Type')[0] ?? ''; $statusCode = $httpResponse->getStatusCode(); - if ($statusCode == 200) { + if ($statusCode == 201) { if (Utils\Utils::matchContentType($contentType, 'application/json')) { $serializer = Utils\JSON::createSerializer(); - $obj = $serializer->deserialize((string) $httpResponse->getBody(), 'array<\Dub\Models\Components\TagSchema>', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); - $response = new Operations\GetTagsResponse( + $obj = $serializer->deserialize((string) $httpResponse->getBody(), '\Dub\Models\Components\TagSchema', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + $response = new Operations\CreateTagResponse( statusCode: $statusCode, contentType: $contentType, rawResponse: $httpResponse, - tagSchemas: $obj); + tagSchema: $obj); return $response; } else { @@ -138,42 +144,36 @@ public function list( } /** - * Create a new tag + * Retrieve a list of tags * - * Create a new tag for the authenticated workspace. + * Retrieve a list of tags for the authenticated workspace. * - * @param Operations\CreateTagRequestBody $request - * @return Operations\CreateTagResponse + * @return Operations\GetTagsResponse * @throws \Dub\Models\Errors\SDKException */ - public function create( - ?Operations\CreateTagRequestBody $request, - ): Operations\CreateTagResponse { + public function list( + ): Operations\GetTagsResponse { $baseUrl = $this->sdkConfiguration->getServerUrl(); $url = Utils\Utils::generateUrl($baseUrl, '/tags'); $options = ['http_errors' => false]; - $body = Utils\Utils::serializeRequestBody($request, 'request', 'json'); - if ($body !== null) { - $options = array_merge_recursive($options, $body); - } $options['headers']['Accept'] = 'application/json'; $options['headers']['user-agent'] = $this->sdkConfiguration->userAgent; - $httpRequest = new \GuzzleHttp\Psr7\Request('POST', $url); + $httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url); $httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options); $contentType = $httpResponse->getHeader('Content-Type')[0] ?? ''; $statusCode = $httpResponse->getStatusCode(); - if ($statusCode == 201) { + if ($statusCode == 200) { if (Utils\Utils::matchContentType($contentType, 'application/json')) { $serializer = Utils\JSON::createSerializer(); - $obj = $serializer->deserialize((string) $httpResponse->getBody(), '\Dub\Models\Components\TagSchema', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); - $response = new Operations\CreateTagResponse( + $obj = $serializer->deserialize((string) $httpResponse->getBody(), 'array<\Dub\Models\Components\TagSchema>', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + $response = new Operations\GetTagsResponse( statusCode: $statusCode, contentType: $contentType, rawResponse: $httpResponse, - tagSchema: $obj); + tagSchemas: $obj); return $response; } else { @@ -259,26 +259,33 @@ public function create( } /** - * Delete a tag + * Update a tag * - * Delete a tag from the workspace. All existing links will still work, but they will no longer be associated with this tag. + * Update a tag in the workspace. * * @param string $id - * @return Operations\DeleteTagResponse + * @param ?Operations\UpdateTagRequestBody $requestBody + * @return Operations\UpdateTagResponse * @throws \Dub\Models\Errors\SDKException */ - public function delete( + public function update( string $id, - ): Operations\DeleteTagResponse { - $request = new Operations\DeleteTagRequest( + ?Operations\UpdateTagRequestBody $requestBody = null, + ): Operations\UpdateTagResponse { + $request = new Operations\UpdateTagRequest( id: $id, + requestBody: $requestBody, ); $baseUrl = $this->sdkConfiguration->getServerUrl(); - $url = Utils\Utils::generateUrl($baseUrl, '/tags/{id}', Operations\DeleteTagRequest::class, $request); + $url = Utils\Utils::generateUrl($baseUrl, '/tags/{id}', Operations\UpdateTagRequest::class, $request); $options = ['http_errors' => false]; + $body = Utils\Utils::serializeRequestBody($request, 'requestBody', 'json'); + if ($body !== null) { + $options = array_merge_recursive($options, $body); + } $options['headers']['Accept'] = 'application/json'; $options['headers']['user-agent'] = $this->sdkConfiguration->userAgent; - $httpRequest = new \GuzzleHttp\Psr7\Request('DELETE', $url); + $httpRequest = new \GuzzleHttp\Psr7\Request('PATCH', $url); $httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options); @@ -288,12 +295,12 @@ public function delete( if ($statusCode == 200) { if (Utils\Utils::matchContentType($contentType, 'application/json')) { $serializer = Utils\JSON::createSerializer(); - $obj = $serializer->deserialize((string) $httpResponse->getBody(), '\Dub\Models\Operations\DeleteTagResponseBody', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); - $response = new Operations\DeleteTagResponse( + $obj = $serializer->deserialize((string) $httpResponse->getBody(), '\Dub\Models\Components\TagSchema', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + $response = new Operations\UpdateTagResponse( statusCode: $statusCode, contentType: $contentType, rawResponse: $httpResponse, - object: $obj); + tagSchema: $obj); return $response; } else { @@ -379,33 +386,26 @@ public function delete( } /** - * Update a tag + * Delete a tag * - * Update a tag in the workspace. + * Delete a tag from the workspace. All existing links will still work, but they will no longer be associated with this tag. * * @param string $id - * @param ?Operations\UpdateTagRequestBody $requestBody - * @return Operations\UpdateTagResponse + * @return Operations\DeleteTagResponse * @throws \Dub\Models\Errors\SDKException */ - public function update( + public function delete( string $id, - ?Operations\UpdateTagRequestBody $requestBody = null, - ): Operations\UpdateTagResponse { - $request = new Operations\UpdateTagRequest( + ): Operations\DeleteTagResponse { + $request = new Operations\DeleteTagRequest( id: $id, - requestBody: $requestBody, ); $baseUrl = $this->sdkConfiguration->getServerUrl(); - $url = Utils\Utils::generateUrl($baseUrl, '/tags/{id}', Operations\UpdateTagRequest::class, $request); + $url = Utils\Utils::generateUrl($baseUrl, '/tags/{id}', Operations\DeleteTagRequest::class, $request); $options = ['http_errors' => false]; - $body = Utils\Utils::serializeRequestBody($request, 'requestBody', 'json'); - if ($body !== null) { - $options = array_merge_recursive($options, $body); - } $options['headers']['Accept'] = 'application/json'; $options['headers']['user-agent'] = $this->sdkConfiguration->userAgent; - $httpRequest = new \GuzzleHttp\Psr7\Request('PATCH', $url); + $httpRequest = new \GuzzleHttp\Psr7\Request('DELETE', $url); $httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options); @@ -415,12 +415,12 @@ public function update( if ($statusCode == 200) { if (Utils\Utils::matchContentType($contentType, 'application/json')) { $serializer = Utils\JSON::createSerializer(); - $obj = $serializer->deserialize((string) $httpResponse->getBody(), '\Dub\Models\Components\TagSchema', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); - $response = new Operations\UpdateTagResponse( + $obj = $serializer->deserialize((string) $httpResponse->getBody(), '\Dub\Models\Operations\DeleteTagResponseBody', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + $response = new Operations\DeleteTagResponse( statusCode: $statusCode, contentType: $contentType, rawResponse: $httpResponse, - tagSchema: $obj); + object: $obj); return $response; } else {