Skip to main content

Remove

Remove a template by ID or alias using the default context.
func (s *TemplatesSvcImpl) Remove(identifier string) (*RemoveTemplateResponse, error)

Parameters

identifier
string
required
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

ctx
context.Context
required
Context for the request, useful for timeouts and cancellation.
identifier
string
required
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"`
}
Object
string
The object type, always “template”.
Id
string
The unique identifier of the deleted template.
Deleted
bool
Indicates whether the template was successfully deleted.

Build docs developers (and LLMs) love