tga

package
v0.0.0-...-d6a62c6 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthCodeValidationCallBack

func AuthCodeValidationCallBack(srv *http.Server, codeChan chan<- string) http.HandlerFunc

func DecompressAllBody

func DecompressAllBody(httpResponse *http.Response) ([]byte, error)

func GetLastApkVersion

func GetLastApkVersion() (string, error)

func GracefulShutdownHook

func GracefulShutdownHook(stopSignalReceived *bool)

func ListenToGoogleRedirect

func ListenToGoogleRedirect(redirectUrlPort int, codeChan chan<- string)

func NewGmailClient

func NewGmailClient(emailConfig EmailConfig) (*gmail.Service, error)

func NewHttpClient

func NewHttpClient() *http.Client

func NewWhatsAppClient

func NewWhatsAppClient(whatsAppConfig WhatsAppConfig) (*whatsmeow.Client, error)

func OpenBrowser

func OpenBrowser(url string) error

func SetupConfig

func SetupConfig(emailConfig EmailConfig) (*oauth2.Config, error)

func Start

func Start()

Types

type Authorization

type Authorization struct {
	AuthorizationPayload AuthorizationPayload `json:"authorization_payload"`
	PaymentProvider      PaymentProvider      `json:"payment_provider"`
	ReturnUrl            string               `json:"return_url"`
}

type AuthorizationPayload

type AuthorizationPayload struct {
	Type              string      `json:"type"`
	PaymentType       PaymentType `json:"payment_type"`
	Payload           string      `json:"payload"`
	DetailsPayload    string      `json:"details_payload,omitempty"`
	SavePaymentMethod string      `json:"save_payment_method,omitempty"`
}

type CancelOrderParameters

type CancelOrderParameters struct {
	CancelReason int `json:"cancel_reason_id"`
}

type Config

type Config struct {
	TooGoodToGoConfig TooGoodToGoConfig `json:"tooGoodToGoConfig"`
	SendConfig        SendConfig        `json:"sendConfig"`
	Verbose           bool              `json:"verbose"`
}

func ReadConfigFromFile

func ReadConfigFromFile(filePath string) (*Config, error)

type CreateOrderParameters

type CreateOrderParameters struct {
	NbBags int `json:"item_count"`
}

type Duration

type Duration struct {
	time.Duration
}

Custom duration to be able to unmarshall it from strings

func (*Duration) UnmarshalJSON

func (duration *Duration) UnmarshalJSON(b []byte) error

type EmailConfig

type EmailConfig struct {
	EmailFrom         string `json:"emailFrom"`
	EmailTo           string `json:"emailTo"`
	GmailApiKeyFile   string `json:"gmailApiKeyFile"`
	OauthPortCallback int    `json:"oauthPortCallBack"`
}

type ItemParameters

type ItemParameters struct {
	UserId        string   `json:"user_id"`
	Origin        Location `json:"origin"`
	Radius        int      `json:"radius"`
	PageSize      int      `json:"page_size"`
	Page          int      `json:"page"`
	Discover      bool     `json:"discover"`
	FavoritesOnly bool     `json:"favorites_only"`
	WithStockOnly bool     `json:"with_stock_only"`
}

type Location

type Location struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
}

type OpenedOrdersParameters

type OpenedOrdersParameters struct {
	UserId string `json:"user_id"`
}

type Order

type Order struct {
	StoreName     string
	StoreId       string
	State         string
	Id            string
	PickupDetails PickupDetails
	Rating        float64
	Price         Price
	Quantity      int
}

func NewOrdersFromListOrdersResponse

func NewOrdersFromListOrdersResponse(responseBody []byte) ([]Order, error)

func (*Order) String

func (o *Order) String() string

type OrderPayment

type OrderPayment struct {
	Id              string
	OrderId         string
	PaymentProvider PaymentProvider
	State           string
}

func NewOrderPaymentFromPayOrderResponse

func NewOrderPaymentFromPayOrderResponse(responseBody []byte) (OrderPayment, error)

type PayOrderParameters

type PayOrderParameters struct {
	Authorization Authorization `json:"authorization"`
}

type PaymentMethod

