Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var API string
View Source
var NHOST_AUTH_URL string
View Source
var NHOST_GRAPHQL_URL string
URLs
View Source
var ResponseCodeMap = map[ErrorType]int{ ErrorTypeJSONMarshal: http.StatusBadRequest, ErrorTypeJSONUnmarshal: http.StatusBadRequest, ErrorTypeJWTExpired: http.StatusUnauthorized, ErrorTypeUnauthorized: http.StatusUnauthorized, ErrorTypeMalformedHeader: 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" 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" ErrorSourceNhost ErrorSource = "nhost" ErrorSourceGo ErrorSource = "go" ErrorSourceSystem ErrorSource = "system" )
type ErrorType ¶
type ErrorType string
const ( ErrorTypeBase64Encode ErrorType = "Base64Encode" ErrorTypeBase64Decode ErrorType = "Base64Decode" ErrorTypeJSONMarshal ErrorType = "JSONMarshal" ErrorTypeJSONUnmarshal ErrorType = "JSONUnmarshal" ErrorTypeJWTExpired ErrorType = "JWTExpired" ErrorTypeMalformedHeader ErrorType = "Malformed Authorization header" 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 ¶
func NewGQLClient ¶
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 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" )
type LoginResponse ¶
type LoginResponse struct { MFA struct { Ticket string `json:"ticket"` } `json:"mfa"` Session NhostSession `json:"session"` }
type NhostClient ¶
type NhostClient struct { *clients.NhostClient // 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 ¶
Click to show internal directories.
Click to hide internal directories.