Documentation ¶
Index ¶
- Constants
- Variables
- func Bool(bool bool) *bool
- func BuildPath(resourcePath string, values interface{}) (string, error)
- func CheckRequired(iStruct interface{}) error
- func CloseBody(res *http.Response)
- func CreateError(i interface{}, name string) error
- func Interface() interface{}
- func IsJSON(res *http.Response) bool
- func JSONEmptyValue(v reflect.Type) string
- func NewReader(ctx context.Context, r io.Reader) io.Reader
- func NonJSONError(res *http.Response) error
- func NonOkError(res *http.Response) error
- func PathEscape(path string) string
- func ResponseErrors(res *http.Response, errorFunc ...func(res *http.Response) error) error
- func String(string string) *string
- func Time(t time.Time) *time.Time
- func UnWrapBool(b *bool) bool
- type ErrorWithOriginalResponse
- type ExportValues
- type Iter
- func (i *Iter) Current() interface{}
- func (i *Iter) EOFPage() bool
- func (i *Iter) Err() error
- func (i *Iter) ExportParams() (ExportValues, error)
- func (i *Iter) GetCursor() string
- func (i *Iter) GetPage() bool
- func (i *Iter) GetParams() *ListParams
- func (i *Iter) Next() bool
- func (i *Iter) NextPage() bool
- func (i *Iter) Paging() bool
- func (i *Iter) SetCursor(cursor string)
- type IterChan
- type IterI
- type IterPagingI
- type ListParams
- type ListParamsContainer
- type OnPageError
- type Params
- type Path
- type ProgressWriter
- type Query
- type Resource
- type ResourceOut
- type UnmarshalJSON
- type Values
- type WithContextReader
Constants ¶
const (
BasePart = int64(1024*1024*5 + 1024*1024/3)
)
Variables ¶
var PartSizes = partSizes()
PartSizes return 10k parts that add up to 4.9 TB
var QueryEscape = url.QueryEscape
Functions ¶
func CheckRequired ¶
func CheckRequired(iStruct interface{}) error
func CreateError ¶
func JSONEmptyValue ¶
func NonJSONError ¶
func NonOkError ¶
func PathEscape ¶
func ResponseErrors ¶
func UnWrapBool ¶
Types ¶
type ErrorWithOriginalResponse ¶
type ErrorWithOriginalResponse struct {
// contains filtered or unexported fields
}
func (ErrorWithOriginalResponse) OriginalResponse ¶
func (u ErrorWithOriginalResponse) OriginalResponse() interface{}
func (ErrorWithOriginalResponse) ProcessError ¶
func (u ErrorWithOriginalResponse) ProcessError(data []byte, err error, t interface{}) error
type ExportValues ¶
type Iter ¶
type Iter struct { Query ListParams ListParamsContainer Params []interface{} CurrentIndex int Values *[]interface{} Cursor string Error error OnPageError }
func (*Iter) Err ¶
Err returns the error, if any, that caused the Iter to stop. It must be inspected after Next returns false.
func (*Iter) ExportParams ¶
func (i *Iter) ExportParams() (ExportValues, error)
func (*Iter) GetParams ¶
func (i *Iter) GetParams() *ListParams
func (*Iter) Next ¶
Next iterates the results in i.Current() or i.`ResourceName`(). It returns true until there are no results remaining. To adjust the number of results set ListParams.PerPage. To have it auto-paginate set ListParams.MaxPages, default is 1.
To iterate over all results use the following pattern.
for i.Next() { i.Current() }
type IterChan ¶
type IterPagingI ¶
type ListParams ¶
type ListParams struct { Page int64 `json:"page,omitempty" url:"page,omitempty" required:"false"` PerPage int64 `json:"per_page,omitempty" url:"per_page,omitempty" required:"false"` Cursor string `json:"cursor,omitempty" url:"cursor,omitempty" required:"false"` MaxPages int64 `json:"-" url:"-"` }
func (*ListParams) GetListParams ¶
func (p *ListParams) GetListParams() *ListParams
GetListParams returns a ListParams struct (itself). It exists because any structs that embed ListParams will inherit it, and thus implement the ListParamsContainer interface.
type ListParamsContainer ¶
type ListParamsContainer interface {
GetListParams() *ListParams
}
ListParamsContainer is a general interface for which all list parameter structs should comply. They achieve this by embedding a ListParams struct and inheriting its implementation of this interface.
type OnPageError ¶
type ProgressWriter ¶
type Resource ¶
type Resource struct { Path string Params interface{} Method string Entity UnmarshalJSON }
func (Resource) Out ¶
func (r Resource) Out() (ResourceOut, error)