wishlists

package
v0.0.0-...-a84335b Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package wishlists contains actions related to wishlists

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateWishlistParams

type CreateWishlistParams struct {
	ProfileID   string
	Title       string
	Description string
	Visibility  WishlistVisibility
}

type NewWishParams

type NewWishParams struct {
	ProfileID   string
	URL         string
	Title       string
	Description string
	Quantity    int64
}

NewWishParams are the input parameters for a new wish

type UpdateWishParams

type UpdateWishParams struct {
	ID          string
	URL         *string
	Title       *string
	Description *string
	Quantity    *int64
}

UpdateWishParams are the optional params allowed to be updated in a wish.

type UpdateWishlistParams

type UpdateWishlistParams struct {
	ID          string
	Title       *string
	Description *string
	Visibility  *WishlistVisibility
}

type Wish

type Wish struct {
	ID          string
	ProfileID   string
	URL         string
	Title       string
	Description string
	Quantity    int64
	Created     time.Time
}

type WishLists

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

func New

func New(db wishdb) WishLists

func (WishLists) AddWish

func (wl WishLists) AddWish(ctx context.Context, w Wishlist, wishID string, order int64) error

AddWish adds a wish to a the wishlist

func (WishLists) ByID

func (wl WishLists) ByID(ctx context.Context, id string) (Wishlist, error)

ByID returns a wishlist with the given ID

func (WishLists) ByProfile

func (wl WishLists) ByProfile(
	ctx context.Context,
	profileID string,
	visibilities ...WishlistVisibility,
) (WishlistList, error)

ByProfile returns a list of Wishlists associated with the given profile.

func (WishLists) CreateWishlist

func (wl WishLists) CreateWishlist(ctx context.Context, params CreateWishlistParams) (Wishlist, error)

CreateWishlist makes a new empty wishlist

func (WishLists) DeleteWish

func (wl WishLists) DeleteWish(ctx context.Context, id string) error

DeleteWish removes a wish from the wishlist

func (WishLists) DeleteWishlist

func (wl WishLists) DeleteWishlist(ctx context.Context, id string) error

func (WishLists) GetUnlisted

func (wl WishLists) GetUnlisted(ctx context.Context, profileID string) (Wishlist, error)

func (WishLists) GetWish

func (wl WishLists) GetWish(ctx context.Context, id string) (Wish, error)

GetWish will return a wish from the wishlist by ID

func (WishLists) NewWish

func (wl WishLists) NewWish(ctx context.Context, params NewWishParams) (Wish, error)

NewWish adds a new wish to the given wishlist.

func (WishLists) RemoveWish

func (wl WishLists) RemoveWish(ctx context.Context, w Wishlist, wishId string) error

func (WishLists) UpdateWish

func (wl WishLists) UpdateWish(ctx context.Context, params UpdateWishParams) (Wish, error)

UpdateWish updates a wish with the given parameters. Nil parameters are left unchanged.

func (WishLists) UpdateWishlist

func (wl WishLists) UpdateWishlist(ctx context.Context, params UpdateWishlistParams) (Wishlist, error)

type Wishlist

type Wishlist struct {
	ID          string
	Title       string
	Description string
	ProfileID   string
	Created     time.Time
	Updated     time.Time
	Visibility  WishlistVisibility
	WishesCount int64
	Items       []WishlistItem `json:",omitempty"`
	System      bool
}

Wishlist is a collection of wishlist items

type WishlistItem

type WishlistItem struct {
	Wish    Wish
	ListID  string
	Ordinal int64
	Added   time.Time
}

WishlistItem is a member of a wishlist

type WishlistList

type WishlistList []Wishlist

WishlistList is a list of wishlists. This is typically a collection of wishlists owned by a profile.

type WishlistVisibility

type WishlistVisibility string
const (
	VisibilityPublic   WishlistVisibility = "public"
	VisibilityUnlisted WishlistVisibility = "unlisted"
	VisibilityPrivate  WishlistVisibility = "private"
)

Jump to

Keyboard shortcuts

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