Skip to content

Commit fb8bbc7

Browse files
authored
chore: Autogenerating code and RC Release preparation (#1092)
* chore: autogenerating code from open api spec and RC Release preparation
1 parent aeb9888 commit fb8bbc7

File tree

1,264 files changed

+51529
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,264 files changed

+51529
-1
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
33

4+
[2024-10-04] Version 7.0.0-rc.1
5+
---------------------------
6+
- Releasing autogenerated code for python from sendgrid open api specification.
7+
8+
[2024-10-04] Version 7.0.0-rc.0
9+
---------------------------
10+
- Release Candidate preparation.
11+
12+
413
[2023-12-01] Version 6.11.0
514
---------------------------
615
**Library - Feature**

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,30 @@ pip install sendgrid
8080

8181
The following is the minimum needed code to send an email with the [/mail/send Helper](sendgrid/helpers/mail) ([here](examples/helpers/mail_example.py#L9) is a full example):
8282

83+
### Send Email using Auto generated code
84+
```python
85+
from sendgrid.client import Client
86+
87+
from sendgrid.rest.api.mail.v3.send_mail import SendMail
88+
from sendgrid.rest.api.mail.v3.models import (MailTo, MailFrom, SendMailRequestPersonalizationsInner,
89+
SendMailRequestContentInner, SendMailRequest)
90+
91+
92+
client = Client(api_key='api_key')
93+
94+
mail_to_list = [MailTo(email="to_email", name="to_name")]
95+
personalization = [SendMailRequestPersonalizationsInner(to=mail_to_list, subject="Message")]
96+
97+
send_mail_request = SendMailRequest(
98+
personalizations=personalization,
99+
var_from=MailFrom(email="from_email", name="from_name"),
100+
content=[SendMailRequestContentInner(type="text/plain", value="Body")])
101+
102+
send_mail = SendMail(client)
103+
response = send_mail.send(send_mail_request=send_mail_request)
104+
print(response)
105+
```
106+
83107
### With Mail Helper Class
84108

85109
```python

UPGRADE.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Upgrade Guide
2+
3+
_`MAJOR` version bumps will have upgrade notes posted here._
4+
5+
[2024-10-XX] 6.x.x to 7.x.x-rc.x
6+
--------------------------------
7+
### Overview
8+
9+
#### Sendgrid Python Helper Library’s version 7.0.0-rc.x is now available.
10+
11+
Behind the scenes Python Helper is now auto-generated via OpenAPI with this release. This enables us to rapidly add new features and enhance consistency across versions and languages.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# TODO
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
from sendgrid.exceptions import ApiException
16+
from sendgrid.http.request import Request
17+
from sendgrid.http.response import ApiResponse
18+
19+
20+
class AuthenticateAccount:
21+
def __init__(self, client) -> None:
22+
self.client = client
23+
24+
def send(
25+
self,
26+
account_id: str,
27+
):
28+
path = "/v3/partners/accounts/{accountID}/sso"
29+
path = path.format(
30+
account_id=account_id,
31+
)
32+
33+
data = None
34+
request = Request(method="POST", url=path, data=data, headers=headers)
35+
response = self.client.send(request)
36+
if response is None:
37+
raise ApiException(
38+
error="CreateAlert creation failed: Unable to connect to server"
39+
)
40+
41+
if response.text:
42+
text = json.loads(response.text)
43+
else:
44+
text = ""
45+
if response.is_success():
46+
return ApiResponse(
47+
status_code=response.status_code, model=text, headers=response.headers
48+
)
49+
else:
50+
raise ApiException(
51+
status_code=response.status_code, error=text, headers=response.headers
52+
)
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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+
from typing import Optional
16+
from sendgrid.base import values
17+
from sendgrid.exceptions import ApiException
18+
from sendgrid.http.request import Request
19+
from sendgrid.http.response import ApiResponse
20+
21+
from typing import Optional
22+
from sendgrid.rest.api.account_provisioning.v3.models.create_account_params import (
23+
CreateAccountParams,
24+
)
25+
26+
27+
class CreateAccount:
28+
def __init__(self, client) -> None:
29+
self.client = client
30+
31+
def send(
32+
self,
33+
t_test_account: Optional[str] = None,
34+
create_account_params: Optional[CreateAccountParams] = None,
35+
):
36+
path = "/v3/partners/accounts"
37+
38+
headers = values.of(
39+
{
40+
"T-Test-Account": t_test_account,
41+
}
42+
)
43+
headers["Content-Type"] = "application/json"
44+
data = None
45+
if create_account_params:
46+
data = create_account_params.to_dict()
47+
request = Request(method="POST", url=path, data=data, headers=headers)
48+
response = self.client.send(request)
49+
if response is None:
50+
raise ApiException(
51+
error="CreateAlert creation failed: Unable to connect to server"
52+
)
53+
54+
if response.text:
55+
text = json.loads(response.text)
56+
else:
57+
text = ""
58+
if response.is_success():
59+
return ApiResponse(
60+
status_code=response.status_code, model=text, headers=response.headers
61+
)
62+
else:
63+
raise ApiException(
64+
status_code=response.status_code, error=text, headers=response.headers
65+
)
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
from sendgrid.exceptions import ApiException
16+
from sendgrid.http.request import Request
17+
from sendgrid.http.response import ApiResponse
18+
19+
20+
class DeleteAccount:
21+
def __init__(self, client) -> None:
22+
self.client = client
23+
24+
def send(
25+
self,
26+
account_id: str,
27+
):
28+
path = "/v3/partners/accounts/{accountID}"
29+
path = path.format(
30+
account_id=account_id,
31+
)
32+
33+
data = None
34+
request = Request(method="DELETE", url=path, data=data, headers=headers)
35+
response = self.client.send(request)
36+
if response is None:
37+
raise ApiException(
38+
error="CreateAlert creation failed: Unable to connect to server"
39+
)
40+
41+
if response.text:
42+
text = json.loads(response.text)
43+
else:
44+
text = ""
45+
if response.is_success():
46+
return ApiResponse(
47+
status_code=response.status_code, model=text, headers=response.headers
48+
)
49+
else:
50+
raise ApiException(
51+
status_code=response.status_code, error=text, headers=response.headers
52+
)
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
from sendgrid.exceptions import ApiException
16+
from sendgrid.http.request import Request
17+
from sendgrid.http.response import ApiResponse
18+
19+
20+
class GetAccountState:
21+
def __init__(self, client) -> None:
22+
self.client = client
23+
24+
def send(
25+
self,
26+
account_id: str,
27+
):
28+
path = "/v3/partners/accounts/{accountID}/state"
29+
path = path.format(
30+
account_id=account_id,
31+
)
32+
33+
data = None
34+
request = Request(method="GET", url=path, data=data, headers=headers)
35+
response = self.client.send(request)
36+
if response is None:
37+
raise ApiException(
38+
error="CreateAlert creation failed: Unable to connect to server"
39+
)
40+
41+
if response.text:
42+
text = json.loads(response.text)
43+
else:
44+
text = ""
45+
if response.is_success():
46+
return ApiResponse(
47+
status_code=response.status_code, model=text, headers=response.headers
48+
)
49+
else:
50+
raise ApiException(
51+
status_code=response.status_code, error=text, headers=response.headers
52+
)
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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+
from typing import Optional
16+
from sendgrid.exceptions import ApiException
17+
from sendgrid.http.request import Request
18+
from sendgrid.http.response import ApiResponse
19+
20+
from typing import Optional
21+
22+
23+
class ListAccount:
24+
def __init__(self, client) -> None:
25+
self.client = client
26+
27+
def send(
28+
self,
29+
offset: Optional[str] = None,
30+
limit: Optional[int] = None,
31+
):
32+
path = "/v3/partners/accounts"
33+
34+
data = None
35+
request = Request(method="GET", url=path, data=data, headers=headers)
36+
response = self.client.send(request)
37+
if response is None:
38+
raise ApiException(
39+
error="CreateAlert creation failed: Unable to connect to server"
40+
)
41+
42+
if response.text:
43+
text = json.loads(response.text)
44+
else:
45+
text = ""
46+
if response.is_success():
47+
return ApiResponse(
48+
status_code=response.status_code, model=text, headers=response.headers
49+
)
50+
else:
51+
raise ApiException(
52+
status_code=response.status_code, error=text, headers=response.headers
53+
)
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
from sendgrid.exceptions import ApiException
16+
from sendgrid.http.request import Request
17+
from sendgrid.http.response import ApiResponse
18+
19+
20+
class ListAccountOffering:
21+
def __init__(self, client) -> None:
22+
self.client = client
23+
24+
def send(
25+
self,
26+
account_id: str,
27+
):
28+
path = "/v3/partners/accounts/{accountID}/offerings"
29+
path = path.format(
30+
account_id=account_id,
31+
)
32+
33+
data = None
34+
request = Request(method="GET", url=path, data=data, headers=headers)
35+
response = self.client.send(request)
36+
if response is None:
37+
raise ApiException(
38+
error="CreateAlert creation failed: Unable to connect to server"
39+
)
40+
41+
if response.text:
42+
text = json.loads(response.text)
43+
else:
44+
text = ""
45+
if response.is_success():
46+
return ApiResponse(
47+
status_code=response.status_code, model=text, headers=response.headers
48+
)
49+
else:
50+
raise ApiException(
51+
status_code=response.status_code, error=text, headers=response.headers
52+
)

0 commit comments

Comments
 (0)