Update
Update a topic using the default context.
func (s *TopicsSvcImpl) Update(topicId string, params *UpdateTopicRequest) (*UpdateTopicResponse, error)
Parameters
The ID of the topic to update.
params
*UpdateTopicRequest
required
The topic update parameters.
Returns
Returns an *UpdateTopicResponse containing the updated topic ID.
Example
updateParams := &resend.UpdateTopicRequest{
Name: "Updated Newsletter",
Description: "Our updated monthly newsletter",
}
response, err := client.Topics.Update("topic_123", updateParams)
if err != nil {
panic(err)
}
fmt.Println("Topic updated:", response.Id)
UpdateWithContext
Update a topic with a custom context.
func (s *TopicsSvcImpl) UpdateWithContext(ctx context.Context, topicId string, params *UpdateTopicRequest) (*UpdateTopicResponse, error)
Parameters
Context for the request, useful for timeouts and cancellation.
The ID of the topic to update.
params
*UpdateTopicRequest
required
The topic update parameters.
Returns
Returns an *UpdateTopicResponse containing the updated topic ID.
Example
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
updateParams := &resend.UpdateTopicRequest{
Name: "Weekly Digest",
Description: "Weekly summary of top content",
}
response, err := client.Topics.UpdateWithContext(ctx, "topic_123", updateParams)
if err != nil {
panic(err)
}
Types
UpdateTopicRequest
Request payload for updating a topic.
type UpdateTopicRequest struct {
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
}
The updated name of the topic.
The updated description of the topic.
The default_subscription field cannot be changed after topic creation.
UpdateTopicResponse
Response from updating a topic.
type UpdateTopicResponse struct {
Id string `json:"id"`
}
The unique identifier of the updated topic.