resources

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Details

type Details json.RawMessage

func (Details) MarshalJSON

func (d Details) MarshalJSON() ([]byte, error)

MarshalJSON - casts Details to []byte

func (*Details) Scan

func (r *Details) Scan(src interface{}) error

Scan - implements db driver method for auto unmarshal

func (Details) String

func (d Details) String() string

func (*Details) UnmarshalJSON

func (d *Details) UnmarshalJSON(data []byte) error

UnmarshalJSON - casts data to Details

func (Details) Value

func (r Details) Value() (driver.Value, error)

Value - implements db driver method for auto marshal

type Flag

type Flag struct {
	Name  string `json:"name"`
	Value int32  `json:"value"`
}

type Flagger

type Flagger interface {
	IsFlag() bool
}

type Flags

type Flags struct {
	Mask   int32  `json:"mask"`
	Values []Flag `json:"flags"`
}

func FlagsFromMask

func FlagsFromMask(mask int32, allFlags map[int32]string) Flags

type Form

type Form struct {
	Key
	Attributes FormAttributes `json:"attributes"`
}

type FormAttributes

type FormAttributes struct {
	Address  string `json:"address"`
	Birthday string `json:"birthday"`
	Citizen  string `json:"citizen"`
	City     string `json:"city"`
	Country  string `json:"country"`
	// Form submission time. Unix time. Read-only.
	CreatedAt *int64 `json:"created_at,omitempty"`
	Email     string `json:"email"`
	IdNum     string `json:"id_num"`
	// base64 encoded image with max size 4 MB or URL for S3 storage with image up to 4 mb
	Image string `json:"image"`
	Name  string `json:"name"`
	// Time of the next possible form submission. Unix time. Read-only.
	NextFormAt *int64 `json:"next_form_at,omitempty"`
	// base64 encoded image with max size 4 MB or URL for S3 storage with image up to 4 mb
	PassportImage *string `json:"passport_image,omitempty"`
	Phone         string  `json:"phone"`
	Postal        string  `json:"postal"`
	// Form processing time. Absent if the status is accepted. Unix time. Read-only.
	ProcessedAt *int64 `json:"processed_at,omitempty"`
	Purpose     string `json:"purpose"`
	// Created - the empty form was created and now user can't use legacy submit Accepted - the data was saved by the service for further processing Processed - the data is processed and stored Read-only.
	Status  *string `json:"status,omitempty"`
	Surname string  `json:"surname"`
	// Time until the next form submission in seconds. Read-only.
	UntilNextForm *int64 `json:"until_next_form,omitempty"`
	Visited       string `json:"visited"`
}

type FormListResponse

type FormListResponse struct {
	Data     []Form          `json:"data"`
	Included Included        `json:"included"`
	Links    *Links          `json:"links"`
	Meta     json.RawMessage `json:"meta,omitempty"`
}

func (*FormListResponse) GetMeta

func (r *FormListResponse) GetMeta(out interface{}) error

func (*FormListResponse) PutMeta

func (r *FormListResponse) PutMeta(v interface{}) (err error)

type FormResponse

type FormResponse struct {
	Data     Form     `json:"data"`
	Included Included `json:"included"`
}

type ImageData

type ImageData struct {
	// Image size. It cannot be more than 4 megabytes.
	ContentLength int64 `json:"content_length"`
	// Allowed content-type is `image/png`, `image/jpeg` or `image/x-jp2`
	ContentType string `json:"content_type"`
}

type Included

type Included struct {
	// contains filtered or unexported fields
}

Included - an array of Resource objects that are related to the primary data and/or each other (“included resources”).

func (*Included) Add

func (c *Included) Add(includes ...Resource)

Add - adds new include into collection. If one already present - skips it

func (Included) MarshalJSON

func (c Included) MarshalJSON() ([]byte, error)

MarshalJSON - marshals include collection as array of json objects

func (*Included) MustForm

func (c *Included) MustForm(key Key) *Form

MustForm - returns Form from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustSubmitForm

func (c *Included) MustSubmitForm(key Key) *SubmitForm

MustSubmitForm - returns SubmitForm from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustUploadImage

func (c *Included) MustUploadImage(key Key) *UploadImage

MustUploadImage - returns UploadImage from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustUploadImageResponse

func (c *Included) MustUploadImageResponse(key Key) *UploadImageResponse

MustUploadImageResponse - returns UploadImageResponse from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustUploadImageResponseV2

func (c *Included) MustUploadImageResponseV2(key Key) *UploadImageResponseV2

MustUploadImageResponseV2 - returns UploadImageResponseV2 from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustUploadImageV2

func (c *Included) MustUploadImageV2(key Key) *UploadImageV2

MustUploadImageV2 - returns UploadImageV2 from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) UnmarshalJSON

func (c *Included) UnmarshalJSON(data []byte) error

UmarshalJSON - unmarshal array of json objects into include collection

type Key

type Key struct {
	ID   string       `json:"id"`
	Type ResourceType `json:"type"`
}

func NewKeyInt64

func NewKeyInt64(id int64, resourceType ResourceType) Key

func (Key) AsRelation

func (r Key) AsRelation() *Relation

func (*Key) GetKey

func (r *Key) GetKey() Key

func (Key) GetKeyP

func (r Key) GetKeyP() *Key
type Links struct {
	First string `json:"first,omitempty"`
	Last  string `json:"last,omitempty"`
	Next  string `json:"next,omitempty"`
	Prev  string `json:"prev,omitempty"`
	Self  string `json:"self,omitempty"`
}

type Relation

type Relation struct {
	Data  *Key   `json:"data,omitempty"`
	Links *Links `json:"links,omitempty"`
}

type RelationCollection

type RelationCollection struct {
	Data  []Key  `json:"data"`
	Links *Links `json:"links,omitempty"`
}

func (RelationCollection) MarshalJSON

func (r RelationCollection) MarshalJSON() ([]byte, error)

type Resource

type Resource interface {
	//GetKey - returns key of the Resource
	GetKey() Key
}

type ResourceType

type ResourceType string
const (
	FORM                  ResourceType = "form"
	SUBMIT_FORM           ResourceType = "submit_form"
	UPLOAD_IMAGE          ResourceType = "upload_image"
	UPLOAD_IMAGE_RESPONSE ResourceType = "upload_image_response"
)

List of ResourceType

type SubmitForm

type SubmitForm struct {
	Key
	Attributes SubmitFormAttributes `json:"attributes"`
}

type SubmitFormAttributes

type SubmitFormAttributes struct {
	Address string `json:"address"`
	// Date formated as DD/MM/YYYY
	Birthday string `json:"birthday"`
	Citizen  string `json:"citizen"`
	City     string `json:"city"`
	Country  string `json:"country"`
	Email    string `json:"email"`
	IdNum    string `json:"id_num"`
	// For default endpoint:   base64 encoded image with max size 4 MB; For lightweight endpoint:   link to the image in s3 storage;
	Image   string `json:"image"`
	Name    string `json:"name"`
	Phone   string `json:"phone"`
	Postal  string `json:"postal"`
	Purpose string `json:"purpose"`
	Surname string `json:"surname"`
	// Date formated as DD/MM/YYYY
	Visited string `json:"visited"`
}

type SubmitFormListRequest

type SubmitFormListRequest struct {
	Data     []SubmitForm    `json:"data"`
	Included Included        `json:"included"`
	Links    *Links          `json:"links"`
	Meta     json.RawMessage `json:"meta,omitempty"`
}

func (*SubmitFormListRequest) GetMeta

func (r *SubmitFormListRequest) GetMeta(out interface{}) error

func (*SubmitFormListRequest) PutMeta

func (r *SubmitFormListRequest) PutMeta(v interface{}) (err error)

type SubmitFormRequest

type SubmitFormRequest struct {
	Data     SubmitForm `json:"data"`
	Included Included   `json:"included"`
}

type UploadImage

type UploadImage struct {
	Key
	Attributes UploadImageAttributes `json:"attributes"`
}

type UploadImageAttributes

type UploadImageAttributes struct {
	// Image size. It cannot be more than 4 megabytes.
	ContentLength int64 `json:"content_length"`
	// Allowed content-type is `image/png` or `image/jpeg`
	ContentType string `json:"content_type"`
}

