diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 908e924..1607c00 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 43187d3e-7c3c-4c11-b5d4-4b2334fb6d96 management: - docChecksum: 35e4c58336f3289dc7d36cd16ac407d9 + docChecksum: 3221eb44e26e0b7b6262f2e3cf1c786a docVersion: 0.0.1 - speakeasyVersion: 1.481.1 - generationVersion: 2.500.5 - releaseVersion: 0.11.21 - configChecksum: b392851852b647b23758b769c2a01fe4 + speakeasyVersion: 1.483.0 + generationVersion: 2.502.0 + releaseVersion: 0.11.22 + configChecksum: d2f122372ee5010221f848719fed3f89 repoURL: https://github.com/dubinc/dub-php.git installationURL: https://github.com/dubinc/dub-php published: true @@ -25,7 +25,7 @@ features: methodArguments: 0.1.0 nameOverrides: 2.81.2 nullables: 1.0.0 - pagination: 0.1.1 + pagination: 0.1.2 responseFormat: 0.1.0 unions: 0.1.4 generatedFiles: @@ -192,6 +192,11 @@ generatedFiles: - docs/Models/Operations/CreateLinkResponse.md - docs/Models/Operations/CreatePartnerDiscount.md - docs/Models/Operations/CreatePartnerInterval.md + - docs/Models/Operations/CreatePartnerLinkLinkProps.md + - docs/Models/Operations/CreatePartnerLinkRequestBody.md + - docs/Models/Operations/CreatePartnerLinkResponse.md + - docs/Models/Operations/CreatePartnerLinkTagIds.md + - docs/Models/Operations/CreatePartnerLinkTagNames.md - docs/Models/Operations/CreatePartnerRequestBody.md - docs/Models/Operations/CreatePartnerResponse.md - docs/Models/Operations/CreatePartnerResponseBody.md @@ -530,6 +535,9 @@ generatedFiles: - src/Models/Operations/CreateLinkResponse.php - src/Models/Operations/CreatePartnerDiscount.php - src/Models/Operations/CreatePartnerInterval.php + - src/Models/Operations/CreatePartnerLinkLinkProps.php + - src/Models/Operations/CreatePartnerLinkRequestBody.php + - src/Models/Operations/CreatePartnerLinkResponse.php - src/Models/Operations/CreatePartnerRequestBody.php - src/Models/Operations/CreatePartnerResponse.php - src/Models/Operations/CreatePartnerResponseBody.php @@ -1003,7 +1011,7 @@ examples: sortBy: "timestamp" responses: "200": - application/json: [{"event": "sale", "eventId": "", "eventName": "", "link": {"id": "", "domain": "remorseful-concentration.biz", "key": "", "url": "https://primary-paintwork.com/", "externalId": "", "tenantId": "", "programId": "", "partnerId": "", "expiresAt": "1761194430109", "expiredUrl": "https://black-poetry.name/", "password": "COyVtOrvIw1vLIJ", "title": "", "description": "despite er boom however when uh-huh", "image": "https://picsum.photos/seed/T1tZJLp1EG/3827/3109", "video": "https://loremflickr.com/2420/1632?lock=7470650813503352", "ios": "", "android": "", "geo": {}, "tagId": "", "tags": [{"id": "", "name": "", "color": "green"}], "webhookIds": [], "comments": "tenement commonly softly boo massive sorrowful", "shortLink": "https://dense-custom.info/", "qrCode": "https://alive-lid.biz", "utm_source": "", "utm_medium": "", "utm_campaign": "", "utm_term": "", "utm_content": "", "userId": "", "workspaceId": "", "clicks": 0, "lastClicked": "", "leads": 0, "sales": 0, "saleAmount": 0, "createdAt": "1726607241652", "updatedAt": "1738480869651", "projectId": ""}, "click": {"id": "", "url": "https://utilized-quit.net/", "country": "Togo", "city": "Cormiermouth", "region": "", "continent": "North America", "device": "Mobile", "browser": "Chrome", "os": "Chrome OS", "referer": "gummy-cope.net", "refererUrl": "https://prickly-bourgeoisie.info/", "ip": "69bd:53cd:cebc:ac4b:d1e8:50e8:ee59:b0b3"}, "customer": {"id": "", "externalId": "", "name": "", "createdAt": "1737362786110"}, "sale": {"amount": 625809, "invoiceId": null, "paymentProcessor": "stripe"}, "saleAmount": 1401.42, "invoice_id": "", "payment_processor": "", "click_id": "", "link_id": "", "domain": "unruly-allegation.name", "key": "", "url": "https://fortunate-swim.info/", "continent": "Australia", "country": "Cook Islands", "city": "South Harryburgh", "device": "Mobile", "browser": "Safari", "os": "WebOS", "qr": 1523.03, "ip": "caf5:04dc:da9e:67cc:af3b:8caf:afbe:e39c"}, {"event": "sale", "eventId": "", "eventName": "", "link": {"id": "", "domain": "right-window.biz", "key": "", "url": "https://physical-experience.org/", "externalId": "", "tenantId": "", "programId": "", "partnerId": "", "expiresAt": "1749885783692", "expiredUrl": "https://indelible-birdbath.net", "password": "4yMlkCXkK5ppW3u", "title": "", "description": "terribly gosh facilitate in", "image": "https://loremflickr.com/2596/954?lock=8527955982122580", "video": "https://loremflickr.com/3336/742?lock=2177640289466521", "ios": "", "android": "", "geo": {}, "tagId": "", "tags": [{"id": "", "name": "", "color": "red"}, {"id": "", "name": "", "color": "pink"}, {"id": "", "name": "", "color": "pink"}], "webhookIds": ["", "", ""], "comments": "up so pro pish clear-cut an mid aw disconnection which wetly typeface usable underneath putrefy ah aha", "shortLink": "https://knowledgeable-season.info", "qrCode": "https://nimble-individual.biz/", "utm_source": "", "utm_medium": "", "utm_campaign": "", "utm_term": "", "utm_content": "", "userId": "", "workspaceId": "", "clicks": 0, "lastClicked": "", "leads": 0, "sales": 0, "saleAmount": 0, "createdAt": "1737101507386", "updatedAt": "1738486590850", "projectId": ""}, "click": {"id": "", "url": "https://perfumed-marketplace.com/", "country": "Burundi", "city": "Stockton", "region": "", "continent": "Asia", "device": "Desktop", "browser": "Chrome", "os": "Symbian", "referer": "well-off-hygienic.org", "refererUrl": "https://ripe-ceramic.org", "ip": "eebc:cce9:cecf:ebeb:dfd9:15f2:a0cc:a3b1"}, "customer": {"id": "", "externalId": "", "name": "", "createdAt": "1721462452208"}, "sale": {"amount": 443316, "invoiceId": null, "paymentProcessor": "paddle"}, "saleAmount": 2634.98, "invoice_id": "", "payment_processor": "", "click_id": "", "link_id": "", "domain": "next-cricket.biz", "key": "", "url": "https://repentant-rust.name/", "continent": "Australia", "country": "Saint Helena", "city": "Luettgenfort", "device": "Mobile", "browser": "Safari", "os": "Chrome OS", "qr": 4390.32, "ip": "54.229.114.129"}] + application/json: [{"event": "sale", "eventId": "", "eventName": "", "link": {"id": "", "domain": "remorseful-concentration.biz", "key": "", "url": "https://primary-paintwork.com/", "externalId": "", "tenantId": "", "programId": "", "partnerId": "", "expiresAt": "1761280780475", "expiredUrl": "https://black-poetry.name/", "password": "COyVtOrvIw1vLIJ", "title": "", "description": "despite er boom however when uh-huh", "image": "https://picsum.photos/seed/T1tZJLp1EG/3827/3109", "video": "https://loremflickr.com/2420/1632?lock=7470650813503352", "ios": "", "android": "", "geo": {}, "tagId": "", "tags": [{"id": "", "name": "", "color": "green"}], "webhookIds": [], "comments": "tenement commonly softly boo massive sorrowful", "shortLink": "https://dense-custom.info/", "qrCode": "https://alive-lid.biz", "utm_source": "", "utm_medium": "", "utm_campaign": "", "utm_term": "", "utm_content": "", "userId": "", "workspaceId": "", "clicks": 0, "lastClicked": "", "leads": 0, "sales": 0, "saleAmount": 0, "createdAt": "1726693592018", "updatedAt": "1738567220017", "projectId": ""}, "click": {"id": "", "url": "https://utilized-quit.net/", "country": "Togo", "city": "Cormiermouth", "region": "", "continent": "North America", "device": "Mobile", "browser": "Chrome", "os": "Chrome OS", "referer": "gummy-cope.net", "refererUrl": "https://prickly-bourgeoisie.info/", "ip": "69bd:53cd:cebc:ac4b:d1e8:50e8:ee59:b0b3"}, "customer": {"id": "", "externalId": "", "name": "", "createdAt": "1737449136483"}, "sale": {"amount": 625809, "invoiceId": null, "paymentProcessor": "stripe"}, "saleAmount": 1401.42, "invoice_id": "", "payment_processor": "", "click_id": "", "link_id": "", "domain": "unruly-allegation.name", "key": "", "url": "https://fortunate-swim.info/", "continent": "Australia", "country": "Cook Islands", "city": "South Harryburgh", "device": "Mobile", "browser": "Safari", "os": "WebOS", "qr": 1523.03, "ip": "caf5:04dc:da9e:67cc:af3b:8caf:afbe:e39c"}, {"event": "sale", "eventId": "", "eventName": "", "link": {"id": "", "domain": "right-window.biz", "key": "", "url": "https://physical-experience.org/", "externalId": "", "tenantId": "", "programId": "", "partnerId": "", "expiresAt": "1749972134077", "expiredUrl": "https://indelible-birdbath.net", "password": "4yMlkCXkK5ppW3u", "title": "", "description": "terribly gosh facilitate in", "image": "https://loremflickr.com/2596/954?lock=8527955982122580", "video": "https://loremflickr.com/3336/742?lock=2177640289466521", "ios": "", "android": "", "geo": {}, "tagId": "", "tags": [{"id": "", "name": "", "color": "red"}, {"id": "", "name": "", "color": "pink"}, {"id": "", "name": "", "color": "pink"}], "webhookIds": ["", "", ""], "comments": "up so pro pish clear-cut an mid aw disconnection which wetly typeface usable underneath putrefy ah aha", "shortLink": "https://knowledgeable-season.info", "qrCode": "https://nimble-individual.biz/", "utm_source": "", "utm_medium": "", "utm_campaign": "", "utm_term": "", "utm_content": "", "userId": "", "workspaceId": "", "clicks": 0, "lastClicked": "", "leads": 0, "sales": 0, "saleAmount": 0, "createdAt": "1737187857798", "updatedAt": "1738572941262", "projectId": ""}, "click": {"id": "", "url": "https://perfumed-marketplace.com/", "country": "Burundi", "city": "Stockton", "region": "", "continent": "Asia", "device": "Desktop", "browser": "Chrome", "os": "Symbian", "referer": "well-off-hygienic.org", "refererUrl": "https://ripe-ceramic.org", "ip": "eebc:cce9:cecf:ebeb:dfd9:15f2:a0cc:a3b1"}, "customer": {"id": "", "externalId": "", "name": "", "createdAt": "1721548802623"}, "sale": {"amount": 443316, "invoiceId": null, "paymentProcessor": "paddle"}, "saleAmount": 2634.98, "invoice_id": "", "payment_processor": "", "click_id": "", "link_id": "", "domain": "next-cricket.biz", "key": "", "url": "https://repentant-rust.name/", "continent": "Australia", "country": "Saint Helena", "city": "Luettgenfort", "device": "Mobile", "browser": "Safari", "os": "Chrome OS", "qr": 4390.32, "ip": "54.229.114.129"}] "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"}} "401": @@ -1550,5 +1558,30 @@ examples: application/json: {"error": {"code": "rate_limit_exceeded", "message": "The requested resource was not found.", "doc_url": "https://dub.co/docs/api-reference/errors#rate-limit_exceeded"}} "500": application/json: {"error": {"code": "internal_server_error", "message": "The requested resource was not found.", "doc_url": "https://dub.co/docs/api-reference/errors#internal-server_error"}} + createPartnerLink: + speakeasy-default-create-partner-link: + requestBody: + application/json: {"programId": "", "url": "https://necessary-brief.name", "linkProps": {"externalId": "123456", "tagIds": ["clux0rgak00011..."]}} + responses: + "201": + application/json: {"id": "", "domain": "inferior-louse.org", "key": "", "url": "https://lighthearted-subexpression.net", "trackConversion": false, "externalId": "", "tenantId": "", "programId": "", "partnerId": "", "archived": false, "expiresAt": "1746975543818", "expiredUrl": "https://mammoth-resolve.com", "password": "oCRFmmigZdFo7_S", "proxy": false, "title": "", "description": "triumphantly zowie polite from yippee whether lazily hyena", "image": "https://loremflickr.com/3108/2731?lock=4230767515156707", "video": "https://loremflickr.com/3903/2681?lock=8712371193890444", "rewrite": false, "doIndex": false, "ios": "", "android": "", "geo": {}, "publicStats": false, "tagId": "", "tags": [{"id": "", "name": "", "color": "blue"}, {"id": "", "name": "", "color": "pink"}, {"id": "", "name": "", "color": "brown"}], "webhookIds": [""], "comments": "after boldly yieldingly from irritably nectarine nor vision loyally ew ick muddy rewrite till amount nor", "shortLink": "https://hard-to-find-railway.name", "qrCode": "https://vivacious-impostor.name/", "utm_source": "", "utm_medium": "", "utm_campaign": "", "utm_term": "", "utm_content": "", "userId": "", "workspaceId": "", "clicks": 0, "lastClicked": "", "leads": 0, "sales": 0, "saleAmount": 0, "createdAt": "1730893636352", "updatedAt": "1738583197892", "projectId": ""} + "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"}} + "401": + application/json: {"error": {"code": "unauthorized", "message": "The requested resource was not found.", "doc_url": "https://dub.co/docs/api-reference/errors#unauthorized"}} + "403": + application/json: {"error": {"code": "forbidden", "message": "The requested resource was not found.", "doc_url": "https://dub.co/docs/api-reference/errors#forbidden"}} + "404": + application/json: {"error": {"code": "not_found", "message": "The requested resource was not found.", "doc_url": "https://dub.co/docs/api-reference/errors#not-found"}} + "409": + application/json: {"error": {"code": "conflict", "message": "The requested resource was not found.", "doc_url": "https://dub.co/docs/api-reference/errors#conflict"}} + "410": + application/json: {"error": {"code": "invite_expired", "message": "The requested resource was not found.", "doc_url": "https://dub.co/docs/api-reference/errors#invite-expired"}} + "422": + application/json: {"error": {"code": "unprocessable_entity", "message": "The requested resource was not found.", "doc_url": "https://dub.co/docs/api-reference/errors#unprocessable-entity"}} + "429": + application/json: {"error": {"code": "rate_limit_exceeded", "message": "The requested resource was not found.", "doc_url": "https://dub.co/docs/api-reference/errors#rate-limit_exceeded"}} + "500": + application/json: {"error": {"code": "internal_server_error", "message": "The requested resource was not found.", "doc_url": "https://dub.co/docs/api-reference/errors#internal-server_error"}} examplesVersion: 1.0.0 generatedTests: {} diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 595d22a..a2fcc61 100755 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -13,7 +13,7 @@ generation: oAuth2ClientCredentialsEnabled: true oAuth2PasswordEnabled: false php: - version: 0.11.21 + version: 0.11.22 additionalDependencies: autoload: {} autoload-dev: {} diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 09f1f55..fcb24dd 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,21 +1,21 @@ -speakeasyVersion: 1.481.1 +speakeasyVersion: 1.483.0 sources: dub: sourceNamespace: dub - sourceRevisionDigest: sha256:6e0f4358a672c0539a3c223bdeff9305c081f7ecc4bbc8317fea4502069b64af - sourceBlobDigest: sha256:451be136201f6f2abfe71e31c9d268f24d14c1a911aad964414e9e62d708dda3 + sourceRevisionDigest: sha256:317e5bd27a149cfa89a30f3b386b9992c5c42d636011329f4a125af8f12a8e2f + sourceBlobDigest: sha256:07d9325feb01f432d02cf3ae4943fed8a9f9c9fdacf649eb143973253d0348ac tags: - latest - - speakeasy-sdk-regen-1738369248 + - speakeasy-sdk-regen-1738628356 - 0.0.1 targets: my-first-target: source: dub sourceNamespace: dub - sourceRevisionDigest: sha256:6e0f4358a672c0539a3c223bdeff9305c081f7ecc4bbc8317fea4502069b64af - sourceBlobDigest: sha256:451be136201f6f2abfe71e31c9d268f24d14c1a911aad964414e9e62d708dda3 + sourceRevisionDigest: sha256:317e5bd27a149cfa89a30f3b386b9992c5c42d636011329f4a125af8f12a8e2f + sourceBlobDigest: sha256:07d9325feb01f432d02cf3ae4943fed8a9f9c9fdacf649eb143973253d0348ac codeSamplesNamespace: code-samples-php-my-first-target - codeSamplesRevisionDigest: sha256:0b8e853962ba47301d60e3d3c0565bf6478ef661ac93a23ddd11dee48adf4d45 + codeSamplesRevisionDigest: sha256:aebab81bf31224b8a45ab55a725558fc5377aebb6abbc99ea91712188653ba5a workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index 4d04762..fc52bc3 100644 --- a/README.md +++ b/README.md @@ -211,6 +211,7 @@ if ($response->responseBodies !== null) { ### [partners](docs/sdks/partners/README.md) * [create](docs/sdks/partners/README.md#create) - Create a new partner +* [createLink](docs/sdks/partners/README.md#createlink) - Create a link for a partner ### [qrCodes](docs/sdks/qrcodes/README.md) diff --git a/RELEASES.md b/RELEASES.md index 76d642a..b202028 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -660,4 +660,14 @@ Based on: ### Generated - [php v0.11.21] . ### Releases -- [Composer v0.11.21] https://packagist.org/packages/dub/dub-php#v0.11.21 - . \ No newline at end of file +- [Composer v0.11.21] https://packagist.org/packages/dub/dub-php#v0.11.21 - . + +## 2025-02-04 00:19:00 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.483.0 (2.502.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [php v0.11.22] . +### Releases +- [Composer v0.11.22] https://packagist.org/packages/dub/dub-php#v0.11.22 - . \ No newline at end of file diff --git a/codeSamples.yaml b/codeSamples.yaml index f8e2104..29fb99d 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -135,6 +135,12 @@ actions: - "lang": "php" "label": "createPartner" "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Dub;\nuse Dub\\Models\\Operations;\n\n$sdk = Dub\\Dub::builder()\n ->setSecurity(\n 'DUB_API_KEY'\n )\n ->build();\n\n$request = new Operations\\CreatePartnerRequestBody(\n programId: '',\n name: '',\n email: 'Loyal79@yahoo.com',\n username: 'Aaliyah_Borer',\n linkProps: new Operations\\LinkProps(\n externalId: '123456',\n tagIds: [\n 'clux0rgak00011...',\n ],\n ),\n);\n\n$response = $sdk->partners->create(\n request: $request\n);\n\nif ($response->object !== null) {\n // handle response\n}" + - target: $["paths"]["/partners/links"]["post"] + update: + "x-codeSamples": + - "lang": "php" + "label": "createPartnerLink" + "source": "declare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse Dub;\nuse Dub\\Models\\Operations;\n\n$sdk = Dub\\Dub::builder()\n ->setSecurity(\n 'DUB_API_KEY'\n )\n ->build();\n\n$request = new Operations\\CreatePartnerLinkRequestBody(\n programId: '',\n url: 'https://necessary-brief.name',\n linkProps: new Operations\\CreatePartnerLinkLinkProps(\n externalId: '123456',\n tagIds: [\n 'clux0rgak00011...',\n ],\n ),\n);\n\n$response = $sdk->partners->createLink(\n request: $request\n);\n\nif ($response->linkSchema !== null) {\n // handle response\n}" - target: $["paths"]["/qr"]["get"] update: "x-codeSamples": diff --git a/docs/Models/Components/AnalyticsTopLinks.md b/docs/Models/Components/AnalyticsTopLinks.md index 56163ba..a5a9616 100644 --- a/docs/Models/Components/AnalyticsTopLinks.md +++ b/docs/Models/Components/AnalyticsTopLinks.md @@ -15,4 +15,5 @@ | `clicks` | *?float* | :heavy_minus_sign: | The number of clicks from this link | | `leads` | *?float* | :heavy_minus_sign: | The number of leads from this link | | `sales` | *?float* | :heavy_minus_sign: | The number of sales from this link | -| `saleAmount` | *?float* | :heavy_minus_sign: | The total amount of sales from this link, in cents | \ No newline at end of file +| `saleAmount` | *?float* | :heavy_minus_sign: | The total amount of sales from this link, in cents | +| `comments` | *?string* | :heavy_minus_sign: | The comments of the short link | \ No newline at end of file diff --git a/docs/Models/Operations/CreatePartnerLinkLinkProps.md b/docs/Models/Operations/CreatePartnerLinkLinkProps.md new file mode 100644 index 0000000..48060db --- /dev/null +++ b/docs/Models/Operations/CreatePartnerLinkLinkProps.md @@ -0,0 +1,35 @@ +# CreatePartnerLinkLinkProps + +Additional properties that you can pass to the partner's short link. Will be used to override the default link properties for this partner. + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `prefix` | *?string* | :heavy_minus_sign: | The prefix of the short link slug for randomly-generated keys (e.g. if prefix is `/c/`, generated keys will be in the `/c/:key` format). Will be ignored if `key` is provided. | | +| `archived` | *?bool* | :heavy_minus_sign: | Whether the short link is archived. Defaults to `false` if not provided. | | +| `tagIds` | [string\|array\|null](../../Models/Operations/CreatePartnerLinkTagIds.md) | :heavy_minus_sign: | The unique IDs of the tags assigned to the short link. | [
"clux0rgak00011..."
] | +| `tagNames` | [string\|array\|null](../../Models/Operations/CreatePartnerLinkTagNames.md) | :heavy_minus_sign: | The unique name of the tags assigned to the short link (case insensitive). | | +| `proxy` | *?bool* | :heavy_minus_sign: | Whether the short link uses Custom Social Media Cards feature. Defaults to `false` if not provided. | | +| `rewrite` | *?bool* | :heavy_minus_sign: | Whether the short link uses link cloaking. Defaults to `false` if not provided. | | +| `doIndex` | *?bool* | :heavy_minus_sign: | Allow search engines to index your short link. Defaults to `false` if not provided. Learn more: https://d.to/noindex | | +| `externalId` | *?string* | :heavy_minus_sign: | The ID of the link in your database. If set, it can be used to identify the link in future API requests (must be prefixed with 'ext_' when passed as a query parameter). This key is unique across your workspace. | 123456 | +| `tenantId` | *?string* | :heavy_minus_sign: | The ID of the tenant that created the link inside your system. If set, it can be used to fetch all links for a tenant. | | +| `partnerId` | *?string* | :heavy_minus_sign: | The ID of the partner the short link is associated with. | | +| `comments` | *?string* | :heavy_minus_sign: | The comments for the short link. | | +| `expiresAt` | *?string* | :heavy_minus_sign: | The date and time when the short link will expire at. | | +| `expiredUrl` | *?string* | :heavy_minus_sign: | The URL to redirect to when the short link has expired. | | +| `password` | *?string* | :heavy_minus_sign: | The password required to access the destination URL of the short link. | | +| `title` | *?string* | :heavy_minus_sign: | The custom link preview title (og:title). Will be used for Custom Social Media Cards if `proxy` is true. Learn more: https://d.to/og | | +| `description` | *?string* | :heavy_minus_sign: | The custom link preview description (og:description). Will be used for Custom Social Media Cards if `proxy` is true. Learn more: https://d.to/og | | +| `image` | *?string* | :heavy_minus_sign: | The custom link preview image (og:image). Will be used for Custom Social Media Cards if `proxy` is true. Learn more: https://d.to/og | | +| `video` | *?string* | :heavy_minus_sign: | The custom link preview video (og:video). Will be used for Custom Social Media Cards if `proxy` is true. Learn more: https://d.to/og | | +| `ios` | *?string* | :heavy_minus_sign: | The iOS destination URL for the short link for iOS device targeting. | | +| `android` | *?string* | :heavy_minus_sign: | The Android destination URL for the short link for Android device targeting. | | +| `utmSource` | *?string* | :heavy_minus_sign: | The UTM source of the short link. If set, this will populate or override the UTM source in the destination URL. | | +| `utmMedium` | *?string* | :heavy_minus_sign: | The UTM medium of the short link. If set, this will populate or override the UTM medium in the destination URL. | | +| `utmCampaign` | *?string* | :heavy_minus_sign: | The UTM campaign of the short link. If set, this will populate or override the UTM campaign in the destination URL. | | +| `utmTerm` | *?string* | :heavy_minus_sign: | The UTM term of the short link. If set, this will populate or override the UTM term in the destination URL. | | +| `utmContent` | *?string* | :heavy_minus_sign: | The UTM content of the short link. If set, this will populate or override the UTM content in the destination URL. | | +| `ref` | *?string* | :heavy_minus_sign: | The referral tag of the short link. If set, this will populate or override the `ref` query parameter in the destination URL. | | \ No newline at end of file diff --git a/docs/Models/Operations/CreatePartnerLinkRequestBody.md b/docs/Models/Operations/CreatePartnerLinkRequestBody.md new file mode 100644 index 0000000..34ef27d --- /dev/null +++ b/docs/Models/Operations/CreatePartnerLinkRequestBody.md @@ -0,0 +1,13 @@ +# CreatePartnerLinkRequestBody + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | +| `programId` | *string* | :heavy_check_mark: | The ID of the program that the partner is enrolled in. | +| `url` | *string* | :heavy_check_mark: | The URL to shorten. Will throw an error if the domain doesn't match the program's default URL domain. | +| `key` | *?string* | :heavy_minus_sign: | The short link slug. If not provided, a random 7-character slug will be generated. | +| `linkProps` | [?Operations\CreatePartnerLinkLinkProps](../../Models/Operations/CreatePartnerLinkLinkProps.md) | :heavy_minus_sign: | Additional properties that you can pass to the partner's short link. Will be used to override the default link properties for this partner. | +| `partnerId` | *?string* | :heavy_minus_sign: | The ID of the partner to create a link for. Will take precedence over `tenantId` if provided. | +| `tenantId` | *?string* | :heavy_minus_sign: | The ID of the partner in your system. If both `partnerId` and `tenantId` are not provided, an error will be thrown. | \ No newline at end of file diff --git a/docs/Models/Operations/CreatePartnerLinkResponse.md b/docs/Models/Operations/CreatePartnerLinkResponse.md new file mode 100644 index 0000000..d39a230 --- /dev/null +++ b/docs/Models/Operations/CreatePartnerLinkResponse.md @@ -0,0 +1,11 @@ +# CreatePartnerLinkResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `contentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [\Psr\Http\Message\ResponseInterface](https://www.php-fig.org/psr/psr-7/#33-psrhttpmessageresponseinterface) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `linkSchema` | [?Components\LinkSchema](../../Models/Components/LinkSchema.md) | :heavy_minus_sign: | The created partner | \ No newline at end of file diff --git a/docs/Models/Operations/CreatePartnerLinkTagIds.md b/docs/Models/Operations/CreatePartnerLinkTagIds.md new file mode 100644 index 0000000..027e40b --- /dev/null +++ b/docs/Models/Operations/CreatePartnerLinkTagIds.md @@ -0,0 +1,25 @@ +# CreatePartnerLinkTagIds + +The unique IDs of the tags assigned to the short link. + + +## Supported Types + +### `string` + +```php +/** +* @var string +*/ +string $value = /* values here */ +``` + +### `array` + +```php +/** +* @var array +*/ +array $value = /* values here */ +``` + diff --git a/docs/Models/Operations/CreatePartnerLinkTagNames.md b/docs/Models/Operations/CreatePartnerLinkTagNames.md new file mode 100644 index 0000000..e54b4c6 --- /dev/null +++ b/docs/Models/Operations/CreatePartnerLinkTagNames.md @@ -0,0 +1,25 @@ +# CreatePartnerLinkTagNames + +The unique name of the tags assigned to the short link (case insensitive). + + +## Supported Types + +### `string` + +```php +/** +* @var string +*/ +string $value = /* values here */ +``` + +### `array` + +```php +/** +* @var array +*/ +array $value = /* values here */ +``` + diff --git a/docs/sdks/partners/README.md b/docs/sdks/partners/README.md index aa54e3d..1e1b1af 100644 --- a/docs/sdks/partners/README.md +++ b/docs/sdks/partners/README.md @@ -6,6 +6,7 @@ ### Available Operations * [create](#create) - Create a new partner +* [createLink](#createlink) - Create a link for a partner ## create @@ -61,6 +62,71 @@ if ($response->object !== null) { ### Errors +| Error Type | 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 | +| Errors\SDKException | 4XX, 5XX | \*/\* | + +## createLink + +Create a new link for a partner that is enrolled in your program + +### Example Usage + +```php +declare(strict_types=1); + +require 'vendor/autoload.php'; + +use Dub; +use Dub\Models\Operations; + +$sdk = Dub\Dub::builder() + ->setSecurity( + 'DUB_API_KEY' + ) + ->build(); + +$request = new Operations\CreatePartnerLinkRequestBody( + programId: '', + url: 'https://necessary-brief.name', + linkProps: new Operations\CreatePartnerLinkLinkProps( + tagIds: [ + 'clux0rgak00011...', + ], + externalId: '123456', + ), +); + +$response = $sdk->partners->createLink( + request: $request +); + +if ($response->linkSchema !== null) { + // handle response +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `$request` | [Operations\CreatePartnerLinkRequestBody](../../Models/Operations/CreatePartnerLinkRequestBody.md) | :heavy_check_mark: | The request object to use for the request. | + +### Response + +**[?Operations\CreatePartnerLinkResponse](../../Models/Operations/CreatePartnerLinkResponse.md)** + +### Errors + | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | Errors\BadRequest | 400 | application/json | diff --git a/src/Models/Components/AnalyticsTopLinks.php b/src/Models/Components/AnalyticsTopLinks.php index 23dcc06..13b5de8 100644 --- a/src/Models/Components/AnalyticsTopLinks.php +++ b/src/Models/Components/AnalyticsTopLinks.php @@ -68,6 +68,15 @@ class AnalyticsTopLinks #[\Speakeasy\Serializer\Annotation\SerializedName('createdAt')] public string $createdAt; + /** + * The comments of the short link + * + * @var ?string $comments + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('comments')] + #[\Speakeasy\Serializer\Annotation\SkipWhenNull] + public ?string $comments = null; + /** * The number of clicks from this link * @@ -116,8 +125,9 @@ class AnalyticsTopLinks * @param ?float $leads * @param ?float $sales * @param ?float $saleAmount + * @param ?string $comments */ - public function __construct(string $link, string $id, string $domain, string $key, string $shortLink, string $url, string $createdAt, ?float $clicks = 0, ?float $leads = 0, ?float $sales = 0, ?float $saleAmount = 0) + public function __construct(string $link, string $id, string $domain, string $key, string $shortLink, string $url, string $createdAt, ?string $comments = null, ?float $clicks = 0, ?float $leads = 0, ?float $sales = 0, ?float $saleAmount = 0) { $this->link = $link; $this->id = $id; @@ -126,6 +136,7 @@ public function __construct(string $link, string $id, string $domain, string $ke $this->shortLink = $shortLink; $this->url = $url; $this->createdAt = $createdAt; + $this->comments = $comments; $this->clicks = $clicks; $this->leads = $leads; $this->sales = $sales; diff --git a/src/Models/Operations/CreatePartnerLinkLinkProps.php b/src/Models/Operations/CreatePartnerLinkLinkProps.php new file mode 100644 index 0000000..395296f --- /dev/null +++ b/src/Models/Operations/CreatePartnerLinkLinkProps.php @@ -0,0 +1,308 @@ +|null $tagIds + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('tagIds')] + #[\Speakeasy\Serializer\Annotation\Type('string|array|null')] + #[\Speakeasy\Serializer\Annotation\SkipWhenNull] + public string|array|null $tagIds = null; + + /** + * The unique name of the tags assigned to the short link (case insensitive). + * + * @var string|array|null $tagNames + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('tagNames')] + #[\Speakeasy\Serializer\Annotation\Type('string|array|null')] + #[\Speakeasy\Serializer\Annotation\SkipWhenNull] + public string|array|null $tagNames = null; + + /** + * Whether the short link uses Custom Social Media Cards feature. Defaults to `false` if not provided. + * + * @var ?bool $proxy + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('proxy')] + #[\Speakeasy\Serializer\Annotation\SkipWhenNull] + public ?bool $proxy = null; + + /** + * Whether the short link uses link cloaking. Defaults to `false` if not provided. + * + * @var ?bool $rewrite + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('rewrite')] + #[\Speakeasy\Serializer\Annotation\SkipWhenNull] + public ?bool $rewrite = null; + + /** + * Allow search engines to index your short link. Defaults to `false` if not provided. Learn more: https://d.to/noindex + * + * @var ?bool $doIndex + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('doIndex')] + #[\Speakeasy\Serializer\Annotation\SkipWhenNull] + public ?bool $doIndex = null; + + /** + * The ID of the link in your database. If set, it can be used to identify the link in future API requests (must be prefixed with 'ext_' when passed as a query parameter). This key is unique across your workspace. + * + * @var ?string $externalId + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('externalId')] + #[\Speakeasy\Serializer\Annotation\SkipWhenNull] + public ?string $externalId = null; + + /** + * The ID of the tenant that created the link inside your system. If set, it can be used to fetch all links for a tenant. + * + * @var ?string $tenantId + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('tenantId')] + #[\Speakeasy\Serializer\Annotation\SkipWhenNull] + public ?string $tenantId = null; + + /** + * The ID of the partner the short link is associated with. + * + * @var ?string $partnerId + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('partnerId')] + #[\Speakeasy\Serializer\Annotation\SkipWhenNull] + public ?string $partnerId = null; + + /** + * The comments for the short link. + * + * @var ?string $comments + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('comments')] + #[\Speakeasy\Serializer\Annotation\SkipWhenNull] + public ?string $comments = null; + + /** + * The date and time when the short link will expire at. + * + * @var ?string $expiresAt + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('expiresAt')] + #[\Speakeasy\Serializer\Annotation\SkipWhenNull] + public ?string $expiresAt = null; + + /** + * The URL to redirect to when the short link has expired. + * + * @var ?string $expiredUrl + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('expiredUrl')] + #[\Speakeasy\Serializer\Annotation\SkipWhenNull] + public ?string $expiredUrl = null; + + /** + * The password required to access the destination URL of the short link. + * + * @var ?string $password + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('password')] + #[\Speakeasy\Serializer\Annotation\SkipWhenNull] + public ?string $password = null; + + /** + * The custom link preview title (og:title). Will be used for Custom Social Media Cards if `proxy` is true. Learn more: https://d.to/og + * + * @var ?string $title + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('title')] + #[\Speakeasy\Serializer\Annotation\SkipWhenNull] + public ?string $title = null; + + /** + * The custom link preview description (og:description). Will be used for Custom Social Media Cards if `proxy` is true. Learn more: https://d.to/og + * + * @var ?string $description + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('description')] + #[\Speakeasy\Serializer\Annotation\SkipWhenNull] + public ?string $description = null; + + /** + * The custom link preview image (og:image). Will be used for Custom Social Media Cards if `proxy` is true. Learn more: https://d.to/og + * + * @var ?string $image + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('image')] + #[\Speakeasy\Serializer\Annotation\SkipWhenNull] + public ?string $image = null; + + /** + * The custom link preview video (og:video). Will be used for Custom Social Media Cards if `proxy` is true. Learn more: https://d.to/og + * + * @var ?string $video + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('video')] + #[\Speakeasy\Serializer\Annotation\SkipWhenNull] + public ?string $video = null; + + /** + * The iOS destination URL for the short link for iOS device targeting. + * + * @var ?string $ios + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('ios')] + #[\Speakeasy\Serializer\Annotation\SkipWhenNull] + public ?string $ios = null; + + /** + * The Android destination URL for the short link for Android device targeting. + * + * @var ?string $android + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('android')] + #[\Speakeasy\Serializer\Annotation\SkipWhenNull] + public ?string $android = null; + + /** + * The UTM source of the short link. If set, this will populate or override the UTM source in the destination URL. + * + * @var ?string $utmSource + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('utm_source')] + #[\Speakeasy\Serializer\Annotation\SkipWhenNull] + public ?string $utmSource = null; + + /** + * The UTM medium of the short link. If set, this will populate or override the UTM medium in the destination URL. + * + * @var ?string $utmMedium + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('utm_medium')] + #[\Speakeasy\Serializer\Annotation\SkipWhenNull] + public ?string $utmMedium = null; + + /** + * The UTM campaign of the short link. If set, this will populate or override the UTM campaign in the destination URL. + * + * @var ?string $utmCampaign + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('utm_campaign')] + #[\Speakeasy\Serializer\Annotation\SkipWhenNull] + public ?string $utmCampaign = null; + + /** + * The UTM term of the short link. If set, this will populate or override the UTM term in the destination URL. + * + * @var ?string $utmTerm + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('utm_term')] + #[\Speakeasy\Serializer\Annotation\SkipWhenNull] + public ?string $utmTerm = null; + + /** + * The UTM content of the short link. If set, this will populate or override the UTM content in the destination URL. + * + * @var ?string $utmContent + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('utm_content')] + #[\Speakeasy\Serializer\Annotation\SkipWhenNull] + public ?string $utmContent = null; + + /** + * The referral tag of the short link. If set, this will populate or override the `ref` query parameter in the destination URL. + * + * @var ?string $ref + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('ref')] + #[\Speakeasy\Serializer\Annotation\SkipWhenNull] + public ?string $ref = null; + + /** + * @param ?string $prefix + * @param ?bool $archived + * @param string|array|null $tagIds + * @param string|array|null $tagNames + * @param ?bool $proxy + * @param ?bool $rewrite + * @param ?bool $doIndex + * @param ?string $externalId + * @param ?string $tenantId + * @param ?string $partnerId + * @param ?string $comments + * @param ?string $expiresAt + * @param ?string $expiredUrl + * @param ?string $password + * @param ?string $title + * @param ?string $description + * @param ?string $image + * @param ?string $video + * @param ?string $ios + * @param ?string $android + * @param ?string $utmSource + * @param ?string $utmMedium + * @param ?string $utmCampaign + * @param ?string $utmTerm + * @param ?string $utmContent + * @param ?string $ref + */ + public function __construct(?string $prefix = null, ?bool $archived = null, string|array|null $tagIds = null, string|array|null $tagNames = null, ?bool $proxy = null, ?bool $rewrite = null, ?bool $doIndex = null, ?string $externalId = null, ?string $tenantId = null, ?string $partnerId = null, ?string $comments = null, ?string $expiresAt = null, ?string $expiredUrl = null, ?string $password = null, ?string $title = null, ?string $description = null, ?string $image = null, ?string $video = null, ?string $ios = null, ?string $android = null, ?string $utmSource = null, ?string $utmMedium = null, ?string $utmCampaign = null, ?string $utmTerm = null, ?string $utmContent = null, ?string $ref = null) + { + $this->prefix = $prefix; + $this->archived = $archived; + $this->tagIds = $tagIds; + $this->tagNames = $tagNames; + $this->proxy = $proxy; + $this->rewrite = $rewrite; + $this->doIndex = $doIndex; + $this->externalId = $externalId; + $this->tenantId = $tenantId; + $this->partnerId = $partnerId; + $this->comments = $comments; + $this->expiresAt = $expiresAt; + $this->expiredUrl = $expiredUrl; + $this->password = $password; + $this->title = $title; + $this->description = $description; + $this->image = $image; + $this->video = $video; + $this->ios = $ios; + $this->android = $android; + $this->utmSource = $utmSource; + $this->utmMedium = $utmMedium; + $this->utmCampaign = $utmCampaign; + $this->utmTerm = $utmTerm; + $this->utmContent = $utmContent; + $this->ref = $ref; + } +} \ No newline at end of file diff --git a/src/Models/Operations/CreatePartnerLinkRequestBody.php b/src/Models/Operations/CreatePartnerLinkRequestBody.php new file mode 100644 index 0000000..992d61f --- /dev/null +++ b/src/Models/Operations/CreatePartnerLinkRequestBody.php @@ -0,0 +1,84 @@ +programId = $programId; + $this->url = $url; + $this->key = $key; + $this->linkProps = $linkProps; + $this->partnerId = $partnerId; + $this->tenantId = $tenantId; + } +} \ No newline at end of file diff --git a/src/Models/Operations/CreatePartnerLinkResponse.php b/src/Models/Operations/CreatePartnerLinkResponse.php new file mode 100644 index 0000000..849d717 --- /dev/null +++ b/src/Models/Operations/CreatePartnerLinkResponse.php @@ -0,0 +1,55 @@ +contentType = $contentType; + $this->statusCode = $statusCode; + $this->rawResponse = $rawResponse; + $this->linkSchema = $linkSchema; + } +} \ No newline at end of file diff --git a/src/Partners.php b/src/Partners.php index 091d4fa..82c7078 100644 --- a/src/Partners.php +++ b/src/Partners.php @@ -208,4 +208,168 @@ public function create(?Operations\CreatePartnerRequestBody $request = null, ?Op } } + /** + * Create a link for a partner + * + * Create a new link for a partner that is enrolled in your program + * + * @param ?Operations\CreatePartnerLinkRequestBody $request + * @return Operations\CreatePartnerLinkResponse + * @throws \Dub\Models\Errors\SDKException + */ + public function createLink(?Operations\CreatePartnerLinkRequestBody $request = null, ?Options $options = null): Operations\CreatePartnerLinkResponse + { + $baseUrl = $this->sdkConfiguration->getServerUrl(); + $url = Utils\Utils::generateUrl($baseUrl, '/partners/links'); + $urlOverride = null; + $httpOptions = ['http_errors' => false]; + $body = Utils\Utils::serializeRequestBody($request, 'request', 'json'); + if ($body !== null) { + $httpOptions = array_merge_recursive($httpOptions, $body); + } + $httpOptions['headers']['Accept'] = 'application/json'; + $httpOptions['headers']['user-agent'] = $this->sdkConfiguration->userAgent; + $httpRequest = new \GuzzleHttp\Psr7\Request('POST', $url); + $hookContext = new HookContext('createPartnerLink', null, $this->sdkConfiguration->securitySource); + $httpRequest = $this->sdkConfiguration->hooks->beforeRequest(new Hooks\BeforeRequestContext($hookContext), $httpRequest); + $httpOptions = Utils\Utils::convertHeadersToOptions($httpRequest, $httpOptions); + $httpRequest = Utils\Utils::removeHeaders($httpRequest); + try { + $httpResponse = $this->sdkConfiguration->client->send($httpRequest, $httpOptions); + } catch (\GuzzleHttp\Exception\GuzzleException $error) { + $res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), null, $error); + $httpResponse = $res; + } + $contentType = $httpResponse->getHeader('Content-Type')[0] ?? ''; + + $statusCode = $httpResponse->getStatusCode(); + if (Utils\Utils::matchStatusCodes($statusCode, ['400', '401', '403', '404', '409', '410', '422', '429', '4XX', '500', '5XX'])) { + $res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), $httpResponse, null); + $httpResponse = $res; + } + if (Utils\Utils::matchStatusCodes($statusCode, ['201'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\Dub\Models\Components\LinkSchema', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + $response = new Operations\CreatePartnerLinkResponse( + statusCode: $statusCode, + contentType: $contentType, + rawResponse: $httpResponse, + linkSchema: $obj); + + return $response; + } else { + throw new \Dub\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['400'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\Dub\Models\Errors\BadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + throw $obj->toException(); + } else { + throw new \Dub\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['401'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\Dub\Models\Errors\Unauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + throw $obj->toException(); + } else { + throw new \Dub\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['403'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\Dub\Models\Errors\Forbidden', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + throw $obj->toException(); + } else { + throw new \Dub\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['404'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\Dub\Models\Errors\NotFound', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + throw $obj->toException(); + } else { + throw new \Dub\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['409'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\Dub\Models\Errors\Conflict', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + throw $obj->toException(); + } else { + throw new \Dub\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['410'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\Dub\Models\Errors\InviteExpired', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + throw $obj->toException(); + } else { + throw new \Dub\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['422'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\Dub\Models\Errors\UnprocessableEntity', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + throw $obj->toException(); + } else { + throw new \Dub\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['429'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\Dub\Models\Errors\RateLimitExceeded', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + throw $obj->toException(); + } else { + throw new \Dub\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['500'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\Dub\Models\Errors\InternalServerError', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + throw $obj->toException(); + } else { + throw new \Dub\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['4XX'])) { + throw new \Dub\Models\Errors\SDKException('API error occurred', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['5XX'])) { + throw new \Dub\Models\Errors\SDKException('API error occurred', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } else { + throw new \Dub\Models\Errors\SDKException('Unknown status code received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } + } \ No newline at end of file diff --git a/src/SDKConfiguration.php b/src/SDKConfiguration.php index 62407b2..690bebf 100644 --- a/src/SDKConfiguration.php +++ b/src/SDKConfiguration.php @@ -26,11 +26,11 @@ class SDKConfiguration public string $openapiDocVersion = '0.0.1'; - public string $sdkVersion = '0.11.21'; + public string $sdkVersion = '0.11.22'; - public string $genVersion = '2.500.5'; + public string $genVersion = '2.502.0'; - public string $userAgent = 'speakeasy-sdk/php 0.11.21 2.500.5 0.0.1 dub/dub-php'; + public string $userAgent = 'speakeasy-sdk/php 0.11.22 2.502.0 0.0.1 dub/dub-php'; public ?RetryConfig $retryConfig = null;