From c7d895b49564f2a2e26d4b5cb3b121d8b47c7278 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Tue, 21 May 2024 18:57:58 +0000 Subject: [PATCH] ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.294.0 --- .speakeasy/gen.lock | 18 +- .speakeasy/gen.yaml | 2 +- .speakeasy/workflow.lock | 8 +- README.md | 6 + RELEASES.md | 12 +- codeSamples.yaml | 804 ++++++++++-------- docs/models/components/workspaceschema.md | 4 +- .../operations/createlinkrequestbody.md | 1 + docs/models/operations/paymentprocessor.md | 12 + docs/models/operations/requestbody.md | 1 + .../operations/trackcustomerrequestbody.md | 11 + .../operations/trackcustomerresponsebody.md | 13 + .../models/operations/trackleadrequestbody.md | 14 + .../operations/trackleadresponsebody.md | 16 + .../models/operations/tracksalerequestbody.md | 13 + .../operations/tracksaleresponsebody.md | 15 + .../operations/updatelinkrequestbody.md | 1 + .../operations/upsertlinkrequestbody.md | 1 + docs/sdks/track/README.md | 172 ++++ jsr.json | 2 +- package-lock.json | 4 +- package.json | 2 +- src/lib/config.ts | 4 +- src/models/components/workspaceschema.ts | 18 + src/models/operations/bulkcreatelinks.ts | 9 + src/models/operations/createlink.ts | 9 + src/models/operations/index.ts | 3 + src/models/operations/trackcustomer.ts | 118 +++ src/models/operations/tracklead.ts | 163 ++++ src/models/operations/tracksale.ts | 168 ++++ src/models/operations/updatelink.ts | 9 + src/models/operations/upsertlink.ts | 9 + src/sdk/sdk.ts | 6 + src/sdk/track.ts | 695 +++++++++++++++ 34 files changed, 1962 insertions(+), 381 deletions(-) create mode 100644 docs/models/operations/paymentprocessor.md create mode 100644 docs/models/operations/trackcustomerrequestbody.md create mode 100644 docs/models/operations/trackcustomerresponsebody.md create mode 100644 docs/models/operations/trackleadrequestbody.md create mode 100644 docs/models/operations/trackleadresponsebody.md create mode 100644 docs/models/operations/tracksalerequestbody.md create mode 100644 docs/models/operations/tracksaleresponsebody.md create mode 100644 docs/sdks/track/README.md create mode 100644 src/models/operations/trackcustomer.ts create mode 100644 src/models/operations/tracklead.ts create mode 100644 src/models/operations/tracksale.ts create mode 100644 src/sdk/track.ts diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 16b0e3f..127bb97 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: f28179cc-ef59-426d-9e85-60cec22fc642 management: - docChecksum: 4f30b36ccc0d6c4b8d2e3cfc7acb8456 + docChecksum: 325f4eff71e08b965879b29076b63bb6 docVersion: 0.0.1 speakeasyVersion: 1.294.0 generationVersion: 2.333.3 - releaseVersion: 0.29.5 - configChecksum: 277a39290066dc427421b36035d1c002 + releaseVersion: 0.29.6 + configChecksum: 3f9a0bc54abf62009e85b3c1e8c5bb7e repoURL: https://github.com/dubinc/dub-node.git installationURL: https://github.com/dubinc/dub-node published: true @@ -37,6 +37,7 @@ generatedFiles: - src/sdk/workspaces.ts - src/sdk/tags.ts - src/sdk/domains.ts + - src/sdk/track.ts - src/sdk/metatags.ts - src/sdk/sdk.ts - .eslintrc.js @@ -119,6 +120,9 @@ generatedFiles: - src/models/operations/updatedomain.ts - src/models/operations/setprimarydomain.ts - src/models/operations/transferdomain.ts + - src/models/operations/tracklead.ts + - src/models/operations/tracksale.ts + - src/models/operations/trackcustomer.ts - src/models/operations/getmetatags.ts - src/models/errors/index.ts - src/models/components/index.ts @@ -266,6 +270,13 @@ generatedFiles: - docs/models/operations/setprimarydomainrequest.md - docs/models/operations/transferdomainrequestbody.md - docs/models/operations/transferdomainrequest.md + - docs/models/operations/trackleadrequestbody.md + - docs/models/operations/trackleadresponsebody.md + - docs/models/operations/paymentprocessor.md + - docs/models/operations/tracksalerequestbody.md + - docs/models/operations/tracksaleresponsebody.md + - docs/models/operations/trackcustomerrequestbody.md + - docs/models/operations/trackcustomerresponsebody.md - docs/models/operations/getmetatagsrequest.md - docs/models/operations/getmetatagsresponsebody.md - docs/sdks/dub/README.md @@ -276,6 +287,7 @@ generatedFiles: - docs/sdks/workspaces/README.md - docs/sdks/tags/README.md - docs/sdks/domains/README.md + - docs/sdks/track/README.md - docs/sdks/metatags/README.md - USAGE.md - .gitattributes diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 7196296..898587f 100755 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -12,7 +12,7 @@ generation: auth: oAuth2ClientCredentialsEnabled: false typescript: - version: 0.29.5 + version: 0.29.6 additionalDependencies: dependencies: {} devDependencies: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index f7d8c7b..b7e5e52 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.294.0 sources: my-first-source: sourceNamespace: my-first-source - sourceRevisionDigest: sha256:e612921da14037b34bd09bc86013303a50c047fc152d13083fc710e453a008d3 - sourceBlobDigest: sha256:92ed16f626f2a227f29b1938305399c6853204e9a81f2820867dd86d75398327 + sourceRevisionDigest: sha256:a8dbb050648ecdd7c081fc10c24e1657ea1f9c4c30692ec7581df4165a09e1cc + sourceBlobDigest: sha256:b7a1bc6bcfcd424e1bfc546ae100c1014fdc24191489e840493a620c14854846 tags: - latest - main @@ -11,8 +11,8 @@ targets: my-first-target: source: my-first-source sourceNamespace: my-first-source - sourceRevisionDigest: sha256:e612921da14037b34bd09bc86013303a50c047fc152d13083fc710e453a008d3 - sourceBlobDigest: sha256:92ed16f626f2a227f29b1938305399c6853204e9a81f2820867dd86d75398327 + sourceRevisionDigest: sha256:a8dbb050648ecdd7c081fc10c24e1657ea1f9c4c30692ec7581df4165a09e1cc + sourceBlobDigest: sha256:b7a1bc6bcfcd424e1bfc546ae100c1014fdc24191489e840493a620c14854846 outLocation: /github/workspace/repo workflow: workflowVersion: 1.0.0 diff --git a/README.md b/README.md index 468fe4d..8a6fae7 100644 --- a/README.md +++ b/README.md @@ -147,6 +147,12 @@ run(); * [setPrimary](docs/sdks/domains/README.md#setprimary) - Set a domain as primary * [transfer](docs/sdks/domains/README.md#transfer) - Transfer a domain +### [track](docs/sdks/track/README.md) + +* [lead](docs/sdks/track/README.md#lead) - Track a lead +* [sale](docs/sdks/track/README.md#sale) - Track a sale +* [customer](docs/sdks/track/README.md#customer) - Track a customer + ### [metatags](docs/sdks/metatags/README.md) * [get](docs/sdks/metatags/README.md#get) - Retrieve the metatags for a URL diff --git a/RELEASES.md b/RELEASES.md index 0fe01f6..a783057 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -306,4 +306,14 @@ Based on: ### Generated - [typescript v0.29.5] . ### Releases -- [NPM v0.29.5] https://www.npmjs.com/package/dub/v/0.29.5 - . \ No newline at end of file +- [NPM v0.29.5] https://www.npmjs.com/package/dub/v/0.29.5 - . + +## 2024-05-21 18:55:58 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.294.0 (2.333.3) https://github.com/speakeasy-api/speakeasy +### Generated +- [typescript v0.29.6] . +### Releases +- [NPM v0.29.6] https://www.npmjs.com/package/dub/v/0.29.6 - . \ No newline at end of file diff --git a/codeSamples.yaml b/codeSamples.yaml index ab8204b..988a6cb 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -3,11 +3,11 @@ info: title: CodeSamples overlay for typescript target version: 0.0.0 actions: - - target: $["paths"]["/links/{linkId}"]["patch"] + - target: $["paths"]["/links/{linkId}"]["delete"] update: "x-codeSamples": - "lang": "typescript" - "label": "updateLink" + "label": "deleteLink" "source": |- import { Dub } from "dub"; @@ -17,20 +17,18 @@ actions: }); async function run() { - const result = await dub.update("", { - url: "https://google/com", - }); + const result = await dub.delete(""); // Handle the result console.log(result) } run(); - - target: $["paths"]["/domains/{slug}/primary"]["post"] + - target: $["paths"]["/analytics/clicks/referers"]["get"] update: "x-codeSamples": - "lang": "typescript" - "label": "setPrimaryDomain" + "label": "getReferersByClicks" "source": |- import { Dub } from "dub"; @@ -40,49 +38,7 @@ actions: }); async function run() { - const result = await dub.setPrimary("acme.com"); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/links/count"]["get"] - update: - "x-codeSamples": - - "lang": "typescript" - "label": "getLinksCount" - "source": |- - import { Dub } from "dub"; - - const dub = new Dub({ - token: "DUB_API_KEY", - workspaceId: "", - }); - - async function run() { - const result = await dub.count({}); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/analytics/os"]["get"] - update: - "x-codeSamples": - - "lang": "typescript" - "label": "getOSByClicksDeprecated" - "source": |- - import { Dub } from "dub"; - - const dub = new Dub({ - token: "DUB_API_KEY", - workspaceId: "", - }); - - async function run() { - const result = await dub.os({}); + const result = await dub.referers({}); // Handle the result console.log(result) @@ -109,6 +65,50 @@ actions: console.log(result) } + run(); + - target: $["paths"]["/links"]["post"] + update: + "x-codeSamples": + - "lang": "typescript" + "label": "createLink" + "source": |- + import { Dub } from "dub"; + + const dub = new Dub({ + token: "DUB_API_KEY", + workspaceId: "", + }); + + async function run() { + const result = await dub.create({ + url: "https://google/com", + }); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/analytics/top_links"]["get"] + update: + "x-codeSamples": + - "lang": "typescript" + "label": "getTopLinksByClicksDeprecated" + "source": |- + import { Dub } from "dub"; + + const dub = new Dub({ + token: "DUB_API_KEY", + workspaceId: "", + }); + + async function run() { + const result = await dub.topLinks({}); + + // Handle the result + console.log(result) + } + run(); - target: $["paths"]["/tags"]["get"] update: @@ -131,11 +131,11 @@ actions: } run(); - - target: $["paths"]["/tags"]["post"] + - target: $["paths"]["/track/customer"]["post"] update: "x-codeSamples": - "lang": "typescript" - "label": "createTag" + "label": "trackCustomer" "source": |- import { Dub } from "dub"; @@ -145,58 +145,14 @@ actions: }); async function run() { - const result = await dub.create({ - tag: "", + const result = await dub.customer({ + customerId: "", }); // Handle the result console.log(result) } - run(); - - target: $["paths"]["/domains"]["post"] - update: - "x-codeSamples": - - "lang": "typescript" - "label": "addDomain" - "source": |- - import { Dub } from "dub"; - - const dub = new Dub({ - token: "DUB_API_KEY", - workspaceId: "", - }); - - async function run() { - const result = await dub.add({ - slug: "acme.com", - }); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/analytics/clicks/count"]["get"] - update: - "x-codeSamples": - - "lang": "typescript" - "label": "getClicksCount" - "source": |- - import { Dub } from "dub"; - - const dub = new Dub({ - token: "DUB_API_KEY", - workspaceId: "", - }); - - async function run() { - const result = await dub.count({}); - - // Handle the result - console.log(result) - } - run(); - target: $["paths"]["/links/upsert"]["put"] update: @@ -220,69 +176,6 @@ actions: console.log(result) } - run(); - - target: $["paths"]["/links/info"]["get"] - update: - "x-codeSamples": - - "lang": "typescript" - "label": "getLinkInfo" - "source": |- - import { Dub } from "dub"; - - const dub = new Dub({ - token: "DUB_API_KEY", - workspaceId: "", - }); - - async function run() { - const result = await dub.get({}); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/analytics/timeseries"]["get"] - update: - "x-codeSamples": - - "lang": "typescript" - "label": "getTimeseriesByClicksDeprecated" - "source": |- - import { Dub } from "dub"; - - const dub = new Dub({ - token: "DUB_API_KEY", - workspaceId: "", - }); - - async function run() { - const result = await dub.timeseries({}); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/analytics/city"]["get"] - update: - "x-codeSamples": - - "lang": "typescript" - "label": "getCitiesByClicksDeprecated" - "source": |- - import { Dub } from "dub"; - - const dub = new Dub({ - token: "DUB_API_KEY", - workspaceId: "", - }); - - async function run() { - const result = await dub.city({}); - - // Handle the result - console.log(result) - } - run(); - target: $["paths"]["/analytics/device"]["get"] update: @@ -305,11 +198,11 @@ actions: } run(); - - target: $["paths"]["/analytics/browser"]["get"] + - target: $["paths"]["/analytics/clicks/cities"]["get"] update: "x-codeSamples": - "lang": "typescript" - "label": "getBrowsersByClicksDeprecated" + "label": "getCitiesByClicks" "source": |- import { Dub } from "dub"; @@ -319,18 +212,18 @@ actions: }); async function run() { - const result = await dub.browser({}); + const result = await dub.cities({}); // Handle the result console.log(result) } run(); - - target: $["paths"]["/analytics/top_links"]["get"] + - target: $["paths"]["/domains/{slug}"]["delete"] update: "x-codeSamples": - "lang": "typescript" - "label": "getTopLinksByClicksDeprecated" + "label": "deleteDomain" "source": |- import { Dub } from "dub"; @@ -340,18 +233,18 @@ actions: }); async function run() { - const result = await dub.topLinks({}); + const result = await dub.delete("acme.com"); // Handle the result console.log(result) } run(); - - target: $["paths"]["/analytics/clicks/devices"]["get"] + - target: $["paths"]["/tags"]["post"] update: "x-codeSamples": - "lang": "typescript" - "label": "getDevicesByClicks" + "label": "createTag" "source": |- import { Dub } from "dub"; @@ -361,18 +254,20 @@ actions: }); async function run() { - const result = await dub.devices({}); + const result = await dub.create({ + tag: "", + }); // Handle the result console.log(result) } run(); - - target: $["paths"]["/analytics/clicks/os"]["get"] + - target: $["paths"]["/track/lead"]["post"] update: "x-codeSamples": - "lang": "typescript" - "label": "getOSByClicks" + "label": "trackLead" "source": |- import { Dub } from "dub"; @@ -382,91 +277,11 @@ actions: }); async function run() { - const result = await dub.os({}); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/analytics/clicks/referers"]["get"] - update: - "x-codeSamples": - - "lang": "typescript" - "label": "getReferersByClicks" - "source": |- - import { Dub } from "dub"; - - const dub = new Dub({ - token: "DUB_API_KEY", - workspaceId: "", - }); - - async function run() { - const result = await dub.referers({}); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/analytics/clicks/top_urls"]["get"] - update: - "x-codeSamples": - - "lang": "typescript" - "label": "getTopURLsByClicks" - "source": |- - import { Dub } from "dub"; - - const dub = new Dub({ - token: "DUB_API_KEY", - workspaceId: "", - }); - - async function run() { - const result = await dub.topUrls({}); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/analytics/clicks"]["get"] - update: - "x-codeSamples": - - "lang": "typescript" - "label": "getClicksCountDeprecated" - "source": |- - import { Dub } from "dub"; - - const dub = new Dub({ - token: "DUB_API_KEY", - workspaceId: "", - }); - - async function run() { - const result = await dub.getClicksCountDeprecated({}); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/domains/{slug}"]["patch"] - update: - "x-codeSamples": - - "lang": "typescript" - "label": "updateDomain" - "source": |- - import { Dub } from "dub"; - - const dub = new Dub({ - token: "DUB_API_KEY", - workspaceId: "", - }); - - async function run() { - const result = await dub.update("acme.com", {}); + const result = await dub.lead({ + clickId: "", + eventName: "Signup", + customerId: "", + }); // Handle the result console.log(result) @@ -493,6 +308,48 @@ actions: console.log(result) } + run(); + - target: $["paths"]["/analytics/clicks/top_links"]["get"] + update: + "x-codeSamples": + - "lang": "typescript" + "label": "getTopLinksByClicks" + "source": |- + import { Dub } from "dub"; + + const dub = new Dub({ + token: "DUB_API_KEY", + workspaceId: "", + }); + + async function run() { + const result = await dub.topLinks({}); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/analytics/clicks/top_urls"]["get"] + update: + "x-codeSamples": + - "lang": "typescript" + "label": "getTopURLsByClicks" + "source": |- + import { Dub } from "dub"; + + const dub = new Dub({ + token: "DUB_API_KEY", + workspaceId: "", + }); + + async function run() { + const result = await dub.topUrls({}); + + // Handle the result + console.log(result) + } + run(); - target: $["paths"]["/workspaces"]["post"] update: @@ -518,11 +375,11 @@ actions: } run(); - - target: $["paths"]["/domains/{slug}"]["delete"] + - target: $["paths"]["/workspaces/{idOrSlug}"]["get"] update: "x-codeSamples": - "lang": "typescript" - "label": "deleteDomain" + "label": "getWorkspace" "source": |- import { Dub } from "dub"; @@ -532,7 +389,30 @@ actions: }); async function run() { - const result = await dub.delete("acme.com"); + const result = await dub.get({ + idOrSlug: "", + }); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/analytics/browser"]["get"] + update: + "x-codeSamples": + - "lang": "typescript" + "label": "getBrowsersByClicksDeprecated" + "source": |- + import { Dub } from "dub"; + + const dub = new Dub({ + token: "DUB_API_KEY", + workspaceId: "", + }); + + async function run() { + const result = await dub.browser({}); // Handle the result console.log(result) @@ -560,11 +440,11 @@ actions: } run(); - - target: $["paths"]["/metatags"]["get"] + - target: $["paths"]["/analytics/clicks/count"]["get"] update: "x-codeSamples": - "lang": "typescript" - "label": "getMetatags" + "label": "getClicksCount" "source": |- import { Dub } from "dub"; @@ -574,9 +454,7 @@ actions: }); async function run() { - const result = await dub.get({ - url: "https://dub.co", - }); + const result = await dub.count({}); // Handle the result console.log(result) @@ -604,11 +482,11 @@ actions: } run(); - - target: $["paths"]["/links/{linkId}"]["delete"] + - target: $["paths"]["/links/count"]["get"] update: "x-codeSamples": - "lang": "typescript" - "label": "deleteLink" + "label": "getLinksCount" "source": |- import { Dub } from "dub"; @@ -618,7 +496,30 @@ actions: }); async function run() { - const result = await dub.delete(""); + const result = await dub.count({}); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/links/{linkId}"]["patch"] + update: + "x-codeSamples": + - "lang": "typescript" + "label": "updateLink" + "source": |- + import { Dub } from "dub"; + + const dub = new Dub({ + token: "DUB_API_KEY", + workspaceId: "", + }); + + async function run() { + const result = await dub.update("", { + url: "https://google/com", + }); // Handle the result console.log(result) @@ -649,92 +550,6 @@ actions: console.log(result) } - run(); - - target: $["paths"]["/analytics/clicks/timeseries"]["get"] - update: - "x-codeSamples": - - "lang": "typescript" - "label": "getTimeseriesByClicks" - "source": |- - import { Dub } from "dub"; - - const dub = new Dub({ - token: "DUB_API_KEY", - workspaceId: "", - }); - - async function run() { - const result = await dub.timeseries({}); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/analytics/clicks/cities"]["get"] - update: - "x-codeSamples": - - "lang": "typescript" - "label": "getCitiesByClicks" - "source": |- - import { Dub } from "dub"; - - const dub = new Dub({ - token: "DUB_API_KEY", - workspaceId: "", - }); - - async function run() { - const result = await dub.cities({}); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/analytics/clicks/browsers"]["get"] - update: - "x-codeSamples": - - "lang": "typescript" - "label": "getBrowsersByClicks" - "source": |- - import { Dub } from "dub"; - - const dub = new Dub({ - token: "DUB_API_KEY", - workspaceId: "", - }); - - async function run() { - const result = await dub.browsers({}); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/links"]["post"] - update: - "x-codeSamples": - - "lang": "typescript" - "label": "createLink" - "source": |- - import { Dub } from "dub"; - - const dub = new Dub({ - token: "DUB_API_KEY", - workspaceId: "", - }); - - async function run() { - const result = await dub.create({ - url: "https://google/com", - }); - - // Handle the result - console.log(result) - } - run(); - target: $["paths"]["/qr"]["get"] update: @@ -758,6 +573,27 @@ actions: console.log(result) } + run(); + - target: $["paths"]["/analytics/clicks/timeseries"]["get"] + update: + "x-codeSamples": + - "lang": "typescript" + "label": "getTimeseriesByClicks" + "source": |- + import { Dub } from "dub"; + + const dub = new Dub({ + token: "DUB_API_KEY", + workspaceId: "", + }); + + async function run() { + const result = await dub.timeseries({}); + + // Handle the result + console.log(result) + } + run(); - target: $["paths"]["/analytics/clicks/countries"]["get"] update: @@ -780,11 +616,11 @@ actions: } run(); - - target: $["paths"]["/domains"]["get"] + - target: $["paths"]["/domains/{slug}"]["patch"] update: "x-codeSamples": - "lang": "typescript" - "label": "listDomains" + "label": "updateDomain" "source": |- import { Dub } from "dub"; @@ -794,7 +630,98 @@ actions: }); async function run() { - const result = await dub.list({}); + const result = await dub.update("acme.com", {}); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/domains/{slug}/primary"]["post"] + update: + "x-codeSamples": + - "lang": "typescript" + "label": "setPrimaryDomain" + "source": |- + import { Dub } from "dub"; + + const dub = new Dub({ + token: "DUB_API_KEY", + workspaceId: "", + }); + + async function run() { + const result = await dub.setPrimary("acme.com"); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/domains"]["post"] + update: + "x-codeSamples": + - "lang": "typescript" + "label": "addDomain" + "source": |- + import { Dub } from "dub"; + + const dub = new Dub({ + token: "DUB_API_KEY", + workspaceId: "", + }); + + async function run() { + const result = await dub.add({ + slug: "acme.com", + }); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/track/sale"]["post"] + update: + "x-codeSamples": + - "lang": "typescript" + "label": "trackSale" + "source": |- + import { Dub } from "dub"; + import { PaymentProcessor } from "dub/models/operations"; + + const dub = new Dub({ + token: "DUB_API_KEY", + workspaceId: "", + }); + + async function run() { + const result = await dub.sale({ + customerId: "", + amount: 996500, + paymentProcessor: PaymentProcessor.Shopify, + }); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/links/info"]["get"] + update: + "x-codeSamples": + - "lang": "typescript" + "label": "getLinkInfo" + "source": |- + import { Dub } from "dub"; + + const dub = new Dub({ + token: "DUB_API_KEY", + workspaceId: "", + }); + + async function run() { + const result = await dub.get({}); // Handle the result console.log(result) @@ -822,11 +749,11 @@ actions: } run(); - - target: $["paths"]["/analytics/clicks/top_links"]["get"] + - target: $["paths"]["/analytics/clicks/browsers"]["get"] update: "x-codeSamples": - "lang": "typescript" - "label": "getTopLinksByClicks" + "label": "getBrowsersByClicks" "source": |- import { Dub } from "dub"; @@ -836,18 +763,18 @@ actions: }); async function run() { - const result = await dub.topLinks({}); + const result = await dub.browsers({}); // Handle the result console.log(result) } run(); - - target: $["paths"]["/workspaces/{idOrSlug}"]["get"] + - target: $["paths"]["/analytics/clicks/os"]["get"] update: "x-codeSamples": - "lang": "typescript" - "label": "getWorkspace" + "label": "getOSByClicks" "source": |- import { Dub } from "dub"; @@ -857,9 +784,91 @@ actions: }); async function run() { - const result = await dub.get({ - idOrSlug: "", - }); + const result = await dub.os({}); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/analytics/clicks"]["get"] + update: + "x-codeSamples": + - "lang": "typescript" + "label": "getClicksCountDeprecated" + "source": |- + import { Dub } from "dub"; + + const dub = new Dub({ + token: "DUB_API_KEY", + workspaceId: "", + }); + + async function run() { + const result = await dub.getClicksCountDeprecated({}); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/analytics/timeseries"]["get"] + update: + "x-codeSamples": + - "lang": "typescript" + "label": "getTimeseriesByClicksDeprecated" + "source": |- + import { Dub } from "dub"; + + const dub = new Dub({ + token: "DUB_API_KEY", + workspaceId: "", + }); + + async function run() { + const result = await dub.timeseries({}); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/analytics/os"]["get"] + update: + "x-codeSamples": + - "lang": "typescript" + "label": "getOSByClicksDeprecated" + "source": |- + import { Dub } from "dub"; + + const dub = new Dub({ + token: "DUB_API_KEY", + workspaceId: "", + }); + + async function run() { + const result = await dub.os({}); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/analytics/clicks/devices"]["get"] + update: + "x-codeSamples": + - "lang": "typescript" + "label": "getDevicesByClicks" + "source": |- + import { Dub } from "dub"; + + const dub = new Dub({ + token: "DUB_API_KEY", + workspaceId: "", + }); + + async function run() { + const result = await dub.devices({}); // Handle the result console.log(result) @@ -888,4 +897,69 @@ actions: console.log(result) } + run(); + - target: $["paths"]["/analytics/city"]["get"] + update: + "x-codeSamples": + - "lang": "typescript" + "label": "getCitiesByClicksDeprecated" + "source": |- + import { Dub } from "dub"; + + const dub = new Dub({ + token: "DUB_API_KEY", + workspaceId: "", + }); + + async function run() { + const result = await dub.city({}); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/domains"]["get"] + update: + "x-codeSamples": + - "lang": "typescript" + "label": "listDomains" + "source": |- + import { Dub } from "dub"; + + const dub = new Dub({ + token: "DUB_API_KEY", + workspaceId: "", + }); + + async function run() { + const result = await dub.list({}); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/metatags"]["get"] + update: + "x-codeSamples": + - "lang": "typescript" + "label": "getMetatags" + "source": |- + import { Dub } from "dub"; + + const dub = new Dub({ + token: "DUB_API_KEY", + workspaceId: "", + }); + + async function run() { + const result = await dub.get({ + url: "https://dub.co", + }); + + // Handle the result + console.log(result) + } + run(); diff --git a/docs/models/components/workspaceschema.md b/docs/models/components/workspaceschema.md index e003d52..77f2838 100644 --- a/docs/models/components/workspaceschema.md +++ b/docs/models/components/workspaceschema.md @@ -19,7 +19,9 @@ | `plan` | [components.Plan](../../models/components/plan.md) | :heavy_check_mark: | The plan of the workspace. | | `stripeId` | *string* | :heavy_check_mark: | The Stripe ID of the workspace. | | `billingCycleStart` | *number* | :heavy_check_mark: | The date and time when the billing cycle starts for the workspace. | +| `stripeConnectId` | *string* | :heavy_check_mark: | [BETA]: The Stripe Connect ID of the workspace. | | `createdAt` | *string* | :heavy_check_mark: | The date and time when the workspace was created. | | `users` | [components.Users](../../models/components/users.md)[] | :heavy_check_mark: | The role of the authenticated user in the workspace. | | `domains` | [components.Domains](../../models/components/domains.md)[] | :heavy_check_mark: | The domains of the workspace. | -| `inviteCode` | *string* | :heavy_check_mark: | The invite code of the workspace. | \ No newline at end of file +| `inviteCode` | *string* | :heavy_check_mark: | The invite code of the workspace. | +| `betaTester` | *boolean* | :heavy_minus_sign: | Whether the workspace is enrolled in the beta testing program. | \ No newline at end of file diff --git a/docs/models/operations/createlinkrequestbody.md b/docs/models/operations/createlinkrequestbody.md index ebcd674..8087d61 100644 --- a/docs/models/operations/createlinkrequestbody.md +++ b/docs/models/operations/createlinkrequestbody.md @@ -10,6 +10,7 @@ | `key` | *string* | :heavy_minus_sign: | The short link slug. If not provided, a random 7-character slug will be generated. | | | `externalId` | *string* | :heavy_minus_sign: | This is the ID of the link in your database. If set, it can be used to identify the link in the future. Must be prefixed with `ext_` when passed as a query parameter. | 123456 | | `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. | | +| `trackConversion` | *boolean* | :heavy_minus_sign: | Whether to track conversions for the short link. | | | `archived` | *boolean* | :heavy_minus_sign: | Whether the short link is archived. | | | `publicStats` | *boolean* | :heavy_minus_sign: | Whether the short link's stats are publicly accessible. | | | ~~`tagId`~~ | *string* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

