dub 0.33.0__py3-none-any.whl → 0.34.1__py3-none-any.whl

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 (65) hide show
  1. dub/_version.py +3 -3
  2. dub/analytics.py +2 -0
  3. dub/basesdk.py +6 -0
  4. dub/bounties.py +841 -0
  5. dub/commissions.py +4 -0
  6. dub/customers.py +8 -0
  7. dub/domains.py +12 -0
  8. dub/embed_tokens.py +2 -0
  9. dub/events.py +2 -0
  10. dub/folders.py +8 -0
  11. dub/links.py +20 -0
  12. dub/models/components/__init__.py +55 -149
  13. dub/models/components/commissioncreatedevent.py +29 -1
  14. dub/models/components/leadcreatedevent.py +8 -8
  15. dub/models/components/linkclickedevent.py +12 -12
  16. dub/models/components/linkerrorschema.py +12 -12
  17. dub/models/components/linkschema.py +3 -3
  18. dub/models/components/linktagschema.py +3 -3
  19. dub/models/components/linktagschemaoutput.py +38 -0
  20. dub/models/components/linkwebhookevent.py +8 -10
  21. dub/models/components/partnerenrolledevent.py +4 -4
  22. dub/models/components/salecreatedevent.py +8 -8
  23. dub/models/operations/__init__.py +223 -22
  24. dub/models/operations/approvebountysubmission.py +185 -0
  25. dub/models/operations/createpartner.py +4 -55
  26. dub/models/operations/createpartnerlink.py +0 -51
  27. dub/models/operations/createreferralsembedtoken.py +0 -51
  28. dub/models/operations/getcustomers.py +18 -0
  29. dub/models/operations/getlinkinfo.py +0 -2
  30. dub/models/operations/getlinks.py +2 -2
  31. dub/models/operations/getlinkscount.py +2 -2
  32. dub/models/operations/getqrcode.py +1 -1
  33. dub/models/operations/listbountysubmissions.py +212 -0
  34. dub/models/operations/listdomains.py +1 -1
  35. dub/models/operations/listevents.py +2016 -21
  36. dub/models/operations/listpartners.py +4 -4
  37. dub/models/operations/rejectbountysubmission.py +174 -0
  38. dub/models/operations/retrieveanalytics.py +16 -5
  39. dub/models/operations/retrievelinks.py +2 -2
  40. dub/models/operations/tracklead.py +4 -4
  41. dub/models/operations/updatecustomer.py +23 -11
  42. dub/models/operations/updatelink.py +0 -2
  43. dub/models/operations/updateworkspace.py +3 -3
  44. dub/models/operations/upsertpartnerlink.py +7 -65
  45. dub/partners.py +22 -4
  46. dub/qr_codes.py +2 -0
  47. dub/sdk.py +3 -0
  48. dub/tags.py +24 -12
  49. dub/track.py +4 -0
  50. dub/types/basemodel.py +41 -3
  51. dub/utils/__init__.py +0 -3
  52. dub/utils/enums.py +60 -0
  53. dub/utils/forms.py +21 -10
  54. dub/utils/queryparams.py +14 -2
  55. dub/utils/requestbodies.py +3 -3
  56. dub/utils/serializers.py +0 -20
  57. dub/workspaces.py +4 -0
  58. {dub-0.33.0.dist-info → dub-0.34.1.dist-info}/METADATA +20 -14
  59. {dub-0.33.0.dist-info → dub-0.34.1.dist-info}/RECORD +61 -60
  60. dub/models/components/clickevent.py +0 -557
  61. dub/models/components/continentcode.py +0 -16
  62. dub/models/components/leadevent.py +0 -681
  63. dub/models/components/saleevent.py +0 -780
  64. {dub-0.33.0.dist-info → dub-0.34.1.dist-info}/WHEEL +0 -0
  65. {dub-0.33.0.dist-info → dub-0.34.1.dist-info}/licenses/LICENSE +0 -0
