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
@@ -142,7 +142,7 @@ class ListPartnersStatus(str, Enum):
142
142
  ARCHIVED = "archived"
143
143
 
144
144
 
145
- class ListPartnersLinkTypedDict(TypedDict):
145
+ class ListPartnersLinksTypedDict(TypedDict):
146
146
  id: str
147
147
  r"""The unique ID of the short link."""
148
148
  domain: str
@@ -165,7 +165,7 @@ class ListPartnersLinkTypedDict(TypedDict):
165
165
  r"""The total dollar value of sales (in cents) generated by the short link."""
166
166
 
167
167
 
168
- class ListPartnersLink(BaseModel):
168
+ class ListPartnersLinks(BaseModel):
169
169
  id: str
170
170
  r"""The unique ID of the short link."""
171
171
 
@@ -238,7 +238,7 @@ class ListPartnersResponseBodyTypedDict(TypedDict):
238
238
  created_at: str
239
239
  status: ListPartnersStatus
240
240
  r"""The status of the partner's enrollment in the program."""
241
- links: Nullable[List[ListPartnersLinkTypedDict]]
241
+ links: Nullable[List[ListPartnersLinksTypedDict]]
242
242
  r"""The partner's referral links in this program."""
243
243
  description: NotRequired[Nullable[str]]
244
244
  r"""A brief description of the partner and their background."""
@@ -341,7 +341,7 @@ class ListPartnersResponseBody(BaseModel):
341
341
  status: ListPartnersStatus
342
342
  r"""The status of the partner's enrollment in the program."""
343
343
 
344
- links: Nullable[List[ListPartnersLink]]
344
+ links: Nullable[List[ListPartnersLinks]]
345
345
  r"""The partner's referral links in this program."""
346
346
 
347
347
  description: OptionalNullable[str] = UNSET
