Go SDK for Apollo Studio.
go get github.com/labd/apollostudio-go-sdk
package main
import (
"context"
"github.com/labd/apollostudio-go-sdk/apollostudio"
)
func main() {
key := "your-api-key"
ref := "your-schema-reference"
client, err := apollostudio.NewClient(key, ref)
if err != nil {
panic(err)
}
_, _ := client.SubmitSubGraph(
context.Background(),
&apollostudio.SubmitOptions{
SubGraphSchema: []byte("schema { query: Query } type Query { hello: String }"),
SubGraphName: "my-subgraph",
SubGraphURL: "https://my-subgraph.com/graphql",
},
)
}
The client allows for several additional options to be set, which can extend its functionality.
var clientOpts = []apollostudio.ClientOpt{
apollostudio.WithHttpClient(http.DefaultClient),
apollostudio.WithDebug(true),
apollostudio.WithUrl("https://studio.apollographql.com/api/graphql"),
}
client, err := apollostudio.NewClient(key, ref, clientOpts...)
Apollo Studio GraphQL explorer can be found here.