2019-03-05 10:38:21 +00:00
|
|
|
// Copyright (C) 2018 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package bootstrapql
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/graphql-go/graphql"
|
|
|
|
|
|
|
|
"storj.io/storj/bootstrap/bootstrapweb"
|
|
|
|
)
|
|
|
|
|
|
|
|
// CreateSchema creates a schema for bootstrap graphql api
|
|
|
|
func CreateSchema(service *bootstrapweb.Service) (schema graphql.Schema, err error) {
|
2019-04-04 15:56:20 +01:00
|
|
|
creator := TypeCreator{}
|
2019-03-05 10:38:21 +00:00
|
|
|
|
2019-04-04 15:56:20 +01:00
|
|
|
err = creator.Create(service)
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
2019-03-05 10:38:21 +00:00
|
|
|
|
2019-04-04 15:56:20 +01:00
|
|
|
return graphql.NewSchema(graphql.SchemaConfig{
|
|
|
|
Query: creator.RootQuery(),
|
2019-03-05 10:38:21 +00:00
|
|
|
})
|
|
|
|
}
|