-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
188 changed files
with
7,581 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
.openapi-generator | ||
README.md | ||
api_create_design.go | ||
api_delete_design.go | ||
api_duplicate_design.go | ||
api_duplicate_pre_built_design.go | ||
api_get_design.go | ||
api_get_pre_built_design.go | ||
api_list_design.go | ||
api_list_pre_built_design.go | ||
api_service.go | ||
api_update_design.go | ||
docs/ApiError.md | ||
docs/ApiErrors.md | ||
docs/CreateDesign.md | ||
docs/DeleteDesign.md | ||
docs/DesignCommonProperties.md | ||
docs/DesignDuplicateInput.md | ||
docs/DesignInput.md | ||
docs/DesignOutput.md | ||
docs/DesignOutputSummary.md | ||
docs/DuplicateDesign.md | ||
docs/DuplicatePreBuiltDesign.md | ||
docs/Editor.md | ||
docs/GetDesign.md | ||
docs/GetPreBuiltDesign.md | ||
docs/ListDesign.md | ||
docs/ListDesign200Response.md | ||
docs/ListPreBuiltDesign.md | ||
docs/Metadata.md | ||
docs/UpdateDesign.md | ||
docs/UpdateDesignRequest.md | ||
model_api_error.go | ||
model_api_errors.go | ||
model_design_common_properties.go | ||
model_design_duplicate_input.go | ||
model_design_input.go | ||
model_design_output.go | ||
model_design_output_summary.go | ||
model_editor.go | ||
model_list_design_200_response.go | ||
model_metadata.go | ||
model_update_design_request.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# OpenAPI Generator Ignore | ||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator | ||
|
||
# Use this file to prevent files from being overwritten by the generator. | ||
# The patterns follow closely to .gitignore or .dockerignore. | ||
|
||
# As an example, the C# client generator defines ApiClient.cs. | ||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: | ||
#ApiClient.cs | ||
|
||
# You can match any string of characters against a directory, file or extension with a single asterisk (*): | ||
#foo/*/qux | ||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux | ||
|
||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**): | ||
#foo/**/qux | ||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux | ||
|
||
# You can also negate patterns with an exclamation (!). | ||
# For example, you can ignore all files in a docs folder with the file extension .md: | ||
#docs/*.md | ||
# Then explicitly reverse the ignore rule for a single file: | ||
#!docs/README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# Go API client for | ||
|
||
The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). | ||
|
||
The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. | ||
|
||
You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. | ||
|
||
The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. | ||
|
||
## 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-04T13:25:44.066640+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 | ||
------------ | ------------- | ------------- | ------------- | ||
*CreateDesign* | [**CreateDesign**](docs/CreateDesign.md#createdesign) | **Post** /v3/designs | Create Design | ||
*DeleteDesign* | [**DeleteDesign**](docs/DeleteDesign.md#deletedesign) | **Delete** /v3/designs/{Id} | Delete Design | ||
*DuplicateDesign* | [**DuplicateDesign**](docs/DuplicateDesign.md#duplicatedesign) | **Post** /v3/designs/{Id} | Duplicate Design | ||
*DuplicatePreBuiltDesign* | [**DuplicatePreBuiltDesign**](docs/DuplicatePreBuiltDesign.md#duplicateprebuiltdesign) | **Post** /v3/designs/pre-builts/{Id} | Duplicate SendGrid Pre-built Design | ||
*GetDesign* | [**GetDesign**](docs/GetDesign.md#getdesign) | **Get** /v3/designs/{Id} | Get Design | ||
*GetPreBuiltDesign* | [**GetPreBuiltDesign**](docs/GetPreBuiltDesign.md#getprebuiltdesign) | **Get** /v3/designs/pre-builts/{Id} | Get SendGrid Pre-built Design | ||
*ListDesign* | [**ListDesign**](docs/ListDesign.md#listdesign) | **Get** /v3/designs | List Designs | ||
*ListPreBuiltDesign* | [**ListPreBuiltDesign**](docs/ListPreBuiltDesign.md#listprebuiltdesign) | **Get** /v3/designs/pre-builts | List SendGrid Pre-built Designs | ||
*UpdateDesign* | [**UpdateDesign**](docs/UpdateDesign.md#updatedesign) | **Patch** /v3/designs/{Id} | Update Design | ||
|
||
|
||
## Documentation For Models | ||
|
||
- [ApiError](ApiError.md) | ||
- [ApiErrors](ApiErrors.md) | ||
- [DesignCommonProperties](DesignCommonProperties.md) | ||
- [DesignDuplicateInput](DesignDuplicateInput.md) | ||
- [DesignInput](DesignInput.md) | ||
- [DesignOutput](DesignOutput.md) | ||
- [DesignOutputSummary](DesignOutputSummary.md) | ||
- [Editor](Editor.md) | ||
- [ListDesign200Response](ListDesign200Response.md) | ||
- [Metadata](Metadata.md) | ||
- [UpdateDesignRequest](UpdateDesignRequest.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) | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* This code was generated by | ||
* | ||
* SENDGRID-OAI-GENERATOR | ||
* | ||
* Twilio SendGrid Marketing Campaigns Designs | ||
* The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. | ||
* | ||
* 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/url" | ||
) | ||
|
||
type CreateDesignParam struct { | ||
// | ||
DesignInput *DesignInput `json:"DesignInput,omitempty"` | ||
} | ||
|
||
func (params *CreateDesignParam) SetDesignInput(DesignInput DesignInput) *CreateDesignParam { | ||
params.DesignInput = &DesignInput | ||
return params | ||
} | ||
|
||
// **This endpoint allows you to create a new design**. You can add a new design by passing data, including a string of HTML email content, to `/designs`. When creating designs from scratch, be aware of the styling constraints inherent to many email clients. For a list of best practices, see our guide to [Cross-Platform Email Design](https://sendgrid.com/docs/ui/sending-email/cross-platform-html-design/). The Design Library can also convert your design’s HTML elements into drag and drop modules that are editable in the Designs Library user interface. For more, visit the [Design and Code Editor documentation](https://sendgrid.com/docs/ui/sending-email/editor/#drag--drop-markup). Because the `/designs` endpoint makes it easy to add designs, you can create a design with your preferred tooling or migrate designs you already own without relying on the Design Library UI. | ||
func (c *ApiService) CreateDesign(params *CreateDesignParam) (interface{}, error) { | ||
path := "/v3/designs" | ||
|
||
data := url.Values{} | ||
headers := map[string]interface{}{ | ||
"Content-Type": "application/json", | ||
} | ||
|
||
body := []byte{} | ||
if params != nil && params.DesignInput != nil { | ||
b, err := json.Marshal(*params.DesignInput) | ||
if err != nil { | ||
return nil, err | ||
} | ||
body = b | ||
} | ||
|
||
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 := &DesignOutput{} | ||
if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { | ||
return nil, err | ||
} | ||
|
||
return ps, err | ||
} | ||
if resp.StatusCode == 400 { | ||
ps := &ApiErrors{} | ||
if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { | ||
return nil, err | ||
} | ||
|
||
return ps, err | ||
} | ||
return nil, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* This code was generated by | ||
* | ||
* SENDGRID-OAI-GENERATOR | ||
* | ||
* Twilio SendGrid Marketing Campaigns Designs | ||
* The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. | ||
* | ||
* 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/url" | ||
|
||
"strings" | ||
) | ||
|
||
type DeleteDesignParam struct { | ||
// The ID of the Design you want to duplicate. | ||
Id *string `json:"id"` | ||
} | ||
|
||
func (params *DeleteDesignParam) SetId(Id string) *DeleteDesignParam { | ||
params.Id = &Id | ||
return params | ||
} | ||
|
||
// **This endpoint allows you to delete a single design**. Be sure to check the ID of the design you intend to delete before making this request; deleting a design is a permanent action. | ||
func (c *ApiService) DeleteDesign(params *DeleteDesignParam) (interface{}, error) { | ||
path := "/v3/designs/{Id}" | ||
if params != nil && params.Id != nil { | ||
path = strings.Replace(path, "{"+"Id"+"}", *params.Id, -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() | ||
if resp.StatusCode == 204 { | ||
ps := &map[string]interface{}{} | ||
if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { | ||
return nil, err | ||
} | ||
|
||
return ps, err | ||
} | ||
if resp.StatusCode == 400 { | ||
ps := &ApiErrors{} | ||
if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { | ||
return nil, err | ||
} | ||
|
||
return ps, err | ||
} | ||
if resp.StatusCode == 404 { | ||
ps := &ApiErrors{} | ||
if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { | ||
return nil, err | ||
} | ||
|
||
return ps, err | ||
} | ||
return nil, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
* This code was generated by | ||
* | ||
* SENDGRID-OAI-GENERATOR | ||
* | ||
* Twilio SendGrid Marketing Campaigns Designs | ||
* The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. | ||
* | ||
* 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/url" | ||
|
||
"strings" | ||
) | ||
|
||
type DuplicateDesignParam struct { | ||
// The ID of the Design you want to duplicate. | ||
Id *string `json:"id"` | ||
// | ||
DesignDuplicateInput *DesignDuplicateInput `json:"DesignDuplicateInput,omitempty"` | ||
} | ||
|
||
func (params *DuplicateDesignParam) SetId(Id string) *DuplicateDesignParam { | ||
params.Id = &Id | ||
return params | ||
} | ||
func (params *DuplicateDesignParam) SetDesignDuplicateInput(DesignDuplicateInput DesignDuplicateInput) *DuplicateDesignParam { | ||
params.DesignDuplicateInput = &DesignDuplicateInput | ||
return params | ||
} | ||
|
||
// **This endpoint allows you to duplicate one of your existing designs**. Modifying an existing design is often the easiest way to create something new. You are not required to pass any data in the body of a request to this endpoint. If you choose to leave the `name` field blank, your duplicate will be assigned the name of the design it was copied from with the text \"Duplicate: \" prepended to it. This name change is only a convenience, as the duplicate will be assigned a unique ID that differentiates it from your other designs. You can modify your duplicate’s name at the time of creation by passing an updated value to the `name` field when making the initial request. More on retrieving design IDs can be found below. | ||
func (c *ApiService) DuplicateDesign(params *DuplicateDesignParam) (interface{}, error) { | ||
path := "/v3/designs/{Id}" | ||
if params != nil && params.Id != nil { | ||
path = strings.Replace(path, "{"+"Id"+"}", *params.Id, -1) | ||
} | ||
|
||
data := url.Values{} | ||
headers := map[string]interface{}{ | ||
"Content-Type": "application/json", | ||
} | ||
|
||
body := []byte{} | ||
if params != nil && params.DesignDuplicateInput != nil { | ||
b, err := json.Marshal(*params.DesignDuplicateInput) | ||
if err != nil { | ||
return nil, err | ||
} | ||
body = b | ||
} | ||
|
||
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 := &DesignOutput{} | ||
if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { | ||
return nil, err | ||
} | ||
|
||
return ps, err | ||
} | ||
if resp.StatusCode == 400 { | ||
ps := &ApiError{} | ||
if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { | ||
return nil, err | ||
} | ||
|
||
return ps, err | ||
} | ||
if resp.StatusCode == 404 { | ||
ps := &ApiErrors{} | ||
if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { | ||
return nil, err | ||
} | ||
|
||
return ps, err | ||
} | ||
return nil, nil | ||
} |
Oops, something went wrong.