Skip to content

Commit 823f95c

Browse files
feat: add None default value to nullable response properties (#123)
1 parent 42b60df commit 823f95c

33 files changed

+496
-496
lines changed

src/orb/pagination.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class PagePaginationMetadata(BaseModel):
1414
has_more: bool
1515

16-
next_cursor: Optional[str]
16+
next_cursor: Optional[str] = None
1717

1818

1919
class SyncPage(BaseSyncPage[ModelT], BasePage[ModelT], Generic[ModelT]):

src/orb/types/coupon.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Coupon(BaseModel):
4949
id: str
5050
"""Also referred to as coupon_id in this documentation."""
5151

52-
archived_at: Optional[datetime]
52+
archived_at: Optional[datetime] = None
5353
"""An archived coupon can no longer be redeemed.
5454
5555
Active coupons will have a value of null for `archived_at`; this field will be
@@ -58,13 +58,13 @@ class Coupon(BaseModel):
5858

5959
discount: Discount
6060

61-
duration_in_months: Optional[int]
61+
duration_in_months: Optional[int] = None
6262
"""
6363
This allows for a coupon's discount to apply for a limited time (determined in
6464
months); a `null` value here means "unlimited time".
6565
"""
6666

67-
max_redemptions: Optional[int]
67+
max_redemptions: Optional[int] = None
6868
"""
6969
The maximum number of redemptions allowed for this coupon before it is
7070
exhausted; `null` here means "unlimited".

src/orb/types/credit_note.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
class Customer(BaseModel):
2424
id: str
2525

26-
external_customer_id: Optional[str]
26+
external_customer_id: Optional[str] = None
2727

2828

2929
class DiscountAppliesToPrice(BaseModel):
@@ -65,7 +65,7 @@ class LineItemSubLineItem(BaseModel):
6565

6666
name: str
6767

68-
quantity: Optional[float]
68+
quantity: Optional[float] = None
6969

7070

7171
class LineItemTaxAmount(BaseModel):
@@ -75,7 +75,7 @@ class LineItemTaxAmount(BaseModel):
7575
tax_rate_description: str
7676
"""The human-readable description of the applied tax rate."""
7777

78-
tax_rate_percentage: Optional[str]
78+
tax_rate_percentage: Optional[str] = None
7979
"""The tax rate percentage, out of 100."""
8080

8181

@@ -92,7 +92,7 @@ class LineItem(BaseModel):
9292
name: str
9393
"""The name of the corresponding invoice line item."""
9494

95-
quantity: Optional[float]
95+
quantity: Optional[float] = None
9696
"""An optional quantity credited."""
9797

9898
sub_line_items: List[LineItemSubLineItem]
@@ -133,7 +133,7 @@ class CreditNote(BaseModel):
133133
credit_note_number: str
134134
"""The unique identifier for credit notes."""
135135

136-
credit_note_pdf: Optional[str]
136+
credit_note_pdf: Optional[str] = None
137137
"""A URL to a PDF of the credit note."""
138138

139139
customer: Customer
@@ -147,16 +147,16 @@ class CreditNote(BaseModel):
147147
line_items: List[LineItem]
148148
"""All of the line items associated with this credit note."""
149149

150-
maximum_amount_adjustment: Optional[MaximumAmountAdjustment]
150+
maximum_amount_adjustment: Optional[MaximumAmountAdjustment] = None
151151
"""The maximum amount applied on the original invoice"""
152152

153-
memo: Optional[str]
153+
memo: Optional[str] = None
154154
"""An optional memo supplied on the credit note."""
155155

156-
minimum_amount_refunded: Optional[str]
156+
minimum_amount_refunded: Optional[str] = None
157157
"""Any credited amount from the applied minimum on the invoice."""
158158

159-
reason: Optional[Literal["Duplicate", "Fraudulent", "Order change", "Product unsatisfactory"]]
159+
reason: Optional[Literal["Duplicate", "Fraudulent", "Order change", "Product unsatisfactory"]] = None
160160

161161
subtotal: str
162162
"""The total prior to any creditable invoice-level discounts or minimums."""
@@ -166,5 +166,5 @@ class CreditNote(BaseModel):
166166

167167
type: Literal["refund", "adjustment"]
168168

169-
voided_at: Optional[datetime]
169+
voided_at: Optional[datetime] = None
170170
"""The time at which the credit note was voided in Orb, if applicable."""

src/orb/types/customer.py

+21-21
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,31 @@
1818

1919

2020
class BillingAddress(BaseModel):
21-
city: Optional[str]
21+
city: Optional[str] = None
2222

23-
country: Optional[str]
23+
country: Optional[str] = None
2424

25-
line1: Optional[str]
25+
line1: Optional[str] = None
2626

27-
line2: Optional[str]
27+
line2: Optional[str] = None
2828

29-
postal_code: Optional[str]
29+
postal_code: Optional[str] = None
3030

31-
state: Optional[str]
31+
state: Optional[str] = None
3232

3333

3434
class ShippingAddress(BaseModel):
35-
city: Optional[str]
35+
city: Optional[str] = None
3636

37-
country: Optional[str]
37+
country: Optional[str] = None
3838

39-
line1: Optional[str]
39+
line1: Optional[str] = None
4040

41-
line2: Optional[str]
41+
line2: Optional[str] = None
4242

43-
postal_code: Optional[str]
43+
postal_code: Optional[str] = None
4444

45-
state: Optional[str]
45+
state: Optional[str] = None
4646

4747

4848
class TaxID(BaseModel):
@@ -169,7 +169,7 @@ class TaxID(BaseModel):
169169

170170

171171
class AccountingSyncConfigurationAccountingProvider(BaseModel):
172-
external_provider_id: Optional[str]
172+
external_provider_id: Optional[str] = None
173173