@@ -1,780 +0,0 @@
1
- """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
-
3
- from __future__ import annotations
4
- from .linktagschema import LinkTagSchema, LinkTagSchemaTypedDict
5
- from dub.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
6
- from enum import Enum
7
- import pydantic
8
- from pydantic import model_serializer
9
- from typing import Any, Dict, List, Optional
10
- from typing_extensions import Annotated, NotRequired, TypedDict
11
-
12
-
13
- class SaleEventEvent(str, Enum):
14
- SALE = "sale"
15
-
16
-
17
- class PaymentProcessor(str, Enum):
18
- r"""The payment processor via which the sale was made."""
19
-
20
- STRIPE = "stripe"
21
- SHOPIFY = "shopify"
22
- POLAR = "polar"
23
- PADDLE = "paddle"
24
- REVENUECAT = "revenuecat"
25
- CUSTOM = "custom"
26
-
27
-
28
- class SaleTypedDict(TypedDict):
29
- amount: int
30
- r"""The amount of the sale in cents (for all two-decimal currencies). If the sale is in a zero-decimal currency, pass the full integer value (e.g. `1437` JPY). Learn more: https://d.to/currency"""
31
- invoice_id: NotRequired[Nullable[str]]
32
- r"""The invoice ID of the sale. Can be used as a idempotency key – only one sale event can be recorded for a given invoice ID."""
33
- payment_processor: NotRequired[PaymentProcessor]
34
- r"""The payment processor via which the sale was made."""
35
-
36
-
37
- class Sale(BaseModel):
38
- amount: int
39
- r"""The amount of the sale in cents (for all two-decimal currencies). If the sale is in a zero-decimal currency, pass the full integer value (e.g. `1437` JPY). Learn more: https://d.to/currency"""
40
-
41
- invoice_id: Annotated[OptionalNullable[str], pydantic.Field(alias="invoiceId")] = (
42
- None
43
- )
44
- r"""The invoice ID of the sale. Can be used as a idempotency key – only one sale event can be recorded for a given invoice ID."""
45
-
46
- payment_processor: Annotated[
47
- Optional[PaymentProcessor], pydantic.Field(alias="paymentProcessor")
48
- ] = PaymentProcessor.CUSTOM
49
- r"""The payment processor via which the sale was made."""
50
-
51
- @model_serializer(mode="wrap")
52
- def serialize_model(self, handler):
53
- optional_fields = ["invoiceId", "paymentProcessor"]
54
- nullable_fields = ["invoiceId"]
55
- null_default_fields = ["invoiceId"]
56
-
57
- serialized = handler(self)
58
-
59
- m = {}
60
-
61
- for n, f in type(self).model_fields.items():
62
- k = f.alias or n
63
- val = serialized.get(k)
64
- serialized.pop(k, None)
65
-
66
- optional_nullable = k in optional_fields and k in nullable_fields
67
- is_set = (
68
- self.__pydantic_fields_set__.intersection({n})
69
- or k in null_default_fields
70
- ) # pylint: disable=no-member
71
-
72
- if val is not None and val != UNSET_SENTINEL:
73
- m[k] = val
74
- elif val != UNSET_SENTINEL and (
75
- not k in optional_fields or (optional_nullable and is_set)
76
- ):
77
- m[k] = val
78
-
79
- return m
80
-
81
-
82
- class SaleEventTestVariantsTypedDict(TypedDict):
83
- url: str
84
- percentage: float
85
-
86
-
87
- class SaleEventTestVariants(BaseModel):
88
- url: str
89
-
90
- percentage: float
91
-
92
-
93
- class SaleEventLinkTypedDict(TypedDict):
94
- id: str
95
- r"""The unique ID of the short link."""
96
- domain: str
97
- r"""The domain of the short link. If not provided, the primary domain for the workspace will be used (or `dub.sh` if the workspace has no domains)."""
98
- key: str
99
- r"""The short link slug. If not provided, a random 7-character slug will be generated."""
100
- url: str
101
- track_conversion: bool
102
- external_id: Nullable[str]
103
- r"""The ID of the link in your database. If set, it can be used to identify the link in future API requests (must be prefixed with 'ext_' when passed as a query parameter). This key is unique across your workspace."""
104
- tenant_id: Nullable[str]
105
- r"""The ID of the tenant that created the link inside your system. If set, it can be used to fetch all links for a tenant."""
106
- program_id: Nullable[str]
107
- r"""The ID of the program the short link is associated with."""
108
- partner_id: Nullable[str]
109
- r"""The ID of the partner the short link is associated with."""
110
- archived: bool
111
- expires_at: str
112
- expired_url: Nullable[str]
113
- disabled_at: str
114
- password: Nullable[str]
115
- r"""The password required to access the destination URL of the short link."""
116
- proxy: bool
117
- title: Nullable[str]
118
- r"""The title of the short link. Will be used for Custom Link Previews if `proxy` is true."""
119
- description: Nullable[str]
120
- r"""The description of the short link. Will be used for Custom Link Previews if `proxy` is true."""
121
- image: Nullable[str]
122
- r"""The image of the short link. Will be used for Custom Link Previews if `proxy` is true."""
123
- video: Nullable[str]
124
- r"""The custom link preview video (og:video). Will be used for Custom Link Previews if `proxy` is true. Learn more: https://d.to/og"""
125
- rewrite: bool
126
- do_index: bool
127
- ios: Nullable[str]
128
- r"""The iOS destination URL for the short link for iOS device targeting."""
129
- android: Nullable[str]
130
- r"""The Android destination URL for the short link for Android device targeting."""
131
- geo: Nullable[Dict[str, str]]
132
- r"""Geo targeting information for the short link in JSON format `{[COUNTRY]: https://example.com }`. See https://d.to/geo for more information."""
133
- public_stats: bool
134
- tags: Nullable[List[LinkTagSchemaTypedDict]]
135
- r"""The tags assigned to the short link."""
136
- folder_id: Nullable[str]
137
- r"""The unique ID of the folder assigned to the short link."""
138
- webhook_ids: List[str]
139
- r"""The IDs of the webhooks that the short link is associated with."""
140
- comments: Nullable[str]
141
- r"""The comments for the short link."""
142
- short_link: str
143
- r"""The full URL of the short link, including the https protocol (e.g. `https://dub.sh/try`)."""
144
- qr_code: str
145
- r"""The full URL of the QR code for the short link (e.g. `https://api.dub.co/qr?url=https://dub.sh/try`)."""
146
- utm_source: Nullable[str]
147
- r"""The UTM source of the short link."""
148
- utm_medium: Nullable[str]
149
- r"""The UTM medium of the short link."""
150
- utm_campaign: Nullable[str]
151
- r"""The UTM campaign of the short link."""
152
- utm_term: Nullable[str]
153
- r"""The UTM term of the short link."""
154
- utm_content: Nullable[str]
155
- r"""The UTM content of the short link."""
156
- test_started_at: str
157
- test_completed_at: str
158
- user_id: Nullable[str]
159
- workspace_id: str
160
- r"""The workspace ID of the short link."""
161
- last_clicked: str
162
- created_at: str
163
- updated_at: str
164
- tag_id: Nullable[str]
165
- r"""Deprecated: Use `tags` instead. The unique ID of the tag assigned to the short link."""
166
- project_id: str
167
- r"""Deprecated: Use `workspaceId` instead. The project ID of the short link."""
168
- test_variants: NotRequired[Nullable[List[SaleEventTestVariantsTypedDict]]]
169
- r"""An array of A/B test URLs and the percentage of traffic to send to each URL."""
170
- clicks: NotRequired[float]
171
- r"""The number of clicks on the short link."""
172
- leads: NotRequired[float]
173
- r"""The number of leads the short link has generated."""
174
- conversions: NotRequired[float]
175
- r"""The number of leads that converted to paying customers."""
176
- sales: NotRequired[float]
177
- r"""The total number of sales (includes recurring sales) generated by the short link."""
178
- sale_amount: NotRequired[float]
179
- r"""The total dollar value of sales (in cents) generated by the short link."""
180
-
181
-
182
- class SaleEventLink(BaseModel):
183
- id: str
184
- r"""The unique ID of the short link."""
185
-
186
- domain: str
187
- r"""The domain of the short link. If not provided, the primary domain for the workspace will be used (or `dub.sh` if the workspace has no domains)."""
188
-
189
- key: str
190
- r"""The short link slug. If not provided, a random 7-character slug will be generated."""
191
-
192
- url: str
193
-
194
- track_conversion: Annotated[bool, pydantic.Field(alias="trackConversion")]
195
-
196
- external_id: Annotated[Nullable[str], pydantic.Field(alias="externalId")]
197
- r"""The ID of the link in your database. If set, it can be used to identify the link in future API requests (must be prefixed with 'ext_' when passed as a query parameter). This key is unique across your workspace."""
198
-
199
- tenant_id: Annotated[Nullable[str], pydantic.Field(alias="tenantId")]
200
- r"""The ID of the tenant that created the link inside your system. If set, it can be used to fetch all links for a tenant."""
201
-
202
- program_id: Annotated[Nullable[str], pydantic.Field(alias="programId")]
203
- r"""The ID of the program the short link is associated with."""
204
-
205
- partner_id: Annotated[Nullable[str], pydantic.Field(alias="partnerId")]
206
- r"""The ID of the partner the short link is associated with."""
207
-
208
- archived: bool
209
-
210
- expires_at: Annotated[str, pydantic.Field(alias="expiresAt")]
211
-
212
- expired_url: Annotated[Nullable[str], pydantic.Field(alias="expiredUrl")]
213
-
214
- disabled_at: Annotated[str, pydantic.Field(alias="disabledAt")]
215
-
216
- password: Nullable[str]
217
- r"""The password required to access the destination URL of the short link."""
218
-
219
- proxy: bool
220
-
221
- title: Nullable[str]
222
- r"""The title of the short link. Will be used for Custom Link Previews if `proxy` is true."""
223
-
224
- description: Nullable[str]
225
- r"""The description of the short link. Will be used for Custom Link Previews if `proxy` is true."""
226
-
227
- image: Nullable[str]
228
- r"""The image of the short link. Will be used for Custom Link Previews if `proxy` is true."""
229
-
230
- video: Nullable[str]
231
- r"""The custom link preview video (og:video). Will be used for Custom Link Previews if `proxy` is true. Learn more: https://d.to/og"""
232
-
233
- rewrite: bool
234
-
235
- do_index: Annotated[bool, pydantic.Field(alias="doIndex")]
236
-
237
- ios: Nullable[str]
238
- r"""The iOS destination URL for the short link for iOS device targeting."""
239
-
240
- android: Nullable[str]
241
- r"""The Android destination URL for the short link for Android device targeting."""
242
-
243
- geo: Nullable[Dict[str, str]]
244
- r"""Geo targeting information for the short link in JSON format `{[COUNTRY]: https://example.com }`. See https://d.to/geo for more information."""
245
-
246
- public_stats: Annotated[bool, pydantic.Field(alias="publicStats")]
247
-
248
- tags: Nullable[List[LinkTagSchema]]
249
- r"""The tags assigned to the short link."""
250
-
251
- folder_id: Annotated[Nullable[str], pydantic.Field(alias="folderId")]
252
- r"""The unique ID of the folder assigned to the short link."""
253
-
254
- webhook_ids: Annotated[List[str], pydantic.Field(alias="webhookIds")]
255
- r"""The IDs of the webhooks that the short link is associated with."""
256
-
257
- comments: Nullable[str]
258
- r"""The comments for the short link."""
259
-
260
- short_link: Annotated[str, pydantic.Field(alias="shortLink")]
261
- r"""The full URL of the short link, including the https protocol (e.g. `https://dub.sh/try`)."""
262
-
263
- qr_code: Annotated[str, pydantic.Field(alias="qrCode")]
264
- r"""The full URL of the QR code for the short link (e.g. `https://api.dub.co/qr?url=https://dub.sh/try`)."""
265
-
266
- utm_source: Nullable[str]
267
- r"""The UTM source of the short link."""
268
-
269
- utm_medium: Nullable[str]
270
- r"""The UTM medium of the short link."""
271
-
272
- utm_campaign: Nullable[str]
273
- r"""The UTM campaign of the short link."""
274
-
275
- utm_term: Nullable[str]
276
- r"""The UTM term of the short link."""
277
-
278
- utm_content: Nullable[str]
279
- r"""The UTM content of the short link."""
280
-
281
- test_started_at: Annotated[str, pydantic.Field(alias="testStartedAt")]
282
-
283
- test_completed_at: Annotated[str, pydantic.Field(alias="testCompletedAt")]
284
-
285
- user_id: Annotated[Nullable[str], pydantic.Field(alias="userId")]
286
-
287
- workspace_id: Annotated[str, pydantic.Field(alias="workspaceId")]
288
- r"""The workspace ID of the short link."""
289
-
290
- last_clicked: Annotated[str, pydantic.Field(alias="lastClicked")]
291
-
292
- created_at: Annotated[str, pydantic.Field(alias="createdAt")]
293
-
294
- updated_at: Annotated[str, pydantic.Field(alias="updatedAt")]
295
-
296
- tag_id: Annotated[
297
- Nullable[str],
298
- pydantic.Field(
299
- deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible.",
300
- alias="tagId",
301
- ),
302
- ]
303
- r"""Deprecated: Use `tags` instead. The unique ID of the tag assigned to the short link."""
304
-
305
- project_id: Annotated[
306
- str,
307
- pydantic.Field(
308
- deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible.",
309
- alias="projectId",
310
- ),
311
- ]
312
- r"""Deprecated: Use `workspaceId` instead. The project ID of the short link."""
313
-
314
- test_variants: Annotated[
315
- OptionalNullable[List[SaleEventTestVariants]],
316
- pydantic.Field(alias="testVariants"),
317
- ] = UNSET
318
- r"""An array of A/B test URLs and the percentage of traffic to send to each URL."""
319
-
320
- clicks: Optional[float] = 0
321
- r"""The number of clicks on the short link."""
322
-
323
- leads: Optional[float] = 0
324
- r"""The number of leads the short link has generated."""
325
-
326
- conversions: Optional[float] = 0
327
- r"""The number of leads that converted to paying customers."""
328
-
329
- sales: Optional[float] = 0
330
- r"""The total number of sales (includes recurring sales) generated by the short link."""
331
-
332
- sale_amount: Annotated[Optional[float], pydantic.Field(alias="saleAmount")] = 0
333
- r"""The total dollar value of sales (in cents) generated by the short link."""
334
-
335
- @model_serializer(mode="wrap")
336
- def serialize_model(self, handler):
337
- optional_fields = [
338
- "testVariants",
339
- "clicks",
340
- "leads",
341
- "conversions",
342
- "sales",
343
- "saleAmount",
344
- ]
345
- nullable_fields = [
346
- "externalId",
347
- "tenantId",
348
- "programId",
349
- "partnerId",
350
- "expiredUrl",
351
- "password",
352
- "title",
353
- "description",
354
- "image",
355
- "video",
356
- "ios",
357
- "android",
358
- "geo",
359
- "tags",
360
- "folderId",
361
- "comments",
362
- "utm_source",
363
- "utm_medium",
364
- "utm_campaign",
365
- "utm_term",
366
- "utm_content",
367
- "testVariants",
368
- "userId",
369
- "tagId",
370
- ]
371
- null_default_fields = []
372
-
373
- serialized = handler(self)
374
-
375
- m = {}
376
-
377
- for n, f in type(self).model_fields.items():
378
- k = f.alias or n
379
- val = serialized.get(k)
380
- serialized.pop(k, None)
381
-
382
- optional_nullable = k in optional_fields and k in nullable_fields
383
- is_set = (
384
- self.__pydantic_fields_set__.intersection({n})
385
- or k in null_default_fields
386
- ) # pylint: disable=no-member
387
-
388
- if val is not None and val != UNSET_SENTINEL:
389
- m[k] = val
390
- elif val != UNSET_SENTINEL and (
391
- not k in optional_fields or (optional_nullable and is_set)
392
- ):
393
- m[k] = val
394
-
395
- return m
396
-
397
-
398
- class SaleEventClickTypedDict(TypedDict):
399
- id: str
400
- timestamp: str
401
- url: str
402
- country: str
403
- city: str
404
- region: str
405
- continent: str
406
- device: str
407
- browser: str
408
- os: str
409
- referer: str
410
- referer_url: str
411
- qr: bool
412
- ip: str
413
- trigger: NotRequired[Nullable[str]]
414
-
415
-
416
- class SaleEventClick(BaseModel):
417
- id: str
418
-
419
- timestamp: str
420
-
421
- url: str
422
-
423
- country: str
424
-
425
- city: str
426
-
427
- region: str
428
-
429
- continent: str
430
-
431
- device: str
432
-
433
- browser: str
434
-
435
- os: str
436
-
437
- referer: str
438
-
439
- referer_url: Annotated[str, pydantic.Field(alias="refererUrl")]
440
-
441
- qr: bool
442
-
443
- ip: str
444
-
445
- trigger: OptionalNullable[str] = UNSET
446
-
447
- @model_serializer(mode="wrap")
448
- def serialize_model(self, handler):
449
- optional_fields = ["trigger"]
450
- nullable_fields = ["trigger"]
451
- null_default_fields = []
452
-
453
- serialized = handler(self)
454
-
455
- m = {}
456
-
457
- for n, f in type(self).model_fields.items():
458
- k = f.alias or n
459
- val = serialized.get(k)
460
- serialized.pop(k, None)
461
-
462
- optional_nullable = k in optional_fields and k in nullable_fields
463
- is_set = (
464
- self.__pydantic_fields_set__.intersection({n})
465
- or k in null_default_fields
466
- ) # pylint: disable=no-member
467
-
468
- if val is not None and val != UNSET_SENTINEL:
469
- m[k] = val
470
- elif val != UNSET_SENTINEL and (
471
- not k in optional_fields or (optional_nullable and is_set)
472
- ):
473
- m[k] = val
474
-
475
- return m
476
-
477
-
478
- class SaleEventCustomerTypedDict(TypedDict):
479
- id: str
480
- r"""The unique ID of the customer. You may use either the customer's `id` on Dub (obtained via `/customers` endpoint) or their `externalId` (unique ID within your system, prefixed with `ext_`, e.g. `ext_123`)."""
481
- external_id: str
482
- r"""Unique identifier for the customer in the client's app."""
483
- name: str
484
- r"""Name of the customer."""
485
- created_at: str
486
- r"""The date the customer was created."""
487
- email: NotRequired[Nullable[str]]
488
- r"""Email of the customer."""
489
- avatar: NotRequired[Nullable[str]]
490
- r"""Avatar URL of the customer."""
491
- country: NotRequired[Nullable[str]]
492
- r"""Country of the customer."""
493
- sales: NotRequired[Nullable[float]]
494
- r"""Total number of sales for the customer."""
495
- sale_amount: NotRequired[Nullable[float]]
496
- r"""Total amount of sales for the customer."""
497
-
498
-
499
- class SaleEventCustomer(BaseModel):
500
- id: str
501
- r"""The unique ID of the customer. You may use either the customer's `id` on Dub (obtained via `/customers` endpoint) or their `externalId` (unique ID within your system, prefixed with `ext_`, e.g. `ext_123`)."""
502
-
503
- external_id: Annotated[str, pydantic.Field(alias="externalId")]
504
- r"""Unique identifier for the customer in the client's app."""
505
-
506
- name: str
507
- r"""Name of the customer."""
508
-
509
- created_at: Annotated[str, pydantic.Field(alias="createdAt")]
510
- r"""The date the customer was created."""
511
-
512
- email: OptionalNullable[str] = UNSET
513
- r"""Email of the customer."""
514
-
515
- avatar: OptionalNullable[str] = UNSET
516
- r"""Avatar URL of the customer."""
517
-
518
- country: OptionalNullable[str] = UNSET
519
- r"""Country of the customer."""
520
-
521
- sales: OptionalNullable[float] = UNSET
522
- r"""Total number of sales for the customer."""
523
-
524
- sale_amount: Annotated[
525
- OptionalNullable[float], pydantic.Field(alias="saleAmount")
526
- ] = UNSET
527
- r"""Total amount of sales for the customer."""
528
-
529
- @model_serializer(mode="wrap")
530
- def serialize_model(self, handler):
531
- optional_fields = ["email", "avatar", "country", "sales", "saleAmount"]
532
- nullable_fields = ["email", "avatar", "country", "sales", "saleAmount"]
533
- null_default_fields = []
534
-
535
- serialized = handler(self)
536
-
537
- m = {}
538
-
539
- for n, f in type(self).model_fields.items():
540
- k = f.alias or n
541
- val = serialized.get(k)
542
- serialized.pop(k, None)
543
-
544
- optional_nullable = k in optional_fields and k in nullable_fields
545
- is_set = (
546
- self.__pydantic_fields_set__.intersection({n})
547
- or k in null_default_fields
548
- ) # pylint: disable=no-member
549
-
550
- if val is not None and val != UNSET_SENTINEL:
551
- m[k] = val
552
- elif val != UNSET_SENTINEL and (
553
- not k in optional_fields or (optional_nullable and is_set)
554
- ):
555
- m[k] = val
556
-
557
- return m
558
-
559
-
560
- class SaleEventTypedDict(TypedDict):
561
- event: SaleEventEvent
562
- timestamp: str
563
- event_id: str
564
- event_name: str
565
- sale: SaleTypedDict
566
- link: SaleEventLinkTypedDict
567
- click: SaleEventClickTypedDict
568
- customer: SaleEventCustomerTypedDict
569
- sale_amount: float
570
- r"""Deprecated: Use `sale.amount` instead."""
571
- invoice_id: str
572
- r"""Deprecated: Use `sale.invoiceId` instead."""
573
- payment_processor: str
574
- r"""Deprecated: Use `sale.paymentProcessor` instead."""
575
- click_id: str
576
- r"""Deprecated: Use `click.id` instead."""
577
- link_id: str
578
- r"""Deprecated: Use `link.id` instead."""
579
- domain: str
580
- r"""Deprecated: Use `link.domain` instead."""
581
- key: str
582
- r"""Deprecated: Use `link.key` instead."""
583
- url: str
584
- r"""Deprecated: Use `click.url` instead."""
585
- continent: str
586
- r"""Deprecated: Use `click.continent` instead."""
587
- country: str
588
- r"""Deprecated: Use `click.country` instead."""
589
- city: str
590
- r"""Deprecated: Use `click.city` instead."""
591
- device: str
592
- r"""Deprecated: Use `click.device` instead."""
593
- browser: str
594
- r"""Deprecated: Use `click.browser` instead."""
595
- os: str
596
- r"""Deprecated: Use `click.os` instead."""
597
- qr: float
598
- r"""Deprecated: Use `click.qr` instead."""
599
- ip: str
600
- r"""Deprecated: Use `click.ip` instead."""
601
- metadata: NotRequired[Nullable[Any]]
602
-
603
-
604
- class SaleEvent(BaseModel):
605
- event: SaleEventEvent
606
-
607
- timestamp: str
608
-
609
- event_id: Annotated[str, pydantic.Field(alias="eventId")]
610
-
611
- event_name: Annotated[str, pydantic.Field(alias="eventName")]
612
-
613
- sale: Sale
614
-
615
- link: SaleEventLink
616
-
617
- click: SaleEventClick
618
-
619
- customer: SaleEventCustomer
620
-
621
- sale_amount: Annotated[
622
- float,
623
- pydantic.Field(
624
- deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible.",
625
- alias="saleAmount",
626
- ),
627
- ]
628
- r"""Deprecated: Use `sale.amount` instead."""
629
-
630
- invoice_id: Annotated[
631
- str,
632
- pydantic.Field(
633
- deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
634
- ),
635
- ]
636
- r"""Deprecated: Use `sale.invoiceId` instead."""
637
-
638
- payment_processor: Annotated[
639
- str,
640
- pydantic.Field(
641
- deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
642
- ),
643
- ]
644
- r"""Deprecated: Use `sale.paymentProcessor` instead."""
645
-
646
- click_id: Annotated[
647
- str,
648
- pydantic.Field(
649
- deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
650
- ),
651
- ]
652
- r"""Deprecated: Use `click.id` instead."""
653
-
654
- link_id: Annotated[
655
- str,
656
- pydantic.Field(
657
- deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
658
- ),
659
- ]
660
- r"""Deprecated: Use `link.id` instead."""
661
-
662
- domain: Annotated[
663
- str,
664
- pydantic.Field(
665
- deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
666
- ),
667
- ]
668
- r"""Deprecated: Use `link.domain` instead."""
669
-
670
- key: Annotated[
671
- str,
672
- pydantic.Field(
673
- deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
674
- ),
675
- ]
676
- r"""Deprecated: Use `link.key` instead."""
677
-
678
- url: Annotated[
679
- str,
680
- pydantic.Field(
681
- deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
682
- ),
683
- ]
684
- r"""Deprecated: Use `click.url` instead."""
685
-
686
- continent: Annotated[
687
- str,
688
- pydantic.Field(
689
- deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
690
- ),
691
- ]
692
- r"""Deprecated: Use `click.continent` instead."""
693
-
694
- country: Annotated[
695
- str,
696
- pydantic.Field(
697
- deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
698
- ),
699
- ]
700
- r"""Deprecated: Use `click.country` instead."""
701
-
702
- city: Annotated[
703
- str,
704
- pydantic.Field(
705
- deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
706
- ),
707
- ]
708
- r"""Deprecated: Use `click.city` instead."""
709
-
710
- device: Annotated[
711
- str,
712
- pydantic.Field(
713
- deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
714
- ),
715
- ]
716
- r"""Deprecated: Use `click.device` instead."""
717
-
718
- browser: Annotated[
719
- str,
720
- pydantic.Field(
721
- deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
722
- ),
723
- ]
724
- r"""Deprecated: Use `click.browser` instead."""
725
-
726
- os: Annotated[
727
- str,
728
- pydantic.Field(
729
- deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
730
- ),
731
- ]
732
- r"""Deprecated: Use `click.os` instead."""
733
-
734
- qr: Annotated[
735
- float,
736
- pydantic.Field(
737
- deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
738
- ),
739
- ]
740
- r"""Deprecated: Use `click.qr` instead."""
741
-
742
- ip: Annotated[
743
- str,
744
- pydantic.Field(
745
- deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
746
- ),
747
- ]
748
- r"""Deprecated: Use `click.ip` instead."""
749
-
750
- metadata: OptionalNullable[Any] = UNSET
751
-
752
- @model_serializer(mode="wrap")
753
- def serialize_model(self, handler):
754
- optional_fields = ["metadata"]
755
- nullable_fields = ["metadata"]
756
- null_default_fields = []
757
-
758
- serialized = handler(self)
759
-
760
- m = {}
761
-
762
- for n, f in type(self).model_fields.items():
763
- k = f.alias or n
764
- val = serialized.get(k)
765
- serialized.pop(k, None)
766
-
767
- optional_nullable = k in optional_fields and k in nullable_fields
768
- is_set = (
769
- self.__pydantic_fields_set__.intersection({n})
770
- or k in null_default_fields
771
- ) # pylint: disable=no-member
772
-
773
- if val is not None and val != UNSET_SENTINEL:
774
- m[k] = val
775
- elif val != UNSET_SENTINEL and (
776
- not k in optional_fields or (optional_nullable and is_set)
777
- ):
778
- m[k] = val
779
-
780
- return m