growsurf-python 0.8.0__py3-none-any.whl → 1.1.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.
- growsurf/_client.py +38 -1
- growsurf/_version.py +1 -1
- growsurf/resources/__init__.py +14 -0
- growsurf/resources/account.py +566 -0
- growsurf/resources/campaign/__init__.py +70 -0
- growsurf/resources/campaign/campaign.py +333 -66
- growsurf/resources/campaign/design.py +272 -0
- growsurf/resources/campaign/emails.py +276 -0
- growsurf/resources/campaign/installation.py +272 -0
- growsurf/resources/campaign/options.py +276 -0
- growsurf/resources/campaign/participant.py +626 -0
- growsurf/resources/campaign/rewards.py +101 -62
- growsurf/resources/campaign/webhooks.py +587 -0
- growsurf/types/__init__.py +10 -0
- growsurf/types/account.py +35 -0
- growsurf/types/account_create_params.py +23 -0
- growsurf/types/account_update_params.py +17 -0
- growsurf/types/campaign/__init__.py +23 -0
- growsurf/types/campaign/campaign.py +20 -0
- growsurf/types/campaign/campaign_design.py +13 -0
- growsurf/types/campaign/campaign_emails.py +13 -0
- growsurf/types/campaign/campaign_installation.py +14 -0
- growsurf/types/campaign/campaign_options.py +14 -0
- growsurf/types/campaign/campaign_reward_list_response.py +1 -1
- growsurf/types/campaign/delete_webhook_response.py +11 -0
- growsurf/types/campaign/email_participant_response.py +14 -0
- growsurf/types/campaign/participant_activity_logs_response.py +28 -0
- growsurf/types/campaign/participant_add_params.py +5 -0
- growsurf/types/campaign/participant_analytics_params.py +37 -0
- growsurf/types/campaign/participant_analytics_response.py +144 -0
- growsurf/types/campaign/participant_bulk_delete_params.py +17 -0
- growsurf/types/campaign/participant_bulk_delete_response.py +63 -0
- growsurf/types/campaign/participant_email_params.py +35 -0
- growsurf/types/campaign/participant_list_activity_logs_params.py +17 -0
- growsurf/types/campaign/participant_update_params.py +7 -0
- growsurf/types/campaign/reward.py +31 -3
- growsurf/types/campaign/reward_create_params.py +45 -6
- growsurf/types/campaign/reward_tax_valuation.py +29 -0
- growsurf/types/campaign/reward_update_params.py +45 -6
- growsurf/types/campaign/webhook.py +37 -0
- growsurf/types/campaign/webhook_create_params.py +27 -0
- growsurf/types/campaign/webhook_event.py +15 -0
- growsurf/types/campaign/webhook_list_response.py +12 -0
- growsurf/types/campaign/webhook_test_params.py +19 -0
- growsurf/types/campaign/webhook_test_response.py +24 -0
- growsurf/types/campaign/webhook_update_params.py +24 -0
- growsurf/types/campaign_create_params.py +5 -6
- growsurf/types/campaign_retrieve_analytics_params.py +18 -1
- growsurf/types/campaign_retrieve_analytics_response.py +127 -2
- growsurf/types/campaign_update_params.py +5 -16
- growsurf/types/commission_structure.py +3 -1
- growsurf/types/create_account_response.py +26 -0
- growsurf/types/participant_commission_list.py +1 -3
- growsurf/types/referral_flow_screenshots_response.py +34 -0
- growsurf/types/rotate_api_key_response.py +12 -0
- growsurf/types/verification_email_response.py +13 -0
- {growsurf_python-0.8.0.dist-info → growsurf_python-1.1.0.dist-info}/METADATA +1 -1
- {growsurf_python-0.8.0.dist-info → growsurf_python-1.1.0.dist-info}/RECORD +60 -26
- {growsurf_python-0.8.0.dist-info → growsurf_python-1.1.0.dist-info}/WHEEL +0 -0
- {growsurf_python-0.8.0.dist-info → growsurf_python-1.1.0.dist-info}/licenses/LICENSE +0 -0
growsurf/_client.py
CHANGED
|
@@ -36,7 +36,8 @@ from ._base_client import (
|
|
|
36
36
|
)
|
|
37
37
|
|
|
38
38
|
if TYPE_CHECKING:
|
|
39
|
-
from .resources import campaign
|
|
39
|
+
from .resources import account, campaign
|
|
40
|
+
from .resources.account import AccountResource, AsyncAccountResource
|
|
40
41
|
from .resources.campaign.campaign import CampaignResource, AsyncCampaignResource
|
|
41
42
|
|
|
42
43
|
__all__ = [
|
|
@@ -115,6 +116,12 @@ class Growsurf(SyncAPIClient):
|
|
|
115
116
|
_strict_response_validation=_strict_response_validation,
|
|
116
117
|
)
|
|
117
118
|
|
|
119
|
+
@cached_property
|
|
120
|
+
def account(self) -> AccountResource:
|
|
121
|
+
from .resources.account import AccountResource
|
|
122
|
+
|
|
123
|
+
return AccountResource(self)
|
|
124
|
+
|
|
118
125
|
@cached_property
|
|
119
126
|
def campaign(self) -> CampaignResource:
|
|
120
127
|
from .resources.campaign import CampaignResource
|
|
@@ -305,6 +312,12 @@ class AsyncGrowsurf(AsyncAPIClient):
|
|
|
305
312
|
_strict_response_validation=_strict_response_validation,
|
|
306
313
|
)
|
|
307
314
|
|
|
315
|
+
@cached_property
|
|
316
|
+
def account(self) -> AsyncAccountResource:
|
|
317
|
+
from .resources.account import AsyncAccountResource
|
|
318
|
+
|
|
319
|
+
return AsyncAccountResource(self)
|
|
320
|
+
|
|
308
321
|
@cached_property
|
|
309
322
|
def campaign(self) -> AsyncCampaignResource:
|
|
310
323
|
from .resources.campaign import AsyncCampaignResource
|
|
@@ -437,6 +450,12 @@ class GrowsurfWithRawResponse:
|
|
|
437
450
|
def __init__(self, client: Growsurf) -> None:
|
|
438
451
|
self._client = client
|
|
439
452
|
|
|
453
|
+
@cached_property
|
|
454
|
+
def account(self) -> account.AccountResourceWithRawResponse:
|
|
455
|
+
from .resources.account import AccountResourceWithRawResponse
|
|
456
|
+
|
|
457
|
+
return AccountResourceWithRawResponse(self._client.account)
|
|
458
|
+
|
|
440
459
|
@cached_property
|
|
441
460
|
def campaign(self) -> campaign.CampaignResourceWithRawResponse:
|
|
442
461
|
from .resources.campaign import CampaignResourceWithRawResponse
|
|
@@ -450,6 +469,12 @@ class AsyncGrowsurfWithRawResponse:
|
|
|
450
469
|
def __init__(self, client: AsyncGrowsurf) -> None:
|
|
451
470
|
self._client = client
|
|
452
471
|
|
|
472
|
+
@cached_property
|
|
473
|
+
def account(self) -> account.AsyncAccountResourceWithRawResponse:
|
|
474
|
+
from .resources.account import AsyncAccountResourceWithRawResponse
|
|
475
|
+
|
|
476
|
+
return AsyncAccountResourceWithRawResponse(self._client.account)
|
|
477
|
+
|
|
453
478
|
@cached_property
|
|
454
479
|
def campaign(self) -> campaign.AsyncCampaignResourceWithRawResponse:
|
|
455
480
|
from .resources.campaign import AsyncCampaignResourceWithRawResponse
|
|
@@ -463,6 +488,12 @@ class GrowsurfWithStreamedResponse:
|
|
|
463
488
|
def __init__(self, client: Growsurf) -> None:
|
|
464
489
|
self._client = client
|
|
465
490
|
|
|
491
|
+
@cached_property
|
|
492
|
+
def account(self) -> account.AccountResourceWithStreamingResponse:
|
|
493
|
+
from .resources.account import AccountResourceWithStreamingResponse
|
|
494
|
+
|
|
495
|
+
return AccountResourceWithStreamingResponse(self._client.account)
|
|
496
|
+
|
|
466
497
|
@cached_property
|
|
467
498
|
def campaign(self) -> campaign.CampaignResourceWithStreamingResponse:
|
|
468
499
|
from .resources.campaign import CampaignResourceWithStreamingResponse
|
|
@@ -476,6 +507,12 @@ class AsyncGrowsurfWithStreamedResponse:
|
|
|
476
507
|
def __init__(self, client: AsyncGrowsurf) -> None:
|
|
477
508
|
self._client = client
|
|
478
509
|
|
|
510
|
+
@cached_property
|
|
511
|
+
def account(self) -> account.AsyncAccountResourceWithStreamingResponse:
|
|
512
|
+
from .resources.account import AsyncAccountResourceWithStreamingResponse
|
|
513
|
+
|
|
514
|
+
return AsyncAccountResourceWithStreamingResponse(self._client.account)
|
|
515
|
+
|
|
479
516
|
@cached_property
|
|
480
517
|
def campaign(self) -> campaign.AsyncCampaignResourceWithStreamingResponse:
|
|
481
518
|
from .resources.campaign import AsyncCampaignResourceWithStreamingResponse
|
growsurf/_version.py
CHANGED
growsurf/resources/__init__.py
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
+
from .account import (
|
|
4
|
+
AccountResource,
|
|
5
|
+
AsyncAccountResource,
|
|
6
|
+
AccountResourceWithRawResponse,
|
|
7
|
+
AsyncAccountResourceWithRawResponse,
|
|
8
|
+
AccountResourceWithStreamingResponse,
|
|
9
|
+
AsyncAccountResourceWithStreamingResponse,
|
|
10
|
+
)
|
|
3
11
|
from .campaign import (
|
|
4
12
|
CampaignResource,
|
|
5
13
|
AsyncCampaignResource,
|
|
@@ -10,6 +18,12 @@ from .campaign import (
|
|
|
10
18
|
)
|
|
11
19
|
|
|
12
20
|
__all__ = [
|
|
21
|
+
"AccountResource",
|
|
22
|
+
"AsyncAccountResource",
|
|
23
|
+
"AccountResourceWithRawResponse",
|
|
24
|
+
"AsyncAccountResourceWithRawResponse",
|
|
25
|
+
"AccountResourceWithStreamingResponse",
|
|
26
|
+
"AsyncAccountResourceWithStreamingResponse",
|
|
13
27
|
"CampaignResource",
|
|
14
28
|
"AsyncCampaignResource",
|
|
15
29
|
"CampaignResourceWithRawResponse",
|
|
@@ -0,0 +1,566 @@
|
|
|
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 account_create_params, account_update_params
|
|
8
|
+
from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
9
|
+
from .._utils import maybe_transform, async_maybe_transform
|
|
10
|
+
from .._compat import cached_property
|
|
11
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
12
|
+
from .._response import (
|
|
13
|
+
to_raw_response_wrapper,
|
|
14
|
+
to_streamed_response_wrapper,
|
|
15
|
+
async_to_raw_response_wrapper,
|
|
16
|
+
async_to_streamed_response_wrapper,
|
|
17
|
+
)
|
|
18
|
+
from .._base_client import make_request_options
|
|
19
|
+
from ..types.account import Account
|
|
20
|
+
from ..types.create_account_response import CreateAccountResponse
|
|
21
|
+
from ..types.rotate_api_key_response import RotateApiKeyResponse
|
|
22
|
+
from ..types.verification_email_response import VerificationEmailResponse
|
|
23
|
+
|
|
24
|
+
__all__ = ["AccountResource", "AsyncAccountResource"]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class AccountResource(SyncAPIResource):
|
|
28
|
+
"""Account operations for the account that owns the API key."""
|
|
29
|
+
|
|
30
|
+
@cached_property
|
|
31
|
+
def with_raw_response(self) -> AccountResourceWithRawResponse:
|
|
32
|
+
"""
|
|
33
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
34
|
+
the raw response object instead of the parsed content.
|
|
35
|
+
|
|
36
|
+
For more information, see https://www.github.com/growsurf/growsurf-python#accessing-raw-response-data-eg-headers
|
|
37
|
+
"""
|
|
38
|
+
return AccountResourceWithRawResponse(self)
|
|
39
|
+
|
|
40
|
+
@cached_property
|
|
41
|
+
def with_streaming_response(self) -> AccountResourceWithStreamingResponse:
|
|
42
|
+
"""
|
|
43
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
44
|
+
|
|
45
|
+
For more information, see https://www.github.com/growsurf/growsurf-python#with_streaming_response
|
|
46
|
+
"""
|
|
47
|
+
return AccountResourceWithStreamingResponse(self)
|
|
48
|
+
|
|
49
|
+
def create(
|
|
50
|
+
self,
|
|
51
|
+
*,
|
|
52
|
+
email: str,
|
|
53
|
+
company: str | Omit = omit,
|
|
54
|
+
first_name: str | Omit = omit,
|
|
55
|
+
last_name: str | Omit = omit,
|
|
56
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
57
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
58
|
+
extra_headers: Headers | None = None,
|
|
59
|
+
extra_query: Query | None = None,
|
|
60
|
+
extra_body: Body | None = None,
|
|
61
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
62
|
+
) -> CreateAccountResponse:
|
|
63
|
+
"""
|
|
64
|
+
Creates a new GrowSurf account. This is the only endpoint that does not require
|
|
65
|
+
an API key, so you can call it on a client constructed with any placeholder
|
|
66
|
+
`api_key`.
|
|
67
|
+
|
|
68
|
+
The response includes an API key for the new account, but the key is locked
|
|
69
|
+
until the account's email address is verified: authenticated endpoints outside
|
|
70
|
+
the Accounts group return a `403` with error code `EMAIL_NOT_VERIFIED_ERROR`
|
|
71
|
+
until then (resend the email via the resend-verification-email endpoint, then
|
|
72
|
+
retry). A welcome email is sent to the address with the verification link and a
|
|
73
|
+
set-password link for dashboard access. Accounts whose email is never verified
|
|
74
|
+
are deleted automatically after 7 days. For security, the API key is rotated
|
|
75
|
+
the first time the account owner signs in to the GrowSurf dashboard. Some
|
|
76
|
+
actions (such as emailing participants) additionally require the GrowSurf team
|
|
77
|
+
to verify the account first. By creating an account you agree, on behalf of the
|
|
78
|
+
account holder, to GrowSurf's [Terms of Service](https://growsurf.com/terms) and
|
|
79
|
+
[Privacy Policy](https://growsurf.com/privacy).
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
email: The email address for the new account. Personal emails and disposable email addresses are not accepted.
|
|
83
|
+
|
|
84
|
+
extra_headers: Send extra headers
|
|
85
|
+
|
|
86
|
+
extra_query: Add additional query parameters to the request
|
|
87
|
+
|
|
88
|
+
extra_body: Add additional JSON properties to the request
|
|
89
|
+
|
|
90
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
91
|
+
"""
|
|
92
|
+
return self._post(
|
|
93
|
+
"/accounts",
|
|
94
|
+
body=maybe_transform(
|
|
95
|
+
{
|
|
96
|
+
"email": email,
|
|
97
|
+
"company": company,
|
|
98
|
+
"first_name": first_name,
|
|
99
|
+
"last_name": last_name,
|
|
100
|
+
},
|
|
101
|
+
account_create_params.AccountCreateParams,
|
|
102
|
+
),
|
|
103
|
+
options=make_request_options(
|
|
104
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
105
|
+
),
|
|
106
|
+
cast_to=CreateAccountResponse,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
def retrieve(
|
|
110
|
+
self,
|
|
111
|
+
*,
|
|
112
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
113
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
114
|
+
extra_headers: Headers | None = None,
|
|
115
|
+
extra_query: Query | None = None,
|
|
116
|
+
extra_body: Body | None = None,
|
|
117
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
118
|
+
) -> Account:
|
|
119
|
+
"""
|
|
120
|
+
Retrieves your GrowSurf account — profile and GrowSurf-team verification state.
|
|
121
|
+
`verificationStatus` is `VERIFIED` once the GrowSurf team has verified the
|
|
122
|
+
account — this is required before you can send participant emails from a program.
|
|
123
|
+
"""
|
|
124
|
+
return self._get(
|
|
125
|
+
"/account",
|
|
126
|
+
options=make_request_options(
|
|
127
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
128
|
+
),
|
|
129
|
+
cast_to=Account,
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
def update(
|
|
133
|
+
self,
|
|
134
|
+
*,
|
|
135
|
+
company: str | Omit = omit,
|
|
136
|
+
first_name: str | Omit = omit,
|
|
137
|
+
last_name: str | Omit = omit,
|
|
138
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
139
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
140
|
+
extra_headers: Headers | None = None,
|
|
141
|
+
extra_query: Query | None = None,
|
|
142
|
+
extra_body: Body | None = None,
|
|
143
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
144
|
+
) -> Account:
|
|
145
|
+
"""
|
|
146
|
+
Updates your own account profile (`first_name`, `last_name`, `company`). Any
|
|
147
|
+
other property is rejected with a `400` — in particular, the account `email`
|
|
148
|
+
cannot be changed via the API, and billing/subscription is not editable here.
|
|
149
|
+
|
|
150
|
+
Args:
|
|
151
|
+
extra_headers: Send extra headers
|
|
152
|
+
|
|
153
|
+
extra_query: Add additional query parameters to the request
|
|
154
|
+
|
|
155
|
+
extra_body: Add additional JSON properties to the request
|
|
156
|
+
|
|
157
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
158
|
+
"""
|
|
159
|
+
return self._patch(
|
|
160
|
+
"/account",
|
|
161
|
+
body=maybe_transform(
|
|
162
|
+
{
|
|
163
|
+
"company": company,
|
|
164
|
+
"first_name": first_name,
|
|
165
|
+
"last_name": last_name,
|
|
166
|
+
},
|
|
167
|
+
account_update_params.AccountUpdateParams,
|
|
168
|
+
),
|
|
169
|
+
options=make_request_options(
|
|
170
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
171
|
+
),
|
|
172
|
+
cast_to=Account,
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
def rotate_api_key(
|
|
176
|
+
self,
|
|
177
|
+
*,
|
|
178
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
179
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
180
|
+
extra_headers: Headers | None = None,
|
|
181
|
+
extra_query: Query | None = None,
|
|
182
|
+
extra_body: Body | None = None,
|
|
183
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
184
|
+
) -> RotateApiKeyResponse:
|
|
185
|
+
"""
|
|
186
|
+
Generates a new API key and immediately revokes the old one.
|
|
187
|
+
|
|
188
|
+
The key used to make this request stops working as soon as the response is
|
|
189
|
+
returned — update every integration that used the old key with the new one. The
|
|
190
|
+
account owner is notified by email whenever the key is rotated.
|
|
191
|
+
"""
|
|
192
|
+
return self._post(
|
|
193
|
+
"/account/api-key",
|
|
194
|
+
options=make_request_options(
|
|
195
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
196
|
+
),
|
|
197
|
+
cast_to=RotateApiKeyResponse,
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
def request_verification(
|
|
201
|
+
self,
|
|
202
|
+
*,
|
|
203
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
204
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
205
|
+
extra_headers: Headers | None = None,
|
|
206
|
+
extra_query: Query | None = None,
|
|
207
|
+
extra_body: Body | None = None,
|
|
208
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
209
|
+
) -> Account:
|
|
210
|
+
"""
|
|
211
|
+
Requests GrowSurf-team verification of your account (required before a program can
|
|
212
|
+
email its participants). Idempotent — calling it again while a request is pending
|
|
213
|
+
does not create a duplicate. Returns the account with its updated
|
|
214
|
+
`verificationStatus`.
|
|
215
|
+
"""
|
|
216
|
+
return self._post(
|
|
217
|
+
"/account/verification-request",
|
|
218
|
+
options=make_request_options(
|
|
219
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
220
|
+
),
|
|
221
|
+
cast_to=Account,
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
def resend_verification_email(
|
|
225
|
+
self,
|
|
226
|
+
*,
|
|
227
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
228
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
229
|
+
extra_headers: Headers | None = None,
|
|
230
|
+
extra_query: Query | None = None,
|
|
231
|
+
extra_body: Body | None = None,
|
|
232
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
233
|
+
) -> VerificationEmailResponse:
|
|
234
|
+
"""
|
|
235
|
+
Resends the email-verification email to the account's email address.
|
|
236
|
+
|
|
237
|
+
A `200` with `status: 'SENT'` is only returned when an email was actually
|
|
238
|
+
dispatched. Returns a `400` if the email is already verified, or a `429` if a
|
|
239
|
+
verification email was sent too recently — wait a moment, then retry.
|
|
240
|
+
"""
|
|
241
|
+
return self._post(
|
|
242
|
+
"/account/verification-email",
|
|
243
|
+
options=make_request_options(
|
|
244
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
245
|
+
),
|
|
246
|
+
cast_to=VerificationEmailResponse,
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
class AsyncAccountResource(AsyncAPIResource):
|
|
251
|
+
"""Account operations for the account that owns the API key."""
|
|
252
|
+
|
|
253
|
+
@cached_property
|
|
254
|
+
def with_raw_response(self) -> AsyncAccountResourceWithRawResponse:
|
|
255
|
+
"""
|
|
256
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
257
|
+
the raw response object instead of the parsed content.
|
|
258
|
+
|
|
259
|
+
For more information, see https://www.github.com/growsurf/growsurf-python#accessing-raw-response-data-eg-headers
|
|
260
|
+
"""
|
|
261
|
+
return AsyncAccountResourceWithRawResponse(self)
|
|
262
|
+
|
|
263
|
+
@cached_property
|
|
264
|
+
def with_streaming_response(self) -> AsyncAccountResourceWithStreamingResponse:
|
|
265
|
+
"""
|
|
266
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
267
|
+
|
|
268
|
+
For more information, see https://www.github.com/growsurf/growsurf-python#with_streaming_response
|
|
269
|
+
"""
|
|
270
|
+
return AsyncAccountResourceWithStreamingResponse(self)
|
|
271
|
+
|
|
272
|
+
async def create(
|
|
273
|
+
self,
|
|
274
|
+
*,
|
|
275
|
+
email: str,
|
|
276
|
+
company: str | Omit = omit,
|
|
277
|
+
first_name: str | Omit = omit,
|
|
278
|
+
last_name: str | Omit = omit,
|
|
279
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
280
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
281
|
+
extra_headers: Headers | None = None,
|
|
282
|
+
extra_query: Query | None = None,
|
|
283
|
+
extra_body: Body | None = None,
|
|
284
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
285
|
+
) -> CreateAccountResponse:
|
|
286
|
+
"""
|
|
287
|
+
Creates a new GrowSurf account. This is the only endpoint that does not require
|
|
288
|
+
an API key, so you can call it on a client constructed with any placeholder
|
|
289
|
+
`api_key`.
|
|
290
|
+
|
|
291
|
+
The response includes an API key for the new account, but the key is locked
|
|
292
|
+
until the account's email address is verified: authenticated endpoints outside
|
|
293
|
+
the Accounts group return a `403` with error code `EMAIL_NOT_VERIFIED_ERROR`
|
|
294
|
+
until then (resend the email via the resend-verification-email endpoint, then
|
|
295
|
+
retry). A welcome email is sent to the address with the verification link and a
|
|
296
|
+
set-password link for dashboard access. Accounts whose email is never verified
|
|
297
|
+
are deleted automatically after 7 days. For security, the API key is rotated
|
|
298
|
+
the first time the account owner signs in to the GrowSurf dashboard. Some
|
|
299
|
+
actions (such as emailing participants) additionally require the GrowSurf team
|
|
300
|
+
to verify the account first. By creating an account you agree, on behalf of the
|
|
301
|
+
account holder, to GrowSurf's [Terms of Service](https://growsurf.com/terms) and
|
|
302
|
+
[Privacy Policy](https://growsurf.com/privacy).
|
|
303
|
+
|
|
304
|
+
Args:
|
|
305
|
+
email: The email address for the new account. Personal emails and disposable email addresses are not accepted.
|
|
306
|
+
|
|
307
|
+
extra_headers: Send extra headers
|
|
308
|
+
|
|
309
|
+
extra_query: Add additional query parameters to the request
|
|
310
|
+
|
|
311
|
+
extra_body: Add additional JSON properties to the request
|
|
312
|
+
|
|
313
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
314
|
+
"""
|
|
315
|
+
return await self._post(
|
|
316
|
+
"/accounts",
|
|
317
|
+
body=await async_maybe_transform(
|
|
318
|
+
{
|
|
319
|
+
"email": email,
|
|
320
|
+
"company": company,
|
|
321
|
+
"first_name": first_name,
|
|
322
|
+
"last_name": last_name,
|
|
323
|
+
},
|
|
324
|
+
account_create_params.AccountCreateParams,
|
|
325
|
+
),
|
|
326
|
+
options=make_request_options(
|
|
327
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
328
|
+
),
|
|
329
|
+
cast_to=CreateAccountResponse,
|
|
330
|
+
)
|
|
331
|
+
|
|
332
|
+
async def retrieve(
|
|
333
|
+
self,
|
|
334
|
+
*,
|
|
335
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
336
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
337
|
+
extra_headers: Headers | None = None,
|
|
338
|
+
extra_query: Query | None = None,
|
|
339
|
+
extra_body: Body | None = None,
|
|
340
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
341
|
+
) -> Account:
|
|
342
|
+
"""
|
|
343
|
+
Retrieves your GrowSurf account — profile and GrowSurf-team verification state.
|
|
344
|
+
`verificationStatus` is `VERIFIED` once the GrowSurf team has verified the
|
|
345
|
+
account — this is required before you can send participant emails from a program.
|
|
346
|
+
"""
|
|
347
|
+
return await self._get(
|
|
348
|
+
"/account",
|
|
349
|
+
options=make_request_options(
|
|
350
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
351
|
+
),
|
|
352
|
+
cast_to=Account,
|
|
353
|
+
)
|
|
354
|
+
|
|
355
|
+
async def update(
|
|
356
|
+
self,
|
|
357
|
+
*,
|
|
358
|
+
company: str | Omit = omit,
|
|
359
|
+
first_name: str | Omit = omit,
|
|
360
|
+
last_name: str | Omit = omit,
|
|
361
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
362
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
363
|
+
extra_headers: Headers | None = None,
|
|
364
|
+
extra_query: Query | None = None,
|
|
365
|
+
extra_body: Body | None = None,
|
|
366
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
367
|
+
) -> Account:
|
|
368
|
+
"""
|
|
369
|
+
Updates your own account profile (`first_name`, `last_name`, `company`). Any
|
|
370
|
+
other property is rejected with a `400` — in particular, the account `email`
|
|
371
|
+
cannot be changed via the API, and billing/subscription is not editable here.
|
|
372
|
+
|
|
373
|
+
Args:
|
|
374
|
+
extra_headers: Send extra headers
|
|
375
|
+
|
|
376
|
+
extra_query: Add additional query parameters to the request
|
|
377
|
+
|
|
378
|
+
extra_body: Add additional JSON properties to the request
|
|
379
|
+
|
|
380
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
381
|
+
"""
|
|
382
|
+
return await self._patch(
|
|
383
|
+
"/account",
|
|
384
|
+
body=await async_maybe_transform(
|
|
385
|
+
{
|
|
386
|
+
"company": company,
|
|
387
|
+
"first_name": first_name,
|
|
388
|
+
"last_name": last_name,
|
|
389
|
+
},
|
|
390
|
+
account_update_params.AccountUpdateParams,
|
|
391
|
+
),
|
|
392
|
+
options=make_request_options(
|
|
393
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
394
|
+
),
|
|
395
|
+
cast_to=Account,
|
|
396
|
+
)
|
|
397
|
+
|
|
398
|
+
async def rotate_api_key(
|
|
399
|
+
self,
|
|
400
|
+
*,
|
|
401
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
402
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
403
|
+
extra_headers: Headers | None = None,
|
|
404
|
+
extra_query: Query | None = None,
|
|
405
|
+
extra_body: Body | None = None,
|
|
406
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
407
|
+
) -> RotateApiKeyResponse:
|
|
408
|
+
"""
|
|
409
|
+
Generates a new API key and immediately revokes the old one.
|
|
410
|
+
|
|
411
|
+
The key used to make this request stops working as soon as the response is
|
|
412
|
+
returned — update every integration that used the old key with the new one. The
|
|
413
|
+
account owner is notified by email whenever the key is rotated.
|
|
414
|
+
"""
|
|
415
|
+
return await self._post(
|
|
416
|
+
"/account/api-key",
|
|
417
|
+
options=make_request_options(
|
|
418
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
419
|
+
),
|
|
420
|
+
cast_to=RotateApiKeyResponse,
|
|
421
|
+
)
|
|
422
|
+
|
|
423
|
+
async def request_verification(
|
|
424
|
+
self,
|
|
425
|
+
*,
|
|
426
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
427
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
428
|
+
extra_headers: Headers | None = None,
|
|
429
|
+
extra_query: Query | None = None,
|
|
430
|
+
extra_body: Body | None = None,
|
|
431
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
432
|
+
) -> Account:
|
|
433
|
+
"""
|
|
434
|
+
Requests GrowSurf-team verification of your account (required before a program can
|
|
435
|
+
email its participants). Idempotent — calling it again while a request is pending
|
|
436
|
+
does not create a duplicate. Returns the account with its updated
|
|
437
|
+
`verificationStatus`.
|
|
438
|
+
"""
|
|
439
|
+
return await self._post(
|
|
440
|
+
"/account/verification-request",
|
|
441
|
+
options=make_request_options(
|
|
442
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
443
|
+
),
|
|
444
|
+
cast_to=Account,
|
|
445
|
+
)
|
|
446
|
+
|
|
447
|
+
async def resend_verification_email(
|
|
448
|
+
self,
|
|
449
|
+
*,
|
|
450
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
451
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
452
|
+
extra_headers: Headers | None = None,
|
|
453
|
+
extra_query: Query | None = None,
|
|
454
|
+
extra_body: Body | None = None,
|
|
455
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
456
|
+
) -> VerificationEmailResponse:
|
|
457
|
+
"""
|
|
458
|
+
Resends the email-verification email to the account's email address.
|
|
459
|
+
|
|
460
|
+
A `200` with `status: 'SENT'` is only returned when an email was actually
|
|
461
|
+
dispatched. Returns a `400` if the email is already verified, or a `429` if a
|
|
462
|
+
verification email was sent too recently — wait a moment, then retry.
|
|
463
|
+
"""
|
|
464
|
+
return await self._post(
|
|
465
|
+
"/account/verification-email",
|
|
466
|
+
options=make_request_options(
|
|
467
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
468
|
+
),
|
|
469
|
+
cast_to=VerificationEmailResponse,
|
|
470
|
+
)
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
class AccountResourceWithRawResponse:
|
|
474
|
+
def __init__(self, account: AccountResource) -> None:
|
|
475
|
+
self._account = account
|
|
476
|
+
|
|
477
|
+
self.create = to_raw_response_wrapper(
|
|
478
|
+
account.create,
|
|
479
|
+
)
|
|
480
|
+
self.retrieve = to_raw_response_wrapper(
|
|
481
|
+
account.retrieve,
|
|
482
|
+
)
|
|
483
|
+
self.update = to_raw_response_wrapper(
|
|
484
|
+
account.update,
|
|
485
|
+
)
|
|
486
|
+
self.rotate_api_key = to_raw_response_wrapper(
|
|
487
|
+
account.rotate_api_key,
|
|
488
|
+
)
|
|
489
|
+
self.request_verification = to_raw_response_wrapper(
|
|
490
|
+
account.request_verification,
|
|
491
|
+
)
|
|
492
|
+
self.resend_verification_email = to_raw_response_wrapper(
|
|
493
|
+
account.resend_verification_email,
|
|
494
|
+
)
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
class AsyncAccountResourceWithRawResponse:
|
|
498
|
+
def __init__(self, account: AsyncAccountResource) -> None:
|
|
499
|
+
self._account = account
|
|
500
|
+
|
|
501
|
+
self.create = async_to_raw_response_wrapper(
|
|
502
|
+
account.create,
|
|
503
|
+
)
|
|
504
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
505
|
+
account.retrieve,
|
|
506
|
+
)
|
|
507
|
+
self.update = async_to_raw_response_wrapper(
|
|
508
|
+
account.update,
|
|
509
|
+
)
|
|
510
|
+
self.rotate_api_key = async_to_raw_response_wrapper(
|
|
511
|
+
account.rotate_api_key,
|
|
512
|
+
)
|
|
513
|
+
self.request_verification = async_to_raw_response_wrapper(
|
|
514
|
+
account.request_verification,
|
|
515
|
+
)
|
|
516
|
+
self.resend_verification_email = async_to_raw_response_wrapper(
|
|
517
|
+
account.resend_verification_email,
|
|
518
|
+
)
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
class AccountResourceWithStreamingResponse:
|
|
522
|
+
def __init__(self, account: AccountResource) -> None:
|
|
523
|
+
self._account = account
|
|
524
|
+
|
|
525
|
+
self.create = to_streamed_response_wrapper(
|
|
526
|
+
account.create,
|
|
527
|
+
)
|
|
528
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
529
|
+
account.retrieve,
|
|
530
|
+
)
|
|
531
|
+
self.update = to_streamed_response_wrapper(
|
|
532
|
+
account.update,
|
|
533
|
+
)
|
|
534
|
+
self.rotate_api_key = to_streamed_response_wrapper(
|
|
535
|
+
account.rotate_api_key,
|
|
536
|
+
)
|
|
537
|
+
self.request_verification = to_streamed_response_wrapper(
|
|
538
|
+
account.request_verification,
|
|
539
|
+
)
|
|
540
|
+
self.resend_verification_email = to_streamed_response_wrapper(
|
|
541
|
+
account.resend_verification_email,
|
|
542
|
+
)
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
class AsyncAccountResourceWithStreamingResponse:
|
|
546
|
+
def __init__(self, account: AsyncAccountResource) -> None:
|
|
547
|
+
self._account = account
|
|
548
|
+
|
|
549
|
+
self.create = async_to_streamed_response_wrapper(
|
|
550
|
+
account.create,
|
|
551
|
+
)
|
|
552
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
553
|
+
account.retrieve,
|
|
554
|
+
)
|
|
555
|
+
self.update = async_to_streamed_response_wrapper(
|
|
556
|
+
account.update,
|
|
557
|
+
)
|
|
558
|
+
self.rotate_api_key = async_to_streamed_response_wrapper(
|
|
559
|
+
account.rotate_api_key,
|
|
560
|
+
)
|
|
561
|
+
self.request_verification = async_to_streamed_response_wrapper(
|
|
562
|
+
account.request_verification,
|
|
563
|
+
)
|
|
564
|
+
self.resend_verification_email = async_to_streamed_response_wrapper(
|
|
565
|
+
account.resend_verification_email,
|
|
566
|
+
)
|