Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Autogenerating code and RC Release preparation #1092

Merged
merged 3 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Change Log
All notable changes to this project will be documented in this file.

[2024-10-04] Version 7.0.0-rc.1
---------------------------
- Releasing autogenerated code for python from sendgrid open api specification.

[2024-10-04] Version 7.0.0-rc.0
---------------------------
- Release Candidate preparation.


[2023-12-01] Version 6.11.0
---------------------------
**Library - Feature**
Expand Down
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,30 @@ pip install sendgrid

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):

### Send Email using Auto generated code
```python
from sendgrid.client import Client

from sendgrid.rest.api.mail.v3.send_mail import SendMail
from sendgrid.rest.api.mail.v3.models import (MailTo, MailFrom, SendMailRequestPersonalizationsInner,
SendMailRequestContentInner, SendMailRequest)


client = Client(api_key='api_key')

mail_to_list = [MailTo(email="to_email", name="to_name")]
personalization = [SendMailRequestPersonalizationsInner(to=mail_to_list, subject="Message")]

send_mail_request = SendMailRequest(
personalizations=personalization,
var_from=MailFrom(email="from_email", name="from_name"),
content=[SendMailRequestContentInner(type="text/plain", value="Body")])

send_mail = SendMail(client)
response = send_mail.send(send_mail_request=send_mail_request)
print(response)
```

### With Mail Helper Class