type UploadImageListRequest

type UploadImageListRequest struct {
	Data     []UploadImage   `json:"data"`
	Included Included        `json:"included"`
	Links    *Links          `json:"links"`
	Meta     json.RawMessage `json:"meta,omitempty"`
}

func (*UploadImageListRequest) GetMeta

func (r *UploadImageListRequest) GetMeta(out interface{}) error

func (*UploadImageListRequest) PutMeta

func (r *UploadImageListRequest) PutMeta(v interface{}) (err error)

type UploadImageRequest

type UploadImageRequest struct {
	Data     UploadImage `json:"data"`
	Included Included    `json:"included"`
}

type UploadImageResponse

type UploadImageResponse struct {
	Key
	Attributes UploadImageResponseAttributes `json:"attributes"`
}

type UploadImageResponseAttributes

type UploadImageResponseAttributes struct {
	// Pre-signed URL to upload the file
	Url string `json:"url"`
}

type UploadImageResponseListResponse

type UploadImageResponseListResponse struct {
	Data     []UploadImageResponse `json:"data"`
	Included Included              `json:"included"`
	Links    *Links                `json:"links"`
	Meta     json.RawMessage       `json:"meta,omitempty"`
}

func (*UploadImageResponseListResponse) GetMeta

func (r *UploadImageResponseListResponse) GetMeta(out interface{}) error

func (*UploadImageResponseListResponse) PutMeta

func (r *UploadImageResponseListResponse) PutMeta(v interface{}) (err error)

type UploadImageResponseResponse

type UploadImageResponseResponse struct {
	Data     UploadImageResponse `json:"data"`
	Included Included            `json:"included"`
}

type UploadImageResponseV2

type UploadImageResponseV2 struct {
	Key
	Attributes UploadImageResponseV2Attributes `json:"attributes"`
}

type UploadImageResponseV2Attributes

type UploadImageResponseV2Attributes struct {
	// Pre-signed URL to upload the file
	PassportImageUrl *string `json:"passport_image_url,omitempty"`
	// Pre-signed URL to upload the file
	SelfieImageUrl string `json:"selfie_image_url"`
}

type UploadImageResponseV2ListResponse

type UploadImageResponseV2ListResponse struct {
	Data     []UploadImageResponseV2 `json:"data"`
	Included Included                `json:"included"`
	Links    *Links                  `json:"links"`
	Meta     json.RawMessage         `json:"meta,omitempty"`
}

func (*UploadImageResponseV2ListResponse) GetMeta

func (r *UploadImageResponseV2ListResponse) GetMeta(out interface{}) error

func (*UploadImageResponseV2ListResponse) PutMeta

func (r *UploadImageResponseV2ListResponse) PutMeta(v interface{}) (err error)

type UploadImageResponseV2Response

type UploadImageResponseV2Response struct {
	Data     UploadImageResponseV2 `json:"data"`
	Included Included              `json:"included"`
}

type UploadImageV2

type UploadImageV2 struct {
	Key
	Attributes UploadImageV2Attributes `json:"attributes"`
}

type UploadImageV2Attributes

type UploadImageV2Attributes struct {
	PassportImage *ImageData `json:"passport_image,omitempty"`
	SelfieImage   ImageData  `json:"selfie_image"`
}

type UploadImageV2ListRequest

type UploadImageV2ListRequest struct {
	Data     []UploadImageV2 `json:"data"`
	Included Included        `json:"included"`
	Links    *Links          `json:"links"`
	Meta     json.RawMessage `json:"meta,omitempty"`
}

func (*UploadImageV2ListRequest) GetMeta

func (r *UploadImageV2ListRequest) GetMeta(out interface{}) error

func (*UploadImageV2ListRequest) PutMeta

func (r *UploadImageV2ListRequest) PutMeta(v interface{}) (err error)

type UploadImageV2Request

type UploadImageV2Request struct {
	Data     UploadImageV2 `json:"data"`
	Included Included      `json:"included"`
}

Jump to

Keyboard shortcuts

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