Documentation ¶
Overview ¶
Package graphapi is the graph api package
Index ¶
- Constants
- Variables
- func AddAllExtensions(h *handler.Server)
- func WithContextLevelCache(h *handler.Server)
- func WithFileUploader(h *handler.Server, u *objects.Objects)
- func WithSkipCache(h *handler.Server)
- func WithTransactions(h *handler.Server, d *ent.Client)
- type AlreadyExistsError
- type Auth
- type ForeignKeyError
- type Handler
- type NotFoundError
- type Resolver
- func (r *Resolver) CreateEntityInput() gqlgenerated.CreateEntityInputResolver
- func (r *Resolver) CreateGroupInput() gqlgenerated.CreateGroupInputResolver
- func (r *Resolver) CreateOrganizationInput() gqlgenerated.CreateOrganizationInputResolver
- func (r *Resolver) Handler(withPlayground bool) *Handler
- func (r *Resolver) Mutation() generated1.MutationResolver
- func (r *Resolver) Query() gqlgenerated.QueryResolver
- func (r *Resolver) UpdateEntityInput() gqlgenerated.UpdateEntityInputResolver
- func (r *Resolver) UpdateGroupInput() gqlgenerated.UpdateGroupInputResolver
- func (r *Resolver) UpdateOrganizationInput() gqlgenerated.UpdateOrganizationInputResolver
- func (r *Resolver) UpdateProgramInput() gqlgenerated.UpdateProgramInputResolver
- func (r *Resolver) UpdateTFASettingInput() gqlgenerated.UpdateTFASettingInputResolver
- func (r Resolver) WithExtensions(enabled bool) *Resolver
- func (r *Resolver) WithPool(maxWorkers int, options ...pond.Option)
Constants ¶
const ( // AuthExtensionKey is the key used to store the auth data in the extensions map AuthExtensionKey = "auth" // ServerLatencyExtensionKey is the key used to store the server latency in the extensions map ServerLatencyExtensionKey = "server_latency" // TraceExtensionKey is the key used to store the trace id in the extensions map TraceExtensionKey = "trace_id" )
const ( ActionGet = "get" ActionUpdate = "update" ActionDelete = "delete" ActionCreate = "create" )
Variables ¶
var ( // ErrInternalServerError is returned when an internal error occurs. ErrInternalServerError = errors.New("internal server error") // ErrCascadeDelete is returned when an error occurs while performing cascade deletes on associated objects ErrCascadeDelete = errors.New("error deleting associated objects") // ErrSearchFailed is returned when the search operation fails ErrSearchFailed = errors.New("search failed, please try again") // ErrSearchQueryTooShort is returned when the search query is too short ErrSearchQueryTooShort = errors.New("search query is too short, please enter a longer search query") // ErrNoOrganizationID is returned when the organization ID is not provided ErrNoOrganizationID = errors.New("unable to determine organization ID in request") // ErrUnableToDetermineObjectType is returned when the object type up the parent upload object cannot be determined ErrUnableToDetermineObjectType = errors.New("unable to determine parent object type") )
Functions ¶
func AddAllExtensions ¶
AddAllExtensions adds all the extensions to the server including auth, latency and trace
func WithContextLevelCache ¶
WithContextLevelCache adds a context level cache to the handler
func WithFileUploader ¶ added in v0.3.0
WithFileUploader adds the file uploader to the graphql handler this will handle the file upload process for the multipart form
func WithSkipCache ¶
WithSkipCache adds a skip cache middleware to the handler This is useful for testing, where you don't want to cache responses so you can see the changes immediately
Types ¶
type AlreadyExistsError ¶
type AlreadyExistsError struct {
ObjectType string
}
AlreadyExistsError is returned when an object already exists
func (*AlreadyExistsError) Error ¶
func (e *AlreadyExistsError) Error() string
Error returns the AlreadyExistsError in string format
type Auth ¶
type Auth struct { // AuthenticationType is the type of authentication used, e.g. JWT, API key, etc. AuthenticationType auth.AuthenticationType `json:"authentication_type,omitempty"` // AuthorizedOrganization is the organization ID of the authenticated user AuthorizedOrganization string `json:"authorized_organization,omitempty"` // AccessToken is the access token used for authentication, if the user did an action (e.g. created a new organization) // that updated the access token, this will be the new access token AccessToken string `json:"access_token,omitempty"` // RefreshToken is the refresh token used for authentication, if the user did an action (e.g. created a new organization) // that updated the refresh token, this will be the new refresh token RefreshToken string `json:"refresh_token,omitempty"` // SessionID is the session token used for authentication SessionID string `json:"session_id,omitempty"` }
Auth contains the authentication data to be added to the extensions map
type ForeignKeyError ¶
ForeignKeyError is returned when an object does not exist in the related table
func (*ForeignKeyError) Error ¶
func (e *ForeignKeyError) Error() string
Error returns the ForeignKeyError in string format
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is an http handler wrapping a Resolver
func (*Handler) Handler ¶
func (h *Handler) Handler() http.HandlerFunc
Handler returns the http.HandlerFunc for the GraphAPI
type NotFoundError ¶ added in v0.4.0
type NotFoundError struct {
ObjectType string
}
NotFoundError is returned when the requested object is not found
func (*NotFoundError) Error ¶ added in v0.4.0
func (e *NotFoundError) Error() string
Error returns the NotFoundError in string format
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver provides a graph response resolver
func NewResolver ¶
NewResolver returns a resolver configured with the given ent client
func (*Resolver) CreateEntityInput ¶
func (r *Resolver) CreateEntityInput() gqlgenerated.CreateEntityInputResolver
CreateEntityInput returns gqlgenerated.CreateEntityInputResolver implementation.
func (*Resolver) CreateGroupInput ¶
func (r *Resolver) CreateGroupInput() gqlgenerated.CreateGroupInputResolver
CreateGroupInput returns gqlgenerated.CreateGroupInputResolver implementation.
func (*Resolver) CreateOrganizationInput ¶
func (r *Resolver) CreateOrganizationInput() gqlgenerated.CreateOrganizationInputResolver
CreateOrganizationInput returns gqlgenerated.CreateOrganizationInputResolver implementation.
func (*Resolver) Mutation ¶
func (r *Resolver) Mutation() generated1.MutationResolver
Mutation returns generated1.MutationResolver implementation.
func (*Resolver) Query ¶
func (r *Resolver) Query() gqlgenerated.QueryResolver
Query returns gqlgenerated.QueryResolver implementation.
func (*Resolver) UpdateEntityInput ¶
func (r *Resolver) UpdateEntityInput() gqlgenerated.UpdateEntityInputResolver
UpdateEntityInput returns gqlgenerated.UpdateEntityInputResolver implementation.
func (*Resolver) UpdateGroupInput ¶
func (r *Resolver) UpdateGroupInput() gqlgenerated.UpdateGroupInputResolver
UpdateGroupInput returns gqlgenerated.UpdateGroupInputResolver implementation.
func (*Resolver) UpdateOrganizationInput ¶
func (r *Resolver) UpdateOrganizationInput() gqlgenerated.UpdateOrganizationInputResolver
UpdateOrganizationInput returns gqlgenerated.UpdateOrganizationInputResolver implementation.
func (*Resolver) UpdateProgramInput ¶ added in v0.4.3
func (r *Resolver) UpdateProgramInput() gqlgenerated.UpdateProgramInputResolver
UpdateProgramInput returns gqlgenerated.UpdateProgramInputResolver implementation.
func (*Resolver) UpdateTFASettingInput ¶
func (r *Resolver) UpdateTFASettingInput() gqlgenerated.UpdateTFASettingInputResolver
UpdateTFASettingInput returns gqlgenerated.UpdateTFASettingInputResolver implementation.
func (Resolver) WithExtensions ¶
Source Files ¶
- actionplan.resolvers.go
- adminsearch.resolvers.go
- apitoken.resolvers.go
- audit.resolvers.go
- bulk.go
- contact.resolvers.go
- control.resolvers.go
- controlobjective.resolvers.go
- doc.go
- documentdata.resolvers.go
- ent.resolvers.go
- entity.resolvers.go
- entityextended.resolvers.go
- entitytype.resolvers.go
- errors.go
- event.resolvers.go
- extensions.go
- file.resolvers.go
- group.resolvers.go
- groupextended.resolvers.go
- groupmembership.resolvers.go
- groupsetting.resolvers.go
- helpers.go
- hush.resolvers.go
- integration.resolvers.go
- internalpolicy.resolvers.go
- invite.resolvers.go
- narrative.resolvers.go
- organization.resolvers.go
- organizationsetting.resolvers.go
- orgextended.resolvers.go
- orgmembership.resolvers.go
- orgsubscription.resolvers.go
- personalaccesstoken.resolvers.go
- procedure.resolvers.go
- program.resolvers.go
- programextended.resolvers.go
- programmembership.resolvers.go
- resolver.go
- risk.resolvers.go
- search.go
- search.resolvers.go
- standard.resolvers.go
- subcontrol.resolvers.go
- subscriber.resolvers.go
- task.resolvers.go
- template.resolvers.go
- tfasetting.resolvers.go
- user.resolvers.go
- usersetting.resolvers.go