Skip to content

Latest commit

 

History

History
361 lines (229 loc) · 9.42 KB

File metadata and controls

361 lines (229 loc) · 9.42 KB

\TemplatesAPI

All URIs are relative to https://api.elasticemail.com/v4

Method HTTP request Description
TemplatesByNameDelete Delete /templates/{name} Delete Template
TemplatesByNameGet Get /templates/{name} Load Template
TemplatesByNamePut Put /templates/{name} Update Template
TemplatesGet Get /templates Load Templates
TemplatesPost Post /templates Add Template

TemplatesByNameDelete

TemplatesByNameDelete(ctx, name).Execute()

Delete Template

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/elasticemail/elasticemail-go"
)

func main() {
	name := "Template01" // string | Name of template.

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	r, err := apiClient.TemplatesAPI.TemplatesByNameDelete(context.Background(), name).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `TemplatesAPI.TemplatesByNameDelete``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
name string Name of template.

Other Parameters

Other parameters are passed through a pointer to a apiTemplatesByNameDeleteRequest struct via the builder pattern

Name Type Description Notes

Return type

(empty response body)

Authorization

apikey

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

TemplatesByNameGet

Template TemplatesByNameGet(ctx, name).Execute()

Load Template

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/elasticemail/elasticemail-go"
)

func main() {
	name := "Template01" // string | Name of template.

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.TemplatesAPI.TemplatesByNameGet(context.Background(), name).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `TemplatesAPI.TemplatesByNameGet``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `TemplatesByNameGet`: Template
	fmt.Fprintf(os.Stdout, "Response from `TemplatesAPI.TemplatesByNameGet`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
name string Name of template.

Other Parameters

Other parameters are passed through a pointer to a apiTemplatesByNameGetRequest struct via the builder pattern

Name Type Description Notes

Return type

Template

Authorization

apikey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

TemplatesByNamePut

Template TemplatesByNamePut(ctx, name).TemplatePayload(templatePayload).Execute()

Update Template

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/elasticemail/elasticemail-go"
)

func main() {
	name := "Template01" // string | Name of template.
	templatePayload := *openapiclient.NewTemplatePayload("Name_example") // TemplatePayload | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.TemplatesAPI.TemplatesByNamePut(context.Background(), name).TemplatePayload(templatePayload).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `TemplatesAPI.TemplatesByNamePut``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `TemplatesByNamePut`: Template
	fmt.Fprintf(os.Stdout, "Response from `TemplatesAPI.TemplatesByNamePut`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
name string Name of template.

Other Parameters

Other parameters are passed through a pointer to a apiTemplatesByNamePutRequest struct via the builder pattern

Name Type Description Notes

templatePayload | TemplatePayload | |

Return type

Template

Authorization

apikey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

TemplatesGet

[]Template TemplatesGet(ctx).ScopeType(scopeType).TemplateTypes(templateTypes).Limit(limit).Offset(offset).Execute()

Load Templates

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/elasticemail/elasticemail-go"
)

func main() {
	scopeType := []openapiclient.TemplateScope{openapiclient.TemplateScope("Personal")} // []TemplateScope | Return templates with specified scope only
	templateTypes := []openapiclient.TemplateType{openapiclient.TemplateType("RawHTML")} // []TemplateType | Return templates with specified type only (optional)
	limit := int32(100) // int32 | Maximum number of returned items. (optional)
	offset := int32(20) // int32 | How many items should be returned ahead. (optional)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.TemplatesAPI.TemplatesGet(context.Background()).ScopeType(scopeType).TemplateTypes(templateTypes).Limit(limit).Offset(offset).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `TemplatesAPI.TemplatesGet``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `TemplatesGet`: []Template
	fmt.Fprintf(os.Stdout, "Response from `TemplatesAPI.TemplatesGet`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiTemplatesGetRequest struct via the builder pattern

Name Type Description Notes
scopeType []TemplateScope Return templates with specified scope only
templateTypes []TemplateType Return templates with specified type only
limit int32 Maximum number of returned items.
offset int32 How many items should be returned ahead.

Return type

[]Template

Authorization

apikey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

TemplatesPost

Template TemplatesPost(ctx).TemplatePayload(templatePayload).Execute()

Add Template

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/elasticemail/elasticemail-go"
)

func main() {
	templatePayload := *openapiclient.NewTemplatePayload("Name_example") // TemplatePayload | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.TemplatesAPI.TemplatesPost(context.Background()).TemplatePayload(templatePayload).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `TemplatesAPI.TemplatesPost``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `TemplatesPost`: Template
	fmt.Fprintf(os.Stdout, "Response from `TemplatesAPI.TemplatesPost`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiTemplatesPostRequest struct via the builder pattern

Name Type Description Notes
templatePayload TemplatePayload

Return type

Template

Authorization

apikey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]