Files
2e03d96084 feat: update speakeasy (#1100)
Co-authored-by: Maxence Maireaux <[email protected]>
Co-authored-by: David Ragot <[email protected]>
2024-01-08 18:23:33 +00:00

58 lines
1008 B
Go

// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
package shared
import (
"encoding/json"
"fmt"
)
type ErrorCode string
const (
ErrorCodeValidation ErrorCode = "VALIDATION"
ErrorCodeNotFound ErrorCode = "NOT_FOUND"
ErrorCodeInternal ErrorCode = "INTERNAL"
)
func (e ErrorCode) ToPointer() *ErrorCode {
return &e
}
func (e *ErrorCode) UnmarshalJSON(data []byte) error {
var v string
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case "VALIDATION":
fallthrough
case "NOT_FOUND":
fallthrough
case "INTERNAL":
*e = ErrorCode(v)
return nil
default:
return fmt.Errorf("invalid value for ErrorCode: %v", v)
}
}
type Error struct {
ErrorCode ErrorCode `json:"errorCode"`
ErrorMessage string `json:"errorMessage"`
}
func (o *Error) GetErrorCode() ErrorCode {
if o == nil {
return ErrorCode("")
}
return o.ErrorCode
}
func (o *Error) GetErrorMessage() string {
if o == nil {
return ""
}
return o.ErrorMessage
}