graphbrainz/src/types/url.js

28 lines
859 B
JavaScript
Raw Normal View History

2016-08-20 05:59:32 +00:00
import { GraphQLObjectType, GraphQLNonNull } from 'graphql/type'
2016-08-31 06:33:29 +00:00
import { connectionDefinitions } from 'graphql-relay'
import Node from './node'
2016-08-20 05:59:32 +00:00
import Entity from './entity'
import { URLString } from './scalars'
2016-11-26 01:38:32 +00:00
import { id, mbid, relationships } from './helpers'
2016-08-20 05:59:32 +00:00
const URL = new GraphQLObjectType({
name: 'URL',
2016-11-26 01:38:32 +00:00
description: `A [URL](https://musicbrainz.org/doc/URL) pointing to a resource
external to MusicBrainz, i.e. an official homepage, a site where music can be
acquired, an entry in another database, etc.`,
2016-08-31 06:33:29 +00:00
interfaces: () => [Node, Entity],
2016-08-20 05:59:32 +00:00
fields: () => ({
id,
2016-08-31 06:33:29 +00:00
mbid,
2016-11-26 01:38:32 +00:00
resource: {
type: new GraphQLNonNull(URLString),
description: 'The actual URL string.'
},
relationships
2016-08-20 05:59:32 +00:00
})
})
2016-08-31 06:33:29 +00:00
const { connectionType: URLConnection } = connectionDefinitions({ nodeType: URL })
export { URLConnection }
2016-08-20 05:59:32 +00:00
export default URL