Documentation ¶
Index ¶
- Constants
- Variables
- type APIClient
- type ActionHandler
- type ActionHandlerNotFoundError
- type ActionRequest
- type AppRequest
- type CredentialStore
- type Credentials
- 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
- func (srv *Server) VerifyPageSignature(req *http.Request) error
- type ServerOpt
- type SignatureVerificationError
- type Source
- type WebhookHandler
- type WebhookHandlerNotFoundError
- type WebhookRequest
Constants ¶
View Source
const ( TotalCountModeDefault = 0 TotalCountModeExact = 1 TotalCountModeNextPage = 2 SearchFilterTypeEquals = "equals" SearchFilterTypeEqualsAny = "equalsAny" SearchSortDirectionAscending = "ASC" SearchSortDirectionDescending = "DESC" )
View Source
const ( AppSignatureKey = "shopware-app-signature" ShopSignatureKey = "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(ctx context.Context, action ActionRequest, api *APIClient) error
type ActionHandlerNotFoundError ¶
type ActionHandlerNotFoundError struct {
// contains filtered or unexported fields
}
func (ActionHandlerNotFoundError) Error ¶
func (e ActionHandlerNotFoundError) Error() string
type ActionRequest ¶
type AppRequest ¶
type AppRequest struct {
Source Source `json:"source"`
}
type CredentialStore ¶
type Credentials ¶
type MemoryCredentialStore ¶
type MemoryCredentialStore struct {
// contains filtered or unexported fields
}
func NewMemoryCredentialStore ¶
func NewMemoryCredentialStore() *MemoryCredentialStore
func (*MemoryCredentialStore) Delete ¶
func (m *MemoryCredentialStore) Delete(ctx context.Context, shopID string) error
func (*MemoryCredentialStore) Get ¶
func (m *MemoryCredentialStore) Get(ctx context.Context, shopID string) (Credentials, error)
func (*MemoryCredentialStore) Store ¶
func (m *MemoryCredentialStore) Store(ctx context.Context, 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
func WithHTTPClient ¶
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(ctx context.Context, webhook WebhookRequest, api *APIClient) error
type WebhookHandlerNotFoundError ¶
type WebhookHandlerNotFoundError struct {
// contains filtered or unexported fields
}
func (WebhookHandlerNotFoundError) Error ¶
func (e WebhookHandlerNotFoundError) Error() string
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.