graphbrainz/src/queries/browse.js

121 lines
2.9 KiB
JavaScript
Raw Normal View History

2016-08-20 05:59:32 +00:00
import { GraphQLObjectType, GraphQLInt } from 'graphql'
import {
MBID,
URLString,
2016-09-01 04:31:48 +00:00
ArtistConnection,
EventConnection,
LabelConnection,
PlaceConnection,
RecordingConnection,
ReleaseConnection,
ReleaseGroupConnection,
URLConnection,
WorkConnection
2016-08-20 05:59:32 +00:00
} from '../types'
import { browseResolver } from '../resolvers'
export default new GraphQLObjectType({
name: 'BrowseQuery',
description:
'Browse requests are a direct lookup of all the entities directly linked ' +
'to another entity.',
fields: {
artists: {
2016-09-01 04:31:48 +00:00
type: ArtistConnection,
2016-08-20 05:59:32 +00:00
args: {
limit: { type: GraphQLInt },
offset: { type: GraphQLInt },
area: { type: MBID },
recording: { type: MBID },
release: { type: MBID },
releaseGroup: { type: MBID },
work: { type: MBID }
},
resolve: browseResolver()
},
events: {
2016-09-01 04:31:48 +00:00
type: EventConnection,
2016-08-20 05:59:32 +00:00
args: {
limit: { type: GraphQLInt },
offset: { type: GraphQLInt },
area: { type: MBID },
artist: { type: MBID },
place: { type: MBID }
},
resolve: browseResolver()
},
labels: {
2016-09-01 04:31:48 +00:00
type: LabelConnection,
2016-08-20 05:59:32 +00:00
args: {
limit: { type: GraphQLInt },
offset: { type: GraphQLInt },
area: { type: MBID },
release: { type: MBID }
},
resolve: browseResolver()
},
places: {
2016-09-01 04:31:48 +00:00
type: PlaceConnection,
2016-08-20 05:59:32 +00:00
args: {
limit: { type: GraphQLInt },
offset: { type: GraphQLInt },
area: { type: MBID }
},
resolve: browseResolver()
},
recordings: {
2016-09-01 04:31:48 +00:00
type: RecordingConnection,
2016-08-20 05:59:32 +00:00
args: {
limit: { type: GraphQLInt },
offset: { type: GraphQLInt },
artist: { type: MBID },
release: { type: MBID }
},
resolve: browseResolver()
},
releases: {
2016-09-01 04:31:48 +00:00
type: ReleaseConnection,
2016-08-20 05:59:32 +00:00
args: {
limit: { type: GraphQLInt },
offset: { type: GraphQLInt },
area: { type: MBID },
artist: { type: MBID },
label: { type: MBID },
track: { type: MBID },
trackArtist: { type: MBID },
recording: { type: MBID },
releaseGroup: { type: MBID }
},
resolve: browseResolver()
},
releaseGroups: {
2016-09-01 04:31:48 +00:00
type: ReleaseGroupConnection,
2016-08-20 05:59:32 +00:00
args: {
limit: { type: GraphQLInt },
offset: { type: GraphQLInt },
artist: { type: MBID },
release: { type: MBID }
},
resolve: browseResolver()
},
works: {
2016-09-01 04:31:48 +00:00
type: WorkConnection,
2016-08-20 05:59:32 +00:00
args: {
limit: { type: GraphQLInt },
offset: { type: GraphQLInt },
artist: { type: MBID }
},
resolve: browseResolver()
},
urls: {
2016-09-01 04:31:48 +00:00
type: URLConnection,
2016-08-20 05:59:32 +00:00
args: {
limit: { type: GraphQLInt },
offset: { type: GraphQLInt },
resource: { type: URLString }
},
resolve: browseResolver()
}
}
})