|
| 1 | +""" |
| 2 | + This code was generated by |
| 3 | + |
| 4 | + SENDGRID-OAI-GENERATOR |
| 5 | + |
| 6 | + Twilio SendGrid Account Provisioning API |
| 7 | + The Twilio SendGrid Account Provisioning API provides a platform for Twilio SendGrid resellers to manage their customer accounts. This API is for companies that have a formal reseller partnership with Twilio SendGrid. You can access Twilio SendGrid sub-account functionality without becoming a reseller. If you require sub-account functionality, see the Twilio [SendGrid Subusers](https://docs.sendgrid.com/ui/account-and-settings/subusers) feature, which is available with [Pro and Premier plans](https://sendgrid.com/pricing/). |
| 8 | + |
| 9 | + NOTE: This class is auto generated by OpenAPI Generator. |
| 10 | + https://openapi-generator.tech |
| 11 | + Do not edit the class manually. |
| 12 | +""" |
| 13 | + |
| 14 | +import json |
| 15 | +import warnings |
| 16 | +from typing import Any, Dict, List, Optional, Tuple, Union |
| 17 | +from typing_extensions import Annotated |
| 18 | +from sendgrid.base import values |
| 19 | +from sendgrid.exceptions import ApiException |
| 20 | +from sendgrid.http.request import Request |
| 21 | +from sendgrid.http.response import ApiResponse |
| 22 | + |
| 23 | +from pydantic import Field, StrictStr |
| 24 | +from typing import Optional |
| 25 | +from typing_extensions import Annotated |
| 26 | +from sendgrid.rest.api.account_provisioning.v3.models.account_provisioning_account_id import AccountProvisioningAccountId |
| 27 | +from sendgrid.rest.api.account_provisioning.v3.models.create_account_params import CreateAccountParams |
| 28 | + |
| 29 | +class CreateAccount: |
| 30 | + def __init__(self, client) -> None: |
| 31 | + self.client = client |
| 32 | + |
| 33 | + def send( |
| 34 | + self, |
| 35 | + t_test_account: Optional[str] = None, |
| 36 | + create_account_params: Optional[CreateAccountParams] = None, |
| 37 | + |
| 38 | + ): |
| 39 | + path='/v3/partners/accounts' |
| 40 | + |
| 41 | + headers = values.of( |
| 42 | + { |
| 43 | + 'T-Test-Account': t_test_account, |
| 44 | + }) |
| 45 | + headers["Content-Type"] = "application/json" |
| 46 | + data = None |
| 47 | + if create_account_params: |
| 48 | + data = create_account_params.to_dict() |
| 49 | + request = Request( |
| 50 | + method='POST', |
| 51 | + url=path, |
| 52 | + data=data, |
| 53 | + headers=headers |
| 54 | + ) |
| 55 | + response=self.client.send(request) |
| 56 | + if response is None: |
| 57 | + raise ApiException(error="CreateAlert creation failed: Unable to connect to server") |
| 58 | + |
| 59 | + if response.text: |
| 60 | + text = json.loads(response.text) |
| 61 | + else: |
| 62 | + text = "" |
| 63 | + if response.is_success(): |
| 64 | + return ApiResponse(status_code=response.status_code, model=text, headers=response.headers) |
| 65 | + else: |
| 66 | + raise ApiException(status_code=response.status_code, error=text, headers=response.headers) |
0 commit comments