graphbrainz/src/types/artist.js

93 lines
2.6 KiB
JavaScript
Raw Normal View History

2016-12-10 17:51:33 +00:00
import { GraphQLObjectType, GraphQLString, GraphQLList } from 'graphql/type'
2016-08-31 06:33:29 +00:00
import Node from './node'
2016-08-20 05:59:32 +00:00
import Entity from './entity'
import Area from './area'
2016-12-10 17:51:33 +00:00
import { IPI, ISNI } from './scalars'
2016-08-08 07:54:06 +00:00
import {
resolveWithFallback,
2016-08-20 05:59:32 +00:00
fieldWithID,
id,
2016-08-31 06:33:29 +00:00
mbid,
2016-08-20 05:59:32 +00:00
name,
sortName,
disambiguation,
aliases,
2016-08-20 05:59:32 +00:00
lifeSpan,
recordings,
releases,
releaseGroups,
works,
relationships,
collections,
tags,
2016-11-28 14:43:32 +00:00
connectionWithExtras
2016-08-20 05:59:32 +00:00
} from './helpers'
2016-08-08 07:54:06 +00:00
2016-08-20 05:59:32 +00:00
const Artist = new GraphQLObjectType({
2016-08-08 07:54:06 +00:00
name: 'Artist',
2016-11-26 01:38:32 +00:00
description: `An [artist](https://musicbrainz.org/doc/Artist) is generally a
musician, group of musicians, or other music professional (like a producer or
engineer). Occasionally, it can also be a non-musical person (like a
photographer, an illustrator, or a poet whose writings are set to music), or
even a fictional character.`,
2016-08-31 06:33:29 +00:00
interfaces: () => [Node, Entity],
2016-08-08 07:54:06 +00:00
fields: () => ({
2016-08-20 05:59:32 +00:00
id,
2016-08-31 06:33:29 +00:00
mbid,
2016-08-20 05:59:32 +00:00
name,
sortName,
disambiguation,
aliases,
2016-11-26 01:38:32 +00:00
country: {
type: GraphQLString,
description: `The country with which an artist is primarily identified. It
is often, but not always, its birth/formation country.`
},
area: {
type: Area,
description: `The area with which an artist is primarily identified. It
is often, but not always, its birth/formation country.`
},
2016-08-20 05:59:32 +00:00
beginArea: {
type: Area,
2016-11-26 01:38:32 +00:00
description: `The area in which an artist began their career (or where
2016-12-14 04:05:35 +00:00
they were born, if the artist is a person).`,
resolve: resolveWithFallback(['begin-area', 'begin_area'])
2016-08-20 05:59:32 +00:00
},
endArea: {
type: Area,
2016-11-26 01:38:32 +00:00
description: `The area in which an artist ended their career (or where
they died, if the artist is a person).`,
resolve: resolveWithFallback(['end-area', 'end_area'])
2016-08-20 05:59:32 +00:00
},
lifeSpan,
2016-11-26 01:38:32 +00:00
...fieldWithID('gender', {
description: `Whether a person or character identifies as male, female, or
neither. Groups do not have genders.`
}),
...fieldWithID('type', {
description: 'Whether an artist is a person, a group, or something else.'
}),
2016-12-10 17:51:33 +00:00
ipis: {
type: new GraphQLList(IPI),
description: `List of [Interested Parties Information](https://musicbrainz.org/doc/IPI)
(IPI) codes for the artist.`
},
isnis: {
type: new GraphQLList(ISNI),
description: `List of [International Standard Name Identifier](https://musicbrainz.org/doc/ISNI)
(ISNI) codes for the artist.`
},
2016-08-20 05:59:32 +00:00
recordings,
releases,
releaseGroups,
works,
relationships,
collections,
tags
2016-08-08 07:54:06 +00:00
})
})
2016-08-20 05:59:32 +00:00
2016-11-28 14:43:32 +00:00
export const ArtistConnection = connectionWithExtras(Artist)
2016-08-20 05:59:32 +00:00
export default Artist