growsurf-python 0.0.2__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.
- growsurf/__init__.py +102 -0
- growsurf/_base_client.py +2153 -0
- growsurf/_client.py +484 -0
- growsurf/_compat.py +226 -0
- growsurf/_constants.py +14 -0
- growsurf/_exceptions.py +108 -0
- growsurf/_files.py +173 -0
- growsurf/_models.py +878 -0
- growsurf/_qs.py +149 -0
- growsurf/_resource.py +43 -0
- growsurf/_response.py +833 -0
- growsurf/_streaming.py +338 -0
- growsurf/_types.py +274 -0
- growsurf/_utils/__init__.py +64 -0
- growsurf/_utils/_compat.py +45 -0
- growsurf/_utils/_datetime_parse.py +136 -0
- growsurf/_utils/_json.py +35 -0
- growsurf/_utils/_logs.py +25 -0
- growsurf/_utils/_path.py +127 -0
- growsurf/_utils/_proxy.py +65 -0
- growsurf/_utils/_reflection.py +42 -0
- growsurf/_utils/_resources_proxy.py +24 -0
- growsurf/_utils/_streams.py +12 -0
- growsurf/_utils/_sync.py +58 -0
- growsurf/_utils/_transform.py +457 -0
- growsurf/_utils/_typing.py +156 -0
- growsurf/_utils/_utils.py +433 -0
- growsurf/_version.py +4 -0
- growsurf/lib/.keep +4 -0
- growsurf/py.typed +0 -0
- growsurf/resources/__init__.py +19 -0
- growsurf/resources/campaign/__init__.py +61 -0
- growsurf/resources/campaign/campaign.py +1126 -0
- growsurf/resources/campaign/commission.py +259 -0
- growsurf/resources/campaign/participant.py +1587 -0
- growsurf/resources/campaign/reward.py +355 -0
- growsurf/types/__init__.py +18 -0
- growsurf/types/campaign/__init__.py +35 -0
- growsurf/types/campaign/campaign.py +73 -0
- growsurf/types/campaign/commission_approve_response.py +9 -0
- growsurf/types/campaign/commission_delete_response.py +9 -0
- growsurf/types/campaign/fraud_risk_level.py +7 -0
- growsurf/types/campaign/participant.py +147 -0
- growsurf/types/campaign/participant_add_params.py +30 -0
- growsurf/types/campaign/participant_delete_response.py +9 -0
- growsurf/types/campaign/participant_list_commissions_params.py +22 -0
- growsurf/types/campaign/participant_list_payouts_params.py +22 -0
- growsurf/types/campaign/participant_list_referrals_params.py +43 -0
- growsurf/types/campaign/participant_list_rewards_params.py +19 -0
- growsurf/types/campaign/participant_list_rewards_response.py +18 -0
- growsurf/types/campaign/participant_record_transaction_params.py +60 -0
- growsurf/types/campaign/participant_record_transaction_response.py +37 -0
- growsurf/types/campaign/participant_reward.py +39 -0
- growsurf/types/campaign/participant_send_invites_params.py +20 -0
- growsurf/types/campaign/participant_send_invites_response.py +15 -0
- growsurf/types/campaign/participant_trigger_referral_response.py +13 -0
- growsurf/types/campaign/participant_update_params.py +34 -0
- growsurf/types/campaign/referral_source.py +7 -0
- growsurf/types/campaign/referral_status.py +7 -0
- growsurf/types/campaign/reward_approve_params.py +14 -0
- growsurf/types/campaign/reward_approve_response.py +9 -0
- growsurf/types/campaign/reward_delete_response.py +9 -0
- growsurf/types/campaign/reward_fulfill_response.py +9 -0
- growsurf/types/campaign_list_commissions_params.py +20 -0
- growsurf/types/campaign_list_leaderboard_params.py +36 -0
- growsurf/types/campaign_list_participants_params.py +17 -0
- growsurf/types/campaign_list_payouts_params.py +20 -0
- growsurf/types/campaign_list_referrals_params.py +41 -0
- growsurf/types/campaign_list_response.py +12 -0
- growsurf/types/campaign_retrieve_analytics_params.py +26 -0
- growsurf/types/campaign_retrieve_analytics_response.py +75 -0
- growsurf/types/commission_structure.py +62 -0
- growsurf/types/participant_commission_list.py +62 -0
- growsurf/types/participant_list.py +18 -0
- growsurf/types/participant_payout_list.py +50 -0
- growsurf/types/referral_list.py +40 -0
- growsurf_python-0.0.2.dist-info/METADATA +399 -0
- growsurf_python-0.0.2.dist-info/RECORD +80 -0
- growsurf_python-0.0.2.dist-info/WHEEL +4 -0
- growsurf_python-0.0.2.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ..._types import Body, Query, Headers, NotGiven, not_given
|
|
8
|
+
from ..._utils import path_template
|
|
9
|
+
from ..._compat import cached_property
|
|
10
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
11
|
+
from ..._response import (
|
|
12
|
+
to_raw_response_wrapper,
|
|
13
|
+
to_streamed_response_wrapper,
|
|
14
|
+
async_to_raw_response_wrapper,
|
|
15
|
+
async_to_streamed_response_wrapper,
|
|
16
|
+
)
|
|
17
|
+
from ..._base_client import make_request_options
|
|
18
|
+
from ...types.campaign.commission_delete_response import CommissionDeleteResponse
|
|
19
|
+
from ...types.campaign.commission_approve_response import CommissionApproveResponse
|
|
20
|
+
|
|
21
|
+
__all__ = ["CommissionResource", "AsyncCommissionResource"]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class CommissionResource(SyncAPIResource):
|
|
25
|
+
"""Affiliate transaction, commission, and payout operations."""
|
|
26
|
+
|
|
27
|
+
@cached_property
|
|
28
|
+
def with_raw_response(self) -> CommissionResourceWithRawResponse:
|
|
29
|
+
"""
|
|
30
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
31
|
+
the raw response object instead of the parsed content.
|
|
32
|
+
|
|
33
|
+
For more information, see https://www.github.com/growsurf/growsurf-python#accessing-raw-response-data-eg-headers
|
|
34
|
+
"""
|
|
35
|
+
return CommissionResourceWithRawResponse(self)
|
|
36
|
+
|
|
37
|
+
@cached_property
|
|
38
|
+
def with_streaming_response(self) -> CommissionResourceWithStreamingResponse:
|
|
39
|
+
"""
|
|
40
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
41
|
+
|
|
42
|
+
For more information, see https://www.github.com/growsurf/growsurf-python#with_streaming_response
|
|
43
|
+
"""
|
|
44
|
+
return CommissionResourceWithStreamingResponse(self)
|
|
45
|
+
|
|
46
|
+
def delete(
|
|
47
|
+
self,
|
|
48
|
+
commission_id: str,
|
|
49
|
+
*,
|
|
50
|
+
id: str,
|
|
51
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
52
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
53
|
+
extra_headers: Headers | None = None,
|
|
54
|
+
extra_query: Query | None = None,
|
|
55
|
+
extra_body: Body | None = None,
|
|
56
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
57
|
+
) -> CommissionDeleteResponse:
|
|
58
|
+
"""
|
|
59
|
+
Removes a pending participant commission.
|
|
60
|
+
|
|
61
|
+
Args:
|
|
62
|
+
extra_headers: Send extra headers
|
|
63
|
+
|
|
64
|
+
extra_query: Add additional query parameters to the request
|
|
65
|
+
|
|
66
|
+
extra_body: Add additional JSON properties to the request
|
|
67
|
+
|
|
68
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
69
|
+
"""
|
|
70
|
+
if not id:
|
|
71
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
72
|
+
if not commission_id:
|
|
73
|
+
raise ValueError(f"Expected a non-empty value for `commission_id` but received {commission_id!r}")
|
|
74
|
+
return self._delete(
|
|
75
|
+
path_template("/campaign/{id}/commission/{commission_id}", id=id, commission_id=commission_id),
|
|
76
|
+
options=make_request_options(
|
|
77
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
78
|
+
),
|
|
79
|
+
cast_to=CommissionDeleteResponse,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
def approve(
|
|
83
|
+
self,
|
|
84
|
+
commission_id: str,
|
|
85
|
+
*,
|
|
86
|
+
id: str,
|
|
87
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
88
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
89
|
+
extra_headers: Headers | None = None,
|
|
90
|
+
extra_query: Query | None = None,
|
|
91
|
+
extra_body: Body | None = None,
|
|
92
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
93
|
+
) -> CommissionApproveResponse:
|
|
94
|
+
"""
|
|
95
|
+
Approves a pending participant commission so it can become eligible for payout.
|
|
96
|
+
|
|
97
|
+
Args:
|
|
98
|
+
extra_headers: Send extra headers
|
|
99
|
+
|
|
100
|
+
extra_query: Add additional query parameters to the request
|
|
101
|
+
|
|
102
|
+
extra_body: Add additional JSON properties to the request
|
|
103
|
+
|
|
104
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
105
|
+
"""
|
|
106
|
+
if not id:
|
|
107
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
108
|
+
if not commission_id:
|
|
109
|
+
raise ValueError(f"Expected a non-empty value for `commission_id` but received {commission_id!r}")
|
|
110
|
+
return self._post(
|
|
111
|
+
path_template("/campaign/{id}/commission/{commission_id}/approve", id=id, commission_id=commission_id),
|
|
112
|
+
options=make_request_options(
|
|
113
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
114
|
+
),
|
|
115
|
+
cast_to=CommissionApproveResponse,
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
class AsyncCommissionResource(AsyncAPIResource):
|
|
120
|
+
"""Affiliate transaction, commission, and payout operations."""
|
|
121
|
+
|
|
122
|
+
@cached_property
|
|
123
|
+
def with_raw_response(self) -> AsyncCommissionResourceWithRawResponse:
|
|
124
|
+
"""
|
|
125
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
126
|
+
the raw response object instead of the parsed content.
|
|
127
|
+
|
|
128
|
+
For more information, see https://www.github.com/growsurf/growsurf-python#accessing-raw-response-data-eg-headers
|
|
129
|
+
"""
|
|
130
|
+
return AsyncCommissionResourceWithRawResponse(self)
|
|
131
|
+
|
|
132
|
+
@cached_property
|
|
133
|
+
def with_streaming_response(self) -> AsyncCommissionResourceWithStreamingResponse:
|
|
134
|
+
"""
|
|
135
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
136
|
+
|
|
137
|
+
For more information, see https://www.github.com/growsurf/growsurf-python#with_streaming_response
|
|
138
|
+
"""
|
|
139
|
+
return AsyncCommissionResourceWithStreamingResponse(self)
|
|
140
|
+
|
|
141
|
+
async def delete(
|
|
142
|
+
self,
|
|
143
|
+
commission_id: str,
|
|
144
|
+
*,
|
|
145
|
+
id: str,
|
|
146
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
147
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
148
|
+
extra_headers: Headers | None = None,
|
|
149
|
+
extra_query: Query | None = None,
|
|
150
|
+
extra_body: Body | None = None,
|
|
151
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
152
|
+
) -> CommissionDeleteResponse:
|
|
153
|
+
"""
|
|
154
|
+
Removes a pending participant commission.
|
|
155
|
+
|
|
156
|
+
Args:
|
|
157
|
+
extra_headers: Send extra headers
|
|
158
|
+
|
|
159
|
+
extra_query: Add additional query parameters to the request
|
|
160
|
+
|
|
161
|
+
extra_body: Add additional JSON properties to the request
|
|
162
|
+
|
|
163
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
164
|
+
"""
|
|
165
|
+
if not id:
|
|
166
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
167
|
+
if not commission_id:
|
|
168
|
+
raise ValueError(f"Expected a non-empty value for `commission_id` but received {commission_id!r}")
|
|
169
|
+
return await self._delete(
|
|
170
|
+
path_template("/campaign/{id}/commission/{commission_id}", id=id, commission_id=commission_id),
|
|
171
|
+
options=make_request_options(
|
|
172
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
173
|
+
),
|
|
174
|
+
cast_to=CommissionDeleteResponse,
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
async def approve(
|
|
178
|
+
self,
|
|
179
|
+
commission_id: str,
|
|
180
|
+
*,
|
|
181
|
+
id: str,
|
|
182
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
183
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
184
|
+
extra_headers: Headers | None = None,
|
|
185
|
+
extra_query: Query | None = None,
|
|
186
|
+
extra_body: Body | None = None,
|
|
187
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
188
|
+
) -> CommissionApproveResponse:
|
|
189
|
+
"""
|
|
190
|
+
Approves a pending participant commission so it can become eligible for payout.
|
|
191
|
+
|
|
192
|
+
Args:
|
|
193
|
+
extra_headers: Send extra headers
|
|
194
|
+
|
|
195
|
+
extra_query: Add additional query parameters to the request
|
|
196
|
+
|
|
197
|
+
extra_body: Add additional JSON properties to the request
|
|
198
|
+
|
|
199
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
200
|
+
"""
|
|
201
|
+
if not id:
|
|
202
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
203
|
+
if not commission_id:
|
|
204
|
+
raise ValueError(f"Expected a non-empty value for `commission_id` but received {commission_id!r}")
|
|
205
|
+
return await self._post(
|
|
206
|
+
path_template("/campaign/{id}/commission/{commission_id}/approve", id=id, commission_id=commission_id),
|
|
207
|
+
options=make_request_options(
|
|
208
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
209
|
+
),
|
|
210
|
+
cast_to=CommissionApproveResponse,
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
class CommissionResourceWithRawResponse:
|
|
215
|
+
def __init__(self, commission: CommissionResource) -> None:
|
|
216
|
+
self._commission = commission
|
|
217
|
+
|
|
218
|
+
self.delete = to_raw_response_wrapper(
|
|
219
|
+
commission.delete,
|
|
220
|
+
)
|
|
221
|
+
self.approve = to_raw_response_wrapper(
|
|
222
|
+
commission.approve,
|
|
223
|
+
)
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
class AsyncCommissionResourceWithRawResponse:
|
|
227
|
+
def __init__(self, commission: AsyncCommissionResource) -> None:
|
|
228
|
+
self._commission = commission
|
|
229
|
+
|
|
230
|
+
self.delete = async_to_raw_response_wrapper(
|
|
231
|
+
commission.delete,
|
|
232
|
+
)
|
|
233
|
+
self.approve = async_to_raw_response_wrapper(
|
|
234
|
+
commission.approve,
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
class CommissionResourceWithStreamingResponse:
|
|
239
|
+
def __init__(self, commission: CommissionResource) -> None:
|
|
240
|
+
self._commission = commission
|
|
241
|
+
|
|
242
|
+
self.delete = to_streamed_response_wrapper(
|
|
243
|
+
commission.delete,
|
|
244
|
+
)
|
|
245
|
+
self.approve = to_streamed_response_wrapper(
|
|
246
|
+
commission.approve,
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
class AsyncCommissionResourceWithStreamingResponse:
|
|
251
|
+
def __init__(self, commission: AsyncCommissionResource) -> None:
|
|
252
|
+
self._commission = commission
|
|
253
|
+
|
|
254
|
+
self.delete = async_to_streamed_response_wrapper(
|
|
255
|
+
commission.delete,
|
|
256
|
+
)
|
|
257
|
+
self.approve = async_to_streamed_response_wrapper(
|
|
258
|
+
commission.approve,
|
|
259
|
+
)
|