Documentation ¶
Index ¶
- Variables
- type APIResponse
- type CallType
- type ClientType
- type CustomHeader
- type Error
- type ErrorSource
- type ErrorType
- type GQLClient
- type GQLConfig
- type HTTPClient
- type HTTPConfig
- type HasuraActionRequestPayload
- type HasuraClient
- type HasuraConfig
- type HasuraTriggerPayload
- type Header
- type NhostClient
- type NhostConfig
- type Response
- type Variable
Constants ¶
This section is empty.
Variables ¶
View Source
var ResponseCodeMap = map[ErrorType]int{ ErrorTypeJSONMarshal: http.StatusBadRequest, ErrorTypeJSONUnmarshal: http.StatusBadRequest, ErrorTypeJWTExpired: http.StatusUnauthorized, ErrorTypeUnauthorized: http.StatusUnauthorized, ErrorTypePermissionDenied: http.StatusForbidden, ErrorTypeTokenRefresh: http.StatusConflict, ErrorTypeInvalidResponse: http.StatusInternalServerError, ErrorTypeBadResponse: http.StatusInternalServerError, ErrorTypeBadRequest: http.StatusBadRequest, ErrorTypeBadGateway: http.StatusBadGateway, ErrorTypeRequestFailed: http.StatusBadRequest, ErrorTypeDoesNotExist: http.StatusNotFound, ErrorTypeInvalidKey: http.StatusBadRequest, ErrorTypeKeyNotFound: http.StatusNotFound, ErrorTypeRecordNotFound: http.StatusNotFound, ErrorTypeInvalidAccountConfiguration: http.StatusBadRequest, ErrorTypeInvalidProjectConfiguration: http.StatusBadRequest, ErrorTypeInvalidToken: http.StatusBadRequest, ErrorTypeEmailFailed: http.StatusInternalServerError, }
Functions ¶
This section is empty.
Types ¶
type APIResponse ¶
type ClientType ¶
type ClientType string
const ( HTTPClientType ClientType = "HTTPClient" GithubClientType ClientType = "GithubClient" VercelClientType ClientType = "VercelClient" VaultClientType ClientType = "VaultClient" HasuraClientType ClientType = "HasuraClient" GraphQLClientType ClientType = "GraphQLClient" )
type CustomHeader ¶
type Error ¶
type Error struct { Error error `json:"error"` Message string `json:"message"` Type ErrorType `json:"type"` Source ErrorSource `json:"source"` }
func ParseExternal ¶
func (*Error) GenerateMessage ¶
type ErrorSource ¶
type ErrorSource string
const ( ErrorSourceHTTP ErrorSource = "http" ErrorSourceGraphQL ErrorSource = "graphql" ErrorSourceHermes ErrorSource = "hermes" ErrorSourceMailer ErrorSource = "mailer" ErrorSourceVault ErrorSource = "vault" ErrorSourceNhost ErrorSource = "nhost" ErrorSourceGo ErrorSource = "go" ErrorSourceSystem ErrorSource = "system" ErrorSourceGithub ErrorSource = "github" ErrorSourceVercel ErrorSource = "vercel" )
type ErrorType ¶
type ErrorType string
const ( ErrorTypeBase64Encode ErrorType = "Base64Encode" ErrorTypeBase64Decode ErrorType = "Base64Decode" ErrorTypeJSONMarshal ErrorType = "JSONMarshal" ErrorTypeJSONUnmarshal ErrorType = "JSONUnmarshal" ErrorTypeJWTExpired ErrorType = "JWTExpired" ErrorTypePermissionDenied ErrorType = "PermissionDenied" ErrorTypeTokenRefresh ErrorType = "TokenRefresh" ErrorTypeInvalidResponse ErrorType = "InvalidResponse" ErrorTypeBadResponse ErrorType = "BadResponse" ErrorTypeBadRequest ErrorType = "BadRequest" ErrorTypeBadGateway ErrorType = "BadGateway" ErrorTypeRequestFailed ErrorType = "RequestFailed" ErrorTypeDoesNotExist ErrorType = "DoesNotExist" ErrorTypeInvalidKey ErrorType = "InvalidKey" ErrorTypeKeyNotFound ErrorType = "KeyNotFound" ErrorTypeRecordNotFound ErrorType = "RecordNotFound" ErrorTypeInvalidToken ErrorType = "InvalidToken" ErrorTypeInvalidAccountConfiguration ErrorType = "InvalidAccountConfiguration" ErrorTypeInvalidProjectConfiguration ErrorType = "InvalidProjectConfiguration" ErrorTypeEmailFailed ErrorType = "EmailFailed" )
func (*ErrorType) GetStatusCode ¶
type GQLClient ¶
type GQLClient struct { *graphql.Client BaseURL string Authorization string Headers []Header CustomHeaders []CustomHeader // contains filtered or unexported fields }
func NewGQLClient ¶
type GQLConfig ¶
type GQLConfig struct { Type ClientType BaseURL string Authorization string Headers []Header CustomHeaders []CustomHeader Logger *logrus.Logger }
type HTTPClient ¶
type HTTPClient struct { *http.Client BaseURL string Authorization string CustomHeaders []CustomHeader ResponseHandler func(*http.Response) error Type ClientType // contains filtered or unexported fields }
func NewHTTPClient ¶
func NewHTTPClient(config *HTTPConfig) *HTTPClient
func (*HTTPClient) Run ¶
func (c *HTTPClient) Run(ctx context.ServiceContext, req *http.Request, response interface{}) error
type HTTPConfig ¶
type HTTPConfig struct { Type ClientType BaseURL string Authorization string Headers []Header CustomHeaders []CustomHeader Logger *logrus.Logger ResponseHandler func(*http.Response) error }
type HasuraActionRequestPayload ¶
type HasuraActionRequestPayload struct { Action struct { Name string `json:"name"` } `json:"action"` Input struct { Args interface{} `json:"args"` } `json:"input"` }
type HasuraClient ¶
type HasuraClient struct { *graphql.Client BaseURL string Authorization string Headers []Header CustomHeaders []CustomHeader // contains filtered or unexported fields }
func NewHasuraClient ¶
func NewHasuraClient(config *HasuraConfig) *HasuraClient
func (*HasuraClient) Do ¶
func (c *HasuraClient) Do(ctx context.ServiceContext, req *graphql.Request, resp interface{}) error
type HasuraConfig ¶
type HasuraTriggerPayload ¶
type HasuraTriggerPayload struct {
Event struct {
Data struct {
New interface{} `json:"new"`
Old interface{} `json:"old"`
} `json:"data"`
} `json:"event"`
}
type Header ¶
type Header string
const ( // Standard HTTP headers AuthorizationHeader Header = "Authorization" ContentTypeHeader Header = "Content-Type" TokenHeader Header = "x-envsecrets-token" OrgIDHeader Header = "x-envsecrets-org-id" HasuraWebhookSecret Header = "X-Hasura-Webhook-Secret" // Hasura headers XHasuraAdminSecretHeader Header = "x-hasura-admin-secret" // Github headers AcceptHeader Header = "Accept" VaultTokenHeader Header = "X-Vault-Token" VaultNamespaceHeader Header = "X-Vault-Namespace" )
type NhostClient ¶
type NhostClient struct { *http.Client Authorization string CustomHeaders []CustomHeader ResponseHandler func(*http.Response) error BaseURL string // contains filtered or unexported fields }
func NewNhostClient ¶
func NewNhostClient(config *NhostConfig) *NhostClient
func (*NhostClient) Run ¶
func (c *NhostClient) Run(ctx context.ServiceContext, req *http.Request, response interface{}) error
type NhostConfig ¶
type Variable ¶
type Variable string
const ( // API constants API Variable = "API" // Nhost constants NHOST_ADMIN_SECRET Variable = "NHOST_ADMIN_SECRET" NHOST_JWT_SECRET Variable = "NHOST_JWT_SECRET" NHOST_WEBHOOK_SECRET Variable = "NHOST_WEBHOOK_SECRET" NHOST_AUTH_URL Variable = "NHOST_AUTH_URL" NHOST_STORAGE_URL Variable = "NHOST_STORAGE_URL" NHOST_FUNCTIONS_URL Variable = "NHOST_FUNCTIONS_URL" NHOST_GRAPHQL_URL Variable = "NHOST_GRAPHQL_URL" )
Click to show internal directories.
Click to hide internal directories.