comparison src/services/kitsu.cc @ 394:de10a647eb9b

kitsu: fix up clang-format's shitty json formatting
author Paper <paper@tflc.us>
date Fri, 07 Nov 2025 07:24:53 -0500
parents 963047512d34
children
comparison
equal deleted inserted replaced
393:963047512d34 394:de10a647eb9b
636 int score; 636 int score;
637 637
638 if (!anime.IsInUserList()) 638 if (!anime.IsInUserList())
639 return 0; /* WTF */ 639 return 0; /* WTF */
640 640
641 // clang-format off
641 nlohmann::json json = { 642 nlohmann::json json = {
642 {"data", 643 {"data", {
643 {{"type", "libraryEntries"}, 644 {"type", "libraryEntries"},
644 {"attributes", 645 {"attributes", {
645 { 646 {"status", UserStatusToString(anime.GetUserStatus())},
646 {"status", UserStatusToString(anime.GetUserStatus())}, 647 {"progress", anime.GetUserProgress()},
647 {"progress", anime.GetUserProgress()}, 648 {"reconsuming", anime.GetUserIsRewatching()},
648 {"reconsuming", anime.GetUserIsRewatching()}, 649 {"reconsumeCount", anime.GetUserRewatchedTimes()},
649 {"reconsumeCount", anime.GetUserRewatchedTimes()}, 650 {"notes", anime.GetUserNotes()},
650 {"notes", anime.GetUserNotes()}, 651 {"private", anime.GetUserIsPrivate()},
651 {"private", anime.GetUserIsPrivate()}, 652 // WTF is reactionSkipped?
652 // WTF is reactionSkipped? 653 {"startedAt", anime.GetUserDateStarted().GetAsISO8601()},
653 {"startedAt", anime.GetUserDateStarted().GetAsISO8601()}, 654 {"finishedAt", anime.GetUserDateCompleted().GetAsISO8601()},
654 {"finishedAt", anime.GetUserDateCompleted().GetAsISO8601()}, 655 }},
655 }}, 656 {"relationships", {
656 {"relationships", 657 {"anime", {
657 {{"anime", 658 {"data", {
658 {{"data", 659 {"type", "anime"},
659 { 660 {"id", anime.GetServiceId(Anime::Service::Kitsu)},
660 {"type", "anime"}, 661 }}
661 {"id", anime.GetServiceId(Anime::Service::Kitsu)}, 662 }},
662 }}}}, 663 {"user", {
663 {"user", 664 {"data", {
664 {{"data", 665 {"type", "users"},
665 { 666 {"id", session.config.auth.kitsu.user_id},
666 {"type", "users"}, 667 }}
667 {"id", session.config.auth.kitsu.user_id}, 668 }}
668 }}}}}}}} 669 }}
669 }; 670 }}
671 };
672 // clang-format on
670 673
671 nlohmann::json &attributes = json["data"]["attributes"]; 674 nlohmann::json &attributes = json["data"]["attributes"];
672 675
673 score = anime.GetUserScore() / 5; 676 score = anime.GetUserScore() / 5;
674 if (score > 0) { 677 if (score > 0) {