playground

package
v0.17.86 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: MIT Imports: 5 Imported by: 3,179

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AltairHandler added in v0.17.23

func AltairHandler(title, endpoint string, options map[string]any) http.HandlerFunc

AltairHandler responsible for setting up the altair playground

func ApolloSandboxHandler added in v0.17.27

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

ApolloSandboxHandler responsible for setting up the apollo sandbox playground

func Handler

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

Handler responsible for setting up the playground

func HandlerWithHeaders added in v0.17.37

func HandlerWithHeaders(
	title, endpoint string,
	fetcherHeaders, 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 added in v0.17.41

type ApolloSandboxOption func(options *apolloSandboxHandlerOptions)

func WithApolloSandboxEndpointIsEditable added in v0.17.41

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 added in v0.17.41

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 added in v0.17.41

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 added in v0.17.41

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 added in v0.17.41

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 added in v0.17.41

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 added in v0.17.41

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 added in v0.17.41

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 added in v0.17.41

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.

func WithApolloSandboxJs added in v0.17.82

func WithApolloSandboxJs(mainJs, mainSri string) ApolloSandboxOption

WithApolloSandboxJs The main javascript resource and its subresource integrity checksum

You can change the version of apollo sandbox.

type GraphiqlConfig added in v0.17.67

type GraphiqlConfig struct {
	Title                string
	StoragePrefix        string
	Endpoint             string
	FetcherHeaders       map[string]string
	UiHeaders            map[string]string
	EndpointIsAbsolute   bool
	SubscriptionEndpoint string
	JsUrl                template.URL
	JsSRI                string
	CssUrl               template.URL
	CssSRI               string
	ReactUrl             template.URL
	ReactSRI             string
	ReactDOMUrl          template.URL
	ReactDOMSRI          string
	EnablePluginExplorer bool
	PluginExplorerJsUrl  template.URL
	PluginExplorerJsSRI  string
	PluginExplorerCssUrl template.URL
	PluginExplorerCssSRI string
}

type GraphiqlConfigOption added in v0.17.67

type GraphiqlConfigOption func(*GraphiqlConfig)

func WithGraphiqlEnablePluginExplorer added in v0.17.69

func WithGraphiqlEnablePluginExplorer(enable bool) GraphiqlConfigOption

func WithGraphiqlFetcherHeaders added in v0.17.67

func WithGraphiqlFetcherHeaders(headers map[string]string) GraphiqlConfigOption

func WithGraphiqlPluginExplorerVersion added in v0.17.82

func WithGraphiqlPluginExplorerVersion(jsUrl, cssUrl, jsSri, cssSri string) GraphiqlConfigOption

func WithGraphiqlReactVersion added in v0.17.82

func WithGraphiqlReactVersion(
	reactJsUrl, reactDomJsUrl, reactJsSri, reactDomJsSri string,
) GraphiqlConfigOption

func WithGraphiqlUiHeaders added in v0.17.67

func WithGraphiqlUiHeaders(headers map[string]string) GraphiqlConfigOption

func WithGraphiqlVersion added in v0.17.82

func WithGraphiqlVersion(jsUrl, cssUrl, jsSri, cssSri string) GraphiqlConfigOption

func WithStoragePrefix added in v0.17.67

func WithStoragePrefix(prefix string) GraphiqlConfigOption

Jump to

Keyboard shortcuts

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