samplehc 0.9.0__py3-none-any.whl → 0.11.0__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 (101) hide show
  1. samplehc/_base_client.py +3 -3
  2. samplehc/_compat.py +48 -48
  3. samplehc/_models.py +41 -41
  4. samplehc/_types.py +35 -1
  5. samplehc/_utils/__init__.py +9 -2
  6. samplehc/_utils/_compat.py +45 -0
  7. samplehc/_utils/_datetime_parse.py +136 -0
  8. samplehc/_utils/_transform.py +11 -1
  9. samplehc/_utils/_typing.py +6 -1
  10. samplehc/_utils/_utils.py +0 -1
  11. samplehc/_version.py +1 -1
  12. samplehc/resources/v2/browser_agents/__init__.py +33 -0
  13. samplehc/resources/v2/{browser_agents.py → browser_agents/browser_agents.py} +40 -8
  14. samplehc/resources/v2/browser_agents/runs/__init__.py +33 -0
  15. samplehc/resources/v2/browser_agents/runs/help_requests.py +191 -0
  16. samplehc/resources/v2/browser_agents/runs/runs.py +102 -0
  17. samplehc/resources/v2/clearinghouse/clearinghouse.py +4 -4
  18. samplehc/resources/v2/clearinghouse/payers.py +18 -20
  19. samplehc/resources/v2/{events/events.py → events.py} +8 -40
  20. samplehc/resources/v2/integrations/__init__.py +28 -0
  21. samplehc/resources/v2/integrations/careviso.py +10 -10
  22. samplehc/resources/v2/integrations/integrations.py +64 -0
  23. samplehc/resources/v2/integrations/salesforce.py +193 -0
  24. samplehc/resources/v2/{events/integrations → integrations}/xcures.py +7 -7
  25. samplehc/resources/v2/ledger/__init__.py +27 -55
  26. samplehc/resources/v2/ledger/{orders.py → account.py} +120 -82
  27. samplehc/resources/v2/ledger/entry.py +382 -0
  28. samplehc/resources/v2/ledger/ledger.py +38 -1560
  29. samplehc/resources/v2/v2.py +16 -16
  30. samplehc/types/v2/__init__.py +0 -28
  31. samplehc/types/v2/browser_agent_invoke_response.py +3 -0
  32. samplehc/types/v2/browser_agents/runs/__init__.py +6 -0
  33. samplehc/types/v2/browser_agents/runs/help_request_resolve_params.py +18 -0
  34. samplehc/types/v2/browser_agents/runs/help_request_resolve_response.py +30 -0
  35. samplehc/types/v2/clearinghouse/__init__.py +2 -2
  36. samplehc/types/v2/clearinghouse/claim_submit_params.py +10 -9
  37. samplehc/types/v2/clearinghouse/{payer_retrieve_search_params.py → payer_search_params.py} +2 -2
  38. samplehc/types/v2/clearinghouse/{payer_retrieve_search_response.py → payer_search_response.py} +2 -2
  39. samplehc/types/v2/clearinghouse_calculate_patient_cost_params.py +3 -2
  40. samplehc/types/v2/clearinghouse_check_eligibility_params.py +2 -2
  41. samplehc/types/v2/communication_send_letter_params.py +4 -3
  42. samplehc/types/v2/document_classify_params.py +3 -2
  43. samplehc/types/v2/document_generate_csv_params.py +3 -2
  44. samplehc/types/v2/documents/legacy_extract_params.py +8 -7
  45. samplehc/types/v2/integrations/__init__.py +2 -0
  46. samplehc/types/v2/integrations/careviso_submit_prior_authorization_params.py +6 -5
  47. samplehc/types/v2/integrations/glidian/prior_authorizations/clinical_question_update_params.py +3 -2
  48. samplehc/types/v2/integrations/salesforce_run_crud_action_params.py +22 -0
  49. samplehc/types/v2/ledger/__init__.py +6 -17
  50. samplehc/types/v2/ledger/account_writeoff_params.py +24 -0
  51. samplehc/types/v2/ledger/account_writeoff_response.py +12 -0
  52. samplehc/types/v2/ledger/entry_post_params.py +61 -0
  53. samplehc/types/v2/ledger/entry_post_response.py +10 -0
  54. samplehc/types/v2/ledger/entry_reverse_params.py +19 -0
  55. samplehc/types/v2/ledger/entry_reverse_response.py +10 -0
  56. {samplehc-0.9.0.dist-info → samplehc-0.11.0.dist-info}/METADATA +1 -1
  57. {samplehc-0.9.0.dist-info → samplehc-0.11.0.dist-info}/RECORD +61 -83
  58. samplehc/resources/v2/events/__init__.py +0 -33
  59. samplehc/resources/v2/events/integrations/__init__.py +0 -33
  60. samplehc/resources/v2/events/integrations/integrations.py +0 -102
  61. samplehc/resources/v2/ledger/institutions/__init__.py +0 -33
  62. samplehc/resources/v2/ledger/institutions/institutions.py +0 -258
  63. samplehc/resources/v2/ledger/institutions/orders.py +0 -169
  64. samplehc/resources/v2/ledger/insurance.py +0 -141
  65. samplehc/resources/v2/ledger/patients.py +0 -141
  66. samplehc/types/v2/events/integrations/__init__.py +0 -5
  67. samplehc/types/v2/ledger/institution_list_outstanding_accounts_response.py +0 -25
  68. samplehc/types/v2/ledger/institution_retrieve_outstanding_orders_response.py +0 -25
  69. samplehc/types/v2/ledger/institutions/__init__.py +0 -5
  70. samplehc/types/v2/ledger/institutions/order_retrieve_balance_response.py +0 -12
  71. samplehc/types/v2/ledger/insurance_list_outstanding_accounts_response.py +0 -25
  72. samplehc/types/v2/ledger/order_retrieve_balances_response.py +0 -31
  73. samplehc/types/v2/ledger/order_retrieve_batch_balances_params.py +0 -15
  74. samplehc/types/v2/ledger/order_retrieve_batch_balances_response.py +0 -38
  75. samplehc/types/v2/ledger/patient_list_outstanding_accounts_response.py +0 -22
  76. samplehc/types/v2/ledger_assign_invoice_params.py +0 -34
  77. samplehc/types/v2/ledger_assign_invoice_response.py +0 -12
  78. samplehc/types/v2/ledger_claim_adjustment_params.py +0 -34
  79. samplehc/types/v2/ledger_claim_adjustment_response.py +0 -12
  80. samplehc/types/v2/ledger_claim_payment_params.py +0 -34
  81. samplehc/types/v2/ledger_claim_payment_response.py +0 -12
  82. samplehc/types/v2/ledger_institution_adjustment_params.py +0 -31
  83. samplehc/types/v2/ledger_institution_adjustment_response.py +0 -12
  84. samplehc/types/v2/ledger_institution_payment_params.py +0 -31
  85. samplehc/types/v2/ledger_institution_payment_response.py +0 -12
  86. samplehc/types/v2/ledger_new_order_params.py +0 -22
  87. samplehc/types/v2/ledger_new_order_response.py +0 -12
  88. samplehc/types/v2/ledger_order_writeoff_params.py +0 -28
  89. samplehc/types/v2/ledger_order_writeoff_response.py +0 -12
  90. samplehc/types/v2/ledger_patient_adjustment_params.py +0 -31
  91. samplehc/types/v2/ledger_patient_adjustment_response.py +0 -12
  92. samplehc/types/v2/ledger_patient_payment_params.py +0 -28
  93. samplehc/types/v2/ledger_patient_payment_response.py +0 -12
  94. samplehc/types/v2/ledger_post_remittance_accepted_params.py +0 -37
  95. samplehc/types/v2/ledger_post_remittance_accepted_response.py +0 -12
  96. samplehc/types/v2/ledger_reverse_entry_params.py +0 -12
  97. samplehc/types/v2/ledger_reverse_entry_response.py +0 -12
  98. /samplehc/types/v2/{events → browser_agents}/__init__.py +0 -0
  99. /samplehc/types/v2/{events/integrations → integrations}/xcure_make_request_params.py +0 -0
  100. {samplehc-0.9.0.dist-info → samplehc-0.11.0.dist-info}/WHEEL +0 -0
  101. {samplehc-0.9.0.dist-info → samplehc-0.11.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,5 +1,13 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
+ from .entry import (
4
+ EntryResource,
5
+ AsyncEntryResource,
6
+ EntryResourceWithRawResponse,
7
+ AsyncEntryResourceWithRawResponse,
8
+ EntryResourceWithStreamingResponse,
9
+ AsyncEntryResourceWithStreamingResponse,
10
+ )
3
11
  from .ledger import (
4
12
  LedgerResource,
5
13
  AsyncLedgerResource,
@@ -8,64 +16,28 @@ from .ledger import (
8
16
  LedgerResourceWithStreamingResponse,
9
17
  AsyncLedgerResourceWithStreamingResponse,
10
18
  )
11
- from .orders import (
12
- OrdersResource,
13
- AsyncOrdersResource,
14
- OrdersResourceWithRawResponse,
15
- AsyncOrdersResourceWithRawResponse,
16
- OrdersResourceWithStreamingResponse,
17
- AsyncOrdersResourceWithStreamingResponse,
18
- )
19
- from .patients import (
20
- PatientsResource,
21
- AsyncPatientsResource,
22
- PatientsResourceWithRawResponse,
23
- AsyncPatientsResourceWithRawResponse,
24
- PatientsResourceWithStreamingResponse,
25
- AsyncPatientsResourceWithStreamingResponse,
26
- )
27
- from .insurance import (
28
- InsuranceResource,
29
- AsyncInsuranceResource,
30
- InsuranceResourceWithRawResponse,
31
- AsyncInsuranceResourceWithRawResponse,
32
- InsuranceResourceWithStreamingResponse,
33
- AsyncInsuranceResourceWithStreamingResponse,
34
- )
35
- from .institutions import (
36
- InstitutionsResource,
37
- AsyncInstitutionsResource,
38
- InstitutionsResourceWithRawResponse,
39
- AsyncInstitutionsResourceWithRawResponse,
40
- InstitutionsResourceWithStreamingResponse,
41
- AsyncInstitutionsResourceWithStreamingResponse,
19
+ from .account import (
20
+ AccountResource,
21
+ AsyncAccountResource,
22
+ AccountResourceWithRawResponse,
23
+ AsyncAccountResourceWithRawResponse,
24
+ AccountResourceWithStreamingResponse,
25
+ AsyncAccountResourceWithStreamingResponse,
42
26
  )
43
27
 
44
28
  __all__ = [
45
- "InstitutionsResource",
46
- "AsyncInstitutionsResource",
47
- "InstitutionsResourceWithRawResponse",
48
- "AsyncInstitutionsResourceWithRawResponse",
49
- "InstitutionsResourceWithStreamingResponse",
50
- "AsyncInstitutionsResourceWithStreamingResponse",
51
- "InsuranceResource",
52
- "AsyncInsuranceResource",
53
- "InsuranceResourceWithRawResponse",
54
- "AsyncInsuranceResourceWithRawResponse",
55
- "InsuranceResourceWithStreamingResponse",
56
- "AsyncInsuranceResourceWithStreamingResponse",
57
- "PatientsResource",
58
- "AsyncPatientsResource",
59
- "PatientsResourceWithRawResponse",
60
- "AsyncPatientsResourceWithRawResponse",
61
- "PatientsResourceWithStreamingResponse",
62
- "AsyncPatientsResourceWithStreamingResponse",
63
- "OrdersResource",
64
- "AsyncOrdersResource",
65
- "OrdersResourceWithRawResponse",
66
- "AsyncOrdersResourceWithRawResponse",
67
- "OrdersResourceWithStreamingResponse",
68
- "AsyncOrdersResourceWithStreamingResponse",
29
+ "EntryResource",
30
+ "AsyncEntryResource",
31
+ "EntryResourceWithRawResponse",
32
+ "AsyncEntryResourceWithRawResponse",
33
+ "EntryResourceWithStreamingResponse",
34
+ "AsyncEntryResourceWithStreamingResponse",
35
+ "AccountResource",
36
+ "AsyncAccountResource",
37
+ "AccountResourceWithRawResponse",
38
+ "AsyncAccountResourceWithRawResponse",
39
+ "AccountResourceWithStreamingResponse",
40
+ "AsyncAccountResourceWithStreamingResponse",
69
41
  "LedgerResource",
70
42
  "AsyncLedgerResource",
71
43
  "LedgerResourceWithRawResponse",
@@ -2,11 +2,12 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import List
5
+ from typing import Dict, Union
6
+ from datetime import datetime
6
7
 
7
8
  import httpx
8
9
 
9
- from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
10
+ from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
10
11
  from ...._utils import maybe_transform, async_maybe_transform
11
12
  from ...._compat import cached_property
12
13
  from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -17,48 +18,46 @@ from ...._response import (
17
18
  async_to_streamed_response_wrapper,
18
19
  )
19
20
  from ...._base_client import make_request_options
20
- from ....types.v2.ledger import order_retrieve_batch_balances_params
21
- from ....types.v2.ledger.order_retrieve_balances_response import OrderRetrieveBalancesResponse
22
- from ....types.v2.ledger.order_retrieve_batch_balances_response import OrderRetrieveBatchBalancesResponse
21
+ from ....types.v2.ledger import account_writeoff_params
22
+ from ....types.v2.ledger.account_writeoff_response import AccountWriteoffResponse
23
23
 
24
- __all__ = ["OrdersResource", "AsyncOrdersResource"]
24
+ __all__ = ["AccountResource", "AsyncAccountResource"]
25
25
 
26
26
 
27
- class OrdersResource(SyncAPIResource):
27
+ class AccountResource(SyncAPIResource):
28
28
  @cached_property
29
- def with_raw_response(self) -> OrdersResourceWithRawResponse:
29
+ def with_raw_response(self) -> AccountResourceWithRawResponse:
30
30
  """
31
31
  This property can be used as a prefix for any HTTP method call to return
32
32
  the raw response object instead of the parsed content.
33
33
 
34
34
  For more information, see https://www.github.com/samplehc/samplehc-python#accessing-raw-response-data-eg-headers
35
35
  """
36
- return OrdersResourceWithRawResponse(self)
36
+ return AccountResourceWithRawResponse(self)
37
37
 
38
38
  @cached_property
39
- def with_streaming_response(self) -> OrdersResourceWithStreamingResponse:
39
+ def with_streaming_response(self) -> AccountResourceWithStreamingResponse:
40
40
  """
41
41
  An alternative to `.with_raw_response` that doesn't eagerly read the response body.
42
42
 
43
43
  For more information, see https://www.github.com/samplehc/samplehc-python#with_streaming_response
44
44
  """
45
- return OrdersResourceWithStreamingResponse(self)
45
+ return AccountResourceWithStreamingResponse(self)
46
46
 
47
- def retrieve_balances(
47
+ def get_balance(
48
48
  self,
49
- order_id: str,
49
+ line_item_id: str,
50
50
  *,
51
+ order_id: str,
51
52
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
52
53
  # The extra values given here take precedence over values defined on the client or passed to this method.
53
54
  extra_headers: Headers | None = None,
54
55
  extra_query: Query | None = None,
55
56
  extra_body: Body | None = None,
56
57
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
57
- ) -> OrderRetrieveBalancesResponse:
58
+ ) -> None:
58
59
  """
59
- Retrieves outstanding balances for a single order ID across all balance
60
- categories (order-writeoff, unallocated, institution invoices, institution
61
- uninvoiced, patient responsibility).
60
+ Get balance for a ledger account
62
61
 
63
62
  Args:
64
63
  extra_headers: Send extra headers
@@ -71,32 +70,43 @@ class OrdersResource(SyncAPIResource):
71
70
  """
72
71
  if not order_id:
73
72
  raise ValueError(f"Expected a non-empty value for `order_id` but received {order_id!r}")
73
+ if not line_item_id:
74
+ raise ValueError(f"Expected a non-empty value for `line_item_id` but received {line_item_id!r}")
75
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
74
76
  return self._get(
75
- f"/api/v2/ledger/orders/{order_id}/balances",
77
+ f"/api/v2/ledger/account/{order_id}/line-item/{line_item_id}/balance",
76
78
  options=make_request_options(
77
79
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
78
80
  ),
79
- cast_to=OrderRetrieveBalancesResponse,
81
+ cast_to=NoneType,
80
82
  )
81
83
 
82
- def retrieve_batch_balances(
84
+ def writeoff(
83
85
  self,
86
+ line_item_id: str,
84
87
  *,
85
- order_ids: List[str],
88
+ order_id: str,
89
+ description: str,
90
+ metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
91
+ posted_at: Union[str, datetime] | NotGiven = NOT_GIVEN,
86
92
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
87
93
  # The extra values given here take precedence over values defined on the client or passed to this method.
88
94
  extra_headers: Headers | None = None,
89
95
  extra_query: Query | None = None,
90
96
  extra_body: Body | None = None,
91
97
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
92
- ) -> OrderRetrieveBatchBalancesResponse:
93
- """
94
- Retrieves outstanding balances for an array of order IDs across all balance
95
- categories (order-writeoff, unallocated, institution invoices, institution
96
- uninvoiced, patient responsibility).
98
+ ) -> AccountWriteoffResponse:
99
+ """Writes off the remaining balance in an account on the ledger.
100
+
101
+ Throws an error if
102
+ the account contains a non-positive balance.
97
103
 
98
104
  Args:
99
- order_ids: Array of order IDs to retrieve balances for (max 100)
105
+ description: The description of the write-off.
106
+
107
+ metadata: Any optional metadata to associate with the write-off.
108
+
109
+ posted_at: The date and time to post the write-off.
100
110
 
101
111
  extra_headers: Send extra headers
102
112
 
@@ -106,53 +116,61 @@ class OrdersResource(SyncAPIResource):
106
116
 
107
117
  timeout: Override the client-level default timeout for this request, in seconds
108
118
  """
119
+ if not order_id:
120
+ raise ValueError(f"Expected a non-empty value for `order_id` but received {order_id!r}")
121
+ if not line_item_id:
122
+ raise ValueError(f"Expected a non-empty value for `line_item_id` but received {line_item_id!r}")
109
123
  return self._post(
110
- "/api/v2/ledger/orders/batch-balances",
124
+ f"/api/v2/ledger/account/{order_id}/line-item/{line_item_id}/writeoff",
111
125
  body=maybe_transform(
112
- {"order_ids": order_ids}, order_retrieve_batch_balances_params.OrderRetrieveBatchBalancesParams
126
+ {
127
+ "description": description,
128
+ "metadata": metadata,
129
+ "posted_at": posted_at,
130
+ },
131
+ account_writeoff_params.AccountWriteoffParams,
113
132
  ),
114
133
  options=make_request_options(
115
134
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
116
135
  ),
117
- cast_to=OrderRetrieveBatchBalancesResponse,
136
+ cast_to=AccountWriteoffResponse,
118
137
  )
119
138
 
120
139
 
121
- class AsyncOrdersResource(AsyncAPIResource):
140
+ class AsyncAccountResource(AsyncAPIResource):
122
141
  @cached_property
123
- def with_raw_response(self) -> AsyncOrdersResourceWithRawResponse:
142
+ def with_raw_response(self) -> AsyncAccountResourceWithRawResponse:
124
143
  """
125
144
  This property can be used as a prefix for any HTTP method call to return
126
145
  the raw response object instead of the parsed content.
127
146
 
128
147
  For more information, see https://www.github.com/samplehc/samplehc-python#accessing-raw-response-data-eg-headers
129
148
  """
130
- return AsyncOrdersResourceWithRawResponse(self)
149
+ return AsyncAccountResourceWithRawResponse(self)
131
150
 
132
151
  @cached_property
133
- def with_streaming_response(self) -> AsyncOrdersResourceWithStreamingResponse:
152
+ def with_streaming_response(self) -> AsyncAccountResourceWithStreamingResponse:
134
153
  """
135
154
  An alternative to `.with_raw_response` that doesn't eagerly read the response body.
136
155
 
137
156
  For more information, see https://www.github.com/samplehc/samplehc-python#with_streaming_response
138
157
  """
139
- return AsyncOrdersResourceWithStreamingResponse(self)
158
+ return AsyncAccountResourceWithStreamingResponse(self)
140
159
 
141
- async def retrieve_balances(
160
+ async def get_balance(
142
161
  self,
143
- order_id: str,
162
+ line_item_id: str,
144
163
  *,
164
+ order_id: str,
145
165
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
146
166
  # The extra values given here take precedence over values defined on the client or passed to this method.
147
167
  extra_headers: Headers | None = None,
148
168
  extra_query: Query | None = None,
149
169
  extra_body: Body | None = None,
150
170
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
151
- ) -> OrderRetrieveBalancesResponse:
171
+ ) -> None:
152
172
  """
153
- Retrieves outstanding balances for a single order ID across all balance
154
- categories (order-writeoff, unallocated, institution invoices, institution
155
- uninvoiced, patient responsibility).
173
+ Get balance for a ledger account
156
174
 
157
175
  Args:
158
176
  extra_headers: Send extra headers
@@ -165,32 +183,43 @@ class AsyncOrdersResource(AsyncAPIResource):
165
183
  """
166
184
  if not order_id:
167
185
  raise ValueError(f"Expected a non-empty value for `order_id` but received {order_id!r}")
186
+ if not line_item_id:
187
+ raise ValueError(f"Expected a non-empty value for `line_item_id` but received {line_item_id!r}")
188
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
168
189
  return await self._get(
169
- f"/api/v2/ledger/orders/{order_id}/balances",
190
+ f"/api/v2/ledger/account/{order_id}/line-item/{line_item_id}/balance",
170
191
  options=make_request_options(
171
192
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
172
193
  ),
173
- cast_to=OrderRetrieveBalancesResponse,
194
+ cast_to=NoneType,
174
195
  )
175
196
 
176
- async def retrieve_batch_balances(
197
+ async def writeoff(
177
198
  self,
199
+ line_item_id: str,
178
200
  *,
179
- order_ids: List[str],
201
+ order_id: str,
202
+ description: str,
203
+ metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
204
+ posted_at: Union[str, datetime] | NotGiven = NOT_GIVEN,
180
205
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
181
206
  # The extra values given here take precedence over values defined on the client or passed to this method.
182
207
  extra_headers: Headers | None = None,
183
208
  extra_query: Query | None = None,
184
209
  extra_body: Body | None = None,
185
210
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
186
- ) -> OrderRetrieveBatchBalancesResponse:
187
- """
188
- Retrieves outstanding balances for an array of order IDs across all balance
189
- categories (order-writeoff, unallocated, institution invoices, institution
190
- uninvoiced, patient responsibility).
211
+ ) -> AccountWriteoffResponse:
212
+ """Writes off the remaining balance in an account on the ledger.
213
+
214
+ Throws an error if
215
+ the account contains a non-positive balance.
191
216
 
192
217
  Args:
193
- order_ids: Array of order IDs to retrieve balances for (max 100)
218
+ description: The description of the write-off.
219
+
220
+ metadata: Any optional metadata to associate with the write-off.
221
+
222
+ posted_at: The date and time to post the write-off.
194
223
 
195
224
  extra_headers: Send extra headers
196
225
 
@@ -200,61 +229,70 @@ class AsyncOrdersResource(AsyncAPIResource):
200
229
 
201
230
  timeout: Override the client-level default timeout for this request, in seconds
202
231
  """
232
+ if not order_id:
233
+ raise ValueError(f"Expected a non-empty value for `order_id` but received {order_id!r}")
234
+ if not line_item_id:
235
+ raise ValueError(f"Expected a non-empty value for `line_item_id` but received {line_item_id!r}")
203
236
  return await self._post(
204
- "/api/v2/ledger/orders/batch-balances",
237
+ f"/api/v2/ledger/account/{order_id}/line-item/{line_item_id}/writeoff",
205
238
  body=await async_maybe_transform(
206
- {"order_ids": order_ids}, order_retrieve_batch_balances_params.OrderRetrieveBatchBalancesParams
239
+ {
240
+ "description": description,
241
+ "metadata": metadata,
242
+ "posted_at": posted_at,
243
+ },
244
+ account_writeoff_params.AccountWriteoffParams,
207
245
  ),
208
246
  options=make_request_options(
209
247
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
210
248
  ),
211
- cast_to=OrderRetrieveBatchBalancesResponse,
249
+ cast_to=AccountWriteoffResponse,
212
250
  )
213
251
 
214
252
 
215
- class OrdersResourceWithRawResponse:
216
- def __init__(self, orders: OrdersResource) -> None:
217
- self._orders = orders
253
+ class AccountResourceWithRawResponse:
254
+ def __init__(self, account: AccountResource) -> None:
255
+ self._account = account
218
256
 
219
- self.retrieve_balances = to_raw_response_wrapper(
220
- orders.retrieve_balances,
257
+ self.get_balance = to_raw_response_wrapper(
258
+ account.get_balance,
221
259
  )
222
- self.retrieve_batch_balances = to_raw_response_wrapper(
223
- orders.retrieve_batch_balances,
260
+ self.writeoff = to_raw_response_wrapper(
261
+ account.writeoff,
224
262
  )
225
263
 
226
264
 
227
- class AsyncOrdersResourceWithRawResponse:
228
- def __init__(self, orders: AsyncOrdersResource) -> None:
229
- self._orders = orders
265
+ class AsyncAccountResourceWithRawResponse:
266
+ def __init__(self, account: AsyncAccountResource) -> None:
267
+ self._account = account
230
268
 
231
- self.retrieve_balances = async_to_raw_response_wrapper(
232
- orders.retrieve_balances,
269
+ self.get_balance = async_to_raw_response_wrapper(
270
+ account.get_balance,
233
271
  )
234
- self.retrieve_batch_balances = async_to_raw_response_wrapper(
235
- orders.retrieve_batch_balances,
272
+ self.writeoff = async_to_raw_response_wrapper(
273
+ account.writeoff,
236
274
  )
237
275
 
238
276
 
239
- class OrdersResourceWithStreamingResponse:
240
- def __init__(self, orders: OrdersResource) -> None:
241
- self._orders = orders
277
+ class AccountResourceWithStreamingResponse:
278
+ def __init__(self, account: AccountResource) -> None:
279
+ self._account = account
242
280
 
243
- self.retrieve_balances = to_streamed_response_wrapper(
244
- orders.retrieve_balances,
281
+ self.get_balance = to_streamed_response_wrapper(
282
+ account.get_balance,
245
283
  )
246
- self.retrieve_batch_balances = to_streamed_response_wrapper(
247
- orders.retrieve_batch_balances,
284
+ self.writeoff = to_streamed_response_wrapper(
285
+ account.writeoff,
248
286
  )
249
287
 
250
288
 
251
- class AsyncOrdersResourceWithStreamingResponse:
252
- def __init__(self, orders: AsyncOrdersResource) -> None:
253
- self._orders = orders
289
+ class AsyncAccountResourceWithStreamingResponse:
290
+ def __init__(self, account: AsyncAccountResource) -> None:
291
+ self._account = account
254
292
 
255
- self.retrieve_balances = async_to_streamed_response_wrapper(
256
- orders.retrieve_balances,
293
+ self.get_balance = async_to_streamed_response_wrapper(
294
+ account.get_balance,
257
295
  )
258
- self.retrieve_batch_balances = async_to_streamed_response_wrapper(
259
- orders.retrieve_batch_balances,
296
+ self.writeoff = async_to_streamed_response_wrapper(
297
+ account.writeoff,
260
298
  )