https://github.com/labd/apollostudio-go-sdk
https://github.com/labd/apollostudio-go-sdk
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/labd/apollostudio-go-sdk
- Owner: labd
- License: mit
- Created: 2022-11-09T10:42:51.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-01T05:00:36.000Z (over 1 year ago)
- Last Synced: 2024-12-31T19:29:49.852Z (over 1 year ago)
- Language: Go
- Size: 66.4 KB
- Stars: 0
- Watchers: 6
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Apollo Studio Go SDK
Go SDK for [Apollo Studio](https://studio.apollographql.com/).
## Installation
```bash
go get github.com/labd/apollostudio-go-sdk
```
## Usage
```go
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.
```go
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...)
```
## Contributing
Apollo Studio GraphQL explorer can be found [here](https://studio.apollographql.com/public/apollo-platform/variant/main/explorer).