The unique ID of the tag assigned to the short link. This field is deprecated – use `tagIds` instead. | | diff --git a/docs/models/operations/paymentprocessor.md b/docs/models/operations/paymentprocessor.md new file mode 100644 index 0000000..26ca8cf --- /dev/null +++ b/docs/models/operations/paymentprocessor.md @@ -0,0 +1,12 @@ +# PaymentProcessor + +The payment processor via which the sale was made. + + +## Values + +| Name | Value | +| --------- | --------- | +| `Stripe` | stripe | +| `Shopify` | shopify | +| `Paddle` | paddle | \ No newline at end of file diff --git a/docs/models/operations/requestbody.md b/docs/models/operations/requestbody.md index 432b169..86f2fd1 100644 --- a/docs/models/operations/requestbody.md +++ b/docs/models/operations/requestbody.md @@ -10,6 +10,7 @@ | `key` | *string* | :heavy_minus_sign: | The short link slug. If not provided, a random 7-character slug will be generated. | | | `externalId` | *string* | :heavy_minus_sign: | This is the ID of the link in your database. If set, it can be used to identify the link in the future. Must be prefixed with `ext_` when passed as a query parameter. | 123456 | | `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. | | +| `trackConversion` | *boolean* | :heavy_minus_sign: | Whether to track conversions for the short link. | | | `archived` | *boolean* | :heavy_minus_sign: | Whether the short link is archived. | | | `publicStats` | *boolean* | :heavy_minus_sign: | Whether the short link's stats are publicly accessible. | | | ~~`tagId`~~ | *string* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

