openapi

package
v4.0.0-rc.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2024 License: MIT Imports: 6 Imported by: 0

README

Go API client for

The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid Design Library.

The Design Library is a feature-rich email layout tool and media repository. You can build designs for all your marketing email needs, 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 project from the OpenAPI specs located at twilio/sendgrid-oai. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 1.0.0
  • Package version:
  • Build date: 2024-10-24T13:26:02.112684Z[Etc/UTC]
  • Build package: com.sendgrid.oai.go.SendgridGoGenerator For more information, please visit https://support.sendgrid.com/hc/en-us

Installation

Install the following dependencies:

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:

import "./"

Documentation for API Endpoints

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

Class Method HTTP request Description
CreateDesign CreateDesign Post /v3/designs Create Design
DeleteDesign DeleteDesign Delete /v3/designs/{Id} Delete Design
DuplicateDesign DuplicateDesign Post /v3/designs/{Id} Duplicate Design
DuplicatePreBuiltDesign DuplicatePreBuiltDesign Post /v3/designs/pre-builts/{Id} Duplicate SendGrid Pre-built Design
GetDesign GetDesign Get /v3/designs/{Id} Get Design
GetPreBuiltDesign GetPreBuiltDesign Get /v3/designs/pre-builts/{Id} Get SendGrid Pre-built Design
ListDesign ListDesign Get /v3/designs List Designs
ListPreBuiltDesign ListPreBuiltDesign Get /v3/designs/pre-builts List SendGrid Pre-built Designs
UpdateDesign UpdateDesign Patch /v3/designs/{Id} Update Design

Documentation For Models

Documentation For Authorization

BearerAuth

  • Type: HTTP basic authentication

Example

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiError

type ApiError struct {
	Message string `json:"message"`
	Field   string `json:"field"`
	ErrorId string `json:"error_id"`
}

ApiError struct for ApiError

type ApiErrors

type ApiErrors struct {
	Errors *[]ApiError `json:"errors,omitempty"`
}

ApiErrors struct for ApiErrors

type ApiService

type ApiService struct {
	// contains filtered or unexported fields
}

func NewApiService

func NewApiService(requestHandler *sendgrid.RequestHandler) *ApiService

func NewApiServiceWithClient

func NewApiServiceWithClient(client sendgrid.BaseClient) *ApiService

func (*ApiService) CreateDesign

func (c *ApiService) CreateDesign(params *CreateDesignParam) (interface{}, error)

**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 (*ApiService) DeleteDesign

func (c *ApiService) DeleteDesign(params *DeleteDesignParam) (interface{}, error)

**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 (*ApiService) DuplicateDesign

func (c *ApiService) DuplicateDesign(params *DuplicateDesignParam) (interface{}, error)

**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 (*ApiService) DuplicatePreBuiltDesign

func (c *ApiService) DuplicatePreBuiltDesign(params *DuplicatePreBuiltDesignParam) (interface{}, error)

**This endpoint allows you to duplicate one of the pre-built Twilio SendGrid designs**. Like duplicating one of your existing designs, 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 design will be assigned a unique ID that differentiates it from your other designs. You can retrieve the IDs for Twilio SendGrid pre-built designs using the \"List SendGrid Pre-built Designs\" endpoint. 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 above.

func (*ApiService) GetDesign

func (c *ApiService) GetDesign(params *GetDesignParam) (interface{}, error)

**This endpoint allows you to retrieve a single design**. A GET request to `/designs/{id}` will retrieve details about a specific design in your Design Library. This endpoint is valuable when retrieving information stored in a field that you wish to update using a PATCH request.

func (*ApiService) GetPreBuiltDesign

func (c *ApiService) GetPreBuiltDesign(params *GetPreBuiltDesignParam) (interface{}, error)

**This endpoint allows you to retrieve a single pre-built design**. A GET request to `/designs/pre-builts/{id}` will retrieve details about a specific pre-built design. This endpoint is valuable when retrieving details about a pre-built design that you wish to duplicate and modify.

func (*ApiService) ListDesign

func (c *ApiService) ListDesign(params *ListDesignParam) (interface{}, error)

**This endpoint allows you to retrieve a list of designs already stored in your Design Library**. A GET request to `/designs` will return a list of your existing designs. This endpoint will not return the pre-built Twilio SendGrid designs. Pre-built designs can be retrieved using the `/designs/pre-builts` endpoint, which is detailed below. By default, you will receive 100 results per request; however, you can modify the number of results returned by passing an integer to the `page_size` query parameter.

func (*ApiService) ListPreBuiltDesign

func (c *ApiService) ListPreBuiltDesign(params *ListPreBuiltDesignParam) (interface{}, error)

