Documentation
¶
Index ¶
- func AuthCodeValidationCallBack(srv *http.Server, codeChan chan<- string) http.HandlerFunc
- func DecompressAllBody(httpResponse *http.Response) ([]byte, error)
- func GetLastApkVersion() (string, error)
- func GracefulShutdownHook(stopSignalReceived *bool)
- func ListenToGoogleRedirect(redirectUrlPort int, codeChan chan<- string)
- func NewGmailClient(emailConfig EmailConfig) (*gmail.Service, error)
- func NewHttpClient() *http.Client
- func NewWhatsAppClient(whatsAppConfig WhatsAppConfig) (*whatsmeow.Client, error)
- func OpenBrowser(url string) error
- func SetupConfig(emailConfig EmailConfig) (*oauth2.Config, error)
- func Start()
- type Authorization
- type AuthorizationPayload
- type CancelOrderParameters
- type Config
- type CreateOrderParameters
- type Duration
- type EmailConfig
- type ItemParameters
- type Location
- type OpenedOrdersParameters
- type Order
- type OrderPayment
- type PayOrderParameters
- type PaymentMethod
- type PaymentMethodRequestItem
- type PaymentMethodsParameters
- type PaymentProvider
- type PaymentType
- type PickupDetails
- type Price
- type QueryDelayPolicy
- type QueryResponse
- type ReservedOrder
- type SearchConfig
- type SendActionType
- type SendConfig
- type Sender
- type Store
- type TooGooToGoClient
- func (client *TooGooToGoClient) CancelOrder(orderId string) error
- func (client *TooGooToGoClient) Close() error
- func (client *TooGooToGoClient) IsLogInStillValid() bool
- func (client *TooGooToGoClient) IsLoggedIn() bool
- func (client *TooGooToGoClient) IsTokenStillValid() bool
- func (client *TooGooToGoClient) ListOpenedOrders() ([]Order, error)
- func (client *TooGooToGoClient) ListStores() ([]Store, error)
- func (client *TooGooToGoClient) PayOrder(orderId string, paymentMethod PaymentMethod) (OrderPayment, error)
- func (client *TooGooToGoClient) PaymentMethods(paymentProvider PaymentProvider) ([]PaymentMethod, error)
- func (client *TooGooToGoClient) ReserveOrder(store Store, nbBags int) (ReservedOrder, error)
- type TooGoodToGoAccount
- type TooGoodToGoConfig
- type WhatsAppConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthCodeValidationCallBack ¶
func AuthCodeValidationCallBack(srv *http.Server, codeChan chan<- string) http.HandlerFunc
func GetLastApkVersion ¶
func GracefulShutdownHook ¶
func GracefulShutdownHook(stopSignalReceived *bool)
func ListenToGoogleRedirect ¶
func NewGmailClient ¶
func NewGmailClient(emailConfig EmailConfig) (*gmail.Service, error)
func NewHttpClient ¶
func NewWhatsAppClient ¶
func NewWhatsAppClient(whatsAppConfig WhatsAppConfig) (*whatsmeow.Client, error)
func OpenBrowser ¶
func SetupConfig ¶
func SetupConfig(emailConfig EmailConfig) (*oauth2.Config, error)
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 ¶
type CreateOrderParameters ¶
type CreateOrderParameters struct {
NbBags int `json:"item_count"`
}
type Duration ¶
Custom duration to be able to unmarshall it from strings
func (*Duration) UnmarshalJSON ¶
type EmailConfig ¶
type ItemParameters ¶
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
}
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 ¶
func (*PickupDetails) String ¶
func (p *PickupDetails) String() string
type Price ¶
func (Price) FloatAmount ¶
type QueryDelayPolicy ¶
type QueryDelayPolicy struct {
// contains filtered or unexported fields
}
type QueryResponse ¶
type ReservedOrder ¶
func NewReservedOrderFromCreateOrder ¶
func NewReservedOrderFromCreateOrder(responseBody []byte) (ReservedOrder, error)
func (*ReservedOrder) String ¶
func (o *ReservedOrder) String() string
type SearchConfig ¶
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)
type Store ¶
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 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 ¶
Click to show internal directories.
Click to hide internal directories.