diff --git a/go/message_attempt.go b/go/message_attempt.go index ddbd74a2b..1fffe3a03 100644 --- a/go/message_attempt.go +++ b/go/message_attempt.go @@ -36,13 +36,13 @@ func (m *MessageAttempt) List( return m.ListByMsg(ctx, appId, msgId, options) } -func (m *MessageAttempt) ListByMsg( +func (m *MessageAttempt) ListByEndpoint( ctx context.Context, appId string, - msgId string, + endpointId string, options *MessageAttemptListOptions, ) (*ListResponseMessageAttemptOut, error) { - req := m.api.MessageAttemptAPI.V1MessageAttemptListByMsg(ctx, appId, msgId) + req := m.api.MessageAttemptAPI.V1MessageAttemptListByEndpoint(ctx, appId, endpointId) if options != nil { if options.Iterator != nil { req = req.Iterator(*options.Iterator) @@ -68,12 +68,12 @@ func (m *MessageAttempt) ListByMsg( if options.Channel != nil { req = req.Channel(*options.Channel) } - if options.EndpointId != nil { - req = req.EndpointId(*options.EndpointId) - } if options.WithContent != nil { req = req.WithContent(*options.WithContent) } + if options.WithMsg != nil { + req = req.WithMsg(*options.WithMsg) + } if options.Tag != nil { req = req.Tag(*options.Tag) } @@ -85,13 +85,13 @@ func (m *MessageAttempt) ListByMsg( return ret, nil } -func (m *MessageAttempt) ListByEndpoint( +func (m *MessageAttempt) ListByMsg( ctx context.Context, appId string, - endpointId string, + msgId string, options *MessageAttemptListOptions, ) (*ListResponseMessageAttemptOut, error) { - req := m.api.MessageAttemptAPI.V1MessageAttemptListByEndpoint(ctx, appId, endpointId) + req := m.api.MessageAttemptAPI.V1MessageAttemptListByMsg(ctx, appId, msgId) if options != nil { if options.Iterator != nil { req = req.Iterator(*options.Iterator) @@ -117,12 +117,12 @@ func (m *MessageAttempt) ListByEndpoint( if options.Channel != nil { req = req.Channel(*options.Channel) } + if options.EndpointId != nil { + req = req.EndpointId(*options.EndpointId) + } if options.WithContent != nil { req = req.WithContent(*options.WithContent) } - if options.WithMsg != nil { - req = req.WithMsg(*options.WithMsg) - } if options.Tag != nil { req = req.Tag(*options.Tag) } @@ -134,46 +134,6 @@ func (m *MessageAttempt) ListByEndpoint( return ret, nil } -func (m *MessageAttempt) Get( - ctx context.Context, - appId string, - msgId string, - attemptID string, -) (*MessageAttemptOut, error) { - req := m.api.MessageAttemptAPI.V1MessageAttemptGet(ctx, appId, msgId, attemptID) - ret, res, err := req.Execute() - if err != nil { - return nil, wrapError(err, res) - } - return ret, nil -} - -func (m *MessageAttempt) Resend( - ctx context.Context, - appId string, - msgId string, - endpointId string, -) error { - return m.ResendWithOptions(ctx, appId, msgId, endpointId, nil) -} - -func (m *MessageAttempt) ResendWithOptions( - ctx context.Context, - appId string, - msgId string, - endpointId string, - options *PostOptions, -) error { - req := m.api.MessageAttemptAPI.V1MessageAttemptResend(ctx, appId, msgId, endpointId) - if options != nil { - if options.IdempotencyKey != nil { - req = req.IdempotencyKey(*options.IdempotencyKey) - } - } - res, err := req.Execute() - return wrapError(err, res) -} - func (m *MessageAttempt) ListAttemptedMessages( ctx context.Context, appId string, @@ -217,6 +177,31 @@ func (m *MessageAttempt) ListAttemptedMessages( return ret, nil } +func (m *MessageAttempt) Get( + ctx context.Context, + appId string, + msgId string, + attemptID string, +) (*MessageAttemptOut, error) { + req := m.api.MessageAttemptAPI.V1MessageAttemptGet(ctx, appId, msgId, attemptID) + ret, res, err := req.Execute() + if err != nil { + return nil, wrapError(err, res) + } + return ret, nil +} + +func (m *MessageAttempt) ExpungeContent( + ctx context.Context, + appId string, + msgId string, + attemptId string, +) error { + req := m.api.MessageAttemptAPI.V1MessageAttemptExpungeContent(ctx, appId, msgId, attemptId) + res, err := req.Execute() + return wrapError(err, res) +} + func (m *MessageAttempt) ListAttemptedDestinations( ctx context.Context, appId string, @@ -281,13 +266,28 @@ func (m *MessageAttempt) ListAttemptsForEndpoint( return ret, nil } -func (m *MessageAttempt) ExpungeContent( +func (m *MessageAttempt) Resend( ctx context.Context, appId string, msgId string, - attemptId string, + endpointId string, ) error { - req := m.api.MessageAttemptAPI.V1MessageAttemptExpungeContent(ctx, appId, msgId, attemptId) + return m.ResendWithOptions(ctx, appId, msgId, endpointId, nil) +} + +func (m *MessageAttempt) ResendWithOptions( + ctx context.Context, + appId string, + msgId string, + endpointId string, + options *PostOptions, +) error { + req := m.api.MessageAttemptAPI.V1MessageAttemptResend(ctx, appId, msgId, endpointId) + if options != nil { + if options.IdempotencyKey != nil { + req = req.IdempotencyKey(*options.IdempotencyKey) + } + } res, err := req.Execute() return wrapError(err, res) }