style(go): reformat embedded GraphQL queries with consistent indentation

Normalize the AniList GraphQL query strings in AniListFunctions.go
and AniListUserFunctions.go so every operation uses the same
indentation scheme: two-space steps, field and nested selection sets
uniformly indented, and keywords/arguments spaced consistently
(query ($search: String!), relations {, startDate {, etc.). Also
break the AniListBrowse parameter list onto its own trailing
parameter line for readability.

The queries themselves are unchanged - this is whitespace-only
normalization of the raw string literals, done with the new
project-local Neovim setup (.nvim.lua) that formats embedded GraphQL
via prettier. No behavior change; queries return identical results.
This commit is contained in:
John O'Keefe
2026-09-24 13:50:31 -04:00
parent c0885a4bd5
commit 79022c04a8
2 changed files with 486 additions and 490 deletions
+475 -479
View File
@@ -115,121 +115,121 @@ func (a *App) GetAniListItem(aniId int, login bool) AniListGetSingleAnime {
Variables interface{} `json:"variables"` Variables interface{} `json:"variables"`
}{ }{
Query: ` Query: `
query($userId: Int, $mediaId: Int, $listType: MediaType) { query ($userId: Int, $mediaId: Int, $listType: MediaType) {
MediaList(mediaId: $mediaId, userId: $userId, type: $listType) { MediaList(mediaId: $mediaId, userId: $userId, type: $listType) {
id id
mediaId mediaId
userId userId
media { media {
id id
idMal idMal
title { title {
userPreferred userPreferred
romaji romaji
english english
native native
} }
description description
coverImage { coverImage {
extraLarge extraLarge
large large
medium medium
color color
} }
startDate { startDate {
year year
month month
day day
} }
endDate { endDate {
year year
month month
day day
} }
bannerImage bannerImage
format format
season season
seasonYear seasonYear
status status
episodes episodes
duration duration
countryOfOrigin countryOfOrigin
source source
synonyms synonyms
averageScore averageScore
meanScore meanScore
popularity popularity
trending trending
favourites favourites
isFavourite isFavourite
relations { relations {
nodes { nodes {
id id
title { title {
userPreferred userPreferred
romaji romaji
english english
native native
} }
} }
} }
nextAiringEpisode { nextAiringEpisode {
airingAt airingAt
timeUntilAiring timeUntilAiring
episode episode
} }
airingSchedule { airingSchedule {
nodes { nodes {
id id
airingAt airingAt
timeUntilAiring timeUntilAiring
episode episode
mediaId mediaId
} }
} }
genres genres
tags { tags {
id id
name name
description description
rank rank
isMediaSpoiler isMediaSpoiler
isAdult isAdult
} }
isAdult isAdult
} }
status status
startedAt{ startedAt {
year year
month month
day day
} }
completedAt{ completedAt {
year year
month month
day day
} }
notes notes
progress progress
score score
repeat repeat
user { user {
id id
name name
avatar { avatar {
large large
medium medium
} }
statistics { statistics {
anime { anime {
count count
statuses { statuses {
status status
count count
} }
} }
} }
} }
} }
} }
`, `,
@@ -288,94 +288,93 @@ func (a *App) AniListSearch(query string) (interface{}, error) {
}{ }{
Query: ` Query: `
query ($search: String!, $listType: MediaType) { query ($search: String!, $listType: MediaType) {
Page (page: 1, perPage: 100) { Page(page: 1, perPage: 100) {
pageInfo { pageInfo {
total total
currentPage currentPage
lastPage lastPage
hasNextPage hasNextPage
perPage perPage
} }
media (search: $search, type: $listType) { media(search: $search, type: $listType) {
id id
idMal idMal
title { title {
userPreferred userPreferred
romaji romaji
english english
native native
} }
description description
coverImage { coverImage {
extraLarge extraLarge
large large
medium medium
color color
} }
bannerImage bannerImage
format format
season season
seasonYear seasonYear
status status
episodes episodes
duration duration
countryOfOrigin countryOfOrigin
source source
synonyms synonyms
averageScore averageScore
meanScore meanScore
popularity popularity
trending trending
favourites favourites
isFavourite isFavourite
relations{ relations {
nodes{ nodes {
id id
title{ title {
userPreferred userPreferred
romaji romaji
english english
native native
} }
} }
} }
startDate{ startDate {
year year
month month
day day
} }
endDate{ endDate {
year year
month month
day day
} }
nextAiringEpisode{ nextAiringEpisode {
airingAt airingAt
timeUntilAiring timeUntilAiring
episode episode
} }
airingSchedule{ airingSchedule {
nodes{ nodes {
id id
airingAt airingAt
timeUntilAiring timeUntilAiring
episode episode
mediaId mediaId
} }
} }
genres genres
tags{ tags {
id id
name name
description description
rank rank
isMediaSpoiler isMediaSpoiler
isAdult isAdult
} }
isAdult isAdult
} }
}
}
} }
`, `,
Variables: Variables{ Variables: Variables{
@@ -417,140 +416,140 @@ func (a *App) GetAniListUserWatchingList(page int, perPage int, sort string) (An
Variables Variables `json:"variables"` Variables Variables `json:"variables"`
}{ }{
Query: ` Query: `
query ( query (
$page: Int $page: Int
$perPage: Int $perPage: Int
$userId: Int $userId: Int
$listType: MediaType $listType: MediaType
$status: MediaListStatus $status: MediaListStatus
$sort: [MediaListSort] $sort: [MediaListSort]
) { ) {
Page(page: $page, perPage: $perPage) { Page(page: $page, perPage: $perPage) {
pageInfo { pageInfo {
total total
perPage perPage
currentPage currentPage
lastPage lastPage
hasNextPage hasNextPage
} }
mediaList(userId: $userId, type: $listType, status: $status, sort: $sort) { mediaList(userId: $userId, type: $listType, status: $status, sort: $sort) {
id id
mediaId mediaId
userId userId
media { media {
id id
idMal idMal
title { title {
userPreferred userPreferred
romaji romaji
english english
native native
} }
description description
coverImage { coverImage {
extraLarge extraLarge
large large
medium medium
color color
} }
bannerImage bannerImage
format format
season season
seasonYear seasonYear
status status
episodes episodes
duration duration
countryOfOrigin countryOfOrigin
source source
synonyms synonyms
averageScore averageScore
meanScore meanScore
popularity popularity
trending trending
favourites favourites
isFavourite isFavourite
relations{ relations {
nodes{ nodes {
id id
title{ title {
userPreferred userPreferred
romaji romaji
english english
native native
} }
} }
} }
startDate{ startDate {
year year
month month
day day
} }
endDate{ endDate {
year year
month month
day day
} }
nextAiringEpisode{ nextAiringEpisode {
airingAt airingAt
timeUntilAiring timeUntilAiring
episode episode
} }
airingSchedule{ airingSchedule {
nodes{ nodes {
id id
airingAt airingAt
timeUntilAiring timeUntilAiring
episode episode
mediaId mediaId
} }
} }
genres genres
tags{ tags {
id id
name name
description description
rank rank
isMediaSpoiler isMediaSpoiler
isAdult isAdult
} }
isAdult isAdult
} }
status status
startedAt { startedAt {
year year
month month
day day
} }
completedAt { completedAt {
year year
month month
day day
} }
notes notes
progress progress
score score
repeat repeat
user { user {
id id
name name
avatar { avatar {
large large
medium medium
} }
statistics { statistics {
anime { anime {
count count
statuses { statuses {
status status
count count
} }
} }
} }
} }
} }
} }
} }
`, `,
Variables: Variables{ Variables: Variables{
Page: page, Page: page,
@@ -617,141 +616,141 @@ func (a *App) AniListUpdateEntry(updateBody AniListUpdateVariables) (AniListGetS
Variables AniListUpdateVariables `json:"variables"` Variables AniListUpdateVariables `json:"variables"`
}{ }{
Query: ` Query: `
mutation ( mutation (
$mediaId: Int $mediaId: Int
$progress: Int $progress: Int
$status: MediaListStatus $status: MediaListStatus
$score: Float $score: Float
$repeat: Int $repeat: Int
$notes: String $notes: String
$startedAt: FuzzyDateInput $startedAt: FuzzyDateInput
$completedAt: FuzzyDateInput $completedAt: FuzzyDateInput
) { ) {
SaveMediaListEntry( SaveMediaListEntry(
mediaId: $mediaId mediaId: $mediaId
progress: $progress progress: $progress
status: $status status: $status
score: $score score: $score
repeat: $repeat repeat: $repeat
notes: $notes notes: $notes
startedAt: $startedAt startedAt: $startedAt
completedAt: $completedAt completedAt: $completedAt
) { ) {
id id
mediaId mediaId
userId userId
media { media {
id id
idMal idMal
title { title {
userPreferred userPreferred
romaji romaji
english english
native native
} }
description description
coverImage { coverImage {
extraLarge extraLarge
large large
medium medium
color color
} }
bannerImage bannerImage
format format
season season
seasonYear seasonYear
status status
episodes episodes
duration duration
countryOfOrigin countryOfOrigin
source source
synonyms synonyms
averageScore averageScore
meanScore meanScore
popularity popularity
trending trending
favourites favourites
isFavourite isFavourite
relations { relations {
nodes { nodes {
id id
title { title {
userPreferred userPreferred
romaji romaji
english english
native native
} }
} }
} }
startDate { startDate {
year year
month month
day day
} }
endDate { endDate {
year year
month month
day day
} }
nextAiringEpisode { nextAiringEpisode {
airingAt airingAt
timeUntilAiring timeUntilAiring
episode episode
} }
airingSchedule { airingSchedule {
nodes { nodes {
id id
airingAt airingAt
timeUntilAiring timeUntilAiring
episode episode
mediaId mediaId
} }
} }
genres genres
tags { tags {
id id
name name
description description
rank rank
isMediaSpoiler isMediaSpoiler
isAdult isAdult
} }
isAdult isAdult
} }
status status
startedAt { startedAt {
year year
month month
day day
} }
completedAt { completedAt {
year year
month month
day day
} }
notes notes
progress progress
score score
repeat repeat
user { user {
id id
name name
avatar { avatar {
large large
medium medium
} }
statistics { statistics {
anime { anime {
count count
statuses { statuses {
status status
count count
} }
} }
} }
} }
} }
} }
`, `,
Variables: updateBody, Variables: updateBody,
} }
@@ -812,14 +811,10 @@ func (a *App) AniListDeleteEntry(mediaListId int) (DeleteAniListReturn, error) {
Variables Variables `json:"variables"` Variables Variables `json:"variables"`
}{ }{
Query: ` Query: `
mutation( mutation ($id: Int) {
$id:Int, DeleteMediaListEntry(id: $id) {
){ deleted
DeleteMediaListEntry( }
id:$id,
){
deleted
}
} }
`, `,
Variables: Variables{ Variables: Variables{
@@ -895,7 +890,8 @@ func (a *App) AniListBrowse(
tags []string, tags []string,
excludedTags []string, excludedTags []string,
minimumTagRank int, minimumTagRank int,
sort []string) (AniListCurrentUserWatchList, error) { sort []string,
) (AniListCurrentUserWatchList, error) {
// user := a.GetAniListLoggedInUser() // user := a.GetAniListLoggedInUser()
type Variables struct { type Variables struct {
Page int `json:"page"` Page int `json:"page"`
+11 -11
View File
@@ -179,18 +179,18 @@ func (a *App) GetAniListLoggedInUser() AniListUser {
Query string `json:"query"` Query string `json:"query"`
}{ }{
Query: ` Query: `
query { query {
Viewer { Viewer {
id id
name name
avatar { avatar {
large large
medium medium
}
bannerImage
siteUrl
}
} }
bannerImage
siteUrl
}
}
`, `,
} }