Documentation
¶
Index ¶
- Constants
- func RequestID(ctx context.Context) string
- type AuthenticatedRequest
- type Body
- type KeysetBasedList
- type OffsetBasedList
- type Option
- type Request
- type StandardRequest
- func (r StandardRequest) Authenticate() (*AuthenticatedRequest, error)
- func (r *StandardRequest) GetBody() Body
- func (r *StandardRequest) GetClient() string
- func (r *StandardRequest) GetContext() context.Context
- func (r *StandardRequest) GetCreatedAt() time.Time
- func (r *StandardRequest) GetHeader() http.Header
- func (r *StandardRequest) GetID() string
- func (r *StandardRequest) GetIP() string
- func (r *StandardRequest) GetLocale() string
- func (r *StandardRequest) SetBody(body Body)
- func (r *StandardRequest) SetContext(ctx context.Context)
- func (r *StandardRequest) SetLocale(locale string)
Constants ¶
View Source
const ( MAX_PAGE_SIZE = 1000 DEFAULT_LIMIT = 50 )
View Source
const DEFAULT_TIMEOUT = 15 * time.Second
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthenticatedRequest ¶
type AuthenticatedRequest struct {
StandardRequest
APIKey string
APISecret string
}
type KeysetBasedList ¶
type KeysetBasedList struct {
Limit int `json:"limit"`
Cursor string `json:"cursor"`
DateFilters []relational.DateFilter `json:"date_filters"`
}
func (*KeysetBasedList) ParseDatesToUnix ¶
func (r *KeysetBasedList) ParseDatesToUnix(validDBColumns []string) error
func (*KeysetBasedList) Validate ¶
func (r *KeysetBasedList) Validate() error
type OffsetBasedList ¶
type OffsetBasedList struct {
Limit int `json:"limit"`
Offset int `json:"offset"`
DateFilters []relational.DateFilter `json:"date_filters"`
}
func (*OffsetBasedList) ParseDatesToUnix ¶
func (r *OffsetBasedList) ParseDatesToUnix(validDBColumns []string) error
func (*OffsetBasedList) Validate ¶
func (r *OffsetBasedList) Validate() error
type Option ¶
type Option func(*StandardRequest)
Option is a function that modifies the Request.
func WithTimeout ¶
WithTimeout returns an Option that sets the timeout for the request context. It replaces the previous deadline and releases the timer of the context it replaces, keeping the context values.
type StandardRequest ¶
type StandardRequest struct {
ID string
IP string
Client string
Header http.Header
Body Body
CreatedAt time.Time
Context context.Context
Cancel context.CancelFunc
Locale string
}
func (StandardRequest) Authenticate ¶
func (r StandardRequest) Authenticate() (*AuthenticatedRequest, error)
func (*StandardRequest) GetBody ¶
func (r *StandardRequest) GetBody() Body
func (*StandardRequest) GetClient ¶
func (r *StandardRequest) GetClient() string
func (*StandardRequest) GetContext ¶
func (r *StandardRequest) GetContext() context.Context
func (*StandardRequest) GetCreatedAt ¶
func (r *StandardRequest) GetCreatedAt() time.Time
func (*StandardRequest) GetHeader ¶
func (r *StandardRequest) GetHeader() http.Header
func (*StandardRequest) GetID ¶
func (r *StandardRequest) GetID() string
func (*StandardRequest) GetIP ¶
func (r *StandardRequest) GetIP() string
func (*StandardRequest) GetLocale ¶ added in v1.9.2
func (r *StandardRequest) GetLocale() string
GetLocale returns the locale used to localize the response, e.g. "es-MX". New negotiates it from the Accept-Language header, so it is always set.
func (*StandardRequest) SetBody ¶
func (r *StandardRequest) SetBody(body Body)
func (*StandardRequest) SetContext ¶
func (r *StandardRequest) SetContext(ctx context.Context)
func (*StandardRequest) SetLocale ¶ added in v1.9.2
func (r *StandardRequest) SetLocale(locale string)
SetLocale overrides the negotiated locale, e.g. with an authenticated user's saved preference.
Click to show internal directories.
Click to hide internal directories.