lots

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field struct {
	Value    string   `json:"value"`
	Variants []string `json:"variants"`
}

Field represents type contains description of the field on edit lot page.

type FieldKey added in v0.4.0

type FieldKey string

FieldKey represents key type for Fields.

type Fields

type Fields map[FieldKey]Field

Fields represents type contains fields from edit lot page.

type Lots

type Lots interface {
	// Save makes request to /lots/offerSave. Use [Lots.Fields] to get fields.
	//
	//	Fields:
	//	- Provide offer_id to update lot;
	//	- Set offer_id = "0" to create lot;
	//	- Set deleted = "1" to delete lot.
	Save(ctx context.Context, fields Fields) error

	// Fields loads [Fields] for [OfferID]. Values will be filled with provided offerID.
	FieldsByOfferID(ctx context.Context, offerID OfferID) (Fields, error)

	// FieldsByNodeID loads [Fields] for [NodeID].
	FieldsByNodeID(ctx context.Context, nodeID NodeID) (Fields, error)

	// ByUser gets lots for provided userID. Key represents nodeID, value represents slice of offerIDs.
	ByUser(ctx context.Context, userID int64) (map[NodeID][]OfferID, error)

	// Update updates lots for current account. Use [Lots.List] to get loaded lots.
	// Returns [funpay.ErrAccountUnauthorized] if user id equals 0. Call [Funpay.Update] to update account info.
	Update(ctx context.Context) error

	// List returns loaded lots (see [Lots.Update]).
	List() map[NodeID][]OfferID
}

func New

func New(fp funpay.Funpay) Lots

type LotsClient

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

func (*LotsClient) ByUser

func (l *LotsClient) ByUser(ctx context.Context, userID int64) (map[NodeID][]OfferID, error)

func (*LotsClient) FieldsByNodeID added in v0.4.0

func (l *LotsClient) FieldsByNodeID(ctx context.Context, nodeID NodeID) (Fields, error)

func (*LotsClient) FieldsByOfferID added in v0.4.0

func (l *LotsClient) FieldsByOfferID(ctx context.Context, offerID OfferID) (Fields, error)

func (*LotsClient) List

func (l *LotsClient) List() map[NodeID][]OfferID

func (*LotsClient) Save

func (l *LotsClient) Save(ctx context.Context, fields Fields) error

func (*LotsClient) Update

func (l *LotsClient) Update(ctx context.Context) error

type NodeID added in v0.4.0

type NodeID string

NodeID represents ID of category.

type OfferID added in v0.4.0

type OfferID string

OfferID represents ID of offer.

Jump to

Keyboard shortcuts

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