Remove
Remove a template by ID or alias using the default context.
func (s *TemplatesSvcImpl) Remove(identifier string) (*RemoveTemplateResponse, error)
Parameters
The template ID or alias to delete.
Returns
Returns a *RemoveTemplateResponse confirming the deletion.
Example
response, err := client.Templates.Remove("template_id_or_alias")
if err != nil {
panic(err)
}
if response.Deleted {
fmt.Println("Template deleted successfully:", response.Id)
}
RemoveWithContext
Remove a template by ID or alias with a custom context.
func (s *TemplatesSvcImpl) RemoveWithContext(ctx context.Context, identifier string) (*RemoveTemplateResponse, error)
Parameters
Context for the request, useful for timeouts and cancellation.
The template ID or alias to delete.
Returns
Returns a *RemoveTemplateResponse confirming the deletion.
Example
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
response, err := client.Templates.RemoveWithContext(ctx, "welcome-email")
if err != nil {
panic(err)
}
fmt.Println("Deleted:", response.Deleted)
Types
RemoveTemplateResponse
Response from removing a template.
type RemoveTemplateResponse struct {
Object string `json:"object"`
Id string `json:"id"`
Deleted bool `json:"deleted"`
}
The object type, always “template”.
The unique identifier of the deleted template.
Indicates whether the template was successfully deleted.