dub 0.72.0 → 0.72.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/commonjs/funcs/commissionsCreate.d.ts +18 -0
- package/dist/commonjs/funcs/commissionsCreate.d.ts.map +1 -0
- package/dist/commonjs/funcs/commissionsCreate.js +121 -0
- package/dist/commonjs/funcs/commissionsCreate.js.map +1 -0
- package/dist/commonjs/funcs/linksList.js +0 -3
- package/dist/commonjs/funcs/linksList.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/models/components/commissioncreatedevent.d.ts +2 -2
- package/dist/commonjs/models/components/commissioncreatedevent.d.ts.map +1 -1
- package/dist/commonjs/models/components/commissioncreatedevent.js +2 -2
- package/dist/commonjs/models/components/commissioncreatedevent.js.map +1 -1
- package/dist/commonjs/models/components/leadcreatedevent.d.ts +2 -2
- package/dist/commonjs/models/components/leadcreatedevent.d.ts.map +1 -1
- package/dist/commonjs/models/components/leadcreatedevent.js +2 -2
- package/dist/commonjs/models/components/leadcreatedevent.js.map +1 -1
- package/dist/commonjs/models/components/salecreatedevent.d.ts +2 -2
- package/dist/commonjs/models/components/salecreatedevent.d.ts.map +1 -1
- package/dist/commonjs/models/components/salecreatedevent.js +2 -2
- package/dist/commonjs/models/components/salecreatedevent.js.map +1 -1
- package/dist/commonjs/models/operations/createcommission.d.ts +227 -0
- package/dist/commonjs/models/operations/createcommission.d.ts.map +1 -0
- package/dist/commonjs/models/operations/createcommission.js +131 -0
- package/dist/commonjs/models/operations/createcommission.js.map +1 -0
- package/dist/commonjs/models/operations/getcustomer.d.ts +1 -1
- package/dist/commonjs/models/operations/getcustomer.d.ts.map +1 -1
- package/dist/commonjs/models/operations/getcustomer.js +1 -1
- package/dist/commonjs/models/operations/getcustomer.js.map +1 -1
- package/dist/commonjs/models/operations/getcustomers.d.ts +1 -1
- package/dist/commonjs/models/operations/getcustomers.d.ts.map +1 -1
- package/dist/commonjs/models/operations/getcustomers.js +1 -1
- package/dist/commonjs/models/operations/getcustomers.js.map +1 -1
- package/dist/commonjs/models/operations/getlinks.d.ts +0 -63
- package/dist/commonjs/models/operations/getlinks.d.ts.map +1 -1
- package/dist/commonjs/models/operations/getlinks.js +1 -39
- package/dist/commonjs/models/operations/getlinks.js.map +1 -1
- package/dist/commonjs/models/operations/gettags.d.ts +8 -8
- package/dist/commonjs/models/operations/gettags.d.ts.map +1 -1
- package/dist/commonjs/models/operations/gettags.js +7 -7
- package/dist/commonjs/models/operations/gettags.js.map +1 -1
- package/dist/commonjs/models/operations/index.d.ts +1 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +1 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/listcommissions.d.ts +1 -1
- package/dist/commonjs/models/operations/listcommissions.d.ts.map +1 -1
- package/dist/commonjs/models/operations/listcommissions.js +1 -1
- package/dist/commonjs/models/operations/listcommissions.js.map +1 -1
- package/dist/commonjs/models/operations/listevents.d.ts +10 -10
- package/dist/commonjs/models/operations/listevents.d.ts.map +1 -1
- package/dist/commonjs/models/operations/listevents.js +11 -9
- package/dist/commonjs/models/operations/listevents.js.map +1 -1
- package/dist/commonjs/models/operations/tracklead.d.ts +4 -4
- package/dist/commonjs/models/operations/tracklead.d.ts.map +1 -1
- package/dist/commonjs/models/operations/tracklead.js +6 -6
- package/dist/commonjs/models/operations/tracklead.js.map +1 -1
- package/dist/commonjs/models/operations/updatecommission.d.ts +1 -1
- package/dist/commonjs/models/operations/updatecommission.d.ts.map +1 -1
- package/dist/commonjs/models/operations/updatecommission.js +1 -1
- package/dist/commonjs/models/operations/updatecommission.js.map +1 -1
- package/dist/commonjs/models/operations/updatecustomer.d.ts +1 -1
- package/dist/commonjs/models/operations/updatecustomer.d.ts.map +1 -1
- package/dist/commonjs/models/operations/updatecustomer.js +1 -1
- package/dist/commonjs/models/operations/updatecustomer.js.map +1 -1
- package/dist/commonjs/sdk/commissions.d.ts +7 -0
- package/dist/commonjs/sdk/commissions.d.ts.map +1 -1
- package/dist/commonjs/sdk/commissions.js +10 -0
- package/dist/commonjs/sdk/commissions.js.map +1 -1
- package/dist/esm/funcs/commissionsCreate.d.ts +18 -0
- package/dist/esm/funcs/commissionsCreate.d.ts.map +1 -0
- package/dist/esm/funcs/commissionsCreate.js +85 -0
- package/dist/esm/funcs/commissionsCreate.js.map +1 -0
- package/dist/esm/funcs/linksList.js +0 -3
- package/dist/esm/funcs/linksList.js.map +1 -1
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/models/components/commissioncreatedevent.d.ts +2 -2
- package/dist/esm/models/components/commissioncreatedevent.d.ts.map +1 -1
- package/dist/esm/models/components/commissioncreatedevent.js +2 -2
- package/dist/esm/models/components/commissioncreatedevent.js.map +1 -1
- package/dist/esm/models/components/leadcreatedevent.d.ts +2 -2
- package/dist/esm/models/components/leadcreatedevent.d.ts.map +1 -1
- package/dist/esm/models/components/leadcreatedevent.js +2 -2
- package/dist/esm/models/components/leadcreatedevent.js.map +1 -1
- package/dist/esm/models/components/salecreatedevent.d.ts +2 -2
- package/dist/esm/models/components/salecreatedevent.d.ts.map +1 -1
- package/dist/esm/models/components/salecreatedevent.js +2 -2
- package/dist/esm/models/components/salecreatedevent.js.map +1 -1
- package/dist/esm/models/operations/createcommission.d.ts +227 -0
- package/dist/esm/models/operations/createcommission.d.ts.map +1 -0
- package/dist/esm/models/operations/createcommission.js +88 -0
- package/dist/esm/models/operations/createcommission.js.map +1 -0
- package/dist/esm/models/operations/getcustomer.d.ts +1 -1
- package/dist/esm/models/operations/getcustomer.d.ts.map +1 -1
- package/dist/esm/models/operations/getcustomer.js +1 -1
- package/dist/esm/models/operations/getcustomer.js.map +1 -1
- package/dist/esm/models/operations/getcustomers.d.ts +1 -1
- package/dist/esm/models/operations/getcustomers.d.ts.map +1 -1
- package/dist/esm/models/operations/getcustomers.js +1 -1
- package/dist/esm/models/operations/getcustomers.js.map +1 -1
- package/dist/esm/models/operations/getlinks.d.ts +0 -63
- package/dist/esm/models/operations/getlinks.d.ts.map +1 -1
- package/dist/esm/models/operations/getlinks.js +0 -38
- package/dist/esm/models/operations/getlinks.js.map +1 -1
- package/dist/esm/models/operations/gettags.d.ts +8 -8
- package/dist/esm/models/operations/gettags.d.ts.map +1 -1
- package/dist/esm/models/operations/gettags.js +6 -6
- package/dist/esm/models/operations/gettags.js.map +1 -1
- package/dist/esm/models/operations/index.d.ts +1 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +1 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/listcommissions.d.ts +1 -1
- package/dist/esm/models/operations/listcommissions.d.ts.map +1 -1
- package/dist/esm/models/operations/listcommissions.js +1 -1
- package/dist/esm/models/operations/listcommissions.js.map +1 -1
- package/dist/esm/models/operations/listevents.d.ts +10 -10
- package/dist/esm/models/operations/listevents.d.ts.map +1 -1
- package/dist/esm/models/operations/listevents.js +10 -8
- package/dist/esm/models/operations/listevents.js.map +1 -1
- package/dist/esm/models/operations/tracklead.d.ts +4 -4
- package/dist/esm/models/operations/tracklead.d.ts.map +1 -1
- package/dist/esm/models/operations/tracklead.js +4 -4
- package/dist/esm/models/operations/tracklead.js.map +1 -1
- package/dist/esm/models/operations/updatecommission.d.ts +1 -1
- package/dist/esm/models/operations/updatecommission.d.ts.map +1 -1
- package/dist/esm/models/operations/updatecommission.js +1 -1
- package/dist/esm/models/operations/updatecommission.js.map +1 -1
- package/dist/esm/models/operations/updatecustomer.d.ts +1 -1
- package/dist/esm/models/operations/updatecustomer.d.ts.map +1 -1
- package/dist/esm/models/operations/updatecustomer.js +1 -1
- package/dist/esm/models/operations/updatecustomer.js.map +1 -1
- package/dist/esm/sdk/commissions.d.ts +7 -0
- package/dist/esm/sdk/commissions.d.ts.map +1 -1
- package/dist/esm/sdk/commissions.js +10 -0
- package/dist/esm/sdk/commissions.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/commissionsCreate.ts +208 -0
- package/src/funcs/linksList.ts +0 -3
- package/src/lib/config.ts +3 -3
- package/src/models/components/commissioncreatedevent.ts +4 -4
- package/src/models/components/leadcreatedevent.ts +4 -4
- package/src/models/components/salecreatedevent.ts +4 -4
- package/src/models/operations/createcommission.ts +369 -0
- package/src/models/operations/getcustomer.ts +2 -2
- package/src/models/operations/getcustomers.ts +2 -2
- package/src/models/operations/getlinks.ts +0 -76
- package/src/models/operations/gettags.ts +14 -18
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/listcommissions.ts +2 -2
- package/src/models/operations/listevents.ts +16 -18
- package/src/models/operations/tracklead.ts +9 -9
- package/src/models/operations/updatecommission.ts +2 -2
- package/src/models/operations/updatecustomer.ts +2 -2
- package/src/sdk/commissions.ts +18 -0
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The full customer object to associate the commission with. Useful for creating the customer on demand.
|
|
12
|
+
*/
|
|
13
|
+
export type RequestBodyCustomer = {
|
|
14
|
+
/**
|
|
15
|
+
* The customer's email address.
|
|
16
|
+
*/
|
|
17
|
+
email?: string | null | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* The customer's name. If not provided, the email address will be used, and if email is not provided, a random name will be generated.
|
|
20
|
+
*/
|
|
21
|
+
name?: string | null | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* The customer's avatar URL. If not provided, a random avatar will be generated.
|
|
24
|
+
*/
|
|
25
|
+
avatar?: string | null | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* The customer's unique identifier your database. This is useful for associating subsequent conversion events from Dub's API to your internal systems.
|
|
28
|
+
*/
|
|
29
|
+
externalId: string;
|
|
30
|
+
/**
|
|
31
|
+
* The customer's Stripe customer ID. This is useful for attributing recurring sale events to the partner who referred the customer.
|
|
32
|
+
*/
|
|
33
|
+
stripeCustomerId?: string | null | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* The customer's country in ISO 3166-1 alpha-2 format. Updating this field will only affect the customer's country in Dub's system (and has no effect on existing conversion events).
|
|
36
|
+
*/
|
|
37
|
+
country: string;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type RequestBody3 = {
|
|
41
|
+
type: "sale";
|
|
42
|
+
/**
|
|
43
|
+
* The ID of the partner to create the commission for.
|
|
44
|
+
*/
|
|
45
|
+
partnerId: string;
|
|
46
|
+
/**
|
|
47
|
+
* The customer ID to associate the commission with. Useful if the customer was already created in a prior operation and you want to associate the commission with it.
|
|
48
|
+
*/
|
|
49
|
+
customerId?: string | null | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* The full customer object to associate the commission with. Useful for creating the customer on demand.
|
|
52
|
+
*/
|
|
53
|
+
customer?: RequestBodyCustomer | null | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* The partner link ID to associate the commission with. If not provided, default to the link with the most revenue.
|
|
56
|
+
*/
|
|
57
|
+
linkId?: string | null | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* When `true`, import all unimported paid Stripe invoices for the customer and create a commission for each. When `false`, create a single manual sale event using `saleAmount`.
|
|
60
|
+
*/
|
|
61
|
+
importStripeInvoices?: boolean | null | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Required when `importStripeInvoices` is `false`. The sale amount in cents for the manual sale event. Ignored when importing from Stripe.
|
|
64
|
+
*/
|
|
65
|
+
saleAmount?: number | null | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Only used when `importStripeInvoices` is `false`. The date of the manual sale event. Defaults to the current date and time if not provided.
|
|
68
|
+
*/
|
|
69
|
+
saleEventDate?: string | null | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Only used when `importStripeInvoices` is `false`. An optional invoice ID to attach to the generated sale event and commission entry for deduplication.
|
|
72
|
+
*/
|
|
73
|
+
invoiceId?: string | null | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Only used when `importStripeInvoices` is `false`. An optional product ID stored on the sale event metadata – will also impact commission earnings calculation (if a `Sale` `Product ID` modifier is set).
|
|
76
|
+
*/
|
|
77
|
+
productId?: string | null | undefined;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The full customer object to associate the commission with. Useful for creating the customer on demand.
|
|
82
|
+
*/
|
|
83
|
+
export type Customer = {
|
|
84
|
+
/**
|
|
85
|
+
* The customer's email address.
|
|
86
|
+
*/
|
|
87
|
+
email?: string | null | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* The customer's name. If not provided, the email address will be used, and if email is not provided, a random name will be generated.
|
|
90
|
+
*/
|
|
91
|
+
name?: string | null | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* The customer's avatar URL. If not provided, a random avatar will be generated.
|
|
94
|
+
*/
|
|
95
|
+
avatar?: string | null | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* The customer's unique identifier your database. This is useful for associating subsequent conversion events from Dub's API to your internal systems.
|
|
98
|
+
*/
|
|
99
|
+
externalId: string;
|
|
100
|
+
/**
|
|
101
|
+
* The customer's Stripe customer ID. This is useful for attributing recurring sale events to the partner who referred the customer.
|
|
102
|
+
*/
|
|
103
|
+
stripeCustomerId?: string | null | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* The customer's country in ISO 3166-1 alpha-2 format. Updating this field will only affect the customer's country in Dub's system (and has no effect on existing conversion events).
|
|
106
|
+
*/
|
|
107
|
+
country: string;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export type RequestBody2 = {
|
|
111
|
+
type: "lead";
|
|
112
|
+
/**
|
|
113
|
+
* The ID of the partner to create the commission for.
|
|
114
|
+
*/
|
|
115
|
+
partnerId: string;
|
|
116
|
+
/**
|
|
117
|
+
* The customer ID to associate the commission with. Useful if the customer was already created in a prior operation and you want to associate the commission with it.
|
|
118
|
+
*/
|
|
119
|
+
customerId?: string | null | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* The full customer object to associate the commission with. Useful for creating the customer on demand.
|
|
122
|
+
*/
|
|
123
|
+
customer?: Customer | null | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* The partner link ID to associate the commission with. If not provided, default to the link with the most revenue.
|
|
126
|
+
*/
|
|
127
|
+
linkId?: string | null | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* The date and time of the lead event. If not provided, defaults to the current date and time.
|
|
130
|
+
*/
|
|
131
|
+
leadEventDate?: string | null | undefined;
|
|
132
|
+
/**
|
|
133
|
+
* The name of the lead event. If not provided, defaults to 'Sign up'.
|
|
134
|
+
*/
|
|
135
|
+
leadEventName?: string | null | undefined;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export type RequestBody1 = {
|
|
139
|
+
type: "custom";
|
|
140
|
+
/**
|
|
141
|
+
* The ID of the partner to create the commission for.
|
|
142
|
+
*/
|
|
143
|
+
partnerId: string;
|
|
144
|
+
/**
|
|
145
|
+
* The commission amount in cents.
|
|
146
|
+
*/
|
|
147
|
+
amount: number;
|
|
148
|
+
/**
|
|
149
|
+
* If not provided, the current date will be used.
|
|
150
|
+
*/
|
|
151
|
+
date?: string | null | undefined;
|
|
152
|
+
/**
|
|
153
|
+
* The description of the commission.
|
|
154
|
+
*/
|
|
155
|
+
description?: string | null | undefined;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export type CreateCommissionRequestBody =
|
|
159
|
+
| RequestBody1
|
|
160
|
+
| RequestBody2
|
|
161
|
+
| RequestBody3;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* The request was accepted and commission creation was queued.
|
|
165
|
+
*/
|
|
166
|
+
export type CreateCommissionResponseBody = {
|
|
167
|
+
success: boolean;
|
|
168
|
+
message: string;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
/** @internal */
|
|
172
|
+
export type RequestBodyCustomer$Outbound = {
|
|
173
|
+
email?: string | null | undefined;
|
|
174
|
+
name?: string | null | undefined;
|
|
175
|
+
avatar?: string | null | undefined;
|
|
176
|
+
externalId: string;
|
|
177
|
+
stripeCustomerId?: string | null | undefined;
|
|
178
|
+
country: string;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
/** @internal */
|
|
182
|
+
export const RequestBodyCustomer$outboundSchema: z.ZodType<
|
|
183
|
+
RequestBodyCustomer$Outbound,
|
|
184
|
+
z.ZodTypeDef,
|
|
185
|
+
RequestBodyCustomer
|
|
186
|
+
> = z.object({
|
|
187
|
+
email: z.nullable(z.string()).optional(),
|
|
188
|
+
name: z.nullable(z.string()).optional(),
|
|
189
|
+
avatar: z.nullable(z.string()).optional(),
|
|
190
|
+
externalId: z.string(),
|
|
191
|
+
stripeCustomerId: z.nullable(z.string()).optional(),
|
|
192
|
+
country: z.string(),
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
export function requestBodyCustomerToJSON(
|
|
196
|
+
requestBodyCustomer: RequestBodyCustomer,
|
|
197
|
+
): string {
|
|
198
|
+
return JSON.stringify(
|
|
199
|
+
RequestBodyCustomer$outboundSchema.parse(requestBodyCustomer),
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/** @internal */
|
|
204
|
+
export type RequestBody3$Outbound = {
|
|
205
|
+
type: "sale";
|
|
206
|
+
partnerId: string;
|
|
207
|
+
customerId?: string | null | undefined;
|
|
208
|
+
customer?: RequestBodyCustomer$Outbound | null | undefined;
|
|
209
|
+
linkId?: string | null | undefined;
|
|
210
|
+
importStripeInvoices: boolean | null;
|
|
211
|
+
saleAmount?: number | null | undefined;
|
|
212
|
+
saleEventDate?: string | null | undefined;
|
|
213
|
+
invoiceId?: string | null | undefined;
|
|
214
|
+
productId?: string | null | undefined;
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
/** @internal */
|
|
218
|
+
export const RequestBody3$outboundSchema: z.ZodType<
|
|
219
|
+
RequestBody3$Outbound,
|
|
220
|
+
z.ZodTypeDef,
|
|
221
|
+
RequestBody3
|
|
222
|
+
> = z.object({
|
|
223
|
+
type: z.literal("sale"),
|
|
224
|
+
partnerId: z.string(),
|
|
225
|
+
customerId: z.nullable(z.string()).optional(),
|
|
226
|
+
customer: z.nullable(z.lazy(() => RequestBodyCustomer$outboundSchema))
|
|
227
|
+
.optional(),
|
|
228
|
+
linkId: z.nullable(z.string()).optional(),
|
|
229
|
+
importStripeInvoices: z.nullable(z.boolean().default(false)),
|
|
230
|
+
saleAmount: z.nullable(z.number()).optional(),
|
|
231
|
+
saleEventDate: z.nullable(z.string()).optional(),
|
|
232
|
+
invoiceId: z.nullable(z.string()).optional(),
|
|
233
|
+
productId: z.nullable(z.string()).optional(),
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
export function requestBody3ToJSON(requestBody3: RequestBody3): string {
|
|
237
|
+
return JSON.stringify(RequestBody3$outboundSchema.parse(requestBody3));
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/** @internal */
|
|
241
|
+
export type Customer$Outbound = {
|
|
242
|
+
email?: string | null | undefined;
|
|
243
|
+
name?: string | null | undefined;
|
|
244
|
+
avatar?: string | null | undefined;
|
|
245
|
+
externalId: string;
|
|
246
|
+
stripeCustomerId?: string | null | undefined;
|
|
247
|
+
country: string;
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
/** @internal */
|
|
251
|
+
export const Customer$outboundSchema: z.ZodType<
|
|
252
|
+
Customer$Outbound,
|
|
253
|
+
z.ZodTypeDef,
|
|
254
|
+
Customer
|
|
255
|
+
> = z.object({
|
|
256
|
+
email: z.nullable(z.string()).optional(),
|
|
257
|
+
name: z.nullable(z.string()).optional(),
|
|
258
|
+
avatar: z.nullable(z.string()).optional(),
|
|
259
|
+
externalId: z.string(),
|
|
260
|
+
stripeCustomerId: z.nullable(z.string()).optional(),
|
|
261
|
+
country: z.string(),
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
export function customerToJSON(customer: Customer): string {
|
|
265
|
+
return JSON.stringify(Customer$outboundSchema.parse(customer));
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/** @internal */
|
|
269
|
+
export type RequestBody2$Outbound = {
|
|
270
|
+
type: "lead";
|
|
271
|
+
partnerId: string;
|
|
272
|
+
customerId?: string | null | undefined;
|
|
273
|
+
customer?: Customer$Outbound | null | undefined;
|
|
274
|
+
linkId?: string | null | undefined;
|
|
275
|
+
leadEventDate?: string | null | undefined;
|
|
276
|
+
leadEventName: string | null;
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
/** @internal */
|
|
280
|
+
export const RequestBody2$outboundSchema: z.ZodType<
|
|
281
|
+
RequestBody2$Outbound,
|
|
282
|
+
z.ZodTypeDef,
|
|
283
|
+
RequestBody2
|
|
284
|
+
> = z.object({
|
|
285
|
+
type: z.literal("lead"),
|
|
286
|
+
partnerId: z.string(),
|
|
287
|
+
customerId: z.nullable(z.string()).optional(),
|
|
288
|
+
customer: z.nullable(z.lazy(() => Customer$outboundSchema)).optional(),
|
|
289
|
+
linkId: z.nullable(z.string()).optional(),
|
|
290
|
+
leadEventDate: z.nullable(z.string()).optional(),
|
|
291
|
+
leadEventName: z.nullable(z.string().default("Sign up")),
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
export function requestBody2ToJSON(requestBody2: RequestBody2): string {
|
|
295
|
+
return JSON.stringify(RequestBody2$outboundSchema.parse(requestBody2));
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/** @internal */
|
|
299
|
+
export type RequestBody1$Outbound = {
|
|
300
|
+
type: "custom";
|
|
301
|
+
partnerId: string;
|
|
302
|
+
amount: number;
|
|
303
|
+
date?: string | null | undefined;
|
|
304
|
+
description?: string | null | undefined;
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
/** @internal */
|
|
308
|
+
export const RequestBody1$outboundSchema: z.ZodType<
|
|
309
|
+
RequestBody1$Outbound,
|
|
310
|
+
z.ZodTypeDef,
|
|
311
|
+
RequestBody1
|
|
312
|
+
> = z.object({
|
|
313
|
+
type: z.literal("custom"),
|
|
314
|
+
partnerId: z.string(),
|
|
315
|
+
amount: z.number(),
|
|
316
|
+
date: z.nullable(z.string()).optional(),
|
|
317
|
+
description: z.nullable(z.string()).optional(),
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
export function requestBody1ToJSON(requestBody1: RequestBody1): string {
|
|
321
|
+
return JSON.stringify(RequestBody1$outboundSchema.parse(requestBody1));
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/** @internal */
|
|
325
|
+
export type CreateCommissionRequestBody$Outbound =
|
|
326
|
+
| RequestBody1$Outbound
|
|
327
|
+
| RequestBody2$Outbound
|
|
328
|
+
| RequestBody3$Outbound;
|
|
329
|
+
|
|
330
|
+
/** @internal */
|
|
331
|
+
export const CreateCommissionRequestBody$outboundSchema: z.ZodType<
|
|
332
|
+
CreateCommissionRequestBody$Outbound,
|
|
333
|
+
z.ZodTypeDef,
|
|
334
|
+
CreateCommissionRequestBody
|
|
335
|
+
> = z.union([
|
|
336
|
+
z.lazy(() => RequestBody1$outboundSchema),
|
|
337
|
+
z.lazy(() => RequestBody2$outboundSchema),
|
|
338
|
+
z.lazy(() => RequestBody3$outboundSchema),
|
|
339
|
+
]);
|
|
340
|
+
|
|
341
|
+
export function createCommissionRequestBodyToJSON(
|
|
342
|
+
createCommissionRequestBody: CreateCommissionRequestBody,
|
|
343
|
+
): string {
|
|
344
|
+
return JSON.stringify(
|
|
345
|
+
CreateCommissionRequestBody$outboundSchema.parse(
|
|
346
|
+
createCommissionRequestBody,
|
|
347
|
+
),
|
|
348
|
+
);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/** @internal */
|
|
352
|
+
export const CreateCommissionResponseBody$inboundSchema: z.ZodType<
|
|
353
|
+
CreateCommissionResponseBody,
|
|
354
|
+
z.ZodTypeDef,
|
|
355
|
+
unknown
|
|
356
|
+
> = z.object({
|
|
357
|
+
success: z.boolean(),
|
|
358
|
+
message: z.string(),
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
export function createCommissionResponseBodyFromJSON(
|
|
362
|
+
jsonString: string,
|
|
363
|
+
): SafeParseResult<CreateCommissionResponseBody, SDKValidationError> {
|
|
364
|
+
return safeParse(
|
|
365
|
+
jsonString,
|
|
366
|
+
(x) => CreateCommissionResponseBody$inboundSchema.parse(JSON.parse(x)),
|
|
367
|
+
`Failed to parse 'CreateCommissionResponseBody' from JSON`,
|
|
368
|
+
);
|
|
369
|
+
}
|
|
@@ -93,7 +93,7 @@ export type GetCustomerResponseBody = {
|
|
|
93
93
|
/**
|
|
94
94
|
* Name of the customer.
|
|
95
95
|
*/
|
|
96
|
-
name
|
|
96
|
+
name?: string | null | undefined;
|
|
97
97
|
/**
|
|
98
98
|
* Email of the customer.
|
|
99
99
|
*/
|
|
@@ -248,7 +248,7 @@ export const GetCustomerResponseBody$inboundSchema: z.ZodType<
|
|
|
248
248
|
unknown
|
|
249
249
|
> = z.object({
|
|
250
250
|
id: z.string(),
|
|
251
|
-
name: z.string(),
|
|
251
|
+
name: z.nullable(z.string()).optional(),
|
|
252
252
|
email: z.nullable(z.string()).optional(),
|
|
253
253
|
avatar: z.nullable(z.string()).optional(),
|
|
254
254
|
externalId: z.string(),
|
|
@@ -169,7 +169,7 @@ export type GetCustomersResponseBody = {
|
|
|
169
169
|
/**
|
|
170
170
|
* Name of the customer.
|
|
171
171
|
*/
|
|
172
|
-
name
|
|
172
|
+
name?: string | null | undefined;
|
|
173
173
|
/**
|
|
174
174
|
* Email of the customer.
|
|
175
175
|
*/
|
|
@@ -362,7 +362,7 @@ export const GetCustomersResponseBody$inboundSchema: z.ZodType<
|
|
|
362
362
|
unknown
|
|
363
363
|
> = z.object({
|
|
364
364
|
id: z.string(),
|
|
365
|
-
name: z.string(),
|
|
365
|
+
name: z.nullable(z.string()).optional(),
|
|
366
366
|
email: z.nullable(z.string()).optional(),
|
|
367
367
|
avatar: z.nullable(z.string()).optional(),
|
|
368
368
|
externalId: z.string(),
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
6
|
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
-
import { ClosedEnum } from "../../types/enums.js";
|
|
9
8
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
10
9
|
import * as components from "../components/index.js";
|
|
11
10
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
@@ -20,50 +19,6 @@ export type QueryParamTagIds = string | Array<string>;
|
|
|
20
19
|
*/
|
|
21
20
|
export type QueryParamTagNames = string | Array<string>;
|
|
22
21
|
|
|
23
|
-
/**
|
|
24
|
-
* The field to sort the links by. The default is `createdAt`.
|
|
25
|
-
*/
|
|
26
|
-
export const SortBy = {
|
|
27
|
-
CreatedAt: "createdAt",
|
|
28
|
-
Clicks: "clicks",
|
|
29
|
-
SaleAmount: "saleAmount",
|
|
30
|
-
LastClicked: "lastClicked",
|
|
31
|
-
} as const;
|
|
32
|
-
/**
|
|
33
|
-
* The field to sort the links by. The default is `createdAt`.
|
|
34
|
-
*/
|
|
35
|
-
export type SortBy = ClosedEnum<typeof SortBy>;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* The sort order. The default is `desc`.
|
|
39
|
-
*/
|
|
40
|
-
export const SortOrder = {
|
|
41
|
-
Asc: "asc",
|
|
42
|
-
Desc: "desc",
|
|
43
|
-
} as const;
|
|
44
|
-
/**
|
|
45
|
-
* The sort order. The default is `desc`.
|
|
46
|
-
*/
|
|
47
|
-
export type SortOrder = ClosedEnum<typeof SortOrder>;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* DEPRECATED. Use `sortBy` instead.
|
|
51
|
-
*
|
|
52
|
-
* @deprecated enum: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
53
|
-
*/
|
|
54
|
-
export const Sort = {
|
|
55
|
-
CreatedAt: "createdAt",
|
|
56
|
-
Clicks: "clicks",
|
|
57
|
-
SaleAmount: "saleAmount",
|
|
58
|
-
LastClicked: "lastClicked",
|
|
59
|
-
} as const;
|
|
60
|
-
/**
|
|
61
|
-
* DEPRECATED. Use `sortBy` instead.
|
|
62
|
-
*
|
|
63
|
-
* @deprecated enum: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
64
|
-
*/
|
|
65
|
-
export type Sort = ClosedEnum<typeof Sort>;
|
|
66
|
-
|
|
67
22
|
export type GetLinksRequest = {
|
|
68
23
|
/**
|
|
69
24
|
* The domain to filter the links by. E.g. `ac.me`. If not provided, all links for the workspace will be returned.
|
|
@@ -105,18 +60,6 @@ export type GetLinksRequest = {
|
|
|
105
60
|
* DEPRECATED. Filter for links that have at least one tag assigned to them.
|
|
106
61
|
*/
|
|
107
62
|
withTags?: boolean | undefined;
|
|
108
|
-
/**
|
|
109
|
-
* The field to sort the links by. The default is `createdAt`.
|
|
110
|
-
*/
|
|
111
|
-
sortBy?: SortBy | undefined;
|
|
112
|
-
/**
|
|
113
|
-
* The sort order. The default is `desc`.
|
|
114
|
-
*/
|
|
115
|
-
sortOrder?: SortOrder | undefined;
|
|
116
|
-
/**
|
|
117
|
-
* DEPRECATED. Use `sortBy` instead.
|
|
118
|
-
*/
|
|
119
|
-
sort?: Sort | undefined;
|
|
120
63
|
/**
|
|
121
64
|
* If specified, the query only searches for results before this cursor. Mutually exclusive with `startingAfter`.
|
|
122
65
|
*/
|
|
@@ -175,19 +118,6 @@ export function queryParamTagNamesToJSON(
|
|
|
175
118
|
);
|
|
176
119
|
}
|
|
177
120
|
|
|
178
|
-
/** @internal */
|
|
179
|
-
export const SortBy$outboundSchema: z.ZodNativeEnum<typeof SortBy> = z
|
|
180
|
-
.nativeEnum(SortBy);
|
|
181
|
-
|
|
182
|
-
/** @internal */
|
|
183
|
-
export const SortOrder$outboundSchema: z.ZodNativeEnum<typeof SortOrder> = z
|
|
184
|
-
.nativeEnum(SortOrder);
|
|
185
|
-
|
|
186
|
-
/** @internal */
|
|
187
|
-
export const Sort$outboundSchema: z.ZodNativeEnum<typeof Sort> = z.nativeEnum(
|
|
188
|
-
Sort,
|
|
189
|
-
);
|
|
190
|
-
|
|
191
121
|
/** @internal */
|
|
192
122
|
export type GetLinksRequest$Outbound = {
|
|
193
123
|
domain?: string | undefined;
|
|
@@ -200,9 +130,6 @@ export type GetLinksRequest$Outbound = {
|
|
|
200
130
|
tenantId?: string | undefined;
|
|
201
131
|
showArchived: boolean;
|
|
202
132
|
withTags: boolean;
|
|
203
|
-
sortBy: string;
|
|
204
|
-
sortOrder: string;
|
|
205
|
-
sort: string;
|
|
206
133
|
endingBefore?: string | undefined;
|
|
207
134
|
startingAfter?: string | undefined;
|
|
208
135
|
page?: number | undefined;
|
|
@@ -225,9 +152,6 @@ export const GetLinksRequest$outboundSchema: z.ZodType<
|
|
|
225
152
|
tenantId: z.string().optional(),
|
|
226
153
|
showArchived: z.boolean().default(false),
|
|
227
154
|
withTags: z.boolean().default(false),
|
|
228
|
-
sortBy: SortBy$outboundSchema.default("createdAt"),
|
|
229
|
-
sortOrder: SortOrder$outboundSchema.default("desc"),
|
|
230
|
-
sort: Sort$outboundSchema.default("createdAt"),
|
|
231
155
|
endingBefore: z.string().optional(),
|
|
232
156
|
startingAfter: z.string().optional(),
|
|
233
157
|
page: z.number().optional(),
|
|
@@ -8,30 +8,26 @@ import { ClosedEnum } from "../../types/enums.js";
|
|
|
8
8
|
/**
|
|
9
9
|
* The field to sort the tags by.
|
|
10
10
|
*/
|
|
11
|
-
export const
|
|
11
|
+
export const QueryParamSortBy = {
|
|
12
12
|
Name: "name",
|
|
13
13
|
CreatedAt: "createdAt",
|
|
14
14
|
} as const;
|
|
15
15
|
/**
|
|
16
16
|
* The field to sort the tags by.
|
|
17
17
|
*/
|
|
18
|
-
export type
|
|
19
|
-
typeof GetTagsQueryParamSortBy
|
|
20
|
-
>;
|
|
18
|
+
export type QueryParamSortBy = ClosedEnum<typeof QueryParamSortBy>;
|
|
21
19
|
|
|
22
20
|
/**
|
|
23
21
|
* The order to sort the tags by.
|
|
24
22
|
*/
|
|
25
|
-
export const
|
|
23
|
+
export const QueryParamSortOrder = {
|
|
26
24
|
Asc: "asc",
|
|
27
25
|
Desc: "desc",
|
|
28
26
|
} as const;
|
|
29
27
|
/**
|
|
30
28
|
* The order to sort the tags by.
|
|
31
29
|
*/
|
|
32
|
-
export type
|
|
33
|
-
typeof GetTagsQueryParamSortOrder
|
|
34
|
-
>;
|
|
30
|
+
export type QueryParamSortOrder = ClosedEnum<typeof QueryParamSortOrder>;
|
|
35
31
|
|
|
36
32
|
/**
|
|
37
33
|
* IDs of tags to filter by.
|
|
@@ -42,11 +38,11 @@ export type GetTagsRequest = {
|
|
|
42
38
|
/**
|
|
43
39
|
* The field to sort the tags by.
|
|
44
40
|
*/
|
|
45
|
-
sortBy?:
|
|
41
|
+
sortBy?: QueryParamSortBy | undefined;
|
|
46
42
|
/**
|
|
47
43
|
* The order to sort the tags by.
|
|
48
44
|
*/
|
|
49
|
-
sortOrder?:
|
|
45
|
+
sortOrder?: QueryParamSortOrder | undefined;
|
|
50
46
|
/**
|
|
51
47
|
* The search term to filter the tags by.
|
|
52
48
|
*/
|
|
@@ -66,14 +62,14 @@ export type GetTagsRequest = {
|
|
|
66
62
|
};
|
|
67
63
|
|
|
68
64
|
/** @internal */
|
|
69
|
-
export const
|
|
70
|
-
typeof
|
|
71
|
-
> = z.nativeEnum(
|
|
65
|
+
export const QueryParamSortBy$outboundSchema: z.ZodNativeEnum<
|
|
66
|
+
typeof QueryParamSortBy
|
|
67
|
+
> = z.nativeEnum(QueryParamSortBy);
|
|
72
68
|
|
|
73
69
|
/** @internal */
|
|
74
|
-
export const
|
|
75
|
-
typeof
|
|
76
|
-
> = z.nativeEnum(
|
|
70
|
+
export const QueryParamSortOrder$outboundSchema: z.ZodNativeEnum<
|
|
71
|
+
typeof QueryParamSortOrder
|
|
72
|
+
> = z.nativeEnum(QueryParamSortOrder);
|
|
77
73
|
|
|
78
74
|
/** @internal */
|
|
79
75
|
export type Ids$Outbound = string | Array<string>;
|
|
@@ -102,8 +98,8 @@ export const GetTagsRequest$outboundSchema: z.ZodType<
|
|
|
102
98
|
z.ZodTypeDef,
|
|
103
99
|
GetTagsRequest
|
|
104
100
|
> = z.object({
|
|
105
|
-
sortBy:
|
|
106
|
-
sortOrder:
|
|
101
|
+
sortBy: QueryParamSortBy$outboundSchema.default("name"),
|
|
102
|
+
sortOrder: QueryParamSortOrder$outboundSchema.default("asc"),
|
|
107
103
|
search: z.string().optional(),
|
|
108
104
|
ids: z.union([z.string(), z.array(z.string())]).optional(),
|
|
109
105
|
page: z.number().optional(),
|
|
@@ -10,6 +10,7 @@ export * from "./bulkdeletelinks.js";
|
|
|
10
10
|
export * from "./bulkupdatecommissions.js";
|
|
11
11
|
export * from "./bulkupdatelinks.js";
|
|
12
12
|
export * from "./checkdomainstatus.js";
|
|
13
|
+
export * from "./createcommission.js";
|
|
13
14
|
export * from "./createdomain.js";
|
|
14
15
|
export * from "./createfolder.js";
|
|
15
16
|
export * from "./createlink.js";
|
|
@@ -225,7 +225,7 @@ export type ListCommissionsCustomer = {
|
|
|
225
225
|
/**
|
|
226
226
|
* Name of the customer.
|
|
227
227
|
*/
|
|
228
|
-
name
|
|
228
|
+
name?: string | null | undefined;
|
|
229
229
|
/**
|
|
230
230
|
* Email of the customer.
|
|
231
231
|
*/
|
|
@@ -420,7 +420,7 @@ export const ListCommissionsCustomer$inboundSchema: z.ZodType<
|
|
|
420
420
|
unknown
|
|
421
421
|
> = z.object({
|
|
422
422
|
id: z.string(),
|
|
423
|
-
name: z.string(),
|
|
423
|
+
name: z.nullable(z.string()).optional(),
|
|
424
424
|
email: z.nullable(z.string()).optional(),
|
|
425
425
|
avatar: z.nullable(z.string()).optional(),
|
|
426
426
|
externalId: z.string(),
|