```python
Expand Down
11 changes: 11 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Upgrade Guide

_`MAJOR` version bumps will have upgrade notes posted here._

[2024-10-XX] 6.x.x to 7.x.x-rc.x
--------------------------------
### Overview

#### Sendgrid Python Helper Library’s version 7.0.0-rc.x is now available.

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.
1 change: 1 addition & 0 deletions sendgrid/rest/api/account_provisioning/v3/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# TODO
52 changes: 52 additions & 0 deletions sendgrid/rest/api/account_provisioning/v3/authenticate_account.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"""
This code was generated by

SENDGRID-OAI-GENERATOR

Twilio SendGrid Account Provisioning API
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/).

NOTE: This class is auto generated by OpenAPI Generator.
https://openapi-generator.tech
Do not edit the class manually.
"""

import json
from sendgrid.exceptions import ApiException
from sendgrid.http.request import Request
from sendgrid.http.response import ApiResponse


class AuthenticateAccount:
def __init__(self, client) -> None:
self.client = client

def send(
self,
account_id: str,
):
path = "/v3/partners/accounts/{accountID}/sso"
path = path.format(
account_id=account_id,
)

data = None
request = Request(method="POST", url=path, data=data, headers=headers)
response = self.client.send(request)
if response is None:
raise ApiException(
error="CreateAlert creation failed: Unable to connect to server"
)

if response.text:
text = json.loads(response.text)
else:
text = ""
if response.is_success():
return ApiResponse(
status_code=response.status_code, model=text, headers=response.headers
)
else:
raise ApiException(
status_code=response.status_code, error=text, headers=response.headers
)
65 changes: 65 additions & 0 deletions sendgrid/rest/api/account_provisioning/v3/create_account.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
"""
This code was generated by

SENDGRID-OAI-GENERATOR

Twilio SendGrid Account Provisioning API
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/).

NOTE: This class is auto generated by OpenAPI Generator.
https://openapi-generator.tech
Do not edit the class manually.
"""

import json
from typing import Optional
from sendgrid.base import values
from sendgrid.exceptions import ApiException
from sendgrid.http.request import Request
from sendgrid.http.response import ApiResponse

from typing import Optional
from sendgrid.rest.api.account_provisioning.v3.models.create_account_params import (
CreateAccountParams,
)


class CreateAccount:
def __init__(self, client) -> None:
self.client = client

def send(
self,
t_test_account: Optional[str] = None,
create_account_params: Optional[CreateAccountParams] = None,
):
path = "/v3/partners/accounts"

headers = values.of(
{
"T-Test-Account": t_test_account,
}
)
headers["Content-Type"] = "application/json"
data = None
if create_account_params:
data = create_account_params.to_dict()
request = Request(method="POST", url=path, data=data, headers=headers)
response = self.client.send(request)
if response is None:
raise ApiException(
error="CreateAlert creation failed: Unable to connect to server"
)

if response.text:
text = json.loads(response.text)
else:
text = ""
if response.is_success():
return ApiResponse(
status_code=response.status_code, model=text, headers=response.headers
)
else:
raise ApiException(
status_code=response.status_code, error=text, headers=response.headers
)
52 changes: 52 additions & 0 deletions sendgrid/rest/api/account_provisioning/v3/delete_account.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"""
This code was generated by

SENDGRID-OAI-GENERATOR

Twilio SendGrid Account Provisioning API
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/).

NOTE: This class is auto generated by OpenAPI Generator.
https://openapi-generator.tech
Do not edit the class manually.
"""

import json
from sendgrid.exceptions import ApiException
from sendgrid.http.request import Request
from sendgrid.http.response import ApiResponse


class DeleteAccount:
def __init__(self, client) -> None:
self.client = client

def send(
self,
account_id: str,
):
path = "/v3/partners/accounts/{accountID}"
path = path.format(
account_id=account_id,
)

data = None
request = Request(method="DELETE", url=path, data=data, headers=headers)
response = self.client.send(request)
if response is None:
raise ApiException(
error="CreateAlert creation failed: Unable to connect to server"
)

if response.text:
text = json.loads(response.text)
else:
text = ""
if response.is_success():
return ApiResponse(
status_code=response.status_code, model=text, headers=response.headers
)
else:
raise ApiException(
status_code=response.status_code, error=text, headers=response.headers
)
52 changes: 52 additions & 0 deletions sendgrid/rest/api/account_provisioning/v3/get_account_state.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"""
This code was generated by

SENDGRID-OAI-GENERATOR

Twilio SendGrid Account Provisioning API
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/).

NOTE: This class is auto generated by OpenAPI Generator.
https://openapi-generator.tech
Do not edit the class manually.
"""

import json
from sendgrid.exceptions import ApiException
from sendgrid.http.request import Request
from sendgrid.http.response import ApiResponse


class GetAccountState:
def __init__(self, client) -> None:
self.client = client

def send(
self,
account_id: str,
):
path = "/v3/partners/accounts/{accountID}/state"
path = path.format(
account_id=account_id,
)

data = None
request = Request(method="GET", url=path, data=data, headers=headers)
response = self.client.send(request)
if response is None:
raise ApiException(
error="CreateAlert creation failed: Unable to connect to server"
)

if response.text:
text = json.loads(response.text)
else:
text = ""
if response.is_success():
return ApiResponse(
status_code=response.status_code, model=text, headers=response.headers
)
else:
raise ApiException(
status_code=response.status_code, error=text, headers=response.headers
)
53 changes: 53 additions & 0 deletions sendgrid/rest/api/account_provisioning/v3/list_account.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
"""
This code was generated by

SENDGRID-OAI-GENERATOR

Twilio SendGrid Account Provisioning API
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/).

NOTE: This class is auto generated by OpenAPI Generator.
https://openapi-generator.tech
Do not edit the class manually.
"""

import json
from typing import Optional
from sendgrid.exceptions import ApiException
from sendgrid.http.request import Request
from sendgrid.http.response import ApiResponse

from typing import Optional


class ListAccount:
def __init__(self, client) -> None:
self.client = client

def send(
self,
offset: Optional[str] = None,
limit: Optional[int] = None,
):
path = "/v3/partners/accounts"

data = None
request = Request(method="GET", url=path, data=data, headers=headers)
response = self.client.send(request)
if response is None:
raise ApiException(
error="CreateAlert creation failed: Unable to connect to server"
)

if response.text:
text = json.loads(response.text)
else:
text = ""
if response.is_success():
return ApiResponse(
status_code=response.status_code, model=text, headers=response.headers
)
else:
raise ApiException(
status_code=response.status_code, error=text, headers=response.headers
)
52 changes: 52 additions & 0 deletions sendgrid/rest/api/account_provisioning/v3/list_account_offering.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"""
This code was generated by

SENDGRID-OAI-GENERATOR

Twilio SendGrid Account Provisioning API
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/).

NOTE: This class is auto generated by OpenAPI Generator.
https://openapi-generator.tech
Do not edit the class manually.
"""

import json
from sendgrid.exceptions import ApiException
from sendgrid.http.request import Request
from sendgrid.http.response import ApiResponse


class ListAccountOffering:
def __init__(self, client) -> None:
self.client = client

def send(
self,
account_id: str,
):
path = "/v3/partners/accounts/{accountID}/offerings"
path = path.format(
account_id=account_id,
)

data = None
request = Request(method="GET", url=path, data=data, headers=headers)
response = self.client.send(request)
if response is None:
raise ApiException(
error="CreateAlert creation failed: Unable to connect to server"
)

if response.text:
text = json.loads(response.text)
else:
text = ""
if response.is_success():
return ApiResponse(
status_code=response.status_code, model=text, headers=response.headers
)
else:
raise ApiException(
status_code=response.status_code, error=text, headers=response.headers
)
Loading
Loading