shared

package
v6.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Pagination paginationNS

Functions

func ApiClient

func ApiClient(secretKey string, baseUrl string, additionalHeaders ...AdditionalHeader) *req.Client

func AssertOk

func AssertOk[T interface{}](result *req.Response, err error, data *T) (*T, error)

func AssertOkArray

func AssertOkArray[T interface{}](result *req.Response, err error, data *[]T) ([]T, error)

func AssertOkMap

func AssertOkMap[T interface{}](result *req.Response, err error, data map[string]T) (map[string]T, error)

func AssertOkNoBody

func AssertOkNoBody(result *req.Response, err error) error

func AssertOkWithoutResult

func AssertOkWithoutResult(result *req.Response, err error) error

func OptionalBool

func OptionalBool(value bool) *bool

func ToSort

func ToSort(sortField string, sortDirection string) string

Types

type AdditionalHeader

type AdditionalHeader func(headers *map[string]string)

func WithAdditionalHeader

func WithAdditionalHeader(key string, value string) AdditionalHeader

type Lister

type Lister[T interface{}] struct {
	PageFetcher *PageFetcher[T]
}

func (*Lister[T]) All

func (lister *Lister[T]) All(opts ...PaginationParamsOption) ([]T, error)

func (*Lister[T]) ListFirstPage

func (lister *Lister[T]) ListFirstPage(opts ...PaginationParamsOption) (*Page[T], error)

func (*Lister[T]) ListPageAfter

func (lister *Lister[T]) ListPageAfter(id int64, opts ...PaginationParamsOption) (*Page[T], error)

func (*Lister[T]) ListPageBefore

func (lister *Lister[T]) ListPageBefore(id int64, opts ...PaginationParamsOption) (*Page[T], error)

type Page

type Page[T interface{}] struct {
	Items                  []T   `json:"items"`
	NextPageStartsAfter    int64 `json:"next_page_starts_after"`
	PreviousPageEndsBefore int64 `json:"previous_page_ends_before"`
}

type PageFetcher

type PageFetcher[T interface{}] struct {
	Client      *req.Client
	Url         string
	UrlParams   map[string]string
	QueryParams map[string]string
}

type PageJson

type PageJson[T interface{}] struct {
	Items                  []T    `json:"items"`
	NextPageStartsAfter    string `json:"next_page_starts_after"`
	PreviousPageEndsBefore string `json:"previous_page_ends_before"`
}

type PaginationParams

type PaginationParams struct {
	PageSize    *int
	QueryParams map[string]string
}

type PaginationParamsOption

type PaginationParamsOption func(Params *PaginationParams)

type SeatsioError

type SeatsioError struct {
	Code    string
	Message string
}

func (*SeatsioError) Error

func (m *SeatsioError) Error() string

type SeatsioErrorResponse

type SeatsioErrorResponse struct {
	Errors []SeatsioErrorTO `json:"errors"`
}

type SeatsioErrorTO

type SeatsioErrorTO struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL