dub 0.45.0 → 0.45.2
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 +15 -2
- package/dist/commonjs/funcs/customersCreate.d.ts +16 -0
- package/dist/commonjs/funcs/customersCreate.d.ts.map +1 -0
- package/dist/commonjs/funcs/customersCreate.js +114 -0
- package/dist/commonjs/funcs/customersCreate.js.map +1 -0
- package/dist/commonjs/funcs/customersDelete.d.ts +16 -0
- package/dist/commonjs/funcs/customersDelete.d.ts.map +1 -0
- package/dist/commonjs/funcs/customersDelete.js +120 -0
- package/dist/commonjs/funcs/customersDelete.js.map +1 -0
- package/dist/commonjs/funcs/customersGet.d.ts +16 -0
- package/dist/commonjs/funcs/customersGet.d.ts.map +1 -0
- package/dist/commonjs/funcs/customersGet.js +117 -0
- package/dist/commonjs/funcs/customersGet.js.map +1 -0
- package/dist/commonjs/funcs/customersList.d.ts +16 -0
- package/dist/commonjs/funcs/customersList.d.ts.map +1 -0
- package/dist/commonjs/funcs/customersList.js +103 -0
- package/dist/commonjs/funcs/customersList.js.map +1 -0
- package/dist/commonjs/funcs/customersUpdate.d.ts +16 -0
- package/dist/commonjs/funcs/customersUpdate.d.ts.map +1 -0
- package/dist/commonjs/funcs/customersUpdate.js +122 -0
- package/dist/commonjs/funcs/customersUpdate.js.map +1 -0
- package/dist/commonjs/funcs/trackCustomer.d.ts +2 -0
- package/dist/commonjs/funcs/trackCustomer.d.ts.map +1 -1
- package/dist/commonjs/funcs/trackCustomer.js +2 -0
- package/dist/commonjs/funcs/trackCustomer.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/leadcreatedevent.d.ts +28 -6
- package/dist/commonjs/models/components/leadcreatedevent.d.ts.map +1 -1
- package/dist/commonjs/models/components/leadcreatedevent.js +10 -6
- package/dist/commonjs/models/components/leadcreatedevent.js.map +1 -1
- package/dist/commonjs/models/components/leadevent.d.ts +26 -4
- package/dist/commonjs/models/components/leadevent.d.ts.map +1 -1
- package/dist/commonjs/models/components/leadevent.js +8 -4
- package/dist/commonjs/models/components/leadevent.js.map +1 -1
- package/dist/commonjs/models/components/salecreatedevent.d.ts +28 -6
- package/dist/commonjs/models/components/salecreatedevent.d.ts.map +1 -1
- package/dist/commonjs/models/components/salecreatedevent.js +10 -6
- package/dist/commonjs/models/components/salecreatedevent.js.map +1 -1
- package/dist/commonjs/models/components/saleevent.d.ts +26 -4
- package/dist/commonjs/models/components/saleevent.d.ts.map +1 -1
- package/dist/commonjs/models/components/saleevent.js +8 -4
- package/dist/commonjs/models/components/saleevent.js.map +1 -1
- package/dist/commonjs/models/components/workspaceschema.d.ts +21 -1
- package/dist/commonjs/models/components/workspaceschema.d.ts.map +1 -1
- package/dist/commonjs/models/components/workspaceschema.js +8 -0
- package/dist/commonjs/models/components/workspaceschema.js.map +1 -1
- package/dist/commonjs/models/operations/createcustomer.d.ts +97 -0
- package/dist/commonjs/models/operations/createcustomer.d.ts.map +1 -0
- package/dist/commonjs/models/operations/createcustomer.js +85 -0
- package/dist/commonjs/models/operations/createcustomer.js.map +1 -0
- package/dist/commonjs/models/operations/deletecustomer.d.ts +57 -0
- package/dist/commonjs/models/operations/deletecustomer.d.ts.map +1 -0
- package/dist/commonjs/models/operations/deletecustomer.js +69 -0
- package/dist/commonjs/models/operations/deletecustomer.js.map +1 -0
- package/dist/commonjs/models/operations/getcustomer.d.ts +82 -0
- package/dist/commonjs/models/operations/getcustomer.d.ts.map +1 -0
- package/dist/commonjs/models/operations/getcustomer.js +79 -0
- package/dist/commonjs/models/operations/getcustomer.js.map +1 -0
- package/dist/commonjs/models/operations/getcustomers.d.ts +53 -0
- package/dist/commonjs/models/operations/getcustomers.d.ts.map +1 -0
- package/dist/commonjs/models/operations/getcustomers.js +60 -0
- package/dist/commonjs/models/operations/getcustomers.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +5 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +5 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/tracklead.d.ts +11 -4
- package/dist/commonjs/models/operations/tracklead.d.ts.map +1 -1
- package/dist/commonjs/models/operations/tracklead.js +6 -4
- package/dist/commonjs/models/operations/tracklead.js.map +1 -1
- package/dist/commonjs/models/operations/tracksale.d.ts +11 -2
- package/dist/commonjs/models/operations/tracksale.d.ts.map +1 -1
- package/dist/commonjs/models/operations/tracksale.js +6 -2
- package/dist/commonjs/models/operations/tracksale.js.map +1 -1
- package/dist/commonjs/models/operations/updatecustomer.d.ts +125 -0
- package/dist/commonjs/models/operations/updatecustomer.d.ts.map +1 -0
- package/dist/commonjs/models/operations/updatecustomer.js +116 -0
- package/dist/commonjs/models/operations/updatecustomer.js.map +1 -0
- package/dist/commonjs/sdk/customers.d.ts +40 -0
- package/dist/commonjs/sdk/customers.d.ts.map +1 -0
- package/dist/commonjs/sdk/customers.js +62 -0
- package/dist/commonjs/sdk/customers.js.map +1 -0
- package/dist/commonjs/sdk/sdk.d.ts +7 -4
- package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
- package/dist/commonjs/sdk/sdk.js +13 -8
- package/dist/commonjs/sdk/sdk.js.map +1 -1
- package/dist/commonjs/sdk/track.d.ts +2 -0
- package/dist/commonjs/sdk/track.d.ts.map +1 -1
- package/dist/commonjs/sdk/track.js +2 -0
- package/dist/commonjs/sdk/track.js.map +1 -1
- package/dist/esm/funcs/customersCreate.d.ts +16 -0
- package/dist/esm/funcs/customersCreate.d.ts.map +1 -0
- package/dist/esm/funcs/customersCreate.js +87 -0
- package/dist/esm/funcs/customersCreate.js.map +1 -0
- package/dist/esm/funcs/customersDelete.d.ts +16 -0
- package/dist/esm/funcs/customersDelete.d.ts.map +1 -0
- package/dist/esm/funcs/customersDelete.js +93 -0
- package/dist/esm/funcs/customersDelete.js.map +1 -0
- package/dist/esm/funcs/customersGet.d.ts +16 -0
- package/dist/esm/funcs/customersGet.d.ts.map +1 -0
- package/dist/esm/funcs/customersGet.js +90 -0
- package/dist/esm/funcs/customersGet.js.map +1 -0
- package/dist/esm/funcs/customersList.d.ts +16 -0
- package/dist/esm/funcs/customersList.d.ts.map +1 -0
- package/dist/esm/funcs/customersList.js +76 -0
- package/dist/esm/funcs/customersList.js.map +1 -0
- package/dist/esm/funcs/customersUpdate.d.ts +16 -0
- package/dist/esm/funcs/customersUpdate.d.ts.map +1 -0
- package/dist/esm/funcs/customersUpdate.js +95 -0
- package/dist/esm/funcs/customersUpdate.js.map +1 -0
- package/dist/esm/funcs/trackCustomer.d.ts +2 -0
- package/dist/esm/funcs/trackCustomer.d.ts.map +1 -1
- package/dist/esm/funcs/trackCustomer.js +2 -0
- package/dist/esm/funcs/trackCustomer.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/leadcreatedevent.d.ts +28 -6
- package/dist/esm/models/components/leadcreatedevent.d.ts.map +1 -1
- package/dist/esm/models/components/leadcreatedevent.js +10 -6
- package/dist/esm/models/components/leadcreatedevent.js.map +1 -1
- package/dist/esm/models/components/leadevent.d.ts +26 -4
- package/dist/esm/models/components/leadevent.d.ts.map +1 -1
- package/dist/esm/models/components/leadevent.js +8 -4
- package/dist/esm/models/components/leadevent.js.map +1 -1
- package/dist/esm/models/components/salecreatedevent.d.ts +28 -6
- package/dist/esm/models/components/salecreatedevent.d.ts.map +1 -1
- package/dist/esm/models/components/salecreatedevent.js +10 -6
- package/dist/esm/models/components/salecreatedevent.js.map +1 -1
- package/dist/esm/models/components/saleevent.d.ts +26 -4
- package/dist/esm/models/components/saleevent.d.ts.map +1 -1
- package/dist/esm/models/components/saleevent.js +8 -4
- package/dist/esm/models/components/saleevent.js.map +1 -1
- package/dist/esm/models/components/workspaceschema.d.ts +21 -1
- package/dist/esm/models/components/workspaceschema.d.ts.map +1 -1
- package/dist/esm/models/components/workspaceschema.js +8 -0
- package/dist/esm/models/components/workspaceschema.js.map +1 -1
- package/dist/esm/models/operations/createcustomer.d.ts +97 -0
- package/dist/esm/models/operations/createcustomer.d.ts.map +1 -0
- package/dist/esm/models/operations/createcustomer.js +59 -0
- package/dist/esm/models/operations/createcustomer.js.map +1 -0
- package/dist/esm/models/operations/deletecustomer.d.ts +57 -0
- package/dist/esm/models/operations/deletecustomer.d.ts.map +1 -0
- package/dist/esm/models/operations/deletecustomer.js +43 -0
- package/dist/esm/models/operations/deletecustomer.js.map +1 -0
- package/dist/esm/models/operations/getcustomer.d.ts +82 -0
- package/dist/esm/models/operations/getcustomer.d.ts.map +1 -0
- package/dist/esm/models/operations/getcustomer.js +53 -0
- package/dist/esm/models/operations/getcustomer.js.map +1 -0
- package/dist/esm/models/operations/getcustomers.d.ts +53 -0
- package/dist/esm/models/operations/getcustomers.d.ts.map +1 -0
- package/dist/esm/models/operations/getcustomers.js +34 -0
- package/dist/esm/models/operations/getcustomers.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +5 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +5 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/tracklead.d.ts +11 -4
- package/dist/esm/models/operations/tracklead.d.ts.map +1 -1
- package/dist/esm/models/operations/tracklead.js +6 -4
- package/dist/esm/models/operations/tracklead.js.map +1 -1
- package/dist/esm/models/operations/tracksale.d.ts +11 -2
- package/dist/esm/models/operations/tracksale.d.ts.map +1 -1
- package/dist/esm/models/operations/tracksale.js +6 -2
- package/dist/esm/models/operations/tracksale.js.map +1 -1
- package/dist/esm/models/operations/updatecustomer.d.ts +125 -0
- package/dist/esm/models/operations/updatecustomer.d.ts.map +1 -0
- package/dist/esm/models/operations/updatecustomer.js +90 -0
- package/dist/esm/models/operations/updatecustomer.js.map +1 -0
- package/dist/esm/sdk/customers.d.ts +40 -0
- package/dist/esm/sdk/customers.d.ts.map +1 -0
- package/dist/esm/sdk/customers.js +58 -0
- package/dist/esm/sdk/customers.js.map +1 -0
- package/dist/esm/sdk/sdk.d.ts +7 -4
- package/dist/esm/sdk/sdk.d.ts.map +1 -1
- package/dist/esm/sdk/sdk.js +13 -8
- package/dist/esm/sdk/sdk.js.map +1 -1
- package/dist/esm/sdk/track.d.ts +2 -0
- package/dist/esm/sdk/track.d.ts.map +1 -1
- package/dist/esm/sdk/track.js +2 -0
- package/dist/esm/sdk/track.js.map +1 -1
- package/docs/sdks/customers/README.md +421 -0
- package/docs/sdks/track/README.md +4 -2
- package/package.json +1 -1
- package/src/funcs/customersCreate.ts +172 -0
- package/src/funcs/customersDelete.ts +177 -0
- package/src/funcs/customersGet.ts +173 -0
- package/src/funcs/customersList.ts +152 -0
- package/src/funcs/customersUpdate.ts +180 -0
- package/src/funcs/trackCustomer.ts +2 -0
- package/src/lib/config.ts +3 -3
- package/src/models/components/leadcreatedevent.ts +38 -12
- package/src/models/components/leadevent.ts +34 -8
- package/src/models/components/salecreatedevent.ts +38 -12
- package/src/models/components/saleevent.ts +34 -8
- package/src/models/components/workspaceschema.ts +29 -1
- package/src/models/operations/createcustomer.ts +150 -0
- package/src/models/operations/deletecustomer.ts +94 -0
- package/src/models/operations/getcustomer.ts +129 -0
- package/src/models/operations/getcustomers.ts +83 -0
- package/src/models/operations/index.ts +5 -0
- package/src/models/operations/tracklead.ts +17 -8
- package/src/models/operations/tracksale.ts +17 -4
- package/src/models/operations/updatecustomer.ts +207 -0
- package/src/sdk/customers.ts +99 -0
- package/src/sdk/sdk.ts +16 -10
- package/src/sdk/track.ts +2 -0
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
# Customers
|
|
2
|
+
(*customers*)
|
|
3
|
+
|
|
4
|
+
## Overview
|
|
5
|
+
|
|
6
|
+
### Available Operations
|
|
7
|
+
|
|
8
|
+
* [list](#list) - Retrieve a list of customers
|
|
9
|
+
* [create](#create) - Create a customer
|
|
10
|
+
* [get](#get) - Retrieve a customer
|
|
11
|
+
* [update](#update) - Update a customer
|
|
12
|
+
* [delete](#delete) - Delete a customer
|
|
13
|
+
|
|
14
|
+
## list
|
|
15
|
+
|
|
16
|
+
Retrieve a list of customers for the authenticated workspace.
|
|
17
|
+
|
|
18
|
+
### Example Usage
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { Dub } from "dub";
|
|
22
|
+
|
|
23
|
+
const dub = new Dub({
|
|
24
|
+
token: "DUB_API_KEY",
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
async function run() {
|
|
28
|
+
const result = await dub.customers.list();
|
|
29
|
+
|
|
30
|
+
// Handle the result
|
|
31
|
+
console.log(result);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
run();
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Standalone function
|
|
38
|
+
|
|
39
|
+
The standalone function version of this method:
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import { DubCore } from "dub/core.js";
|
|
43
|
+
import { customersList } from "dub/funcs/customersList.js";
|
|
44
|
+
|
|
45
|
+
// Use `DubCore` for best tree-shaking performance.
|
|
46
|
+
// You can create one instance of it to use across an application.
|
|
47
|
+
const dub = new DubCore({
|
|
48
|
+
token: "DUB_API_KEY",
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
async function run() {
|
|
52
|
+
const res = await customersList(dub);
|
|
53
|
+
|
|
54
|
+
if (!res.ok) {
|
|
55
|
+
throw res.error;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const { value: result } = res;
|
|
59
|
+
|
|
60
|
+
// Handle the result
|
|
61
|
+
console.log(result);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
run();
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Parameters
|
|
68
|
+
|
|
69
|
+
| Parameter | Type | Required | Description |
|
|
70
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
71
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
72
|
+
| `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. |
|
|
73
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
74
|
+
|
|
75
|
+
### Response
|
|
76
|
+
|
|
77
|
+
**Promise\<[operations.ResponseBody[]](../../models/.md)\>**
|
|
78
|
+
|
|
79
|
+
### Errors
|
|
80
|
+
|
|
81
|
+
| Error Type | Status Code | Content Type |
|
|
82
|
+
| -------------------------- | -------------------------- | -------------------------- |
|
|
83
|
+
| errors.BadRequest | 400 | application/json |
|
|
84
|
+
| errors.Unauthorized | 401 | application/json |
|
|
85
|
+
| errors.Forbidden | 403 | application/json |
|
|
86
|
+
| errors.NotFound | 404 | application/json |
|
|
87
|
+
| errors.Conflict | 409 | application/json |
|
|
88
|
+
| errors.InviteExpired | 410 | application/json |
|
|
89
|
+
| errors.UnprocessableEntity | 422 | application/json |
|
|
90
|
+
| errors.RateLimitExceeded | 429 | application/json |
|
|
91
|
+
| errors.InternalServerError | 500 | application/json |
|
|
92
|
+
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
93
|
+
|
|
94
|
+
## create
|
|
95
|
+
|
|
96
|
+
Create a customer for the authenticated workspace.
|
|
97
|
+
|
|
98
|
+
### Example Usage
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
import { Dub } from "dub";
|
|
102
|
+
|
|
103
|
+
const dub = new Dub({
|
|
104
|
+
token: "DUB_API_KEY",
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
async function run() {
|
|
108
|
+
const result = await dub.customers.create();
|
|
109
|
+
|
|
110
|
+
// Handle the result
|
|
111
|
+
console.log(result);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
run();
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Standalone function
|
|
118
|
+
|
|
119
|
+
The standalone function version of this method:
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
import { DubCore } from "dub/core.js";
|
|
123
|
+
import { customersCreate } from "dub/funcs/customersCreate.js";
|
|
124
|
+
|
|
125
|
+
// Use `DubCore` for best tree-shaking performance.
|
|
126
|
+
// You can create one instance of it to use across an application.
|
|
127
|
+
const dub = new DubCore({
|
|
128
|
+
token: "DUB_API_KEY",
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
async function run() {
|
|
132
|
+
const res = await customersCreate(dub);
|
|
133
|
+
|
|
134
|
+
if (!res.ok) {
|
|
135
|
+
throw res.error;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const { value: result } = res;
|
|
139
|
+
|
|
140
|
+
// Handle the result
|
|
141
|
+
console.log(result);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
run();
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Parameters
|
|
148
|
+
|
|
149
|
+
| Parameter | Type | Required | Description |
|
|
150
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
151
|
+
| `request` | [operations.CreateCustomerRequestBody](../../models/operations/createcustomerrequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
152
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
153
|
+
| `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. |
|
|
154
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
155
|
+
|
|
156
|
+
### Response
|
|
157
|
+
|
|
158
|
+
**Promise\<[operations.CreateCustomerResponseBody](../../models/operations/createcustomerresponsebody.md)\>**
|
|
159
|
+
|
|
160
|
+
### Errors
|
|
161
|
+
|
|
162
|
+
| Error Type | Status Code | Content Type |
|
|
163
|
+
| -------------------------- | -------------------------- | -------------------------- |
|
|
164
|
+
| errors.BadRequest | 400 | application/json |
|
|
165
|
+
| errors.Unauthorized | 401 | application/json |
|
|
166
|
+
| errors.Forbidden | 403 | application/json |
|
|
167
|
+
| errors.NotFound | 404 | application/json |
|
|
168
|
+
| errors.Conflict | 409 | application/json |
|
|
169
|
+
| errors.InviteExpired | 410 | application/json |
|
|
170
|
+
| errors.UnprocessableEntity | 422 | application/json |
|
|
171
|
+
| errors.RateLimitExceeded | 429 | application/json |
|
|
172
|
+
| errors.InternalServerError | 500 | application/json |
|
|
173
|
+
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
174
|
+
|
|
175
|
+
## get
|
|
176
|
+
|
|
177
|
+
Retrieve a customer by ID for the authenticated workspace.
|
|
178
|
+
|
|
179
|
+
### Example Usage
|
|
180
|
+
|
|
181
|
+
```typescript
|
|
182
|
+
import { Dub } from "dub";
|
|
183
|
+
|
|
184
|
+
const dub = new Dub({
|
|
185
|
+
token: "DUB_API_KEY",
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
async function run() {
|
|
189
|
+
const result = await dub.customers.get({
|
|
190
|
+
id: "<id>",
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
// Handle the result
|
|
194
|
+
console.log(result);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
run();
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Standalone function
|
|
201
|
+
|
|
202
|
+
The standalone function version of this method:
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
import { DubCore } from "dub/core.js";
|
|
206
|
+
import { customersGet } from "dub/funcs/customersGet.js";
|
|
207
|
+
|
|
208
|
+
// Use `DubCore` for best tree-shaking performance.
|
|
209
|
+
// You can create one instance of it to use across an application.
|
|
210
|
+
const dub = new DubCore({
|
|
211
|
+
token: "DUB_API_KEY",
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
async function run() {
|
|
215
|
+
const res = await customersGet(dub, {
|
|
216
|
+
id: "<id>",
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
if (!res.ok) {
|
|
220
|
+
throw res.error;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const { value: result } = res;
|
|
224
|
+
|
|
225
|
+
// Handle the result
|
|
226
|
+
console.log(result);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
run();
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Parameters
|
|
233
|
+
|
|
234
|
+
| Parameter | Type | Required | Description |
|
|
235
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
236
|
+
| `request` | [operations.GetCustomerRequest](../../models/operations/getcustomerrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
237
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
238
|
+
| `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. |
|
|
239
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
240
|
+
|
|
241
|
+
### Response
|
|
242
|
+
|
|
243
|
+
**Promise\<[operations.GetCustomerResponseBody](../../models/operations/getcustomerresponsebody.md)\>**
|
|
244
|
+
|
|
245
|
+
### Errors
|
|
246
|
+
|
|
247
|
+
| Error Type | Status Code | Content Type |
|
|
248
|
+
| -------------------------- | -------------------------- | -------------------------- |
|
|
249
|
+
| errors.BadRequest | 400 | application/json |
|
|
250
|
+
| errors.Unauthorized | 401 | application/json |
|
|
251
|
+
| errors.Forbidden | 403 | application/json |
|
|
252
|
+
| errors.NotFound | 404 | application/json |
|
|
253
|
+
| errors.Conflict | 409 | application/json |
|
|
254
|
+
| errors.InviteExpired | 410 | application/json |
|
|
255
|
+
| errors.UnprocessableEntity | 422 | application/json |
|
|
256
|
+
| errors.RateLimitExceeded | 429 | application/json |
|
|
257
|
+
| errors.InternalServerError | 500 | application/json |
|
|
258
|
+
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
259
|
+
|
|
260
|
+
## update
|
|
261
|
+
|
|
262
|
+
Update a customer for the authenticated workspace.
|
|
263
|
+
|
|
264
|
+
### Example Usage
|
|
265
|
+
|
|
266
|
+
```typescript
|
|
267
|
+
import { Dub } from "dub";
|
|
268
|
+
|
|
269
|
+
const dub = new Dub({
|
|
270
|
+
token: "DUB_API_KEY",
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
async function run() {
|
|
274
|
+
const result = await dub.customers.update("<id>");
|
|
275
|
+
|
|
276
|
+
// Handle the result
|
|
277
|
+
console.log(result);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
run();
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Standalone function
|
|
284
|
+
|
|
285
|
+
The standalone function version of this method:
|
|
286
|
+
|
|
287
|
+
```typescript
|
|
288
|
+
import { DubCore } from "dub/core.js";
|
|
289
|
+
import { customersUpdate } from "dub/funcs/customersUpdate.js";
|
|
290
|
+
|
|
291
|
+
// Use `DubCore` for best tree-shaking performance.
|
|
292
|
+
// You can create one instance of it to use across an application.
|
|
293
|
+
const dub = new DubCore({
|
|
294
|
+
token: "DUB_API_KEY",
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
async function run() {
|
|
298
|
+
const res = await customersUpdate(dub, "<id>");
|
|
299
|
+
|
|
300
|
+
if (!res.ok) {
|
|
301
|
+
throw res.error;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const { value: result } = res;
|
|
305
|
+
|
|
306
|
+
// Handle the result
|
|
307
|
+
console.log(result);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
run();
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Parameters
|
|
314
|
+
|
|
315
|
+
| Parameter | Type | Required | Description |
|
|
316
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
317
|
+
| `id` | *string* | :heavy_check_mark: | The unique identifier of the customer in Dub. |
|
|
318
|
+
| `requestBody` | [operations.UpdateCustomerRequestBody](../../models/operations/updatecustomerrequestbody.md) | :heavy_minus_sign: | N/A |
|
|
319
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
320
|
+
| `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. |
|
|
321
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
322
|
+
|
|
323
|
+
### Response
|
|
324
|
+
|
|
325
|
+
**Promise\<[operations.UpdateCustomerResponseBody](../../models/operations/updatecustomerresponsebody.md)\>**
|
|
326
|
+
|
|
327
|
+
### Errors
|
|
328
|
+
|
|
329
|
+
| Error Type | Status Code | Content Type |
|
|
330
|
+
| -------------------------- | -------------------------- | -------------------------- |
|
|
331
|
+
| errors.BadRequest | 400 | application/json |
|
|
332
|
+
| errors.Unauthorized | 401 | application/json |
|
|
333
|
+
| errors.Forbidden | 403 | application/json |
|
|
334
|
+
| errors.NotFound | 404 | application/json |
|
|
335
|
+
| errors.Conflict | 409 | application/json |
|
|
336
|
+
| errors.InviteExpired | 410 | application/json |
|
|
337
|
+
| errors.UnprocessableEntity | 422 | application/json |
|
|
338
|
+
| errors.RateLimitExceeded | 429 | application/json |
|
|
339
|
+
| errors.InternalServerError | 500 | application/json |
|
|
340
|
+
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
341
|
+
|
|
342
|
+
## delete
|
|
343
|
+
|
|
344
|
+
Delete a customer from a workspace.
|
|
345
|
+
|
|
346
|
+
### Example Usage
|
|
347
|
+
|
|
348
|
+
```typescript
|
|
349
|
+
import { Dub } from "dub";
|
|
350
|
+
|
|
351
|
+
const dub = new Dub({
|
|
352
|
+
token: "DUB_API_KEY",
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
async function run() {
|
|
356
|
+
const result = await dub.customers.delete("<id>");
|
|
357
|
+
|
|
358
|
+
// Handle the result
|
|
359
|
+
console.log(result);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
run();
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### Standalone function
|
|
366
|
+
|
|
367
|
+
The standalone function version of this method:
|
|
368
|
+
|
|
369
|
+
```typescript
|
|
370
|
+
import { DubCore } from "dub/core.js";
|
|
371
|
+
import { customersDelete } from "dub/funcs/customersDelete.js";
|
|
372
|
+
|
|
373
|
+
// Use `DubCore` for best tree-shaking performance.
|
|
374
|
+
// You can create one instance of it to use across an application.
|
|
375
|
+
const dub = new DubCore({
|
|
376
|
+
token: "DUB_API_KEY",
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
async function run() {
|
|
380
|
+
const res = await customersDelete(dub, "<id>");
|
|
381
|
+
|
|
382
|
+
if (!res.ok) {
|
|
383
|
+
throw res.error;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
const { value: result } = res;
|
|
387
|
+
|
|
388
|
+
// Handle the result
|
|
389
|
+
console.log(result);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
run();
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
### Parameters
|
|
396
|
+
|
|
397
|
+
| Parameter | Type | Required | Description |
|
|
398
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
399
|
+
| `id` | *string* | :heavy_check_mark: | The unique identifier of the customer in Dub. |
|
|
400
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
401
|
+
| `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. |
|
|
402
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
403
|
+
|
|
404
|
+
### Response
|
|
405
|
+
|
|
406
|
+
**Promise\<[operations.DeleteCustomerResponseBody](../../models/operations/deletecustomerresponsebody.md)\>**
|
|
407
|
+
|
|
408
|
+
### Errors
|
|
409
|
+
|
|
410
|
+
| Error Type | Status Code | Content Type |
|
|
411
|
+
| -------------------------- | -------------------------- | -------------------------- |
|
|
412
|
+
| errors.BadRequest | 400 | application/json |
|
|
413
|
+
| errors.Unauthorized | 401 | application/json |
|
|
414
|
+
| errors.Forbidden | 403 | application/json |
|
|
415
|
+
| errors.NotFound | 404 | application/json |
|
|
416
|
+
| errors.Conflict | 409 | application/json |
|
|
417
|
+
| errors.InviteExpired | 410 | application/json |
|
|
418
|
+
| errors.UnprocessableEntity | 422 | application/json |
|
|
419
|
+
| errors.RateLimitExceeded | 429 | application/json |
|
|
420
|
+
| errors.InternalServerError | 500 | application/json |
|
|
421
|
+
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
* [lead](#lead) - Track a lead
|
|
9
9
|
* [sale](#sale) - Track a sale
|
|
10
|
-
* [customer](#customer) - Track a customer
|
|
10
|
+
* [~~customer~~](#customer) - Track a customer :warning: **Deprecated**
|
|
11
11
|
|
|
12
12
|
## lead
|
|
13
13
|
|
|
@@ -171,10 +171,12 @@ run();
|
|
|
171
171
|
| errors.InternalServerError | 500 | application/json |
|
|
172
172
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
173
173
|
|
|
174
|
-
## customer
|
|
174
|
+
## ~~customer~~
|
|
175
175
|
|
|
176
176
|
Track a customer for an authenticated workspace.
|
|
177
177
|
|
|
178
|
+
> :warning: **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
179
|
+
|
|
178
180
|
### Example Usage
|
|
179
181
|
|
|
180
182
|
```typescript
|
package/package.json
CHANGED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { DubCore } from "../core.js";
|
|
6
|
+
import { encodeJSON } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { safeParse } from "../lib/schemas.js";
|
|
9
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import {
|
|
13
|
+
ConnectionError,
|
|
14
|
+
InvalidRequestError,
|
|
15
|
+
RequestAbortedError,
|
|
16
|
+
RequestTimeoutError,
|
|
17
|
+
UnexpectedClientError,
|
|
18
|
+
} from "../models/errors/httpclienterrors.js";
|
|
19
|
+
import * as errors from "../models/errors/index.js";
|
|
20
|
+
import { SDKError } from "../models/errors/sdkerror.js";
|
|
21
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
22
|
+
import * as operations from "../models/operations/index.js";
|
|
23
|
+
import { Result } from "../types/fp.js";
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Create a customer
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* Create a customer for the authenticated workspace.
|
|
30
|
+
*/
|
|
31
|
+
export async function customersCreate(
|
|
32
|
+
client: DubCore,
|
|
33
|
+
request?: operations.CreateCustomerRequestBody | undefined,
|
|
34
|
+
options?: RequestOptions,
|
|
35
|
+
): Promise<
|
|
36
|
+
Result<
|
|
37
|
+
operations.CreateCustomerResponseBody,
|
|
38
|
+
| errors.BadRequest
|
|
39
|
+
| errors.Unauthorized
|
|
40
|
+
| errors.Forbidden
|
|
41
|
+
| errors.NotFound
|
|
42
|
+
| errors.Conflict
|
|
43
|
+
| errors.InviteExpired
|
|
44
|
+
| errors.UnprocessableEntity
|
|
45
|
+
| errors.RateLimitExceeded
|
|
46
|
+
| errors.InternalServerError
|
|
47
|
+
| SDKError
|
|
48
|
+
| SDKValidationError
|
|
49
|
+
| UnexpectedClientError
|
|
50
|
+
| InvalidRequestError
|
|
51
|
+
| RequestAbortedError
|
|
52
|
+
| RequestTimeoutError
|
|
53
|
+
| ConnectionError
|
|
54
|
+
>
|
|
55
|
+
> {
|
|
56
|
+
const parsed = safeParse(
|
|
57
|
+
request,
|
|
58
|
+
(value) =>
|
|
59
|
+
operations.CreateCustomerRequestBody$outboundSchema.optional().parse(
|
|
60
|
+
value,
|
|
61
|
+
),
|
|
62
|
+
"Input validation failed",
|
|
63
|
+
);
|
|
64
|
+
if (!parsed.ok) {
|
|
65
|
+
return parsed;
|
|
66
|
+
}
|
|
67
|
+
const payload = parsed.value;
|
|
68
|
+
const body = payload === undefined
|
|
69
|
+
? null
|
|
70
|
+
: encodeJSON("body", payload, { explode: true });
|
|
71
|
+
|
|
72
|
+
const path = pathToFunc("/customers")();
|
|
73
|
+
|
|
74
|
+
const headers = new Headers({
|
|
75
|
+
"Content-Type": "application/json",
|
|
76
|
+
Accept: "application/json",
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const secConfig = await extractSecurity(client._options.token);
|
|
80
|
+
const securityInput = secConfig == null ? {} : { token: secConfig };
|
|
81
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
82
|
+
|
|
83
|
+
const context = {
|
|
84
|
+
operationID: "createCustomer",
|
|
85
|
+
oAuth2Scopes: [],
|
|
86
|
+
|
|
87
|
+
resolvedSecurity: requestSecurity,
|
|
88
|
+
|
|
89
|
+
securitySource: client._options.token,
|
|
90
|
+
retryConfig: options?.retries
|
|
91
|
+
|| client._options.retryConfig
|
|
92
|
+
|| { strategy: "none" },
|
|
93
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const requestRes = client._createRequest(context, {
|
|
97
|
+
security: requestSecurity,
|
|
98
|
+
method: "POST",
|
|
99
|
+
path: path,
|
|
100
|
+
headers: headers,
|
|
101
|
+
body: body,
|
|
102
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
103
|
+
}, options);
|
|
104
|
+
if (!requestRes.ok) {
|
|
105
|
+
return requestRes;
|
|
106
|
+
}
|
|
107
|
+
const req = requestRes.value;
|
|
108
|
+
|
|
109
|
+
const doResult = await client._do(req, {
|
|
110
|
+
context,
|
|
111
|
+
errorCodes: [
|
|
112
|
+
"400",
|
|
113
|
+
"401",
|
|
114
|
+
"403",
|
|
115
|
+
"404",
|
|
116
|
+
"409",
|
|
117
|
+
"410",
|
|
118
|
+
"422",
|
|
119
|
+
"429",
|
|
120
|
+
"4XX",
|
|
121
|
+
"500",
|
|
122
|
+
"5XX",
|
|
123
|
+
],
|
|
124
|
+
retryConfig: context.retryConfig,
|
|
125
|
+
retryCodes: context.retryCodes,
|
|
126
|
+
});
|
|
127
|
+
if (!doResult.ok) {
|
|
128
|
+
return doResult;
|
|
129
|
+
}
|
|
130
|
+
const response = doResult.value;
|
|
131
|
+
|
|
132
|
+
const responseFields = {
|
|
133
|
+
HttpMeta: { Response: response, Request: req },
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const [result] = await M.match<
|
|
137
|
+
operations.CreateCustomerResponseBody,
|
|
138
|
+
| errors.BadRequest
|
|
139
|
+
| errors.Unauthorized
|
|
140
|
+
| errors.Forbidden
|
|
141
|
+
| errors.NotFound
|
|
142
|
+
| errors.Conflict
|
|
143
|
+
| errors.InviteExpired
|
|
144
|
+
| errors.UnprocessableEntity
|
|
145
|
+
| errors.RateLimitExceeded
|
|
146
|
+
| errors.InternalServerError
|
|
147
|
+
| SDKError
|
|
148
|
+
| SDKValidationError
|
|
149
|
+
| UnexpectedClientError
|
|
150
|
+
| InvalidRequestError
|
|
151
|
+
| RequestAbortedError
|
|
152
|
+
| RequestTimeoutError
|
|
153
|
+
| ConnectionError
|
|
154
|
+
>(
|
|
155
|
+
M.json(201, operations.CreateCustomerResponseBody$inboundSchema),
|
|
156
|
+
M.jsonErr(400, errors.BadRequest$inboundSchema),
|
|
157
|
+
M.jsonErr(401, errors.Unauthorized$inboundSchema),
|
|
158
|
+
M.jsonErr(403, errors.Forbidden$inboundSchema),
|
|
159
|
+
M.jsonErr(404, errors.NotFound$inboundSchema),
|
|
160
|
+
M.jsonErr(409, errors.Conflict$inboundSchema),
|
|
161
|
+
M.jsonErr(410, errors.InviteExpired$inboundSchema),
|
|
162
|
+
M.jsonErr(422, errors.UnprocessableEntity$inboundSchema),
|
|
163
|
+
M.jsonErr(429, errors.RateLimitExceeded$inboundSchema),
|
|
164
|
+
M.jsonErr(500, errors.InternalServerError$inboundSchema),
|
|
165
|
+
M.fail(["4XX", "5XX"]),
|
|
166
|
+
)(response, { extraFields: responseFields });
|
|
167
|
+
if (!result.ok) {
|
|
168
|
+
return result;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return result;
|
|
172
|
+
}
|