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.
Files changed (207) hide show
  1. package/README.md +15 -2
  2. package/dist/commonjs/funcs/customersCreate.d.ts +16 -0
  3. package/dist/commonjs/funcs/customersCreate.d.ts.map +1 -0
  4. package/dist/commonjs/funcs/customersCreate.js +114 -0
  5. package/dist/commonjs/funcs/customersCreate.js.map +1 -0
  6. package/dist/commonjs/funcs/customersDelete.d.ts +16 -0
  7. package/dist/commonjs/funcs/customersDelete.d.ts.map +1 -0
  8. package/dist/commonjs/funcs/customersDelete.js +120 -0
  9. package/dist/commonjs/funcs/customersDelete.js.map +1 -0
  10. package/dist/commonjs/funcs/customersGet.d.ts +16 -0
  11. package/dist/commonjs/funcs/customersGet.d.ts.map +1 -0
  12. package/dist/commonjs/funcs/customersGet.js +117 -0
  13. package/dist/commonjs/funcs/customersGet.js.map +1 -0
  14. package/dist/commonjs/funcs/customersList.d.ts +16 -0
  15. package/dist/commonjs/funcs/customersList.d.ts.map +1 -0
  16. package/dist/commonjs/funcs/customersList.js +103 -0
  17. package/dist/commonjs/funcs/customersList.js.map +1 -0
  18. package/dist/commonjs/funcs/customersUpdate.d.ts +16 -0
  19. package/dist/commonjs/funcs/customersUpdate.d.ts.map +1 -0
  20. package/dist/commonjs/funcs/customersUpdate.js +122 -0
  21. package/dist/commonjs/funcs/customersUpdate.js.map +1 -0
  22. package/dist/commonjs/funcs/trackCustomer.d.ts +2 -0
  23. package/dist/commonjs/funcs/trackCustomer.d.ts.map +1 -1
  24. package/dist/commonjs/funcs/trackCustomer.js +2 -0
  25. package/dist/commonjs/funcs/trackCustomer.js.map +1 -1
  26. package/dist/commonjs/lib/config.d.ts +3 -3
  27. package/dist/commonjs/lib/config.js +3 -3
  28. package/dist/commonjs/models/components/leadcreatedevent.d.ts +28 -6
  29. package/dist/commonjs/models/components/leadcreatedevent.d.ts.map +1 -1
  30. package/dist/commonjs/models/components/leadcreatedevent.js +10 -6
  31. package/dist/commonjs/models/components/leadcreatedevent.js.map +1 -1
  32. package/dist/commonjs/models/components/leadevent.d.ts +26 -4
  33. package/dist/commonjs/models/components/leadevent.d.ts.map +1 -1
  34. package/dist/commonjs/models/components/leadevent.js +8 -4
  35. package/dist/commonjs/models/components/leadevent.js.map +1 -1
  36. package/dist/commonjs/models/components/salecreatedevent.d.ts +28 -6
  37. package/dist/commonjs/models/components/salecreatedevent.d.ts.map +1 -1
  38. package/dist/commonjs/models/components/salecreatedevent.js +10 -6
  39. package/dist/commonjs/models/components/salecreatedevent.js.map +1 -1
  40. package/dist/commonjs/models/components/saleevent.d.ts +26 -4
  41. package/dist/commonjs/models/components/saleevent.d.ts.map +1 -1
  42. package/dist/commonjs/models/components/saleevent.js +8 -4
  43. package/dist/commonjs/models/components/saleevent.js.map +1 -1
  44. package/dist/commonjs/models/components/workspaceschema.d.ts +21 -1
  45. package/dist/commonjs/models/components/workspaceschema.d.ts.map +1 -1
  46. package/dist/commonjs/models/components/workspaceschema.js +8 -0
  47. package/dist/commonjs/models/components/workspaceschema.js.map +1 -1
  48. package/dist/commonjs/models/operations/createcustomer.d.ts +97 -0
  49. package/dist/commonjs/models/operations/createcustomer.d.ts.map +1 -0
  50. package/dist/commonjs/models/operations/createcustomer.js +85 -0
  51. package/dist/commonjs/models/operations/createcustomer.js.map +1 -0
  52. package/dist/commonjs/models/operations/deletecustomer.d.ts +57 -0
  53. package/dist/commonjs/models/operations/deletecustomer.d.ts.map +1 -0
  54. package/dist/commonjs/models/operations/deletecustomer.js +69 -0
  55. package/dist/commonjs/models/operations/deletecustomer.js.map +1 -0
  56. package/dist/commonjs/models/operations/getcustomer.d.ts +82 -0
  57. package/dist/commonjs/models/operations/getcustomer.d.ts.map +1 -0
  58. package/dist/commonjs/models/operations/getcustomer.js +79 -0
  59. package/dist/commonjs/models/operations/getcustomer.js.map +1 -0
  60. package/dist/commonjs/models/operations/getcustomers.d.ts +53 -0
  61. package/dist/commonjs/models/operations/getcustomers.d.ts.map +1 -0
  62. package/dist/commonjs/models/operations/getcustomers.js +60 -0
  63. package/dist/commonjs/models/operations/getcustomers.js.map +1 -0
  64. package/dist/commonjs/models/operations/index.d.ts +5 -0
  65. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  66. package/dist/commonjs/models/operations/index.js +5 -0
  67. package/dist/commonjs/models/operations/index.js.map +1 -1
  68. package/dist/commonjs/models/operations/tracklead.d.ts +11 -4
  69. package/dist/commonjs/models/operations/tracklead.d.ts.map +1 -1
  70. package/dist/commonjs/models/operations/tracklead.js +6 -4
  71. package/dist/commonjs/models/operations/tracklead.js.map +1 -1
  72. package/dist/commonjs/models/operations/tracksale.d.ts +11 -2
  73. package/dist/commonjs/models/operations/tracksale.d.ts.map +1 -1
  74. package/dist/commonjs/models/operations/tracksale.js +6 -2
  75. package/dist/commonjs/models/operations/tracksale.js.map +1 -1
  76. package/dist/commonjs/models/operations/updatecustomer.d.ts +125 -0
  77. package/dist/commonjs/models/operations/updatecustomer.d.ts.map +1 -0
  78. package/dist/commonjs/models/operations/updatecustomer.js +116 -0
  79. package/dist/commonjs/models/operations/updatecustomer.js.map +1 -0
  80. package/dist/commonjs/sdk/customers.d.ts +40 -0
  81. package/dist/commonjs/sdk/customers.d.ts.map +1 -0
  82. package/dist/commonjs/sdk/customers.js +62 -0
  83. package/dist/commonjs/sdk/customers.js.map +1 -0
  84. package/dist/commonjs/sdk/sdk.d.ts +7 -4
  85. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  86. package/dist/commonjs/sdk/sdk.js +13 -8
  87. package/dist/commonjs/sdk/sdk.js.map +1 -1
  88. package/dist/commonjs/sdk/track.d.ts +2 -0
  89. package/dist/commonjs/sdk/track.d.ts.map +1 -1
  90. package/dist/commonjs/sdk/track.js +2 -0
  91. package/dist/commonjs/sdk/track.js.map +1 -1
  92. package/dist/esm/funcs/customersCreate.d.ts +16 -0
  93. package/dist/esm/funcs/customersCreate.d.ts.map +1 -0
  94. package/dist/esm/funcs/customersCreate.js +87 -0
  95. package/dist/esm/funcs/customersCreate.js.map +1 -0
  96. package/dist/esm/funcs/customersDelete.d.ts +16 -0
  97. package/dist/esm/funcs/customersDelete.d.ts.map +1 -0
  98. package/dist/esm/funcs/customersDelete.js +93 -0
  99. package/dist/esm/funcs/customersDelete.js.map +1 -0
  100. package/dist/esm/funcs/customersGet.d.ts +16 -0
  101. package/dist/esm/funcs/customersGet.d.ts.map +1 -0
  102. package/dist/esm/funcs/customersGet.js +90 -0
  103. package/dist/esm/funcs/customersGet.js.map +1 -0
  104. package/dist/esm/funcs/customersList.d.ts +16 -0
  105. package/dist/esm/funcs/customersList.d.ts.map +1 -0
  106. package/dist/esm/funcs/customersList.js +76 -0
  107. package/dist/esm/funcs/customersList.js.map +1 -0
  108. package/dist/esm/funcs/customersUpdate.d.ts +16 -0
  109. package/dist/esm/funcs/customersUpdate.d.ts.map +1 -0
  110. package/dist/esm/funcs/customersUpdate.js +95 -0
  111. package/dist/esm/funcs/customersUpdate.js.map +1 -0
  112. package/dist/esm/funcs/trackCustomer.d.ts +2 -0
  113. package/dist/esm/funcs/trackCustomer.d.ts.map +1 -1
  114. package/dist/esm/funcs/trackCustomer.js +2 -0
  115. package/dist/esm/funcs/trackCustomer.js.map +1 -1
  116. package/dist/esm/lib/config.d.ts +3 -3
  117. package/dist/esm/lib/config.js +3 -3
  118. package/dist/esm/models/components/leadcreatedevent.d.ts +28 -6
  119. package/dist/esm/models/components/leadcreatedevent.d.ts.map +1 -1
  120. package/dist/esm/models/components/leadcreatedevent.js +10 -6
  121. package/dist/esm/models/components/leadcreatedevent.js.map +1 -1
  122. package/dist/esm/models/components/leadevent.d.ts +26 -4
  123. package/dist/esm/models/components/leadevent.d.ts.map +1 -1
  124. package/dist/esm/models/components/leadevent.js +8 -4
  125. package/dist/esm/models/components/leadevent.js.map +1 -1
  126. package/dist/esm/models/components/salecreatedevent.d.ts +28 -6
  127. package/dist/esm/models/components/salecreatedevent.d.ts.map +1 -1
  128. package/dist/esm/models/components/salecreatedevent.js +10 -6
  129. package/dist/esm/models/components/salecreatedevent.js.map +1 -1
  130. package/dist/esm/models/components/saleevent.d.ts +26 -4
  131. package/dist/esm/models/components/saleevent.d.ts.map +1 -1
  132. package/dist/esm/models/components/saleevent.js +8 -4
  133. package/dist/esm/models/components/saleevent.js.map +1 -1
  134. package/dist/esm/models/components/workspaceschema.d.ts +21 -1
  135. package/dist/esm/models/components/workspaceschema.d.ts.map +1 -1
  136. package/dist/esm/models/components/workspaceschema.js +8 -0
  137. package/dist/esm/models/components/workspaceschema.js.map +1 -1
  138. package/dist/esm/models/operations/createcustomer.d.ts +97 -0
  139. package/dist/esm/models/operations/createcustomer.d.ts.map +1 -0
  140. package/dist/esm/models/operations/createcustomer.js +59 -0
  141. package/dist/esm/models/operations/createcustomer.js.map +1 -0
  142. package/dist/esm/models/operations/deletecustomer.d.ts +57 -0
  143. package/dist/esm/models/operations/deletecustomer.d.ts.map +1 -0
  144. package/dist/esm/models/operations/deletecustomer.js +43 -0
  145. package/dist/esm/models/operations/deletecustomer.js.map +1 -0
  146. package/dist/esm/models/operations/getcustomer.d.ts +82 -0
  147. package/dist/esm/models/operations/getcustomer.d.ts.map +1 -0
  148. package/dist/esm/models/operations/getcustomer.js +53 -0
  149. package/dist/esm/models/operations/getcustomer.js.map +1 -0
  150. package/dist/esm/models/operations/getcustomers.d.ts +53 -0
  151. package/dist/esm/models/operations/getcustomers.d.ts.map +1 -0
  152. package/dist/esm/models/operations/getcustomers.js +34 -0
  153. package/dist/esm/models/operations/getcustomers.js.map +1 -0
  154. package/dist/esm/models/operations/index.d.ts +5 -0
  155. package/dist/esm/models/operations/index.d.ts.map +1 -1
  156. package/dist/esm/models/operations/index.js +5 -0
  157. package/dist/esm/models/operations/index.js.map +1 -1
  158. package/dist/esm/models/operations/tracklead.d.ts +11 -4
  159. package/dist/esm/models/operations/tracklead.d.ts.map +1 -1
  160. package/dist/esm/models/operations/tracklead.js +6 -4
  161. package/dist/esm/models/operations/tracklead.js.map +1 -1
  162. package/dist/esm/models/operations/tracksale.d.ts +11 -2
  163. package/dist/esm/models/operations/tracksale.d.ts.map +1 -1
  164. package/dist/esm/models/operations/tracksale.js +6 -2
  165. package/dist/esm/models/operations/tracksale.js.map +1 -1
  166. package/dist/esm/models/operations/updatecustomer.d.ts +125 -0
  167. package/dist/esm/models/operations/updatecustomer.d.ts.map +1 -0
  168. package/dist/esm/models/operations/updatecustomer.js +90 -0
  169. package/dist/esm/models/operations/updatecustomer.js.map +1 -0
  170. package/dist/esm/sdk/customers.d.ts +40 -0
  171. package/dist/esm/sdk/customers.d.ts.map +1 -0
  172. package/dist/esm/sdk/customers.js +58 -0
  173. package/dist/esm/sdk/customers.js.map +1 -0
  174. package/dist/esm/sdk/sdk.d.ts +7 -4
  175. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  176. package/dist/esm/sdk/sdk.js +13 -8
  177. package/dist/esm/sdk/sdk.js.map +1 -1
  178. package/dist/esm/sdk/track.d.ts +2 -0
  179. package/dist/esm/sdk/track.d.ts.map +1 -1
  180. package/dist/esm/sdk/track.js +2 -0
  181. package/dist/esm/sdk/track.js.map +1 -1
  182. package/docs/sdks/customers/README.md +421 -0
  183. package/docs/sdks/track/README.md +4 -2
  184. package/package.json +1 -1
  185. package/src/funcs/customersCreate.ts +172 -0
  186. package/src/funcs/customersDelete.ts +177 -0
  187. package/src/funcs/customersGet.ts +173 -0
  188. package/src/funcs/customersList.ts +152 -0
  189. package/src/funcs/customersUpdate.ts +180 -0
  190. package/src/funcs/trackCustomer.ts +2 -0
  191. package/src/lib/config.ts +3 -3
  192. package/src/models/components/leadcreatedevent.ts +38 -12
  193. package/src/models/components/leadevent.ts +34 -8
  194. package/src/models/components/salecreatedevent.ts +38 -12
  195. package/src/models/components/saleevent.ts +34 -8
  196. package/src/models/components/workspaceschema.ts +29 -1
  197. package/src/models/operations/createcustomer.ts +150 -0
  198. package/src/models/operations/deletecustomer.ts +94 -0
  199. package/src/models/operations/getcustomer.ts +129 -0
  200. package/src/models/operations/getcustomers.ts +83 -0
  201. package/src/models/operations/index.ts +5 -0
  202. package/src/models/operations/tracklead.ts +17 -8
  203. package/src/models/operations/tracksale.ts +17 -4
  204. package/src/models/operations/updatecustomer.ts +207 -0
  205. package/src/sdk/customers.ts +99 -0
  206. package/src/sdk/sdk.ts +16 -10
  207. 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dub",
3
- "version": "0.45.0",
3
+ "version": "0.45.2",
4
4
  "author": "Dub",
5
5
  "tshy": {
6
6
  "exports": {
@@ -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
+ }