The unique ID of the tag assigned to the short link. This field is deprecated – use `tagIds` instead. | | diff --git a/docs/models/operations/trackcustomerrequestbody.md b/docs/models/operations/trackcustomerrequestbody.md new file mode 100644 index 0000000..ed4a3c8 --- /dev/null +++ b/docs/models/operations/trackcustomerrequestbody.md @@ -0,0 +1,11 @@ +# TrackCustomerRequestBody + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | +| `customerId` | *string* | :heavy_check_mark: | This is the unique identifier for the customer in the client's app. This is used to track the customer's journey. | +| `customerName` | *string* | :heavy_minus_sign: | Name of the customer in the client's app. | +| `customerEmail` | *string* | :heavy_minus_sign: | Email of the customer in the client's app. | +| `customerAvatar` | *string* | :heavy_minus_sign: | Avatar of the customer in the client's app. | \ No newline at end of file diff --git a/docs/models/operations/trackcustomerresponsebody.md b/docs/models/operations/trackcustomerresponsebody.md new file mode 100644 index 0000000..8a8c704 --- /dev/null +++ b/docs/models/operations/trackcustomerresponsebody.md @@ -0,0 +1,13 @@ +# TrackCustomerResponseBody + +A customer was tracked. + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `customerId` | *string* | :heavy_check_mark: | N/A | +| `customerName` | *string* | :heavy_check_mark: | N/A | +| `customerEmail` | *string* | :heavy_check_mark: | N/A | +| `customerAvatar` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/trackleadrequestbody.md b/docs/models/operations/trackleadrequestbody.md new file mode 100644 index 0000000..a00d55e --- /dev/null +++ b/docs/models/operations/trackleadrequestbody.md @@ -0,0 +1,14 @@ +# TrackLeadRequestBody + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | +| `clickId` | *string* | :heavy_check_mark: | The ID of the click in th Dub. You can read this value from `dclid` cookie. | | +| `eventName` | *string* | :heavy_check_mark: | The name of the event to track. | Signup | +| `customerId` | *string* | :heavy_check_mark: | This is the unique identifier for the customer in the client's app. This is used to track the customer's journey. | | +| `customerName` | *string* | :heavy_minus_sign: | Name of the customer in the client's app. | | +| `customerEmail` | *string* | :heavy_minus_sign: | Email of the customer in the client's app. | | +| `customerAvatar` | *string* | :heavy_minus_sign: | Avatar of the customer in the client's app. | | +| `metadata` | Record | :heavy_minus_sign: | Additional metadata to be stored with the lead event | | \ No newline at end of file diff --git a/docs/models/operations/trackleadresponsebody.md b/docs/models/operations/trackleadresponsebody.md new file mode 100644 index 0000000..f76b20c --- /dev/null +++ b/docs/models/operations/trackleadresponsebody.md @@ -0,0 +1,16 @@ +# TrackLeadResponseBody + +A lead was tracked. + + +## Fields + +| Field | Type | Required | Description | +| --------------------- | --------------------- | --------------------- | --------------------- | +| `clickId` | *string* | :heavy_check_mark: | N/A | +| `eventName` | *string* | :heavy_check_mark: | N/A | +| `customerId` | *string* | :heavy_check_mark: | N/A | +| `customerName` | *string* | :heavy_check_mark: | N/A | +| `customerEmail` | *string* | :heavy_check_mark: | N/A | +| `customerAvatar` | *string* | :heavy_check_mark: | N/A | +| `metadata` | Record | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/tracksalerequestbody.md b/docs/models/operations/tracksalerequestbody.md new file mode 100644 index 0000000..81a6b97 --- /dev/null +++ b/docs/models/operations/tracksalerequestbody.md @@ -0,0 +1,13 @@ +# TrackSaleRequestBody + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | +| `customerId` | *string* | :heavy_check_mark: | This is the unique identifier for the customer in the client's app. This is used to track the customer's journey. | +| `amount` | *number* | :heavy_check_mark: | The amount of the sale. Should be passed in cents. | +| `paymentProcessor` | [operations.PaymentProcessor](../../models/operations/paymentprocessor.md) | :heavy_check_mark: | The payment processor via which the sale was made. | +| `invoiceId` | *string* | :heavy_minus_sign: | The invoice ID of the sale. | +| `currency` | *string* | :heavy_minus_sign: | The currency of the sale. Accepts ISO 4217 currency codes. | +| `metadata` | Record | :heavy_minus_sign: | Additional metadata to be stored with the sale event. | \ No newline at end of file diff --git a/docs/models/operations/tracksaleresponsebody.md b/docs/models/operations/tracksaleresponsebody.md new file mode 100644 index 0000000..e369ac0 --- /dev/null +++ b/docs/models/operations/tracksaleresponsebody.md @@ -0,0 +1,15 @@ +# TrackSaleResponseBody + +A sale was tracked. + + +## Fields + +| Field | Type | Required | Description | +| --------------------- | --------------------- | --------------------- | --------------------- | +| `customerId` | *string* | :heavy_check_mark: | N/A | +| `amount` | *number* | :heavy_check_mark: | N/A | +| `paymentProcessor` | *string* | :heavy_check_mark: | N/A | +| `invoiceId` | *string* | :heavy_check_mark: | N/A | +| `currency` | *string* | :heavy_check_mark: | N/A | +| `metadata` | Record | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/updatelinkrequestbody.md b/docs/models/operations/updatelinkrequestbody.md index 4b77ff6..5175e05 100644 --- a/docs/models/operations/updatelinkrequestbody.md +++ b/docs/models/operations/updatelinkrequestbody.md @@ -10,6 +10,7 @@ | `key` | *string* | :heavy_minus_sign: | The short link slug. If not provided, a random 7-character slug will be generated. | | | `externalId` | *string* | :heavy_minus_sign: | This is the ID of the link in your database. If set, it can be used to identify the link in the future. Must be prefixed with `ext_` when passed as a query parameter. | 123456 | | `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. | | +| `trackConversion` | *boolean* | :heavy_minus_sign: | Whether to track conversions for the short link. | | | `archived` | *boolean* | :heavy_minus_sign: | Whether the short link is archived. | | | `publicStats` | *boolean* | :heavy_minus_sign: | Whether the short link's stats are publicly accessible. | | | ~~`tagId`~~ | *string* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

