Documentation ¶
Index ¶
- Constants
- Variables
- type APIClient
- type ActionHandler
- type ActionRequest
- type AppRequest
- type BBoltStore
- type CredentialStore
- type Credentials
- type ErrActionHandlerNotFound
- type ErrWebhookHandlerNotFound
- type MemoryCredentialStore
- type RegistrationResponse
- type Search
- type SearchFilter
- type SearchResponse
- type SearchSort
- type Server
- func (srv *Server) Action(entity string, action string, handler ActionHandler)
- func (srv *Server) Event(event string, handler WebhookHandler)
- func (srv *Server) HandleAction(req *http.Request) error
- func (srv Server) HandleConfirm(req *http.Request) error
- func (srv Server) HandleRegistration(req *http.Request) (RegistrationResponse, error)
- func (srv Server) HandleWebhook(req *http.Request) error
- type ServerOpt
- type SignatureVerificationError
- type Source
- type WebhookHandler
- type WebhookRequest
Constants ¶
View Source
const ( TotalCountModeDefault = 0 TotalCountModeExact = 1 TotalCountModeNextPage = 2 SearchFilterTypeEquals = "equals" SearchFilterTypeEqualsAny = "equalsAny" SearchSortDirectionAscending = "ASC" SearchSortDirectionDescending = "DESC" )
View Source
const ( HeaderAppSignature = "shopware-app-signature" HeaderPayloadSignature = "shopware-shop-signature" )
Variables ¶
View Source
var (
ErrActionMissingAction = errors.New("missing action or entity")
)
View Source
var (
ErrCredentialsNotFound = errors.New("credentials for shop not found")
)
View Source
var (
ErrWebhookMissingEvent = errors.New("missing event")
)
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient struct {
// contains filtered or unexported fields
}
func (*APIClient) GetAppConfig ¶
type ActionHandler ¶
type ActionHandler func(action ActionRequest, api *APIClient) error
type ActionRequest ¶
type AppRequest ¶
type AppRequest struct {
Source Source `json:"source"`
}
type BBoltStore ¶
type BBoltStore struct {
// contains filtered or unexported fields
}
func NewBBoltStore ¶
func NewBBoltStore(path string) (*BBoltStore, error)
func (*BBoltStore) Close ¶
func (s *BBoltStore) Close()
func (*BBoltStore) Delete ¶
func (s *BBoltStore) Delete(shopID string) error
func (*BBoltStore) Get ¶
func (s *BBoltStore) Get(shopID string) (*Credentials, error)
func (*BBoltStore) Store ¶
func (s *BBoltStore) Store(credentials *Credentials) error
type CredentialStore ¶
type CredentialStore interface { Store(credentials *Credentials) error Get(shopID string) (*Credentials, error) Delete(shopID string) error }
func NewMemoryCredentialStore ¶
func NewMemoryCredentialStore() CredentialStore
type Credentials ¶
type ErrActionHandlerNotFound ¶
type ErrActionHandlerNotFound struct {
// contains filtered or unexported fields
}
func (ErrActionHandlerNotFound) Error ¶
func (e ErrActionHandlerNotFound) Error() string
type ErrWebhookHandlerNotFound ¶
type ErrWebhookHandlerNotFound struct {
// contains filtered or unexported fields
}
func (ErrWebhookHandlerNotFound) Error ¶
func (e ErrWebhookHandlerNotFound) Error() string
type MemoryCredentialStore ¶
type MemoryCredentialStore struct {
// contains filtered or unexported fields
}
func (*MemoryCredentialStore) Delete ¶
func (m *MemoryCredentialStore) Delete(shopID string) error
func (*MemoryCredentialStore) Get ¶
func (m *MemoryCredentialStore) Get(shopID string) (*Credentials, error)
func (*MemoryCredentialStore) Store ¶
func (m *MemoryCredentialStore) Store(credentials *Credentials) error
type RegistrationResponse ¶
type Search ¶
type Search struct { Includes map[string][]string `json:"includes,omitempty"` Page int64 `json:"page,omitempty"` Limit int64 `json:"limit,omitempty"` IDs []string `json:"ids,omitempty"` Filter []SearchFilter `json:"filter,omitempty"` PostFilter []SearchFilter `json:"postFilter,omitempty"` Sort []SearchSort `json:"sort,omitempty"` Term string `json:"term,omitempty"` TotalCountMode int `json:"totalCountMode,omitempty"` }
type SearchFilter ¶
type SearchResponse ¶
type SearchResponse struct { Total int64 `json:"total"` Data interface{} `json:"data"` Aggregations interface{} `json:"aggregations"` }
type SearchSort ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) Action ¶
func (srv *Server) Action(entity string, action string, handler ActionHandler)
func (*Server) Event ¶
func (srv *Server) Event(event string, handler WebhookHandler)
func (Server) HandleRegistration ¶
func (srv Server) HandleRegistration(req *http.Request) (RegistrationResponse, error)
type ServerOpt ¶
type ServerOpt func(s *Server)
func WithCredentialStore ¶
func WithCredentialStore(store CredentialStore) ServerOpt
type SignatureVerificationError ¶
type SignatureVerificationError struct {
// contains filtered or unexported fields
}
func (SignatureVerificationError) Error ¶
func (e SignatureVerificationError) Error() string
func (SignatureVerificationError) Unwrap ¶
func (e SignatureVerificationError) Unwrap() error
type WebhookHandler ¶
type WebhookHandler func(webhook WebhookRequest, api *APIClient) error
type WebhookRequest ¶
type WebhookRequest struct { *AppRequest Data struct { Payload []map[string]interface{} `json:"payload"` Event string `json:"event"` } `json:"data"` }
Click to show internal directories.
Click to hide internal directories.