playground

package
v0.17.54 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AltairHandler

func AltairHandler(title, endpoint string) http.HandlerFunc

AltairHandler responsible for setting up the altair playground

func ApolloSandboxHandler

func ApolloSandboxHandler(title, endpoint string, opts ...ApolloSandboxOption) http.HandlerFunc

ApolloSandboxHandler responsible for setting up the apollo sandbox playground

func Handler

func Handler(title string, endpoint string) http.HandlerFunc

Handler responsible for setting up the playground

func HandlerWithHeaders

func HandlerWithHeaders(title string, endpoint string, fetcherHeaders map[string]string, uiHeaders map[string]string) http.HandlerFunc

HandlerWithHeaders sets up the playground. fetcherHeaders are used by the playground's fetcher instance and will not be visible in the UI. uiHeaders are default headers that will show up in the UI headers editor.

Types

type ApolloSandboxOption

type ApolloSandboxOption func(options *apolloSandboxOptions)

func WithApolloSandboxEndpointIsEditable

func WithApolloSandboxEndpointIsEditable(endpointIsEditable bool) ApolloSandboxOption

WithApolloSandboxEndpointIsEditable By default, the embedded Sandbox has a URL input box that is editable by users.

Set endpointIsEditable to false to prevent users of your embedded Sandbox instance from changing the endpoint URL.

func WithApolloSandboxHideCookieToggle

func WithApolloSandboxHideCookieToggle(hideCookieToggle bool) ApolloSandboxOption

WithApolloSandboxHideCookieToggle By default, the embedded Sandbox does not show the Include cookies toggle in its connection settings.

Set hideCookieToggle to false to enable users of your embedded Sandbox instance to toggle the Include cookies setting.

func WithApolloSandboxInitialStateCollectionIdAndOperationId

func WithApolloSandboxInitialStateCollectionIdAndOperationId(collectionId, operationId string) ApolloSandboxOption

WithApolloSandboxInitialStateCollectionIdAndOperationId The ID of a collection, paired with an operation ID to populate in the Sandbox on load.

You can find these values from a registered graph in Studio by clicking the ... menu next to an operation in the Explorer of that graph and selecting View operation details.

func WithApolloSandboxInitialStateDocument

func WithApolloSandboxInitialStateDocument(document string) ApolloSandboxOption

WithApolloSandboxInitialStateDocument Document operation to populate in the Sandbox's editor on load.

If you omit this, the Sandbox initially loads an example query based on your schema.

func WithApolloSandboxInitialStateHeaders

func WithApolloSandboxInitialStateHeaders(headers map[string]any) ApolloSandboxOption

WithApolloSandboxInitialStateHeaders Headers containing initial variable values to populate in the Sandbox on load.

If provided, these variables should apply to the initial query you provide for document.

func WithApolloSandboxInitialStateIncludeCookies

func WithApolloSandboxInitialStateIncludeCookies(includeCookies bool) ApolloSandboxOption

WithApolloSandboxInitialStateIncludeCookies Set this value to true if you want the Sandbox to pass { credentials: 'include' } for its requests by default.

If you set hideCookieToggle to false, users can override this default setting with the Include cookies toggle. (By default, the embedded Sandbox does not show the Include cookies toggle in its connection settings.)

If you also pass the handleRequest option, this option is ignored.

Read more about the fetch API and credentials here https://developer.mozilla.org/en-US/docs/Web/API/fetch#credentials

func WithApolloSandboxInitialStatePollForSchemaUpdates

func WithApolloSandboxInitialStatePollForSchemaUpdates(pollForSchemaUpdates bool) ApolloSandboxOption

WithApolloSandboxInitialStatePollForSchemaUpdates If true, the embedded Sandbox periodically polls your initialEndpoint for schema updates.

The default value is false.

func WithApolloSandboxInitialStateSharedHeaders

func WithApolloSandboxInitialStateSharedHeaders(sharedHeaders map[string]any) ApolloSandboxOption

WithApolloSandboxInitialStateSharedHeaders Headers that are applied by default to every operation executed by the embedded Sandbox.

Users can disable the application of these headers, but they can't modify their values.

The embedded Sandbox always includes these headers in its introspection queries to your initialEndpoint.

func WithApolloSandboxInitialStateVariables

func WithApolloSandboxInitialStateVariables(variables map[string]any) ApolloSandboxOption

WithApolloSandboxInitialStateVariables Variables containing initial variable values to populate in the Sandbox on load.

If provided, these variables should apply to the initial query you provide for document.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL