package response // Envelope for response objects type Envelope struct { Success bool `json:"success"` RequestID string `json:"request_id,omitempty"` Warnings []string `json:"warnings,omitempty"` Errors []string `json:"errors,omitempty"` // PaginationInfo *pagination.Pagination `json:"pagination_info,omitempty"` Result interface{} `json:"result,omitempty"` } // AppendError to envelope func (envelope *Envelope) AppendError(err error) *Envelope { envelope.Success = false envelope.Result = nil envelope.Errors = append(envelope.Errors, err.Error()) return envelope } // SetSuccess to envelope func (envelope *Envelope) SetSuccess(result interface{}) *Envelope { envelope.Success = true envelope.Result = result return envelope }