**This endpoint allows you to retrieve a list of pre-built designs provided by Twilio SendGrid**. Unlike the `/designs` endpoint where *your* designs are stored, a GET request made to `designs/pre-builts` will retrieve a list of the pre-built Twilio SendGrid designs. This endpoint will not return the designs stored in your Design Library. By default, you will receive 100 results per request; however, you can modify the number of results returned by passing an integer to the `page_size` query parameter. This endpoint is useful for retrieving the IDs of Twilio SendGrid designs that you want to duplicate and modify.

func (*ApiService) UpdateDesign

func (c *ApiService) UpdateDesign(params *UpdateDesignParam) (interface{}, error)

**This endpoint allows you to edit a design**. The Design API supports PATCH requests, which allow you to make partial updates to a single design. Passing data to a specific field will update only the data stored in that field; all other fields will be unaltered. For example, updating a design's name requires that you make a PATCH request to this endpoint with data specified for the `name` field only. ``` { \"name\": \"<Updated Name>\" } ```

type CreateDesignParam

type CreateDesignParam struct {
	//
	DesignInput *DesignInput `json:"DesignInput,omitempty"`
}

func (*CreateDesignParam) SetDesignInput

func (params *CreateDesignParam) SetDesignInput(DesignInput DesignInput) *CreateDesignParam

type DeleteDesignParam

type DeleteDesignParam struct {
	// The ID of the Design you want to duplicate.
	Id *string `json:"id"`
}

func (*DeleteDesignParam) SetId

func (params *DeleteDesignParam) SetId(Id string) *DeleteDesignParam

type DesignCommonProperties

type DesignCommonProperties struct {
	// The name of the new design.
	Name *string `json:"name,omitempty"`
	// The editor used in the UI.
	Editor *Editor `json:"editor,omitempty"`
	// If true, plain_content is always generated from html_content. If false, plain_content is not altered.
	GeneratePlainContent *bool `json:"generate_plain_content,omitempty"`
	// Subject of the Design.
	Subject *string `json:"subject,omitempty"`
	// The list of categories applied to the design
	Categories *[]string `json:"categories,omitempty"`
}

DesignCommonProperties struct for DesignCommonProperties

type DesignDuplicateInput

type DesignDuplicateInput struct {
	// The name of the new design.
	Name *string `json:"name,omitempty"`
	// The editor used in the UI.
	Editor *Editor `json:"editor,omitempty"`
}

DesignDuplicateInput struct for DesignDuplicateInput

type DesignInput

type DesignInput struct {
	// The name of the new design.
	Name *string `json:"name,omitempty"`
	// The editor used in the UI.
	Editor *Editor `json:"editor,omitempty"`
	// The HTML content of the Design.
	HtmlContent string `json:"html_content"`
	// Plain text content of the Design.
	PlainContent *string `json:"plain_content,omitempty"`
}

DesignInput struct for DesignInput

type DesignOutput

type DesignOutput struct {
	// The name of the new design.
	Name *string `json:"name,omitempty"`
	// The editor used in the UI.
	Editor *Editor `json:"editor,omitempty"`
	// The HTML content of the Design.
	HtmlContent string `json:"html_content"`
	// Plain text content of the Design.
	PlainContent *string `json:"plain_content,omitempty"`
}

DesignOutput struct for DesignOutput

type DesignOutputSummary

type DesignOutputSummary struct {
	// ID of the Design.
	Id *string `json:"id,omitempty"`
	// Datetime that Design was last updated.
	UpdatedAt *string `json:"updated_at,omitempty"`
	// Datetime that Design was created.
	CreatedAt *string `json:"created_at,omitempty"`
	// A Thumbnail preview of the template's html content.
	ThumbnailUrl *string `json:"thumbnail_url,omitempty"`
	// The name of the new design.
	Name *string `json:"name,omitempty"`
	// The editor used in the UI.
	Editor *Editor `json:"editor,omitempty"`
}

DesignOutputSummary struct for DesignOutputSummary

type DuplicateDesignParam

type DuplicateDesignParam struct {
	// The ID of the Design you want to duplicate.
	Id *string `json:"id"`
	//
	DesignDuplicateInput *DesignDuplicateInput `json:"DesignDuplicateInput,omitempty"`
}

func (*DuplicateDesignParam) SetDesignDuplicateInput

func (params *DuplicateDesignParam) SetDesignDuplicateInput(DesignDuplicateInput DesignDuplicateInput) *DuplicateDesignParam

func (*DuplicateDesignParam) SetId

type DuplicatePreBuiltDesignParam

