Skip to content

Latest commit

 

History

History
361 lines (229 loc) · 11.1 KB

File metadata and controls

361 lines (229 loc) · 11.1 KB

\TemplateAPI

All URIs are relative to https://api.sendx.io/api/v1/rest

Method HTTP request Description
CreateEmailTemplate Post /template/email Create email template
DeleteEmailTemplate Delete /template/email/{identifier} Delete template
GetAllEmailTemplates Get /template/email Get all templates
GetEmailTemplate Get /template/email/{identifier} Get template by ID
UpdateEmailTemplate Put /template/email/{identifier} Update template

CreateEmailTemplate

RestRTemplate CreateEmailTemplate(ctx).RestETemplate(restETemplate).Execute()

Create email template

Example

package main

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

func main() {
	restETemplate := *openapiclient.NewRestETemplate("Welcome Email Template", "Welcome to {{company_name}}!") // RestETemplate | 

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

Path Parameters

Other Parameters

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

Name Type Description Notes
restETemplate RestETemplate

Return type

RestRTemplate

Authorization

TeamApiKey

HTTP request headers

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

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

DeleteEmailTemplate

DeleteResponse DeleteEmailTemplate(ctx, identifier).Execute()

Delete template

Example

package main

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

func main() {
	identifier := "template_f3lJvTEhSjKGVb5Lwc5SWS" // string | The unique template identifier to update.  - `template_f3lJvTEhSjKGVb5Lwc5SWS` 

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

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
identifier string The unique template identifier to update. - `template_f3lJvTEhSjKGVb5Lwc5SWS`

Other Parameters

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

Name Type Description Notes

Return type

DeleteResponse

Authorization

TeamApiKey

HTTP request headers

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

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

GetAllEmailTemplates

[]RestRTemplate GetAllEmailTemplates(ctx).Offset(offset).Limit(limit).Search(search).Execute()

Get all templates

Example

package main

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

func main() {
	offset := int32(56) // int32 | Number of records to skip for pagination.  **Examples:** - `0` - First page (default) - `25` - Second page (with limit=25) - `50` - Third page (with limit=25)  (optional) (default to 0)
	limit := int32(56) // int32 | Maximum number of templates to return per page.  **Guidelines:** - Default: 10 templates - Maximum: 100 templates - Recommended: 25-100 for optimal performance  (optional) (default to 10)
	search := "search_example" // string | Search templates by name (case-insensitive partial matching).  **Examples:** - `newsletter` - Finds \"Weekly Newsletter\", \"Monthly Newsletter\" - `welcome` - Finds \"Welcome Email\", \"New User Welcome\" - `product` - Finds \"Product Launch\", \"Product Update\"  (optional)

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

Path Parameters

Other Parameters

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

Name Type Description Notes
offset int32 Number of records to skip for pagination. Examples: - `0` - First page (default) - `25` - Second page (with limit=25) - `50` - Third page (with limit=25) [default to 0]
limit int32 Maximum number of templates to return per page. Guidelines: - Default: 10 templates - Maximum: 100 templates - Recommended: 25-100 for optimal performance [default to 10]
search string Search templates by name (case-insensitive partial matching). Examples: - `newsletter` - Finds "Weekly Newsletter", "Monthly Newsletter" - `welcome` - Finds "Welcome Email", "New User Welcome" - `product` - Finds "Product Launch", "Product Update"

Return type

[]RestRTemplate

Authorization

TeamApiKey

HTTP request headers

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

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

GetEmailTemplate

RestRTemplate GetEmailTemplate(ctx, identifier).Execute()

Get template by ID

Example

package main

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

func main() {
	identifier := "template_f3lJvTEhSjKGVb5Lwc5SWS" // string | The unique template identifier.  - `template_f3lJvTEhSjKGVb5Lwc5SWS` - Standard prefixed ID 

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

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
identifier string The unique template identifier. - `template_f3lJvTEhSjKGVb5Lwc5SWS` - Standard prefixed ID

Other Parameters

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

Name Type Description Notes

Return type

RestRTemplate

Authorization

TeamApiKey

HTTP request headers

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

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

UpdateEmailTemplate

RestRTemplate UpdateEmailTemplate(ctx, identifier).RestETemplate(restETemplate).Execute()

Update template

Example

package main

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

func main() {
	restETemplate := *openapiclient.NewRestETemplate("Welcome Email Template", "Welcome to {{company_name}}!") // RestETemplate | 
	identifier := "template_f3lJvTEhSjKGVb5Lwc5SWS" // string | The unique template identifier to update.  - `template_f3lJvTEhSjKGVb5Lwc5SWS` 

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

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
identifier string The unique template identifier to update. - `template_f3lJvTEhSjKGVb5Lwc5SWS`

Other Parameters

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

Name Type Description Notes
restETemplate RestETemplate

Return type

RestRTemplate

Authorization

TeamApiKey

HTTP request headers

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

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