@@ -0,0 +1,174 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from dub.types import BaseModel, Nullable, UNSET_SENTINEL
5
+ from dub.utils import FieldMetadata, PathParamMetadata, RequestMetadata
6
+ from enum import Enum
7
+ import pydantic
8
+ from pydantic import model_serializer
9
+ from typing import List, Optional
10
+ from typing_extensions import Annotated, NotRequired, TypedDict
11
+
12
+
13
+ class RejectionReason(str, Enum):
14
+ r"""The reason for rejecting the submission."""
15
+
16
+ INVALID_PROOF = "invalidProof"
17
+ DUPLICATE_SUBMISSION = "duplicateSubmission"
18
+ OUT_OF_TIME_WINDOW = "outOfTimeWindow"
19
+ DID_NOT_MEET_CRITERIA = "didNotMeetCriteria"
20
+ OTHER = "other"
21
+
22
+
23
+ class RejectBountySubmissionRequestBodyTypedDict(TypedDict):
24
+ rejection_reason: NotRequired[RejectionReason]
25
+ r"""The reason for rejecting the submission."""
26
+ rejection_note: NotRequired[str]
27
+ r"""The note for rejecting the submission."""
28
+
29
+
30
+ class RejectBountySubmissionRequestBody(BaseModel):
31
+ rejection_reason: Annotated[
32
+ Optional[RejectionReason], pydantic.Field(alias="rejectionReason")
33
+ ] = None
34
+ r"""The reason for rejecting the submission."""
35
+
36
+ rejection_note: Annotated[Optional[str], pydantic.Field(alias="rejectionNote")] = (
37
+ None
38
+ )
39
+ r"""The note for rejecting the submission."""
40
+
41
+
42
+ class RejectBountySubmissionRequestTypedDict(TypedDict):
43
+ bounty_id: str
44
+ submission_id: str
45
+ request_body: NotRequired[RejectBountySubmissionRequestBodyTypedDict]
46
+
47
+
48
+ class RejectBountySubmissionRequest(BaseModel):
49
+ bounty_id: Annotated[
50
+ str,
51
+ pydantic.Field(alias="bountyId"),
52
+ FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
53
+ ]
54
+
55
+ submission_id: Annotated[
56
+ str,
57
+ pydantic.Field(alias="submissionId"),
58
+ FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
59
+ ]
60
+
61
+ request_body: Annotated[
62
+ Optional[RejectBountySubmissionRequestBody],
63
+ FieldMetadata(request=RequestMetadata(media_type="application/json")),
64
+ ] = None
65
+
66
+
67
+ class RejectBountySubmissionFilesTypedDict(TypedDict):
68
+ url: str
69
+ file_name: str
70
+ size: float
71
+
72
+
73
+ class RejectBountySubmissionFiles(BaseModel):
74
+ url: str
75
+
76
+ file_name: Annotated[str, pydantic.Field(alias="fileName")]
77
+
78
+ size: float
79
+
80
+
81
+ class RejectBountySubmissionStatus(str, Enum):
82
+ DRAFT = "draft"
83
+ SUBMITTED = "submitted"
84
+ APPROVED = "approved"
85
+ REJECTED = "rejected"
86
+
87
+
88
+ class RejectBountySubmissionResponseBodyTypedDict(TypedDict):
89
+ r"""The rejected bounty submission."""
90
+
91
+ id: str
92
+ bounty_id: str
93
+ partner_id: str
94
+ description: Nullable[str]
95
+ urls: Nullable[List[str]]
96
+ files: Nullable[List[RejectBountySubmissionFilesTypedDict]]
97
+ status: RejectBountySubmissionStatus
98
+ performance_count: Nullable[float]
99
+ created_at: str
100
+ completed_at: Nullable[str]
101
+ reviewed_at: Nullable[str]
102
+ rejection_reason: Nullable[str]
103
+ rejection_note: Nullable[str]
104
+
105
+
106
+ class RejectBountySubmissionResponseBody(BaseModel):
107
+ r"""The rejected bounty submission."""
108
+
109
+ id: str
110
+
111
+ bounty_id: Annotated[str, pydantic.Field(alias="bountyId")]
112
+
113
+ partner_id: Annotated[str, pydantic.Field(alias="partnerId")]
114
+
115
+ description: Nullable[str]
116
+
117
+ urls: Nullable[List[str]]
118
+
119
+ files: Nullable[List[RejectBountySubmissionFiles]]
120
+
121
+ status: RejectBountySubmissionStatus
122
+
123
+ performance_count: Annotated[
124
+ Nullable[float], pydantic.Field(alias="performanceCount")
125
+ ]
126
+
127
+ created_at: Annotated[str, pydantic.Field(alias="createdAt")]
128
+
129
+ completed_at: Annotated[Nullable[str], pydantic.Field(alias="completedAt")]
130
+
131
+ reviewed_at: Annotated[Nullable[str], pydantic.Field(alias="reviewedAt")]
132
+
133
+ rejection_reason: Annotated[Nullable[str], pydantic.Field(alias="rejectionReason")]
134
+
135
+ rejection_note: Annotated[Nullable[str], pydantic.Field(alias="rejectionNote")]
136
+
137
+ @model_serializer(mode="wrap")
138
+ def serialize_model(self, handler):
139
+ optional_fields = []
140
+ nullable_fields = [
141
+ "description",
142
+ "urls",
143
+ "files",
144
+ "performanceCount",
145
+ "completedAt",
146
+ "reviewedAt",
147
+ "rejectionReason",
148
+ "rejectionNote",
149
+ ]
150
+ null_default_fields = []
151
+
152
+ serialized = handler(self)
153
+
154
+ m = {}
155
+
156
+ for n, f in type(self).model_fields.items():
157
+ k = f.alias or n
158
+ val = serialized.get(k)
159
+ serialized.pop(k, None)
160
+
161
+ optional_nullable = k in optional_fields and k in nullable_fields
162
+ is_set = (
163
+ self.__pydantic_fields_set__.intersection({n})
164
+ or k in null_default_fields
165
+ ) # pylint: disable=no-member
166
+
167
+ if val is not None and val != UNSET_SENTINEL:
168
+ m[k] = val
169
+ elif val != UNSET_SENTINEL and (
170
+ not k in optional_fields or (optional_nullable and is_set)
171
+ ):
172
+ m[k] = val
173
+
174
+ return m
@@ -16,7 +16,6 @@ from dub.models.components import (
16
16
  analyticstoplinks as components_analyticstoplinks,
17
17
  analyticstopurls as components_analyticstopurls,
18
18
  analyticstriggers as components_analyticstriggers,
19
- continentcode as components_continentcode,
20
19
  )
21
20
  from dub.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
22
21
  from dub.utils import FieldMetadata, QueryParamMetadata
@@ -81,6 +80,18 @@ class Interval(str, Enum):
81
80
  ALL = "all"
82
81
 
83
82
 
83
+ class Continent(str, Enum):
84
+ r"""The continent to retrieve analytics for."""
85
+
86
+ AF = "AF"
87
+ AN = "AN"
88
+ AS = "AS"
89
+ EU = "EU"
90
+ NA = "NA"
91
+ OC = "OC"
92
+ SA = "SA"
93
+
94
+
84
95
  class Trigger(str, Enum):
85
96
  r"""The trigger to retrieve analytics for. If undefined, returns all trigger types."""
86
97
 
@@ -144,7 +155,7 @@ class RetrieveAnalyticsRequestTypedDict(TypedDict):
144
155
  r"""The city to retrieve analytics for."""
145
156
  region: NotRequired[str]
146
157
  r"""The ISO 3166-2 region code to retrieve analytics for."""
147
- continent: NotRequired[components_continentcode.ContinentCode]
158
+ continent: NotRequired[Continent]
148
159
  r"""The continent to retrieve analytics for."""
149
160
  device: NotRequired[str]
150
161
  r"""The device to retrieve analytics for."""
@@ -155,7 +166,7 @@ class RetrieveAnalyticsRequestTypedDict(TypedDict):
155
166
  trigger: NotRequired[Trigger]
156
167
  r"""The trigger to retrieve analytics for. If undefined, returns all trigger types."""
157
168
  referer: NotRequired[str]
158
- r"""The referer to retrieve analytics for."""
169
+ r"""The referer hostname to retrieve analytics for."""
159
170
  referer_url: NotRequired[str]
160
171
  r"""The full referer URL to retrieve analytics for."""
161
172
  url: NotRequired[str]
@@ -301,7 +312,7 @@ class RetrieveAnalyticsRequest(BaseModel):
301
312
  r"""The ISO 3166-2 region code to retrieve analytics for."""
302
313
 
303
314
  continent: Annotated[
304
- Optional[components_continentcode.ContinentCode],
315
+ Optional[Continent],
305
316
  FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
306
317
  ] = None
307
318
  r"""The continent to retrieve analytics for."""
@@ -334,7 +345,7 @@ class RetrieveAnalyticsRequest(BaseModel):
334
345
  Optional[str],
335
346
  FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
336
347
  ] = None
337
- r"""The referer to retrieve analytics for."""
348
+ r"""The referer hostname to retrieve analytics for."""
338
349
 
339
350
  referer_url: Annotated[
340
351
  Optional[str],
@@ -62,7 +62,7 @@ class RetrieveLinksRequest(BaseModel):
62
62
  return m
63
63
 
64
64
 
65
- class LinkTypedDict(TypedDict):
65
+ class RetrieveLinksResponseBodyTypedDict(TypedDict):
66
66
  id: str
67
67
  r"""The unique ID of the short link."""
68
68
  domain: str
@@ -85,7 +85,7 @@ class LinkTypedDict(TypedDict):
85
85
  r"""The total dollar value of sales (in cents) generated by the short link."""
86
86
 
87
87
 
88
- class Link(BaseModel):
88
+ class RetrieveLinksResponseBody(BaseModel):
89
89
  id: str
90
90
  r"""The unique ID of the short link."""
91
91
 
@@ -126,7 +126,7 @@ class Click(BaseModel):
126
126
  id: str
127
127
 
128
128
 
129
- class TrackLeadLinkTypedDict(TypedDict):
129
+ class LinkTypedDict(TypedDict):
130
130
  id: str
131
131
  r"""The unique ID of the short link."""
132
132
  domain: str
@@ -147,7 +147,7 @@ class TrackLeadLinkTypedDict(TypedDict):
147
147
  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."""
148
148
 
149
149
 
150
- class TrackLeadLink(BaseModel):
150
+ class Link(BaseModel):
151
151
  id: str
152
152
  r"""The unique ID of the short link."""
153
153
 
@@ -257,7 +257,7 @@ class TrackLeadResponseBodyTypedDict(TypedDict):
257
257
  r"""A lead was tracked."""
258
258
 
259
259
  click: ClickTypedDict
260
- link: Nullable[TrackLeadLinkTypedDict]
260
+ link: Nullable[LinkTypedDict]
261
261
  customer: CustomerTypedDict
262
262
 
263
263
 
@@ -266,7 +266,7 @@ class TrackLeadResponseBody(BaseModel):
266
266
 
267
267
  click: Click
268
268
 
269
- link: Nullable[TrackLeadLink]
269
+ link: Nullable[Link]
270
270
 
271
271
  customer: Customer
272
272
 
@@ -17,38 +17,50 @@ from typing_extensions import Annotated, NotRequired, TypedDict
17
17
 
18
18
  class UpdateCustomerRequestBodyTypedDict(TypedDict):
19
19
  email: NotRequired[Nullable[str]]
20
- r"""Email of the customer in the client's app."""
20
+ r"""The customer's email address."""
21
21
  name: NotRequired[Nullable[str]]
22
- r"""Name of the customer in the client's app. If not provided, a random name will be generated."""
22
+ r"""The customer's name. If not provided, the email address will be used, and if email is not provided, a random name will be generated."""
23
23
  avatar: NotRequired[Nullable[str]]
24
- r"""Avatar URL of the customer in the client's app."""
24
+ r"""The customer's avatar URL. If not provided, a random avatar will be generated."""
25
25
  external_id: NotRequired[str]
26
- r"""Unique identifier for the customer in the client's app."""
26
+ r"""The customer's unique identifier your database. This is useful for associating subsequent conversion events from Dub's API to your internal systems."""
27
27
  stripe_customer_id: NotRequired[Nullable[str]]
28
- r"""The customer's Stripe customer ID. Useful for attribution recurring sale events to the partner who referred the customer."""
28
+ r"""The customer's Stripe customer ID. This is useful for attributing recurring sale events to the partner who referred the customer."""
29
+ country: NotRequired[str]
30
+ r"""The customer's country in ISO 3166-1 alpha-2 format. Updating this field will only affect the customer's country in Dub's system (and has no effect on existing conversion events)."""
29
31
 
30
32
 
31
33
  class UpdateCustomerRequestBody(BaseModel):
32
34
  email: OptionalNullable[str] = UNSET
33
- r"""Email of the customer in the client's app."""
35
+ r"""The customer's email address."""
34
36
 
35
37
  name: OptionalNullable[str] = UNSET
36
- r"""Name of the customer in the client's app. If not provided, a random name will be generated."""
38
+ r"""The customer's name. If not provided, the email address will be used, and if email is not provided, a random name will be generated."""
37
39
 
38
40
  avatar: OptionalNullable[str] = UNSET
39
- r"""Avatar URL of the customer in the client's app."""
41
+ r"""The customer's avatar URL. If not provided, a random avatar will be generated."""
40
42
 
41
43
  external_id: Annotated[Optional[str], pydantic.Field(alias="externalId")] = None
42
- r"""Unique identifier for the customer in the client's app."""
44
+ r"""The customer's unique identifier your database. This is useful for associating subsequent conversion events from Dub's API to your internal systems."""
43
45
 
44
46
  stripe_customer_id: Annotated[
45
47
  OptionalNullable[str], pydantic.Field(alias="stripeCustomerId")
46
48
  ] = UNSET
47
- r"""The customer's Stripe customer ID. Useful for attribution recurring sale events to the partner who referred the customer."""
49
+ r"""The customer's Stripe customer ID. This is useful for attributing recurring sale events to the partner who referred the customer."""
50
+
51
+ country: Optional[str] = None
52
+ r"""The customer's country in ISO 3166-1 alpha-2 format. Updating this field will only affect the customer's country in Dub's system (and has no effect on existing conversion events)."""
48
53
 
49
54
  @model_serializer(mode="wrap")
50
55
  def serialize_model(self, handler):
51
- optional_fields = ["email", "name", "avatar", "externalId", "stripeCustomerId"]
56
+ optional_fields = [
57
+ "email",
58
+ "name",
59
+ "avatar",
60
+ "externalId",
61
+ "stripeCustomerId",
62
+ "country",
63
+ ]
52
64
  nullable_fields = ["email", "name", "avatar", "stripeCustomerId"]
53
65
  null_default_fields = []
54
66
 
@@ -89,7 +89,6 @@ class UpdateLinkRequestBodyTypedDict(TypedDict):
89
89
  android: NotRequired[Nullable[str]]
90
90
  r"""The Android destination URL for the short link for Android device targeting."""
91
91
  geo: NotRequired[Nullable[Dict[str, str]]]
92
- r"""Geo targeting information for the short link in JSON format `{[COUNTRY]: https://example.com }`. See https://d.to/geo for more information."""
93
92
  do_index: NotRequired[bool]
94
93
  r"""Allow search engines to index your short link. Defaults to `false` if not provided. Learn more: https://d.to/noindex"""
95
94
  utm_source: NotRequired[Nullable[str]]
@@ -211,7 +210,6 @@ class UpdateLinkRequestBody(BaseModel):
211
210
  r"""The Android destination URL for the short link for Android device targeting."""
212
211
 
213
212
  geo: OptionalNullable[Dict[str, str]] = UNSET
214
- r"""Geo targeting information for the short link in JSON format `{[COUNTRY]: https://example.com }`. See https://d.to/geo for more information."""
215
213
 
216
214
  do_index: Annotated[Optional[bool], pydantic.Field(alias="doIndex")] = None
217
215
  r"""Allow search engines to index your short link. Defaults to `false` if not provided. Learn more: https://d.to/noindex"""
@@ -5,14 +5,14 @@ from dub.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTIN
5
5
  from dub.utils import FieldMetadata, PathParamMetadata, RequestMetadata
6
6
  import pydantic
7
7
  from pydantic import model_serializer
8
- from typing import Optional
8
+ from typing import Any, Optional
9
9
  from typing_extensions import Annotated, NotRequired, TypedDict
10
10
 
11
11
 
12
12
  class UpdateWorkspaceRequestBodyTypedDict(TypedDict):
13
13
  name: NotRequired[str]
14
14
  slug: NotRequired[str]
15
- logo: NotRequired[Nullable[str]]
15
+ logo: NotRequired[Nullable[Any]]
16
16
  conversion_enabled: NotRequired[bool]
17
17
 
18
18
 
@@ -21,7 +21,7 @@ class UpdateWorkspaceRequestBody(BaseModel):
21
21
 
22
22
  slug: Optional[str] = None
23
23
 
24
- logo: OptionalNullable[str] = UNSET
24
+ logo: OptionalNullable[Any] = UNSET
25
25
 
26
26
  conversion_enabled: Annotated[
27
27
  Optional[bool], pydantic.Field(alias="conversionEnabled")
@@ -60,8 +60,6 @@ class UpsertPartnerLinkLinkPropsTypedDict(TypedDict):
60
60
  r"""The unique IDs of the tags assigned to the short link."""
61
61
  tag_names: NotRequired[UpsertPartnerLinkTagNamesTypedDict]
62
62
  r"""The unique name of the tags assigned to the short link (case insensitive)."""
63
- folder_id: NotRequired[Nullable[str]]
64
- r"""The unique ID existing folder to assign the short link to."""
65
63
  comments: NotRequired[Nullable[str]]
66
64
  r"""The comments for the short link."""
67
65
  expires_at: NotRequired[Nullable[str]]
@@ -88,18 +86,6 @@ class UpsertPartnerLinkLinkPropsTypedDict(TypedDict):
88
86
  r"""The Android destination URL for the short link for Android device targeting."""
89
87
  do_index: NotRequired[bool]
90
88
  r"""Allow search engines to index your short link. Defaults to `false` if not provided. Learn more: https://d.to/noindex"""
91
- utm_source: NotRequired[Nullable[str]]
92
- r"""The UTM source of the short link. If set, this will populate or override the UTM source in the destination URL."""
93
- utm_medium: NotRequired[Nullable[str]]
94
- r"""The UTM medium of the short link. If set, this will populate or override the UTM medium in the destination URL."""
95
- utm_campaign: NotRequired[Nullable[str]]
96
- r"""The UTM campaign of the short link. If set, this will populate or override the UTM campaign in the destination URL."""
97
- utm_term: NotRequired[Nullable[str]]
98
- r"""The UTM term of the short link. If set, this will populate or override the UTM term in the destination URL."""
99
- utm_content: NotRequired[Nullable[str]]
100
- r"""The UTM content of the short link. If set, this will populate or override the UTM content in the destination URL."""
101
- ref: NotRequired[Nullable[str]]
102
- r"""The referral tag of the short link. If set, this will populate or override the `ref` query parameter in the destination URL."""
103
89
  test_variants: NotRequired[Nullable[List[UpsertPartnerLinkTestVariantsTypedDict]]]
104
90
  r"""An array of A/B test URLs and the percentage of traffic to send to each URL."""
105
91
  test_started_at: NotRequired[Nullable[str]]
@@ -140,11 +126,6 @@ class UpsertPartnerLinkLinkProps(BaseModel):
140
126
  ] = None
141
127
  r"""The unique name of the tags assigned to the short link (case insensitive)."""
142
128
 
143
- folder_id: Annotated[OptionalNullable[str], pydantic.Field(alias="folderId")] = (
144
- UNSET
145
- )
146
- r"""The unique ID existing folder to assign the short link to."""
147
-
148
129
  comments: OptionalNullable[str] = UNSET
149
130
  r"""The comments for the short link."""
150
131
 
@@ -188,24 +169,6 @@ class UpsertPartnerLinkLinkProps(BaseModel):
188
169
  do_index: Annotated[Optional[bool], pydantic.Field(alias="doIndex")] = None
189
170
  r"""Allow search engines to index your short link. Defaults to `false` if not provided. Learn more: https://d.to/noindex"""
190
171
 
191
- utm_source: OptionalNullable[str] = UNSET
192
- r"""The UTM source of the short link. If set, this will populate or override the UTM source in the destination URL."""
193
-
194
- utm_medium: OptionalNullable[str] = UNSET
195
- r"""The UTM medium of the short link. If set, this will populate or override the UTM medium in the destination URL."""
196
-
197
- utm_campaign: OptionalNullable[str] = UNSET
198
- r"""The UTM campaign of the short link. If set, this will populate or override the UTM campaign in the destination URL."""
199
-
200
- utm_term: OptionalNullable[str] = UNSET
201
- r"""The UTM term of the short link. If set, this will populate or override the UTM term in the destination URL."""
202
-
203
- utm_content: OptionalNullable[str] = UNSET
204
- r"""The UTM content of the short link. If set, this will populate or override the UTM content in the destination URL."""
205
-
206
- ref: OptionalNullable[str] = UNSET
207
- r"""The referral tag of the short link. If set, this will populate or override the `ref` query parameter in the destination URL."""
208
-
209
172
  test_variants: Annotated[
210
173
  OptionalNullable[List[UpsertPartnerLinkTestVariants]],
211
174
  pydantic.Field(alias="testVariants"),
@@ -232,7 +195,6 @@ class UpsertPartnerLinkLinkProps(BaseModel):
232
195
  "archived",
233
196
  "tagIds",
234
197
  "tagNames",
235
- "folderId",
236
198
  "comments",
237
199
  "expiresAt",
238
200
  "expiredUrl",
@@ -246,12 +208,6 @@ class UpsertPartnerLinkLinkProps(BaseModel):
246
208
  "ios",
247
209
  "android",
248
210
  "doIndex",
249
- "utm_source",
250
- "utm_medium",
251
- "utm_campaign",
252
- "utm_term",
253
- "utm_content",
254
- "ref",
255
211
  "testVariants",
256
212
  "testStartedAt",
257
213
  "testCompletedAt",
@@ -259,7 +215,6 @@ class UpsertPartnerLinkLinkProps(BaseModel):
259
215
  nullable_fields = [
260
216
  "externalId",
261
217
  "tenantId",
262
- "folderId",
263
218
  "comments",
264
219
  "expiresAt",
265
220
  "expiredUrl",
@@ -270,12 +225,6 @@ class UpsertPartnerLinkLinkProps(BaseModel):
270
225
  "video",
271
226
  "ios",
272
227
  "android",
273
- "utm_source",
274
- "utm_medium",
275
- "utm_campaign",
276
- "utm_term",
277
- "utm_content",
278
- "ref",
279
228
  "testVariants",
280
229
  "testStartedAt",
281
230
  "testCompletedAt",
@@ -308,12 +257,12 @@ class UpsertPartnerLinkLinkProps(BaseModel):
308
257
 
309
258
 
310
259
  class UpsertPartnerLinkRequestBodyTypedDict(TypedDict):
260
+ url: str
261
+ r"""The URL to upsert for. Will throw an error if the domain doesn't match the program's default URL domain."""
311
262
  partner_id: NotRequired[Nullable[str]]
312
263
  r"""The ID of the partner to create a link for. Will take precedence over `tenantId` if provided."""
313
264
  tenant_id: NotRequired[Nullable[str]]
314
265
  r"""The ID of the partner in your system. If both `partnerId` and `tenantId` are not provided, an error will be thrown."""
315
- url: NotRequired[Nullable[str]]
316
- r"""The URL to shorten (if not provided, the program's default URL will be used). Will throw an error if the domain doesn't match the program's default URL domain."""
317
266
  key: NotRequired[str]
318
267
  r"""The short link slug. If not provided, a random 7-character slug will be generated."""
319
268
  comments: NotRequired[Nullable[str]]
@@ -323,6 +272,9 @@ class UpsertPartnerLinkRequestBodyTypedDict(TypedDict):
323
272
 
324
273
 
325
274
  class UpsertPartnerLinkRequestBody(BaseModel):
275
+ url: str
276
+ r"""The URL to upsert for. Will throw an error if the domain doesn't match the program's default URL domain."""
277
+
326
278
  partner_id: Annotated[OptionalNullable[str], pydantic.Field(alias="partnerId")] = (
327
279
  UNSET
328
280
  )
@@ -333,9 +285,6 @@ class UpsertPartnerLinkRequestBody(BaseModel):
333
285
  )
334
286
  r"""The ID of the partner in your system. If both `partnerId` and `tenantId` are not provided, an error will be thrown."""
335
287
 
336
- url: OptionalNullable[str] = UNSET
337
- r"""The URL to shorten (if not provided, the program's default URL will be used). Will throw an error if the domain doesn't match the program's default URL domain."""
338
-
339
288
  key: Optional[str] = None
340
289
  r"""The short link slug. If not provided, a random 7-character slug will be generated."""
341
290
 
@@ -349,15 +298,8 @@ class UpsertPartnerLinkRequestBody(BaseModel):
349
298
 
350
299
  @model_serializer(mode="wrap")
351
300
  def serialize_model(self, handler):
352
- optional_fields = [
353
- "partnerId",
354
- "tenantId",
355
- "url",
356
- "key",
357
- "comments",
358
- "linkProps",
359
- ]
360
- nullable_fields = ["partnerId", "tenantId", "url", "comments"]
301
+ optional_fields = ["partnerId", "tenantId", "key", "comments", "linkProps"]
302
+ nullable_fields = ["partnerId", "tenantId", "comments"]
361
303
  null_default_fields = []
362
304
 
363
305
  serialized = handler(self)