174174
provider_type: Literal["quickbooks", "netsuite"]
175175

@@ -194,11 +194,11 @@ class Customer(BaseModel):
194194
balance: str
195195
"""The customer's current balance in their currency."""
196196

197-
billing_address: Optional[BillingAddress]
197+
billing_address: Optional[BillingAddress] = None
198198

199199
created_at: datetime
200200

201-
currency: Optional[str]
201+
currency: Optional[str] = None
202202

203203
email: str
204204
"""A valid customer email, to be used for notifications.
@@ -209,7 +209,7 @@ class Customer(BaseModel):
209209

210210
email_delivery: bool
211211

212-
external_customer_id: Optional[str]
212+
external_customer_id: Optional[str] = None
213213
"""
214214
An optional user-defined ID for this customer resource, used throughout the
215215
system as an alias for this Customer. Use this field to identify a customer by
@@ -227,24 +227,24 @@ class Customer(BaseModel):
227227
name: str
228228
"""The full name of the customer"""
229229

230-
payment_provider: Optional[Literal["quickbooks", "bill.com", "stripe_charge", "stripe_invoice", "netsuite"]]
230+
payment_provider: Optional[Literal["quickbooks", "bill.com", "stripe_charge", "stripe_invoice", "netsuite"]] = None
231231
"""This is used for creating charges or invoices in an external system via Orb.
232232
233233
When not in test mode, the connection must first be configured in the Orb
234234
webapp.
235235
"""
236236

237-
payment_provider_id: Optional[str]
237+
payment_provider_id: Optional[str] = None
238238
"""The ID of this customer in an external payments solution, such as Stripe.
239239
240240
This is used for creating charges or invoices in the external system via Orb.
241241
"""
242242

243-
portal_url: Optional[str]
243+
portal_url: Optional[str] = None
244244

245-
shipping_address: Optional[ShippingAddress]
245+
shipping_address: Optional[ShippingAddress] = None
246246

247-
tax_id: Optional[TaxID]
247+
tax_id: Optional[TaxID] = None
248248
"""
249249
Tax IDs are commonly required to be displayed on customer invoices, which are
250250
added to the headers of invoices.

src/orb/types/customers/balance_transaction_create_response.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ class BalanceTransactionCreateResponse(BaseModel):
4040
created_at: datetime
4141
"""The creation time of this transaction."""
4242

43-
credit_note: Optional[CreditNote]
43+
credit_note: Optional[CreditNote] = None
4444

45-
description: Optional[str]
45+
description: Optional[str] = None
4646
"""An optional description provided for manual customer balance adjustments."""
4747

4848
ending_balance: str
@@ -51,7 +51,7 @@ class BalanceTransactionCreateResponse(BaseModel):
5151
customer's currency.
5252
"""
5353

54-
invoice: Optional[Invoice]
54+
invoice: Optional[Invoice] = None
5555

5656
starting_balance: str
5757
"""

src/orb/types/customers/balance_transaction_list_response.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ class BalanceTransactionListResponse(BaseModel):
4040
created_at: datetime
4141
"""The creation time of this transaction."""
4242

43-
credit_note: Optional[CreditNote]
43+
credit_note: Optional[CreditNote] = None
4444

45-
description: Optional[str]
45+
description: Optional[str] = None
4646
"""An optional description provided for manual customer balance adjustments."""
4747

4848
ending_balance: str
@@ -51,7 +51,7 @@ class BalanceTransactionListResponse(BaseModel):
5151
customer's currency.
5252
"""
5353

54-
invoice: Optional[Invoice]
54+
invoice: Optional[Invoice] = None
5555

5656
starting_balance: str
5757
"""

src/orb/types/customers/cost_list_by_external_id_response.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ class DataPerPriceCostPriceGroup(BaseModel):
1313
grouping_key: str
1414
"""Grouping key to break down a single price's costs"""
1515

16-
grouping_value: Optional[str]
16+
grouping_value: Optional[str] = None
1717

18-
secondary_grouping_key: Optional[str]
18+
secondary_grouping_key: Optional[str] = None
1919
"""If the price is a matrix price, this is the second dimension key"""
2020

21-
secondary_grouping_value: Optional[str]
21+
secondary_grouping_value: Optional[str] = None
2222

2323
total: str
2424
"""Total costs for this group for the timeframe.

src/orb/types/customers/cost_list_response.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ class DataPerPriceCostPriceGroup(BaseModel):
1313
grouping_key: str
1414
"""Grouping key to break down a single price's costs"""
1515

16-
grouping_value: Optional[str]
16+
grouping_value: Optional[str] = None
1717

18-
secondary_grouping_key: Optional[str]
18+
secondary_grouping_key: Optional[str] = None
1919
"""If the price is a matrix price, this is the second dimension key"""
2020

21-
secondary_grouping_value: Optional[str]
21+
secondary_grouping_value: Optional[str] = None
2222

2323
total: str
2424
"""Total costs for this group for the timeframe.

src/orb/types/customers/credit_list_by_external_id_response.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ class CreditListByExternalIDResponse(BaseModel):
1313

1414
balance: float
1515

16-
expiry_date: Optional[datetime]
16+
expiry_date: Optional[datetime] = None
1717

18-
per_unit_cost_basis: Optional[str]
18+
per_unit_cost_basis: Optional[str] = None

src/orb/types/customers/credit_list_response.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ class CreditListResponse(BaseModel):
1313

1414
balance: float
1515

16-
expiry_date: Optional[datetime]
16+
expiry_date: Optional[datetime] = None
1717

18-
per_unit_cost_basis: Optional[str]
18+
per_unit_cost_basis: Optional[str] = None

0 commit comments

Comments
 (0)