docs(graphql): added every relationship available (#113)

(cherry picked from commit a7b9f326e4)
This commit is contained in:
Kyrch
2025-07-25 02:23:01 -03:00
committed by Maniload
parent cb58190584
commit 522cfec744
2 changed files with 87 additions and 4 deletions
+4 -2
View File
@@ -65,8 +65,10 @@ query {
data {
name
animethemes(type: OP) {
type
sequence
data {
type
sequence
}
}
}
}
+83 -2
View File
@@ -8,9 +8,45 @@ title: Relationships
The AnimeThemes API implements relationships for most types, previously known as allowed included in the REST API.
// TODO: Waiting API refactor: pagination everywhere.
The many-to-many, one-to-many and polymorphic one-to-many relationships apply pagination.
## Many-to-Many
## Many-to-One (BelongsTo)
A many-to-one relationship has a object that references the foreign type.
```graphql
query {
animethemes {
data {
sequence
anime {
name
}
}
}
}
```
## One-to-Many (HasMany)
An one-to-many relationship has a list of objects that reference the related type.
```graphql
query {
animes {
data {
name
animethemes(first: 2) {
data {
sequence
}
}
}
}
}
```
## Many-to-Many (BelongsToMany)
A many-to-many relationship has a `edges` list that contains edge objects.
@@ -65,4 +101,49 @@ will return the JSON:
}
}
}
```
## Polymorphic Many-to-One (MorphTo)
An union type indicates that a field might have multiple object types.
```graphql
query {
performances {
data {
artist {
... on Artist {
name
}
... on Membership {
group {
name
}
member {
name
}
}
}
}
}
}
```
## Polymorphic One-to-Many (MorphMany)
The inverse relationship of polymorphic many-to-one. Applies pagination.
```graphql
query {
memberships {
data {
performances {
data {
alias
as
}
}
}
}
}
```