playground

package
v0.17.61 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 5 Imported by: 2,600

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) 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) 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 *apolloSandboxOptions)

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.

Jump to

Keyboard shortcuts

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