2022-02-03 17:23:29 +01:00
|
|
|
package anilist
|
|
|
|
|
2022-02-06 10:39:04 +01:00
|
|
|
import "context"
|
|
|
|
|
2022-02-24 21:15:14 +01:00
|
|
|
func (api *Api) GetMediaList(ctx context.Context, vars MediaListQuery, onError func(error)) *Cursor[MediaList] {
|
2022-02-03 17:23:29 +01:00
|
|
|
resp := responseObj[*page[MediaList]]{}
|
2022-02-06 10:39:04 +01:00
|
|
|
return requestPaged(api, ctx, getMediaListQuery, vars.toMap(), &resp, onError)
|
2022-02-03 17:23:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
const (
|
|
|
|
getMediaListQuery = `query (
|
|
|
|
$id: Int,
|
|
|
|
$userId: Int,
|
|
|
|
$userName: String,
|
|
|
|
$type: MediaType,
|
|
|
|
$status: MediaListStatus,
|
|
|
|
$mediaId: Int,
|
|
|
|
$isFollowing: Boolean,
|
|
|
|
$notes: String,
|
|
|
|
$userId_in: [Int],
|
|
|
|
$status_in: [MediaListStatus],
|
|
|
|
$status_not_in: [MediaListStatus],
|
|
|
|
$status_not: MediaListStatus,
|
|
|
|
$mediaId_in: [Int],
|
|
|
|
$mediaId_not_in: [Int],
|
|
|
|
$sort: [MediaListSort],
|
|
|
|
$page: Int
|
|
|
|
)
|
|
|
|
|
|
|
|
{
|
|
|
|
Page (page: $page) {
|
|
|
|
pageInfo ` + subSelectionPageInfo + `
|
|
|
|
|
|
|
|
mediaList (
|
|
|
|
id: $id,
|
|
|
|
userId: $userId,
|
|
|
|
userName: $userName,
|
|
|
|
type: $type,
|
|
|
|
status: $status,
|
|
|
|
mediaId: $mediaId,
|
|
|
|
isFollowing: $isFollowing,
|
|
|
|
notes: $notes,
|
|
|
|
userId_in: $userId_in,
|
|
|
|
status_in: $status_in,
|
|
|
|
status_not_in: $status_not_in,
|
|
|
|
status_not: $status_not,
|
|
|
|
mediaId_in: $mediaId_in,
|
|
|
|
mediaId_not_in: $mediaId_not_in,
|
|
|
|
sort: $sort
|
|
|
|
) ` + subSelectionMediaList + `
|
|
|
|
}
|
|
|
|
}`
|
|
|
|
)
|