type PaymentMethod struct {
	Id                string
	InternalType      string
	AdyenApiPayload   string
	DisplayValue      string
	SavePaymentMethod string // TODO: check what it is
	PaymentProvider   PaymentProvider
	PaymentType       PaymentType
	IsPreferred       bool
}

func NewPaymentMethodsFromPaymentMethodsResponse

func NewPaymentMethodsFromPaymentMethodsResponse(responseBody []byte) ([]PaymentMethod, error)

func (PaymentMethod) String

func (p PaymentMethod) String() string

type PaymentMethodRequestItem

type PaymentMethodRequestItem struct {
	PaymentProvider PaymentProvider `json:"provider"`
	PaymentTypes    []PaymentType   `json:"payment_types"`
}

type PaymentMethodsParameters

type PaymentMethodsParameters struct {
	PaymentMethodRequestItem []PaymentMethodRequestItem `json:"supported_types"`
}

type PaymentProvider

type PaymentProvider int
const (
	Cash PaymentProvider = iota
	Braintree
	Adyen
	Satispay
)

func NewPaymentProvider

func NewPaymentProvider(str string) (PaymentProvider, error)

func (PaymentProvider) GetAuthorizationPayloadType

func (p PaymentProvider) GetAuthorizationPayloadType() string

func (PaymentProvider) MarshalJSON

func (p PaymentProvider) MarshalJSON() ([]byte, error)

func (PaymentProvider) String

func (p PaymentProvider) String() string

func (*PaymentProvider) UnmarshalJSON

func (p *PaymentProvider) UnmarshalJSON(b []byte) error

type PaymentType

type PaymentType int
const (
	CreditCard PaymentType = iota
	GooglePay
	BcMcMobile
	BcMcCard
	Vipps
	Twint
	MbWay
	Swish
	Blik
	Venmo
	FakeDoor
	PayPal
	SoFort
)

func NewPaymentType

func NewPaymentType(str string) (PaymentType, error)

func (PaymentType) MarshalJSON

func (p PaymentType) MarshalJSON() ([]byte, error)

func (PaymentType) String

func (p PaymentType) String() string

func (*PaymentType) UnmarshalJSON

func (p *PaymentType) UnmarshalJSON(b []byte) error

type PickupDetails

type PickupDetails struct {
	Address string
	FromGMT time.Time
	ToGMT   time.Time
}

func (*PickupDetails) String

func (p *PickupDetails) String() string

type Price

type Price struct {
	Amount       int
	NbDecimals   int
	CurrencyCode string
}

func NewPrice

func NewPrice(priceIncludingTaxes map[string]interface{}) Price

func (Price) FloatAmount

func (p Price) FloatAmount() float64

func (Price) String

func (p Price) String() string

type QueryDelayPolicy

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

type QueryResponse

type QueryResponse struct {
	Body       []byte
	StatusCode int
}

type ReservedOrder

type ReservedOrder struct {
	Id       string
	StoreId  string
	Quantity int
}

func NewReservedOrderFromCreateOrder

func NewReservedOrderFromCreateOrder(responseBody []byte) (ReservedOrder, error)

func (*ReservedOrder) String

func (o *ReservedOrder) String() string

type SearchConfig

type SearchConfig struct {
	Origin        Location `json:"origin"`
	RadiusInKm    int      `json:"radiusInKm"`
	NbMaxResults  int      `json:"nbMaxResults"`
	FavoritesOnly bool     `json:"favoritesOnly"`
	WithStockOnly bool     `json:"withStockOnly"`
}

type SendActionType

type SendActionType int
const (
	NoSend SendActionType = iota
	SendEmail
	SendWhatsApp
)

func NewSendActionType

func NewSendActionType(str string) (SendActionType, error)

func (SendActionType) MarshalJSON

func (s SendActionType) MarshalJSON() ([]byte, error)

func (SendActionType) String

func (s SendActionType) String() string

func (*SendActionType) UnmarshalJSON

func (s *SendActionType) UnmarshalJSON(b []byte) error

type SendConfig

type SendConfig struct {
	EmailConfig    EmailConfig    `json:"emailConfig"`
	WhatsAppConfig WhatsAppConfig `json:"whatsAppConfig"`
	SendAction     SendActionType `json:"sendAction"`
}