type DuplicatePreBuiltDesignParam struct {
	// The ID of the pre-built Design you want to duplicate.
	Id *string `json:"id"`
	//
	DesignDuplicateInput *DesignDuplicateInput `json:"DesignDuplicateInput,omitempty"`
}

func (*DuplicatePreBuiltDesignParam) SetDesignDuplicateInput

func (params *DuplicatePreBuiltDesignParam) SetDesignDuplicateInput(DesignDuplicateInput DesignDuplicateInput) *DuplicatePreBuiltDesignParam

func (*DuplicatePreBuiltDesignParam) SetId

type Editor

type Editor string

Editor the model 'Editor'

const (
	EDITOR_CODE   Editor = "code"
	EDITOR_DESIGN Editor = "design"
)

List of Editor

type GetDesignParam

type GetDesignParam struct {
	// The ID of the Design you want to duplicate.
	Id *string `json:"id"`
}

func (*GetDesignParam) SetId

func (params *GetDesignParam) SetId(Id string) *GetDesignParam

type GetPreBuiltDesignParam

type GetPreBuiltDesignParam struct {
	// The ID of the pre-built Design you want to duplicate.
	Id *string `json:"id"`
}

func (*GetPreBuiltDesignParam) SetId

type ListDesign200Response

type ListDesign200Response struct {
	Result   *[]DesignOutputSummary `json:"result,omitempty"`
	Metadata *Metadata              `json:"_metadata,omitempty"`
}

ListDesign200Response struct for ListDesign200Response

type ListDesignParam

type ListDesignParam struct {
	// number of results to return
	PageSize *int32 `json:"page_size,omitempty"`
	// token corresponding to a specific page of results, as provided by metadata
	PageToken *string `json:"page_token,omitempty"`
	// set to false to return all fields
	Summary *bool `json:"summary,omitempty"`
}

func (*ListDesignParam) SetPageSize

func (params *ListDesignParam) SetPageSize(PageSize int32) *ListDesignParam

func (*ListDesignParam) SetPageToken

func (params *ListDesignParam) SetPageToken(PageToken string) *ListDesignParam

func (*ListDesignParam) SetSummary

func (params *ListDesignParam) SetSummary(Summary bool) *ListDesignParam

type ListPreBuiltDesignParam

type ListPreBuiltDesignParam struct {
	// number of results to return
	PageSize *int32 `json:"page_size,omitempty"`
	// token corresponding to a specific page of results, as provided by metadata
	PageToken *string `json:"page_token,omitempty"`
	// set to false to return all fields
	Summary *bool `json:"summary,omitempty"`
}

func (*ListPreBuiltDesignParam) SetPageSize

func (params *ListPreBuiltDesignParam) SetPageSize(PageSize int32) *ListPreBuiltDesignParam

func (*ListPreBuiltDesignParam) SetPageToken

func (params *ListPreBuiltDesignParam) SetPageToken(PageToken string) *ListPreBuiltDesignParam

func (*ListPreBuiltDesignParam) SetSummary

func (params *ListPreBuiltDesignParam) SetSummary(Summary bool) *ListPreBuiltDesignParam

type Metadata

type Metadata struct {
	Prev  *string `json:"prev,omitempty"`
	Self  *string `json:"self,omitempty"`
	Next  *string `json:"next,omitempty"`
	Count *int32  `json:"count,omitempty"`
}

Metadata struct for Metadata

type UpdateDesignParam

type UpdateDesignParam struct {
	// The ID of the Design you want to duplicate.
	Id *string `json:"id"`
	//
	UpdateDesignRequest *UpdateDesignRequest `json:"UpdateDesignRequest,omitempty"`
}

func (*UpdateDesignParam) SetId

func (params *UpdateDesignParam) SetId(Id string) *UpdateDesignParam

func (*UpdateDesignParam) SetUpdateDesignRequest

func (params *UpdateDesignParam) SetUpdateDesignRequest(UpdateDesignRequest UpdateDesignRequest) *UpdateDesignParam

type UpdateDesignRequest

type UpdateDesignRequest struct {
	// Name of the Design.
	Name *string `json:"name,omitempty"`
	// The HTML content of the Design.
	HtmlContent *string `json:"html_content,omitempty"`
	// Plain text content of the Design.
	PlainContent *string `json:"plain_content,omitempty"`
	// If true, plain_content is always generated from html_content. If false, plain_content is not altered.
	GeneratePlainContent *bool `json:"generate_plain_content,omitempty"`
	// Subject of the Design.
	Subject *string `json:"subject,omitempty"`
	// The list of categories applied to the design
	Categories *[]string `json:"categories,omitempty"`
}

UpdateDesignRequest struct for UpdateDesignRequest

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL