Duplicate
Duplicate a template by ID or alias using the default context.
func (s *TemplatesSvcImpl) Duplicate(identifier string) (*DuplicateTemplateResponse, error)
Parameters
The template ID or alias to duplicate.
Returns
Returns a *DuplicateTemplateResponse containing the new template ID.
Example
response, err := client.Templates.Duplicate("template_id_or_alias")
if err != nil {
panic(err)
}
fmt.Println("New template ID:", response.Id)
DuplicateWithContext
Duplicate a template by ID or alias with a custom context.
func (s *TemplatesSvcImpl) DuplicateWithContext(ctx context.Context, identifier string) (*DuplicateTemplateResponse, error)
Parameters
Context for the request, useful for timeouts and cancellation.
The template ID or alias to duplicate.
Returns
Returns a *DuplicateTemplateResponse containing the new template ID.
Example
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
response, err := client.Templates.DuplicateWithContext(ctx, "welcome-email")
if err != nil {
panic(err)
}
fmt.Println("Duplicated template:", response.Id)
Types
DuplicateTemplateResponse
Response from duplicating a template.
type DuplicateTemplateResponse struct {
Id string `json:"id"`
Object string `json:"object"`
}
The unique identifier of the newly created duplicate template.
The object type, always “template”.