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