Skip to content

Commit

Permalink
chore: add rest folder
Browse files Browse the repository at this point in the history
  • Loading branch information
tiwarishubham635 committed Oct 4, 2024
1 parent bf215d8 commit 3f10519
Show file tree
Hide file tree
Showing 2,156 changed files with 76,487 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ sendgrid.env
.vscode
prism*
**/.idea/**/*
**/.openapi-generator*
87 changes: 87 additions & 0 deletions rest/api/v3/account_provisioning/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Go API client for

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/).

## Overview
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/sendgrid-oai](https://github.com/twilio/sendgrid-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.

- API version: 1.0.0
- Package version:
- Build date: 2024-10-04T18:29:01.491818+05:30[Asia/Kolkata]
- Build package: com.sendgrid.oai.go.SendgridGoGenerator
For more information, please visit [https://support.sendgrid.com/hc/en-us](https://support.sendgrid.com/hc/en-us)

## Installation

Install the following dependencies:

```shell
go get github.com/stretchr/testify/assert
go get golang.org/x/net/context
```

Put the package under your project folder and add the following in import:

```golang
import "./"
```

## Documentation for API Endpoints

All URIs are relative to *https://api.sendgrid.com*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AuthenticateAccount* | [**AuthenticateAccount**](docs/AuthenticateAccount.md#authenticateaccount) | **Post** /v3/partners/accounts/{AccountID}/sso | Authenticate an account with single sign on
*CreateAccount* | [**CreateAccount**](docs/CreateAccount.md#createaccount) | **Post** /v3/partners/accounts | Create an account
*DeleteAccount* | [**DeleteAccount**](docs/DeleteAccount.md#deleteaccount) | **Delete** /v3/partners/accounts/{AccountID} | Delete an account
*GetAccountState* | [**GetAccountState**](docs/GetAccountState.md#getaccountstate) | **Get** /v3/partners/accounts/{AccountID}/state | Get an account's state
*ListAccount* | [**ListAccount**](docs/ListAccount.md#listaccount) | **Get** /v3/partners/accounts | Get all accounts
*ListAccountOffering* | [**ListAccountOffering**](docs/ListAccountOffering.md#listaccountoffering) | **Get** /v3/partners/accounts/{AccountID}/offerings | Get account offerings
*ListOffering* | [**ListOffering**](docs/ListOffering.md#listoffering) | **Get** /v3/partners/offerings | Get all available offerings
*UpdateAccountOffering* | [**UpdateAccountOffering**](docs/UpdateAccountOffering.md#updateaccountoffering) | **Put** /v3/partners/accounts/{AccountID}/offerings | Update account offerings
*UpdateAccountState* | [**UpdateAccountState**](docs/UpdateAccountState.md#updateaccountstate) | **Put** /v3/partners/accounts/{AccountID}/state | Update an account's state


## Documentation For Models

- [AccountList](AccountList.md)
- [AccountProvisioningAccount](AccountProvisioningAccount.md)
- [AccountProvisioningAccountId](AccountProvisioningAccountId.md)
- [AccountProvisioningCatalog](AccountProvisioningCatalog.md)
- [AccountProvisioningOfferingList](AccountProvisioningOfferingList.md)
- [AccountProvisioningOfferingV1](AccountProvisioningOfferingV1.md)
- [AccountProvisioningPagination](AccountProvisioningPagination.md)
- [AccountProvisioningProfile](AccountProvisioningProfile.md)
- [AccountProvisioningStateRead](AccountProvisioningStateRead.md)
- [AccountProvisioningStateWrite](AccountProvisioningStateWrite.md)
- [CatalogEntry](CatalogEntry.md)
- [CatalogEntryEntitlements](CatalogEntryEntitlements.md)
- [CreateAccountParams](CreateAccountParams.md)
- [ErrorResponse](ErrorResponse.md)
- [OfferingsToAdd](OfferingsToAdd.md)
- [State](State.md)
- [State1](State1.md)
- [Type](Type.md)


## Documentation For Authorization



## BearerAuth

- **Type**: HTTP basic authentication

Example

```golang
auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
UserName: "username",
Password: "password",
})
r, err := client.Service.Operation(auth, args)
```

52 changes: 52 additions & 0 deletions rest/api/v3/account_provisioning/api_authenticate_account.go
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.
*/

package openapi

import (
"net/http"
"net/url"

"strings"
)

type AuthenticateAccountParam struct {
// Twilio SendGrid account ID
AccountID *string `json:"accountID"`
}

func (params *AuthenticateAccountParam) SetAccountID(AccountID string) *AuthenticateAccountParam {
params.AccountID = &AccountID
return params
}

// Authenticates and logs in a user to Twilio Sendgrid as a specific admin identity configured for SSO by partner. Any additional teammates or subusers will need to log in directly via app.sendgrid.com
func (c *ApiService) AuthenticateAccount(params *AuthenticateAccountParam) (interface{}, error) {
path := "/v3/partners/accounts/{AccountID}/sso"
if params != nil && params.AccountID != nil {
path = strings.Replace(path, "{"+"AccountID"+"}", *params.AccountID, -1)
}

data := url.Values{}
headers := map[string]interface{}{
"Content-Type": "application/x-www-form-urlencoded",
}

resp, err := c.requestHandler.Post(c.baseURL+path, data, headers)
if err != nil {
return nil, err
}

defer resp.Body.Close()
return http.Response{StatusCode: resp.StatusCode, Body: resp.Body, Header: resp.Header}, nil
}
74 changes: 74 additions & 0 deletions rest/api/v3/account_provisioning/api_create_account.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* 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.
*/

package openapi

import (
"encoding/json"
"net/http"
"net/url"
)

type CreateAccountParam struct {
//
CreateAccountParams *CreateAccountParams `json:"CreateAccountParams"`
// **OPTIONAL** Custom request header provided ONLY for a test account
TTestAccount *string `json:"T-Test-Account,omitempty"`
}

func (params *CreateAccountParam) SetCreateAccountParams(CreateAccountParams CreateAccountParams) *CreateAccountParam {
params.CreateAccountParams = &CreateAccountParams
return params
}
func (params *CreateAccountParam) SetTTestAccount(TTestAccount string) *CreateAccountParam {
params.TTestAccount = &TTestAccount
return params
}

// Creates a new account, with specified offering, under the organization.
func (c *ApiService) CreateAccount(params *CreateAccountParam) (interface{}, error) {
path := "/v3/partners/accounts"

data := url.Values{}
headers := map[string]interface{}{
"Content-Type": "application/json",
}

body := []byte{}
if params != nil && params.CreateAccountParams != nil {
b, err := json.Marshal(*params.CreateAccountParams)
if err != nil {
return nil, err
}
body = b
}

if params != nil && params.TTestAccount != nil {
headers["T-Test-Account"] = *params.TTestAccount
}
resp, err := c.requestHandler.Post(c.baseURL+path, data, headers, body...)
if err != nil {
return nil, err
}

defer resp.Body.Close()
if resp.StatusCode == 201 {
ps := &AccountProvisioningAccountId{}
if err := json.NewDecoder(resp.Body).Decode(ps); err != nil {
return nil, err
}

return ps, err
}
return http.Response{StatusCode: resp.StatusCode, Body: resp.Body, Header: resp.Header}, nil
}
52 changes: 52 additions & 0 deletions rest/api/v3/account_provisioning/api_delete_account.go
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.
*/

package openapi

import (
"net/http"
"net/url"

"strings"
)

type DeleteAccountParam struct {
// Twilio SendGrid account ID
AccountID *string `json:"accountID"`
}

func (params *DeleteAccountParam) SetAccountID(AccountID string) *DeleteAccountParam {
params.AccountID = &AccountID
return params
}

// Delete a specific account under your organization by account ID. Note that this is an **irreversible** action that does the following: - Revokes API Keys and SSO so that the account user cannot log in or access SendGrid data. - Removes all offerings and configured SendGrid resources such as dedicated IPs. - Cancels billing effective immediately.
func (c *ApiService) DeleteAccount(params *DeleteAccountParam) (interface{}, error) {
path := "/v3/partners/accounts/{AccountID}"
if params != nil && params.AccountID != nil {
path = strings.Replace(path, "{"+"AccountID"+"}", *params.AccountID, -1)
}

data := url.Values{}
headers := map[string]interface{}{
"Content-Type": "application/x-www-form-urlencoded",
}

resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers)
if err != nil {
return nil, err
}

defer resp.Body.Close()
return http.Response{StatusCode: resp.StatusCode, Body: resp.Body, Header: resp.Header}, nil
}
61 changes: 61 additions & 0 deletions rest/api/v3/account_provisioning/api_get_account_state.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* 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.
*/

package openapi

import (
"encoding/json"
"net/http"
"net/url"

"strings"
)

type GetAccountStateParam struct {
// Twilio SendGrid account ID
AccountID *string `json:"accountID"`
}

func (params *GetAccountStateParam) SetAccountID(AccountID string) *GetAccountStateParam {
params.AccountID = &AccountID
return params
}

// Retrieve the state of the specified account.
func (c *ApiService) GetAccountState(params *GetAccountStateParam) (interface{}, error) {
path := "/v3/partners/accounts/{AccountID}/state"
if params != nil && params.AccountID != nil {
path = strings.Replace(path, "{"+"AccountID"+"}", *params.AccountID, -1)
}

data := url.Values{}
headers := map[string]interface{}{
"Content-Type": "application/x-www-form-urlencoded",
}

resp, err := c.requestHandler.Get(c.baseURL+path, data, headers)
if err != nil {
return nil, err
}

defer resp.Body.Close()
if resp.StatusCode == 200 {
ps := &AccountProvisioningStateRead{}
if err := json.NewDecoder(resp.Body).Decode(ps); err != nil {
return nil, err
}

return ps, err
}
return http.Response{StatusCode: resp.StatusCode, Body: resp.Body, Header: resp.Header}, nil
}
Loading

0 comments on commit 3f10519

Please sign in to comment.