type Sender

type Sender struct {
	GmailClient    *gmail.Service
	WhatsAppClient *whatsmeow.Client
	// contains filtered or unexported fields
}

io.WriteCloser interface

func NewSender

func NewSender(sendConfig SendConfig) (Sender, error)

func (Sender) Close

func (s Sender) Close() error

satisfy the Closer interface

func (Sender) Write

func (s Sender) Write(p []byte) (n int, err error)

satisfy the Writer interface

type Store

type Store struct {
	Name          string
	Id            string
	Rating        float64
	Price         Price
	AvailableBags int
}

func NewStoresFromListStoresResponse

func NewStoresFromListStoresResponse(responseBody []byte) ([]Store, error)

func (*Store) String

func (s *Store) String() string

type TooGooToGoClient

type TooGooToGoClient struct {
	Config                 *TooGoodToGoConfig `json:"-"`
	AccessToken            string             `json:"accessToken"`
	RefreshToken           string             `json:"refreshToken"`
	Cookie                 []string           `json:"cookie"`
	UserId                 string             `json:"userId"`
	UserAgent              string             `json:"userAgent"`
	LastLogInRefreshedTime time.Time          `json:"lastLogInRefreshedTime"`
	LastTokenRefreshedTime time.Time          `json:"lastTokenRefreshedTime"`
	// contains filtered or unexported fields
}

func NewTooGooToGoClient

func NewTooGooToGoClient(config *TooGoodToGoConfig, verbose bool) *TooGooToGoClient

func (*TooGooToGoClient) CancelOrder

func (client *TooGooToGoClient) CancelOrder(orderId string) error

func (*TooGooToGoClient) Close

func (client *TooGooToGoClient) Close() error

func (*TooGooToGoClient) IsLogInStillValid

func (client *TooGooToGoClient) IsLogInStillValid() bool

func (*TooGooToGoClient) IsLoggedIn

func (client *TooGooToGoClient) IsLoggedIn() bool

func (*TooGooToGoClient) IsTokenStillValid

func (client *TooGooToGoClient) IsTokenStillValid() bool

func (*TooGooToGoClient) ListOpenedOrders

func (client *TooGooToGoClient) ListOpenedOrders() ([]Order, error)

func (*TooGooToGoClient) ListStores

func (client *TooGooToGoClient) ListStores() ([]Store, error)

func (*TooGooToGoClient) PayOrder

func (client *TooGooToGoClient) PayOrder(orderId string, paymentMethod PaymentMethod) (OrderPayment, error)

func (*TooGooToGoClient) PaymentMethods

func (client *TooGooToGoClient) PaymentMethods(paymentProvider PaymentProvider) ([]PaymentMethod, error)

func (*TooGooToGoClient) ReserveOrder

func (client *TooGooToGoClient) ReserveOrder(store Store, nbBags int) (ReservedOrder, error)

type TooGoodToGoAccount

type TooGoodToGoAccount struct {
	Email     string `json:"email"`
	UserAgent string `json:"userAgent"`
}

type TooGoodToGoConfig

type TooGoodToGoConfig struct {
	Accounts                            []TooGoodToGoAccount `json:"accounts"`
	Language                            string               `json:"language"`
	AverageRequestsPeriod               Duration             `json:"averageRequestsPeriod"`
	TooManyRequestsPausePeriod          Duration             `json:"tooManyRequestsPausePeriod"`
	ActiveOrdersReminderPeriod          Duration             `json:"activeOrdersReminderPeriod"`
	LogInEmailValidationRequestsPeriod  Duration             `json:"logInEmailValidationRequestsPeriod"`
	LogInEmailValidationTimeoutDuration Duration             `json:"logInEmailValidationTimeoutDuration"`
	LogInValidityDuration               Duration             `json:"logInValidityDuration"`
	TokenValidityDuration               Duration             `json:"tokenValidityDuration"`
	SearchConfig                        SearchConfig         `json:"searchConfig"`
}

type WhatsAppConfig

type WhatsAppConfig struct {
	GroupNameTo string `json:"groupNameTo"`
	UserNameTo  string `json:"userNameTo"`
}

Jump to

Keyboard shortcuts

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