Promotion | Felder in GraphQL
Hier findest du eine Anleitung um deine im Promotion Schema definierten Felder im GraphQL Query abzubilden und über die API auszuspielen.
Hier findest du eine Anleitung um deine im Promotion Schema definierten Felder im GraphQL Query abzubilden und über die API auszuspielen.
BasisQuery
Ein Query beginnt immer mit dem Schlüsselwort query, gefolgt von einer frei definierten Operation, in unserem Fall “getEventPromotionsWebsite”. Diese wird in der API als Parameter “operationName” übergeben.
Das gewünschte Schema wird über den channelslug definiert, in unserem Fall “dreigroschen.com”
query getEventPromotionsWebsite($cursor: Cursor) {
campaigns(channelSlug: "dreigroschen.com", scope: event, cursor: $cursor) {
next
edges {
node {
....

Felddefinitionen
Jedes Feld im Promotion Schema wird über einen eindeutigen Key und einen Typ definiert.
Diese werden im GraphQL Schema angegeben.

Für eine bessere Strukturierung werden alle Typen als Fragmente definiert, die man dann in GraphQL einbinden kann.
Label
Einzeiliger Bezeichner, z.B. Titel
fragment Label on ContentField {
value {
... on PromotionValueLabel {
label
}
}
}
Text (unformatiert)
Mehrzeiliger unformatierter Text
fragment Text on ContentField {
value {
... on PromotionValueText {
text
}
}
}
Richtext = Formatierter Text
fragment RichText on ContentField {
value {
... on PromotionValueRichText {
html
}
}
}
Datum und Uhrzeit = Datetime
Einzeiliger Bezeichner, z.B. Titel
fragment DateTime on ContentField {
value {
... on PromotionValueDateTime {
dateTimeISO
}
}
}
Status
fragment Status on ContentField {
value {
... on PromotionValueStatus {
status
}
}
}
Link
fragment Link on ContentField {
value {
... on PromotionValueLink {
href
}
}
}
Image = Bild
fragment Image on ContentField {
value {
... on PromotionValueImage {
file {
image1920: image(width: 1920 quality: 80) {
href
}
publicUrl
}
alt
credits
}
}
}
Line-up
Künstler & Show
fragment LineUp on ContentField {
value {
... on PromotionValueList {
items {
...Artist
...Program
}
}
}
}
Künstler = Artist
fragment Artist on PromotionValueLineUpItem {
... on PromotionValueLineUpItem {
content {
artist: field(key: "artist") {
value {
... on PromotionValueLabel {
label
}
}
}
beschreibung: field(key: "description") {
...RichText
}
image: field(key: "image") {
...Image
}
}
}
}
Programm
fragment Program on PromotionValueLineUpItem {
... on PromotionValueLineUpItem {
content {
program: field(key: "program") {
value {
__typename
... on PromotionValueLabel {
label
}
}
}
}
}
}
List
Liste von Texten, Labels, Links
fragment List on ContentField {
value {
...on PromotionValueList {
items {
... on PromotionValueLink {
href
text
}
}
}
}
}
Liste von Bildern
fragment ImageList on ContentField {
value {
...on PromotionValueList {
items {
... ImageItem
}
}
}
}
fragment ImageItem on PromotionValueImage {
file {
image1920: image(width: 1920, quality: 80) {
href
}
publicUrl
}
alt
credits
}
Venue
Spielort mit Raum und Anschrift
fragment Venue on ContentField {
value {
... on PromotionValueList {
items {
... on PromotionValueVenue {
room {
name
location {
name
addresses {
edges {
node {
street
zip
city
}
}
}
}
}
}
}
}
}
}
Kontakt
fragment Contact on ContentField {
value {
... on PromotionValueContact {
contact {
... on OrganizationContact {
name
promotion {
logo: field(key: "logo") {
value {
... on PromotionValueImage {
file {
publicUrl
}
}
}
}
homepage: field(key: "homepage") {
value {
... on PromotionValueLink {
href
}
}
}
}
}
}
}
}
}