ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.294.0

This commit is contained in:
speakeasybot
2024-05-21 18:57:58 +00:00
parent 7d385b7729
commit c7d895b495
34 changed files with 1962 additions and 381 deletions

View File

@@ -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

View File

@@ -12,7 +12,7 @@ generation:
auth:
oAuth2ClientCredentialsEnabled: false
typescript:
version: 0.29.5
version: 0.29.6
additionalDependencies:
dependencies: {}
devDependencies:

View File

@@ -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

View File

@@ -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

View File

@@ -307,3 +307,13 @@ Based on:
- [typescript v0.29.5] .
### Releases
- [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 - .

File diff suppressed because it is too large Load Diff

View File

@@ -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. |
| `betaTester` | *boolean* | :heavy_minus_sign: | Whether the workspace is enrolled in the beta testing program. |

View File

@@ -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.<br/><br/>The unique ID of the tag assigned to the short link. This field is deprecated use `tagIds` instead. | |

View File

@@ -0,0 +1,12 @@
# PaymentProcessor
The payment processor via which the sale was made.
## Values
| Name | Value |
| --------- | --------- |
| `Stripe` | stripe |
| `Shopify` | shopify |
| `Paddle` | paddle |

View File

@@ -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.<br/><br/>The unique ID of the tag assigned to the short link. This field is deprecated use `tagIds` instead. | |

View File

@@ -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. |

View File

@@ -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 |

View File

@@ -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<string, *any*> | :heavy_minus_sign: | Additional metadata to be stored with the lead event | |

View File

@@ -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<string, *any*> | :heavy_check_mark: | N/A |

View File

@@ -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<string, *any*> | :heavy_minus_sign: | Additional metadata to be stored with the sale event. |

View File

@@ -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<string, *any*> | :heavy_check_mark: | N/A |

View File

@@ -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.<br/><br/>The unique ID of the tag assigned to the short link. This field is deprecated use `tagIds` instead. | |

View File

@@ -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.<br/><br/>The unique ID of the tag assigned to the short link. This field is deprecated use `tagIds` instead. | |

172
docs/sdks/track/README.md Normal file
View File

@@ -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: "<value>",
});
async function run() {
const result = await dub.track.lead({
clickId: "<value>",
eventName: "Signup",
customerId: "<value>",
});
// 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: "<value>",
});
async function run() {
const result = await dub.track.sale({
customerId: "<value>",
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: "<value>",
});
async function run() {
const result = await dub.track.customer({
customerId: "<value>",
});
// 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 | */* |

View File

@@ -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",

4
package-lock.json generated
View File

@@ -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",

View File

@@ -1,6 +1,6 @@
{
"name": "dub",
"version": "0.29.5",
"version": "0.29.6",
"author": "Dub",
"main": "./index.js",
"sideEffects": false,

View File

@@ -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;

View File

@@ -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<Users$.Outbound>;
domains: Array<Domains$.Outbound>;
inviteCode: string | null;
betaTester?: boolean | undefined;
};
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, WorkspaceSchema> = 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 }),
};
});
}

View File

@@ -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 }),

View File

@@ -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 }),

View File

@@ -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";

View File

@@ -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<TrackCustomerRequestBody, z.ZodTypeDef, unknown> = 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<Outbound, z.ZodTypeDef, TrackCustomerRequestBody> = 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<TrackCustomerResponseBody, z.ZodTypeDef, unknown> = 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<Outbound, z.ZodTypeDef, TrackCustomerResponseBody> = 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,
};
});
}

View File

@@ -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<TrackLeadRequestBody, z.ZodTypeDef, unknown> = 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<Outbound, z.ZodTypeDef, TrackLeadRequestBody> = 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<TrackLeadResponseBody, z.ZodTypeDef, unknown> = 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<Outbound, z.ZodTypeDef, TrackLeadResponseBody> = 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,
};
});
}

View File

@@ -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<typeof PaymentProcessor>;
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<TrackSaleRequestBody, z.ZodTypeDef, unknown> = 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<Outbound, z.ZodTypeDef, TrackSaleRequestBody> = 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<TrackSaleResponseBody, z.ZodTypeDef, unknown> = 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<Outbound, z.ZodTypeDef, TrackSaleResponseBody> = 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,
};
});
}

View File

@@ -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 }),

View File

@@ -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 }),

View File

@@ -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$));

695
src/sdk/track.ts Normal file
View File

@@ -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<operations.TrackLeadResponseBody> {
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<operations.TrackSaleResponseBody> {
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<operations.TrackCustomerResponseBody> {
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
);
}
}
}