The unique ID of the tag assigned to the short link. This field is deprecated – use `tagIds` instead. | | diff --git a/docs/models/operations/upsertlinkrequestbody.md b/docs/models/operations/upsertlinkrequestbody.md index 4c5f759..8c1e4d4 100644 --- a/docs/models/operations/upsertlinkrequestbody.md +++ b/docs/models/operations/upsertlinkrequestbody.md @@ -10,6 +10,7 @@ | `key` | *string* | :heavy_minus_sign: | The short link slug. If not provided, a random 7-character slug will be generated. | | | `externalId` | *string* | :heavy_minus_sign: | This is the ID of the link in your database. If set, it can be used to identify the link in the future. Must be prefixed with `ext_` when passed as a query parameter. | 123456 | | `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. | | +| `trackConversion` | *boolean* | :heavy_minus_sign: | Whether to track conversions for the short link. | | | `archived` | *boolean* | :heavy_minus_sign: | Whether the short link is archived. | | | `publicStats` | *boolean* | :heavy_minus_sign: | Whether the short link's stats are publicly accessible. | | | ~~`tagId`~~ | *string* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

The unique ID of the tag assigned to the short link. This field is deprecated – use `tagIds` instead. | | diff --git a/docs/sdks/track/README.md b/docs/sdks/track/README.md new file mode 100644 index 0000000..d726717 --- /dev/null +++ b/docs/sdks/track/README.md @@ -0,0 +1,172 @@ +# Track +(*track*) + +### Available Operations + +* [lead](#lead) - Track a lead +* [sale](#sale) - Track a sale +* [customer](#customer) - Track a customer + +## lead + +Track a lead for a short link. + +### Example Usage + +```typescript +import { Dub } from "dub"; + +const dub = new Dub({ + token: "DUB_API_KEY", + workspaceId: "", +}); + +async function run() { + const result = await dub.track.lead({ + clickId: "", + eventName: "Signup", + customerId: "", + }); + + // Handle the result + console.log(result) +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [operations.TrackLeadRequestBody](../../models/operations/trackleadrequestbody.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | + + +### Response + +**Promise<[operations.TrackLeadResponseBody](../../models/operations/trackleadresponsebody.md)>** +### Errors + +| Error Object | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| errors.BadRequest | 400 | application/json | +| errors.Unauthorized | 401 | application/json | +| errors.Forbidden | 403 | application/json | +| errors.NotFound | 404 | application/json | +| errors.Conflict | 409 | application/json | +| errors.InviteExpired | 410 | application/json | +| errors.UnprocessableEntity | 422 | application/json | +| errors.RateLimitExceeded | 429 | application/json | +| errors.InternalServerError | 500 | application/json | +| errors.SDKError | 4xx-5xx | */* | + +## sale + +Track a sale for a short link. + +### Example Usage + +```typescript +import { Dub } from "dub"; +import { PaymentProcessor } from "dub/models/operations"; + +const dub = new Dub({ + token: "DUB_API_KEY", + workspaceId: "", +}); + +async function run() { + const result = await dub.track.sale({ + customerId: "", + amount: 996500, + paymentProcessor: PaymentProcessor.Shopify, + }); + + // Handle the result + console.log(result) +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [operations.TrackSaleRequestBody](../../models/operations/tracksalerequestbody.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | + + +### Response + +**Promise<[operations.TrackSaleResponseBody](../../models/operations/tracksaleresponsebody.md)>** +### Errors + +| Error Object | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| errors.BadRequest | 400 | application/json | +| errors.Unauthorized | 401 | application/json | +| errors.Forbidden | 403 | application/json | +| errors.NotFound | 404 | application/json | +| errors.Conflict | 409 | application/json | +| errors.InviteExpired | 410 | application/json | +| errors.UnprocessableEntity | 422 | application/json | +| errors.RateLimitExceeded | 429 | application/json | +| errors.InternalServerError | 500 | application/json | +| errors.SDKError | 4xx-5xx | */* | + +## customer + +Track a customer for an authenticated workspace. + +### Example Usage + +```typescript +import { Dub } from "dub"; + +const dub = new Dub({ + token: "DUB_API_KEY", + workspaceId: "", +}); + +async function run() { + const result = await dub.track.customer({ + customerId: "", + }); + + // Handle the result + console.log(result) +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [operations.TrackCustomerRequestBody](../../models/operations/trackcustomerrequestbody.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | + + +### Response + +**Promise<[operations.TrackCustomerResponseBody](../../models/operations/trackcustomerresponsebody.md)>** +### Errors + +| Error Object | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| errors.BadRequest | 400 | application/json | +| errors.Unauthorized | 401 | application/json | +| errors.Forbidden | 403 | application/json | +| errors.NotFound | 404 | application/json | +| errors.Conflict | 409 | application/json | +| errors.InviteExpired | 410 | application/json | +| errors.UnprocessableEntity | 422 | application/json | +| errors.RateLimitExceeded | 429 | application/json | +| errors.InternalServerError | 500 | application/json | +| errors.SDKError | 4xx-5xx | */* | diff --git a/jsr.json b/jsr.json index 11bf17f..aa1542f 100644 --- a/jsr.json +++ b/jsr.json @@ -2,7 +2,7 @@ { "name": "dub", - "version": "0.29.5", + "version": "0.29.6", "exports": { ".": "./src/index.ts", "./models/errors": "./src/models/errors/index.ts", diff --git a/package-lock.json b/package-lock.json index 57f88b8..ec028d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "dub", - "version": "0.29.5", + "version": "0.29.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dub", - "version": "0.29.5", + "version": "0.29.6", "devDependencies": { "@types/jsonpath": "^0.2.4", "@types/node": "^20.12.7", diff --git a/package.json b/package.json index 6676b68..9f11abb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dub", - "version": "0.29.5", + "version": "0.29.6", "author": "Dub", "main": "./index.js", "sideEffects": false, diff --git a/src/lib/config.ts b/src/lib/config.ts index 1a1e679..38b2825 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -64,7 +64,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null { export const SDK_METADATA = { language: "typescript", openapiDocVersion: "0.0.1", - sdkVersion: "0.29.5", + sdkVersion: "0.29.6", genVersion: "2.333.3", - userAgent: "speakeasy-sdk/typescript 0.29.5 2.333.3 0.0.1 dub", + userAgent: "speakeasy-sdk/typescript 0.29.6 2.333.3 0.0.1 dub", } as const; diff --git a/src/models/components/workspaceschema.ts b/src/models/components/workspaceschema.ts index ea31004..ddc0327 100644 --- a/src/models/components/workspaceschema.ts +++ b/src/models/components/workspaceschema.ts @@ -109,6 +109,10 @@ export type WorkspaceSchema = { * The date and time when the billing cycle starts for the workspace. */ billingCycleStart: number; + /** + * [BETA]: The Stripe Connect ID of the workspace. + */ + stripeConnectId: string | null; /** * The date and time when the workspace was created. */ @@ -125,6 +129,10 @@ export type WorkspaceSchema = { * The invite code of the workspace. */ inviteCode: string | null; + /** + * Whether the workspace is enrolled in the beta testing program. + */ + betaTester?: boolean | undefined; }; /** @internal */ @@ -216,10 +224,12 @@ export namespace WorkspaceSchema$ { plan: Plan$.inboundSchema, stripeId: z.nullable(z.string()), billingCycleStart: z.number(), + stripeConnectId: z.nullable(z.string()), createdAt: z.string(), users: z.array(z.lazy(() => Users$.inboundSchema)), domains: z.array(z.lazy(() => Domains$.inboundSchema)), inviteCode: z.nullable(z.string()), + betaTester: z.boolean().optional(), }) .transform((v) => { return { @@ -237,10 +247,12 @@ export namespace WorkspaceSchema$ { plan: v.plan, stripeId: v.stripeId, billingCycleStart: v.billingCycleStart, + stripeConnectId: v.stripeConnectId, createdAt: v.createdAt, users: v.users, domains: v.domains, inviteCode: v.inviteCode, + ...(v.betaTester === undefined ? null : { betaTester: v.betaTester }), }; }); @@ -259,10 +271,12 @@ export namespace WorkspaceSchema$ { plan: string; stripeId: string | null; billingCycleStart: number; + stripeConnectId: string | null; createdAt: string; users: Array; domains: Array; inviteCode: string | null; + betaTester?: boolean | undefined; }; export const outboundSchema: z.ZodType = z @@ -281,10 +295,12 @@ export namespace WorkspaceSchema$ { plan: Plan$.outboundSchema, stripeId: z.nullable(z.string()), billingCycleStart: z.number(), + stripeConnectId: z.nullable(z.string()), createdAt: z.string(), users: z.array(z.lazy(() => Users$.outboundSchema)), domains: z.array(z.lazy(() => Domains$.outboundSchema)), inviteCode: z.nullable(z.string()), + betaTester: z.boolean().optional(), }) .transform((v) => { return { @@ -302,10 +318,12 @@ export namespace WorkspaceSchema$ { plan: v.plan, stripeId: v.stripeId, billingCycleStart: v.billingCycleStart, + stripeConnectId: v.stripeConnectId, createdAt: v.createdAt, users: v.users, domains: v.domains, inviteCode: v.inviteCode, + ...(v.betaTester === undefined ? null : { betaTester: v.betaTester }), }; }); } diff --git a/src/models/operations/bulkcreatelinks.ts b/src/models/operations/bulkcreatelinks.ts index 395051f..bd025ac 100644 --- a/src/models/operations/bulkcreatelinks.ts +++ b/src/models/operations/bulkcreatelinks.ts @@ -36,6 +36,10 @@ export type RequestBody = { * 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. */ prefix?: string | undefined; + /** + * Whether to track conversions for the short link. + */ + trackConversion?: boolean | undefined; /** * Whether the short link is archived. */ @@ -141,6 +145,7 @@ export namespace RequestBody$ { key: z.string().optional(), externalId: z.nullable(z.string()).optional(), prefix: z.string().optional(), + trackConversion: z.boolean().default(false), archived: z.boolean().default(false), publicStats: z.boolean().default(false), tagId: z.nullable(z.string()).optional(), @@ -166,6 +171,7 @@ export namespace RequestBody$ { ...(v.key === undefined ? null : { key: v.key }), ...(v.externalId === undefined ? null : { externalId: v.externalId }), ...(v.prefix === undefined ? null : { prefix: v.prefix }), + trackConversion: v.trackConversion, archived: v.archived, publicStats: v.publicStats, ...(v.tagId === undefined ? null : { tagId: v.tagId }), @@ -192,6 +198,7 @@ export namespace RequestBody$ { key?: string | undefined; externalId?: string | null | undefined; prefix?: string | undefined; + trackConversion: boolean; archived: boolean; publicStats: boolean; tagId?: string | null | undefined; @@ -218,6 +225,7 @@ export namespace RequestBody$ { key: z.string().optional(), externalId: z.nullable(z.string()).optional(), prefix: z.string().optional(), + trackConversion: z.boolean().default(false), archived: z.boolean().default(false), publicStats: z.boolean().default(false), tagId: z.nullable(z.string()).optional(), @@ -243,6 +251,7 @@ export namespace RequestBody$ { ...(v.key === undefined ? null : { key: v.key }), ...(v.externalId === undefined ? null : { externalId: v.externalId }), ...(v.prefix === undefined ? null : { prefix: v.prefix }), + trackConversion: v.trackConversion, archived: v.archived, publicStats: v.publicStats, ...(v.tagId === undefined ? null : { tagId: v.tagId }), diff --git a/src/models/operations/createlink.ts b/src/models/operations/createlink.ts index 012bf3a..abc6bd0 100644 --- a/src/models/operations/createlink.ts +++ b/src/models/operations/createlink.ts @@ -36,6 +36,10 @@ export type CreateLinkRequestBody = { * 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. */ prefix?: string | undefined; + /** + * Whether to track conversions for the short link. + */ + trackConversion?: boolean | undefined; /** * Whether the short link is archived. */ @@ -145,6 +149,7 @@ export namespace CreateLinkRequestBody$ { key: z.string().optional(), externalId: z.nullable(z.string()).optional(), prefix: z.string().optional(), + trackConversion: z.boolean().default(false), archived: z.boolean().default(false), publicStats: z.boolean().default(false), tagId: z.nullable(z.string()).optional(), @@ -170,6 +175,7 @@ export namespace CreateLinkRequestBody$ { ...(v.key === undefined ? null : { key: v.key }), ...(v.externalId === undefined ? null : { externalId: v.externalId }), ...(v.prefix === undefined ? null : { prefix: v.prefix }), + trackConversion: v.trackConversion, archived: v.archived, publicStats: v.publicStats, ...(v.tagId === undefined ? null : { tagId: v.tagId }), @@ -196,6 +202,7 @@ export namespace CreateLinkRequestBody$ { key?: string | undefined; externalId?: string | null | undefined; prefix?: string | undefined; + trackConversion: boolean; archived: boolean; publicStats: boolean; tagId?: string | null | undefined; @@ -222,6 +229,7 @@ export namespace CreateLinkRequestBody$ { key: z.string().optional(), externalId: z.nullable(z.string()).optional(), prefix: z.string().optional(), + trackConversion: z.boolean().default(false), archived: z.boolean().default(false), publicStats: z.boolean().default(false), tagId: z.nullable(z.string()).optional(), @@ -247,6 +255,7 @@ export namespace CreateLinkRequestBody$ { ...(v.key === undefined ? null : { key: v.key }), ...(v.externalId === undefined ? null : { externalId: v.externalId }), ...(v.prefix === undefined ? null : { prefix: v.prefix }), + trackConversion: v.trackConversion, archived: v.archived, publicStats: v.publicStats, ...(v.tagId === undefined ? null : { tagId: v.tagId }), diff --git a/src/models/operations/index.ts b/src/models/operations/index.ts index 7bb30b8..e1b9f74 100644 --- a/src/models/operations/index.ts +++ b/src/models/operations/index.ts @@ -38,6 +38,9 @@ export * from "./gettopurlsbyclicksdeprecated"; export * from "./getworkspace"; export * from "./listdomains"; export * from "./setprimarydomain"; +export * from "./trackcustomer"; +export * from "./tracklead"; +export * from "./tracksale"; export * from "./transferdomain"; export * from "./updatedomain"; export * from "./updatelink"; diff --git a/src/models/operations/trackcustomer.ts b/src/models/operations/trackcustomer.ts new file mode 100644 index 0000000..6041d50 --- /dev/null +++ b/src/models/operations/trackcustomer.ts @@ -0,0 +1,118 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +import * as z from "zod"; + +export type TrackCustomerRequestBody = { + /** + * This is the unique identifier for the customer in the client's app. This is used to track the customer's journey. + */ + customerId: string; + /** + * Name of the customer in the client's app. + */ + customerName?: string | null | undefined; + /** + * Email of the customer in the client's app. + */ + customerEmail?: string | null | undefined; + /** + * Avatar of the customer in the client's app. + */ + customerAvatar?: string | null | undefined; +}; + +/** + * A customer was tracked. + */ +export type TrackCustomerResponseBody = { + customerId: string; + customerName: string | null; + customerEmail: string | null; + customerAvatar: string | null; +}; + +/** @internal */ +export namespace TrackCustomerRequestBody$ { + export const inboundSchema: z.ZodType = z + .object({ + customerId: z.string(), + customerName: z.nullable(z.string()).default(null), + customerEmail: z.nullable(z.string()).default(null), + customerAvatar: z.nullable(z.string()).default(null), + }) + .transform((v) => { + return { + customerId: v.customerId, + customerName: v.customerName, + customerEmail: v.customerEmail, + customerAvatar: v.customerAvatar, + }; + }); + + export type Outbound = { + customerId: string; + customerName: string | null; + customerEmail: string | null; + customerAvatar: string | null; + }; + + export const outboundSchema: z.ZodType = z + .object({ + customerId: z.string(), + customerName: z.nullable(z.string()).default(null), + customerEmail: z.nullable(z.string()).default(null), + customerAvatar: z.nullable(z.string()).default(null), + }) + .transform((v) => { + return { + customerId: v.customerId, + customerName: v.customerName, + customerEmail: v.customerEmail, + customerAvatar: v.customerAvatar, + }; + }); +} + +/** @internal */ +export namespace TrackCustomerResponseBody$ { + export const inboundSchema: z.ZodType = z + .object({ + customerId: z.string(), + customerName: z.nullable(z.string()), + customerEmail: z.nullable(z.string()), + customerAvatar: z.nullable(z.string()), + }) + .transform((v) => { + return { + customerId: v.customerId, + customerName: v.customerName, + customerEmail: v.customerEmail, + customerAvatar: v.customerAvatar, + }; + }); + + export type Outbound = { + customerId: string; + customerName: string | null; + customerEmail: string | null; + customerAvatar: string | null; + }; + + export const outboundSchema: z.ZodType = z + .object({ + customerId: z.string(), + customerName: z.nullable(z.string()), + customerEmail: z.nullable(z.string()), + customerAvatar: z.nullable(z.string()), + }) + .transform((v) => { + return { + customerId: v.customerId, + customerName: v.customerName, + customerEmail: v.customerEmail, + customerAvatar: v.customerAvatar, + }; + }); +} diff --git a/src/models/operations/tracklead.ts b/src/models/operations/tracklead.ts new file mode 100644 index 0000000..8a4fdbd --- /dev/null +++ b/src/models/operations/tracklead.ts @@ -0,0 +1,163 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +import * as z from "zod"; + +export type TrackLeadRequestBody = { + /** + * The ID of the click in th Dub. You can read this value from `dclid` cookie. + */ + clickId: string; + /** + * The name of the event to track. + */ + eventName: string; + /** + * This is the unique identifier for the customer in the client's app. This is used to track the customer's journey. + */ + customerId: string; + /** + * Name of the customer in the client's app. + */ + customerName?: string | null | undefined; + /** + * Email of the customer in the client's app. + */ + customerEmail?: string | null | undefined; + /** + * Avatar of the customer in the client's app. + */ + customerAvatar?: string | null | undefined; + /** + * Additional metadata to be stored with the lead event + */ + metadata?: { [k: string]: any } | null | undefined; +}; + +/** + * A lead was tracked. + */ +export type TrackLeadResponseBody = { + clickId: string; + eventName: string; + customerId: string; + customerName: string | null; + customerEmail: string | null; + customerAvatar: string | null; + metadata: { [k: string]: any } | null; +}; + +/** @internal */ +export namespace TrackLeadRequestBody$ { + export const inboundSchema: z.ZodType = z + .object({ + clickId: z.string(), + eventName: z.string(), + customerId: z.string(), + customerName: z.nullable(z.string()).default(null), + customerEmail: z.nullable(z.string()).default(null), + customerAvatar: z.nullable(z.string()).default(null), + metadata: z.nullable(z.record(z.any())).optional(), + }) + .transform((v) => { + return { + clickId: v.clickId, + eventName: v.eventName, + customerId: v.customerId, + customerName: v.customerName, + customerEmail: v.customerEmail, + customerAvatar: v.customerAvatar, + ...(v.metadata === undefined ? null : { metadata: v.metadata }), + }; + }); + + export type Outbound = { + clickId: string; + eventName: string; + customerId: string; + customerName: string | null; + customerEmail: string | null; + customerAvatar: string | null; + metadata?: { [k: string]: any } | null | undefined; + }; + + export const outboundSchema: z.ZodType = z + .object({ + clickId: z.string(), + eventName: z.string(), + customerId: z.string(), + customerName: z.nullable(z.string()).default(null), + customerEmail: z.nullable(z.string()).default(null), + customerAvatar: z.nullable(z.string()).default(null), + metadata: z.nullable(z.record(z.any())).optional(), + }) + .transform((v) => { + return { + clickId: v.clickId, + eventName: v.eventName, + customerId: v.customerId, + customerName: v.customerName, + customerEmail: v.customerEmail, + customerAvatar: v.customerAvatar, + ...(v.metadata === undefined ? null : { metadata: v.metadata }), + }; + }); +} + +/** @internal */ +export namespace TrackLeadResponseBody$ { + export const inboundSchema: z.ZodType = z + .object({ + clickId: z.string(), + eventName: z.string(), + customerId: z.string(), + customerName: z.nullable(z.string()), + customerEmail: z.nullable(z.string()), + customerAvatar: z.nullable(z.string()), + metadata: z.nullable(z.record(z.any())), + }) + .transform((v) => { + return { + clickId: v.clickId, + eventName: v.eventName, + customerId: v.customerId, + customerName: v.customerName, + customerEmail: v.customerEmail, + customerAvatar: v.customerAvatar, + metadata: v.metadata, + }; + }); + + export type Outbound = { + clickId: string; + eventName: string; + customerId: string; + customerName: string | null; + customerEmail: string | null; + customerAvatar: string | null; + metadata: { [k: string]: any } | null; + }; + + export const outboundSchema: z.ZodType = z + .object({ + clickId: z.string(), + eventName: z.string(), + customerId: z.string(), + customerName: z.nullable(z.string()), + customerEmail: z.nullable(z.string()), + customerAvatar: z.nullable(z.string()), + metadata: z.nullable(z.record(z.any())), + }) + .transform((v) => { + return { + clickId: v.clickId, + eventName: v.eventName, + customerId: v.customerId, + customerName: v.customerName, + customerEmail: v.customerEmail, + customerAvatar: v.customerAvatar, + metadata: v.metadata, + }; + }); +} diff --git a/src/models/operations/tracksale.ts b/src/models/operations/tracksale.ts new file mode 100644 index 0000000..e4cf5ff --- /dev/null +++ b/src/models/operations/tracksale.ts @@ -0,0 +1,168 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +import { ClosedEnum } from "../../types"; +import * as z from "zod"; + +/** + * The payment processor via which the sale was made. + */ +export const PaymentProcessor = { + Stripe: "stripe", + Shopify: "shopify", + Paddle: "paddle", +} as const; +/** + * The payment processor via which the sale was made. + */ +export type PaymentProcessor = ClosedEnum; + +export type TrackSaleRequestBody = { + /** + * This is the unique identifier for the customer in the client's app. This is used to track the customer's journey. + */ + customerId: string; + /** + * The amount of the sale. Should be passed in cents. + */ + amount: number; + /** + * The payment processor via which the sale was made. + */ + paymentProcessor: PaymentProcessor; + /** + * The invoice ID of the sale. + */ + invoiceId?: string | null | undefined; + /** + * The currency of the sale. Accepts ISO 4217 currency codes. + */ + currency?: string | undefined; + /** + * Additional metadata to be stored with the sale event. + */ + metadata?: { [k: string]: any } | null | undefined; +}; + +/** + * A sale was tracked. + */ +export type TrackSaleResponseBody = { + customerId: string; + amount: number; + paymentProcessor: string; + invoiceId: string | null; + currency: string; + metadata: { [k: string]: any } | null; +}; + +/** @internal */ +export namespace PaymentProcessor$ { + export const inboundSchema = z.nativeEnum(PaymentProcessor); + export const outboundSchema = inboundSchema; +} + +/** @internal */ +export namespace TrackSaleRequestBody$ { + export const inboundSchema: z.ZodType = z + .object({ + customerId: z.string(), + amount: z.number().int(), + paymentProcessor: PaymentProcessor$.inboundSchema, + invoiceId: z.nullable(z.string()).default(null), + currency: z.string().default("usd"), + metadata: z.nullable(z.record(z.any())).optional(), + }) + .transform((v) => { + return { + customerId: v.customerId, + amount: v.amount, + paymentProcessor: v.paymentProcessor, + invoiceId: v.invoiceId, + currency: v.currency, + ...(v.metadata === undefined ? null : { metadata: v.metadata }), + }; + }); + + export type Outbound = { + customerId: string; + amount: number; + paymentProcessor: string; + invoiceId: string | null; + currency: string; + metadata?: { [k: string]: any } | null | undefined; + }; + + export const outboundSchema: z.ZodType = z + .object({ + customerId: z.string(), + amount: z.number().int(), + paymentProcessor: PaymentProcessor$.outboundSchema, + invoiceId: z.nullable(z.string()).default(null), + currency: z.string().default("usd"), + metadata: z.nullable(z.record(z.any())).optional(), + }) + .transform((v) => { + return { + customerId: v.customerId, + amount: v.amount, + paymentProcessor: v.paymentProcessor, + invoiceId: v.invoiceId, + currency: v.currency, + ...(v.metadata === undefined ? null : { metadata: v.metadata }), + }; + }); +} + +/** @internal */ +export namespace TrackSaleResponseBody$ { + export const inboundSchema: z.ZodType = z + .object({ + customerId: z.string(), + amount: z.number(), + paymentProcessor: z.string(), + invoiceId: z.nullable(z.string()), + currency: z.string(), + metadata: z.nullable(z.record(z.any())), + }) + .transform((v) => { + return { + customerId: v.customerId, + amount: v.amount, + paymentProcessor: v.paymentProcessor, + invoiceId: v.invoiceId, + currency: v.currency, + metadata: v.metadata, + }; + }); + + export type Outbound = { + customerId: string; + amount: number; + paymentProcessor: string; + invoiceId: string | null; + currency: string; + metadata: { [k: string]: any } | null; + }; + + export const outboundSchema: z.ZodType = z + .object({ + customerId: z.string(), + amount: z.number(), + paymentProcessor: z.string(), + invoiceId: z.nullable(z.string()), + currency: z.string(), + metadata: z.nullable(z.record(z.any())), + }) + .transform((v) => { + return { + customerId: v.customerId, + amount: v.amount, + paymentProcessor: v.paymentProcessor, + invoiceId: v.invoiceId, + currency: v.currency, + metadata: v.metadata, + }; + }); +} diff --git a/src/models/operations/updatelink.ts b/src/models/operations/updatelink.ts index ee7c007..d6282fa 100644 --- a/src/models/operations/updatelink.ts +++ b/src/models/operations/updatelink.ts @@ -36,6 +36,10 @@ export type UpdateLinkRequestBody = { * 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. */ prefix?: string | undefined; + /** + * Whether to track conversions for the short link. + */ + trackConversion?: boolean | undefined; /** * Whether the short link is archived. */ @@ -153,6 +157,7 @@ export namespace UpdateLinkRequestBody$ { key: z.string().optional(), externalId: z.nullable(z.string()).optional(), prefix: z.string().optional(), + trackConversion: z.boolean().default(false), archived: z.boolean().default(false), publicStats: z.boolean().default(false), tagId: z.nullable(z.string()).optional(), @@ -178,6 +183,7 @@ export namespace UpdateLinkRequestBody$ { ...(v.key === undefined ? null : { key: v.key }), ...(v.externalId === undefined ? null : { externalId: v.externalId }), ...(v.prefix === undefined ? null : { prefix: v.prefix }), + trackConversion: v.trackConversion, archived: v.archived, publicStats: v.publicStats, ...(v.tagId === undefined ? null : { tagId: v.tagId }), @@ -204,6 +210,7 @@ export namespace UpdateLinkRequestBody$ { key?: string | undefined; externalId?: string | null | undefined; prefix?: string | undefined; + trackConversion: boolean; archived: boolean; publicStats: boolean; tagId?: string | null | undefined; @@ -230,6 +237,7 @@ export namespace UpdateLinkRequestBody$ { key: z.string().optional(), externalId: z.nullable(z.string()).optional(), prefix: z.string().optional(), + trackConversion: z.boolean().default(false), archived: z.boolean().default(false), publicStats: z.boolean().default(false), tagId: z.nullable(z.string()).optional(), @@ -255,6 +263,7 @@ export namespace UpdateLinkRequestBody$ { ...(v.key === undefined ? null : { key: v.key }), ...(v.externalId === undefined ? null : { externalId: v.externalId }), ...(v.prefix === undefined ? null : { prefix: v.prefix }), + trackConversion: v.trackConversion, archived: v.archived, publicStats: v.publicStats, ...(v.tagId === undefined ? null : { tagId: v.tagId }), diff --git a/src/models/operations/upsertlink.ts b/src/models/operations/upsertlink.ts index a5ddfac..0aaa735 100644 --- a/src/models/operations/upsertlink.ts +++ b/src/models/operations/upsertlink.ts @@ -36,6 +36,10 @@ export type UpsertLinkRequestBody = { * 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. */ prefix?: string | undefined; + /** + * Whether to track conversions for the short link. + */ + trackConversion?: boolean | undefined; /** * Whether the short link is archived. */ @@ -145,6 +149,7 @@ export namespace UpsertLinkRequestBody$ { key: z.string().optional(), externalId: z.nullable(z.string()).optional(), prefix: z.string().optional(), + trackConversion: z.boolean().default(false), archived: z.boolean().default(false), publicStats: z.boolean().default(false), tagId: z.nullable(z.string()).optional(), @@ -170,6 +175,7 @@ export namespace UpsertLinkRequestBody$ { ...(v.key === undefined ? null : { key: v.key }), ...(v.externalId === undefined ? null : { externalId: v.externalId }), ...(v.prefix === undefined ? null : { prefix: v.prefix }), + trackConversion: v.trackConversion, archived: v.archived, publicStats: v.publicStats, ...(v.tagId === undefined ? null : { tagId: v.tagId }), @@ -196,6 +202,7 @@ export namespace UpsertLinkRequestBody$ { key?: string | undefined; externalId?: string | null | undefined; prefix?: string | undefined; + trackConversion: boolean; archived: boolean; publicStats: boolean; tagId?: string | null | undefined; @@ -222,6 +229,7 @@ export namespace UpsertLinkRequestBody$ { key: z.string().optional(), externalId: z.nullable(z.string()).optional(), prefix: z.string().optional(), + trackConversion: z.boolean().default(false), archived: z.boolean().default(false), publicStats: z.boolean().default(false), tagId: z.nullable(z.string()).optional(), @@ -247,6 +255,7 @@ export namespace UpsertLinkRequestBody$ { ...(v.key === undefined ? null : { key: v.key }), ...(v.externalId === undefined ? null : { externalId: v.externalId }), ...(v.prefix === undefined ? null : { prefix: v.prefix }), + trackConversion: v.trackConversion, archived: v.archived, publicStats: v.publicStats, ...(v.tagId === undefined ? null : { tagId: v.tagId }), diff --git a/src/sdk/sdk.ts b/src/sdk/sdk.ts index 10084ec..60785d4 100644 --- a/src/sdk/sdk.ts +++ b/src/sdk/sdk.ts @@ -12,6 +12,7 @@ import { Links } from "./links"; import { Metatags } from "./metatags"; import { QRCodes } from "./qrcodes"; import { Tags } from "./tags"; +import { Track } from "./track"; import { Workspaces } from "./workspaces"; export class Dub extends ClientSDK { @@ -71,6 +72,11 @@ export class Dub extends ClientSDK { return (this._domains ??= new Domains(this.options$)); } + private _track?: Track; + get track(): Track { + return (this._track ??= new Track(this.options$)); + } + private _metatags?: Metatags; get metatags(): Metatags { return (this._metatags ??= new Metatags(this.options$)); diff --git a/src/sdk/track.ts b/src/sdk/track.ts new file mode 100644 index 0000000..64acf3c --- /dev/null +++ b/src/sdk/track.ts @@ -0,0 +1,695 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +import { SDKHooks } from "../hooks"; +import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config"; +import * as enc$ from "../lib/encodings"; +import { HTTPClient } from "../lib/http"; +import * as schemas$ from "../lib/schemas"; +import { ClientSDK, RequestOptions } from "../lib/sdks"; +import * as errors from "../models/errors"; +import * as operations from "../models/operations"; + +export class Track extends ClientSDK { + private readonly options$: SDKOptions & { hooks?: SDKHooks }; + + constructor(options: SDKOptions = {}) { + const opt = options as unknown; + let hooks: SDKHooks; + if ( + typeof opt === "object" && + opt != null && + "hooks" in opt && + opt.hooks instanceof SDKHooks + ) { + hooks = opt.hooks; + } else { + hooks = new SDKHooks(); + } + + super({ + client: options.httpClient || new HTTPClient(), + baseURL: serverURLFromOptions(options), + hooks, + }); + + this.options$ = { ...options, hooks }; + void this.options$; + } + + /** + * Track a lead + * + * @remarks + * Track a lead for a short link. + */ + async lead( + request?: operations.TrackLeadRequestBody | undefined, + options?: RequestOptions + ): Promise { + const input$ = request; + const headers$ = new Headers(); + headers$.set("user-agent", SDK_METADATA.userAgent); + headers$.set("Content-Type", "application/json"); + headers$.set("Accept", "application/json"); + + const payload$ = schemas$.parse( + input$, + (value$) => operations.TrackLeadRequestBody$.outboundSchema.optional().parse(value$), + "Input validation failed" + ); + const body$ = + payload$ === undefined ? null : enc$.encodeJSON("body", payload$, { explode: true }); + + const path$ = this.templateURLComponent("/track/lead")(); + + const query$ = ""; + + let security$; + if (typeof this.options$.token === "function") { + security$ = { token: await this.options$.token() }; + } else if (this.options$.token) { + security$ = { token: this.options$.token }; + } else { + security$ = {}; + } + const context = { + operationID: "trackLead", + oAuth2Scopes: [], + securitySource: this.options$.token, + }; + const securitySettings$ = this.resolveGlobalSecurity(security$); + + const doOptions = { + context, + errorCodes: [ + "400", + "401", + "403", + "404", + "409", + "410", + "422", + "429", + "4XX", + "500", + "5XX", + ], + }; + const request$ = this.createRequest$( + context, + { + security: securitySettings$, + method: "POST", + path: path$, + headers: headers$, + query: query$, + body: body$, + }, + options + ); + + const response = await this.do$(request$, doOptions); + + const responseFields$ = { + HttpMeta: { + Response: response, + Request: request$, + }, + }; + + if (this.matchResponse(response, 200, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return operations.TrackLeadResponseBody$.inboundSchema.parse(val$); + }, + "Response validation failed" + ); + return result; + } else if (this.matchResponse(response, 400, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.BadRequest$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else if (this.matchResponse(response, 401, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.Unauthorized$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else if (this.matchResponse(response, 403, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.Forbidden$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else if (this.matchResponse(response, 404, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.NotFound$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else if (this.matchResponse(response, 409, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.Conflict$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else if (this.matchResponse(response, 410, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.InviteExpired$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else if (this.matchResponse(response, 422, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.UnprocessableEntity$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else if (this.matchResponse(response, 429, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.RateLimitExceeded$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else if (this.matchResponse(response, 500, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.InternalServerError$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else { + const responseBody = await response.text(); + throw new errors.SDKError( + "Unexpected API response status or content-type", + response, + responseBody + ); + } + } + + /** + * Track a sale + * + * @remarks + * Track a sale for a short link. + */ + async sale( + request?: operations.TrackSaleRequestBody | undefined, + options?: RequestOptions + ): Promise { + const input$ = request; + const headers$ = new Headers(); + headers$.set("user-agent", SDK_METADATA.userAgent); + headers$.set("Content-Type", "application/json"); + headers$.set("Accept", "application/json"); + + const payload$ = schemas$.parse( + input$, + (value$) => operations.TrackSaleRequestBody$.outboundSchema.optional().parse(value$), + "Input validation failed" + ); + const body$ = + payload$ === undefined ? null : enc$.encodeJSON("body", payload$, { explode: true }); + + const path$ = this.templateURLComponent("/track/sale")(); + + const query$ = ""; + + let security$; + if (typeof this.options$.token === "function") { + security$ = { token: await this.options$.token() }; + } else if (this.options$.token) { + security$ = { token: this.options$.token }; + } else { + security$ = {}; + } + const context = { + operationID: "trackSale", + oAuth2Scopes: [], + securitySource: this.options$.token, + }; + const securitySettings$ = this.resolveGlobalSecurity(security$); + + const doOptions = { + context, + errorCodes: [ + "400", + "401", + "403", + "404", + "409", + "410", + "422", + "429", + "4XX", + "500", + "5XX", + ], + }; + const request$ = this.createRequest$( + context, + { + security: securitySettings$, + method: "POST", + path: path$, + headers: headers$, + query: query$, + body: body$, + }, + options + ); + + const response = await this.do$(request$, doOptions); + + const responseFields$ = { + HttpMeta: { + Response: response, + Request: request$, + }, + }; + + if (this.matchResponse(response, 200, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return operations.TrackSaleResponseBody$.inboundSchema.parse(val$); + }, + "Response validation failed" + ); + return result; + } else if (this.matchResponse(response, 400, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.BadRequest$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else if (this.matchResponse(response, 401, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.Unauthorized$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else if (this.matchResponse(response, 403, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.Forbidden$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else if (this.matchResponse(response, 404, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.NotFound$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else if (this.matchResponse(response, 409, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.Conflict$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else if (this.matchResponse(response, 410, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.InviteExpired$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else if (this.matchResponse(response, 422, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.UnprocessableEntity$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else if (this.matchResponse(response, 429, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.RateLimitExceeded$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else if (this.matchResponse(response, 500, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.InternalServerError$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else { + const responseBody = await response.text(); + throw new errors.SDKError( + "Unexpected API response status or content-type", + response, + responseBody + ); + } + } + + /** + * Track a customer + * + * @remarks + * Track a customer for an authenticated workspace. + */ + async customer( + request?: operations.TrackCustomerRequestBody | undefined, + options?: RequestOptions + ): Promise { + const input$ = request; + const headers$ = new Headers(); + headers$.set("user-agent", SDK_METADATA.userAgent); + headers$.set("Content-Type", "application/json"); + headers$.set("Accept", "application/json"); + + const payload$ = schemas$.parse( + input$, + (value$) => + operations.TrackCustomerRequestBody$.outboundSchema.optional().parse(value$), + "Input validation failed" + ); + const body$ = + payload$ === undefined ? null : enc$.encodeJSON("body", payload$, { explode: true }); + + const path$ = this.templateURLComponent("/track/customer")(); + + const query$ = ""; + + let security$; + if (typeof this.options$.token === "function") { + security$ = { token: await this.options$.token() }; + } else if (this.options$.token) { + security$ = { token: this.options$.token }; + } else { + security$ = {}; + } + const context = { + operationID: "trackCustomer", + oAuth2Scopes: [], + securitySource: this.options$.token, + }; + const securitySettings$ = this.resolveGlobalSecurity(security$); + + const doOptions = { + context, + errorCodes: [ + "400", + "401", + "403", + "404", + "409", + "410", + "422", + "429", + "4XX", + "500", + "5XX", + ], + }; + const request$ = this.createRequest$( + context, + { + security: securitySettings$, + method: "POST", + path: path$, + headers: headers$, + query: query$, + body: body$, + }, + options + ); + + const response = await this.do$(request$, doOptions); + + const responseFields$ = { + HttpMeta: { + Response: response, + Request: request$, + }, + }; + + if (this.matchResponse(response, 200, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return operations.TrackCustomerResponseBody$.inboundSchema.parse(val$); + }, + "Response validation failed" + ); + return result; + } else if (this.matchResponse(response, 400, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.BadRequest$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else if (this.matchResponse(response, 401, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.Unauthorized$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else if (this.matchResponse(response, 403, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.Forbidden$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else if (this.matchResponse(response, 404, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.NotFound$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else if (this.matchResponse(response, 409, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.Conflict$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else if (this.matchResponse(response, 410, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.InviteExpired$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else if (this.matchResponse(response, 422, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.UnprocessableEntity$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else if (this.matchResponse(response, 429, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.RateLimitExceeded$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else if (this.matchResponse(response, 500, "application/json")) { + const responseBody = await response.json(); + const result = schemas$.parse( + responseBody, + (val$) => { + return errors.InternalServerError$.inboundSchema.parse({ + ...responseFields$, + ...val$, + }); + }, + "Response validation failed" + ); + throw result; + } else { + const responseBody = await response.text(); + throw new errors.SDKError( + "Unexpected API response status or content-type", + response, + responseBody + ); + } + } +}