mirror of
https://github.com/captbaritone/webamp.git
synced 2026-01-23 18:25:30 +00:00
1378 lines
64 KiB
TypeScript
1378 lines
64 KiB
TypeScript
/**
|
|
* Executable schema generated by Grats (https://grats.capt.dev)
|
|
* Do not manually edit. Regenerate by running `npx grats`.
|
|
*/
|
|
|
|
import { GraphQLSchema, GraphQLDirective, DirectiveLocation, GraphQLList, GraphQLInt, specifiedDirectives, GraphQLObjectType, GraphQLString, defaultFieldResolver, GraphQLNonNull, GraphQLInterfaceType, GraphQLBoolean, GraphQLID, GraphQLEnumType, GraphQLInputObjectType } from "graphql";
|
|
import { getUserContext } from "./index";
|
|
import { bulkDownload as queryBulkDownloadResolver } from "./resolvers/BulkDownloadConnection";
|
|
import { fetch_archive_file_by_md5 as queryFetch_archive_file_by_md5Resolver } from "./../../data/ArchiveFileModel";
|
|
import { fetch_internet_archive_item_by_identifier as queryFetch_internet_archive_item_by_identifierResolver } from "./../../data/IaItemModel";
|
|
import { fetch_skin_by_md5 as queryFetch_skin_by_md5Resolver, search_classic_skins as querySearch_classic_skinsResolver, search_skins as querySearch_skinsResolver, skin_to_review as querySkin_to_reviewResolver } from "./resolvers/SkinResolver";
|
|
import { fetch_tweet_by_url as queryFetch_tweet_by_urlResolver } from "./../../data/TweetModel";
|
|
import { me as queryMeResolver } from "./resolvers/UserResolver";
|
|
import { archive_files as modernSkinArchive_filesResolver, average_color as modernSkinAverage_colorResolver, download_url as modernSkinDownload_urlResolver, filename as modernSkinFilenameResolver, id as modernSkinIdResolver, internet_archive_item as modernSkinInternet_archive_itemResolver, md5 as modernSkinMd5Resolver, museum_url as modernSkinMuseum_urlResolver, nsfw as modernSkinNsfwResolver, readme_text as modernSkinReadme_textResolver, reviews as modernSkinReviewsResolver, screenshot_url as modernSkinScreenshot_urlResolver, tweeted as modernSkinTweetedResolver, tweets as modernSkinTweetsResolver, webamp_url as modernSkinWebamp_urlResolver, archive_files as classicSkinArchive_filesResolver, average_color as classicSkinAverage_colorResolver, download_url as classicSkinDownload_urlResolver, filename as classicSkinFilenameResolver, id as classicSkinIdResolver, internet_archive_item as classicSkinInternet_archive_itemResolver, md5 as classicSkinMd5Resolver, museum_url as classicSkinMuseum_urlResolver, nsfw as classicSkinNsfwResolver, readme_text as classicSkinReadme_textResolver, reviews as classicSkinReviewsResolver, screenshot_url as classicSkinScreenshot_urlResolver, tweeted as classicSkinTweetedResolver, tweets as classicSkinTweetsResolver, webamp_url as classicSkinWebamp_urlResolver } from "./resolvers/CommonSkinResolver";
|
|
import { modern_skins as queryModern_skinsResolver } from "./ModernSkinsConnection";
|
|
import { node as queryNodeResolver } from "./resolvers/NodeResolver";
|
|
import { skins as querySkinsResolver } from "./SkinsConnection";
|
|
import { statistics as queryStatisticsResolver } from "./resolvers/DatabaseStatisticsResolver";
|
|
import { tweets as queryTweetsResolver } from "./TweetsConnection";
|
|
import { upload_statuses as queryUpload_statusesResolver, upload_statuses_by_md5 as queryUpload_statuses_by_md5Resolver } from "./resolvers/SkinUpload";
|
|
import { approve_skin as mutationApprove_skinResolver, mark_skin_nsfw as mutationMark_skin_nsfwResolver, reject_skin as mutationReject_skinResolver, request_nsfw_review_for_skin as mutationRequest_nsfw_review_for_skinResolver } from "./resolvers/ReviewMutations";
|
|
import { send_feedback as mutationSend_feedbackResolver } from "./resolvers/FeedbackMutation";
|
|
import { upload as mutationUploadResolver } from "./resolvers/UploadMutation";
|
|
async function assertNonNull<T>(value: T | Promise<T>): Promise<T> {
|
|
const awaited = await value;
|
|
if (awaited == null)
|
|
throw new Error("Cannot return null for semantically non-nullable field.");
|
|
return awaited;
|
|
}
|
|
export function getSchema(): GraphQLSchema {
|
|
const ArchiveFileType: GraphQLObjectType = new GraphQLObjectType({
|
|
name: "ArchiveFile",
|
|
description: "A file found within a Winamp Skin's .wsz archive",
|
|
fields() {
|
|
return {
|
|
date: {
|
|
description: "The date on the file inside the archive. Given in simplified extended ISO\nformat (ISO 8601).",
|
|
name: "date",
|
|
type: GraphQLString,
|
|
resolve(source) {
|
|
return assertNonNull(source.getIsoDate());
|
|
}
|
|
},
|
|
file_md5: {
|
|
description: "The md5 hash of the file within the archive",
|
|
name: "file_md5",
|
|
type: GraphQLString,
|
|
resolve(source) {
|
|
return assertNonNull(source.getFileMd5());
|
|
}
|
|
},
|
|
filename: {
|
|
description: "Filename of the file within the archive",
|
|
name: "filename",
|
|
type: GraphQLString,
|
|
resolve(source) {
|
|
return assertNonNull(source.getFileName());
|
|
}
|
|
},
|
|
is_directory: {
|
|
description: "Is the file a directory?",
|
|
name: "is_directory",
|
|
type: GraphQLBoolean,
|
|
resolve(source) {
|
|
return assertNonNull(source.getIsDirectory());
|
|
}
|
|
},
|
|
size: {
|
|
description: "The uncompressed size of the file in bytes.\n\n**Note:** Will be `null` for directories",
|
|
name: "size",
|
|
type: GraphQLInt,
|
|
resolve(source) {
|
|
return source.getFileSize();
|
|
}
|
|
},
|
|
skin: {
|
|
description: "The skin in which this file was found",
|
|
name: "skin",
|
|
type: SkinType
|
|
},
|
|
text_content: {
|
|
description: "The content of the file, if it's a text file",
|
|
name: "text_content",
|
|
type: GraphQLString,
|
|
resolve(source) {
|
|
return source.getTextContent();
|
|
}
|
|
},
|
|
url: {
|
|
description: "A URL to download the file. **Note:** This is powered by a little\nserverless Cloudflare function which tries to exctact the file on the fly.\nIt may not work for all files.",
|
|
name: "url",
|
|
type: GraphQLString,
|
|
resolve(source) {
|
|
return source.getUrl();
|
|
}
|
|
}
|
|
};
|
|
}
|
|
});
|
|
const InternetArchiveItemType: GraphQLObjectType = new GraphQLObjectType({
|
|
name: "InternetArchiveItem",
|
|
fields() {
|
|
return {
|
|
identifier: {
|
|
description: "The Internet Archive's unique identifier for this item",
|
|
name: "identifier",
|
|
type: GraphQLString,
|
|
resolve(source) {
|
|
return assertNonNull(source.getIdentifier());
|
|
}
|
|
},
|
|
last_metadata_scrape_date_UNSTABLE: {
|
|
description: "The date and time that we last scraped this item's metadata.\n**Note:** This field is temporary and will be removed in the future.\nThe date format is just what we get from the database, and it's ambiguous.",
|
|
name: "last_metadata_scrape_date_UNSTABLE",
|
|
type: GraphQLString,
|
|
resolve(source) {
|
|
return source.getMetadataTimestamp();
|
|
}
|
|
},
|
|
metadata_url: {
|
|
description: "URL to get the Internet Archive's metadata for this item in JSON form.",
|
|
name: "metadata_url",
|
|
type: GraphQLString,
|
|
resolve(source) {
|
|
return assertNonNull(source.getMetadataUrl());
|
|
}
|
|
},
|
|
raw_metadata_json: {
|
|
description: "Our cached version of the metadata available at \\`metadata_url\\` (above)",
|
|
name: "raw_metadata_json",
|
|
type: GraphQLString,
|
|
resolve(source) {
|
|
return source.getMetadataJSON();
|
|
}
|
|
},
|
|
skin: {
|
|
description: "The skin that this item contains",
|
|
name: "skin",
|
|
type: SkinType
|
|
},
|
|
url: {
|
|
description: "The URL where this item can be viewed on the Internet Archive",
|
|
name: "url",
|
|
type: GraphQLString,
|
|
resolve(source) {
|
|
return assertNonNull(source.getUrl());
|
|
}
|
|
}
|
|
};
|
|
}
|
|
});
|
|
const RatingType: GraphQLEnumType = new GraphQLEnumType({
|
|
description: "The judgement made about a skin by a moderator",
|
|
name: "Rating",
|
|
values: {
|
|
APPROVED: {
|
|
value: "APPROVED"
|
|
},
|
|
NSFW: {
|
|
value: "NSFW"
|
|
},
|
|
REJECTED: {
|
|
value: "REJECTED"
|
|
}
|
|
}
|
|
});
|
|
const ReviewType: GraphQLObjectType = new GraphQLObjectType({
|
|
name: "Review",
|
|
description: "A review of a skin. Done either on the Museum's Tinder-style\nreivew page, or via the Discord bot.",
|
|
fields() {
|
|
return {
|
|
rating: {
|
|
description: "The rating that the user gave the skin",
|
|
name: "rating",
|
|
type: RatingType,
|
|
resolve(source, args, context, info) {
|
|
return assertNonNull(defaultFieldResolver(source, args, context, info));
|
|
}
|
|
},
|
|
reviewer: {
|
|
description: "The user who made the review (if known). **Note:** In the early days we didn't\ntrack this, so many will be null.",
|
|
name: "reviewer",
|
|
type: GraphQLString,
|
|
resolve(source, args, context, info) {
|
|
return assertNonNull(defaultFieldResolver(source, args, context, info));
|
|
}
|
|
},
|
|
skin: {
|
|
description: "The skin that was reviewed",
|
|
name: "skin",
|
|
type: SkinType,
|
|
resolve(source, _args, context) {
|
|
return source.skin(getUserContext(context));
|
|
}
|
|
}
|
|
};
|
|
}
|
|
});
|
|
const TweetType: GraphQLObjectType = new GraphQLObjectType({
|
|
name: "Tweet",
|
|
description: "A tweet made by",
|
|
fields() {
|
|
return {
|
|
likes: {
|
|
description: "Number of likes the tweet has received. Updated nightly. (Note: Recent likes on older tweets may not be reflected here)",
|
|
name: "likes",
|
|
type: GraphQLInt,
|
|
resolve(source) {
|
|
return assertNonNull(source.getLikes());
|
|
}
|
|
},
|
|
retweets: {
|
|
description: "Number of retweets the tweet has received. Updated nightly. (Note: Recent retweets on older tweets may not be reflected here)",
|
|
name: "retweets",
|
|
type: GraphQLInt,
|
|
resolve(source) {
|
|
return assertNonNull(source.getRetweets());
|
|
}
|
|
},
|
|
skin: {
|
|
description: "The skin featured in this Tweet",
|
|
name: "skin",
|
|
type: SkinType
|
|
},
|
|
url: {
|
|
description: "URL of the tweet. **Note:** Early on in the bot's life we just recorded\n_which_ skins were tweeted, not any info about the actual tweet. This means we\ndon't always know the URL of the tweet.",
|
|
name: "url",
|
|
type: GraphQLString,
|
|
resolve(source) {
|
|
return source.getUrl();
|
|
}
|
|
}
|
|
};
|
|
}
|
|
});
|
|
const SkinType: GraphQLInterfaceType = new GraphQLInterfaceType({
|
|
description: "A Winamp skin. Could be modern or classic.",
|
|
name: "Skin",
|
|
fields() {
|
|
return {
|
|
archive_files: {
|
|
description: "List of files contained within the skin's .wsz archive",
|
|
name: "archive_files",
|
|
type: new GraphQLList(ArchiveFileType)
|
|
},
|
|
average_color: {
|
|
description: "String representation (rgb usually) of the skin's average color",
|
|
name: "average_color",
|
|
type: GraphQLString
|
|
},
|
|
download_url: {
|
|
description: "URL to download the skin",
|
|
name: "download_url",
|
|
type: GraphQLString
|
|
},
|
|
filename: {
|
|
description: "Filename of skin when uploaded to the Museum. Note: In some cases a skin\nhas been uploaded under multiple names. Here we just pick one.",
|
|
name: "filename",
|
|
type: GraphQLString,
|
|
args: {
|
|
include_museum_id: {
|
|
description: "If true, the museum ID will be appended to the filename to ensure filenames are globally unique.",
|
|
type: new GraphQLNonNull(GraphQLBoolean),
|
|
defaultValue: false
|
|
},
|
|
normalize_extension: {
|
|
description: "If true, the the correct file extension (.wsz or .wal) will be .\nOtherwise, the original user-uploaded file extension will be used.",
|
|
type: new GraphQLNonNull(GraphQLBoolean),
|
|
defaultValue: false
|
|
}
|
|
}
|
|
},
|
|
id: {
|
|
description: "GraphQL ID of the skin",
|
|
name: "id",
|
|
type: new GraphQLNonNull(GraphQLID)
|
|
},
|
|
internet_archive_item: {
|
|
description: "The skin's \"item\" at archive.org",
|
|
name: "internet_archive_item",
|
|
type: InternetArchiveItemType
|
|
},
|
|
md5: {
|
|
description: "MD5 hash of the skin's file",
|
|
name: "md5",
|
|
type: GraphQLString
|
|
},
|
|
museum_url: {
|
|
description: "URL of the skin on the Winamp Skin Museum",
|
|
name: "museum_url",
|
|
type: GraphQLString
|
|
},
|
|
nsfw: {
|
|
description: "Has the skin been flagged as \"not safe for work\"?\"",
|
|
name: "nsfw",
|
|
type: GraphQLBoolean
|
|
},
|
|
readme_text: {
|
|
description: "Text of the readme file extracted from the skin",
|
|
name: "readme_text",
|
|
type: GraphQLString
|
|
},
|
|
reviews: {
|
|
description: "Times that the skin has been reviewed either on the Museum's Tinder-style\nreview page, or via the Discord bot.",
|
|
name: "reviews",
|
|
type: new GraphQLList(ReviewType)
|
|
},
|
|
screenshot_url: {
|
|
description: "URL of a screenshot of the skin",
|
|
name: "screenshot_url",
|
|
type: GraphQLString
|
|
},
|
|
tweeted: {
|
|
description: "Has the skin been tweeted?",
|
|
name: "tweeted",
|
|
type: GraphQLBoolean
|
|
},
|
|
tweets: {
|
|
description: "List of",
|
|
name: "tweets",
|
|
type: new GraphQLList(TweetType)
|
|
},
|
|
webamp_url: {
|
|
description: "URL of webamp.org with the skin loaded",
|
|
name: "webamp_url",
|
|
type: GraphQLString
|
|
}
|
|
};
|
|
}
|
|
});
|
|
const BulkDownloadConnectionType: GraphQLObjectType = new GraphQLObjectType({
|
|
name: "BulkDownloadConnection",
|
|
description: "Connection for bulk download skin metadata",
|
|
fields() {
|
|
return {
|
|
estimatedSizeBytes: {
|
|
description: "Estimated total size in bytes (approximation for progress indication)",
|
|
name: "estimatedSizeBytes",
|
|
type: GraphQLString,
|
|
resolve(source, args, context, info) {
|
|
return assertNonNull(defaultFieldResolver(source, args, context, info));
|
|
}
|
|
},
|
|
nodes: {
|
|
description: "List of skin metadata for bulk download",
|
|
name: "nodes",
|
|
type: new GraphQLList(new GraphQLNonNull(SkinType)),
|
|
resolve(source, _args, context) {
|
|
return assertNonNull(source.nodes(getUserContext(context)));
|
|
}
|
|
},
|
|
totalCount: {
|
|
description: "Total number of skins available for download",
|
|
name: "totalCount",
|
|
type: GraphQLInt,
|
|
resolve(source, args, context, info) {
|
|
return assertNonNull(defaultFieldResolver(source, args, context, info));
|
|
}
|
|
}
|
|
};
|
|
}
|
|
});
|
|
const UserType: GraphQLObjectType = new GraphQLObjectType({
|
|
name: "User",
|
|
fields() {
|
|
return {
|
|
username: {
|
|
name: "username",
|
|
type: GraphQLString,
|
|
resolve(source, _args, context) {
|
|
return source.username(getUserContext(context));
|
|
}
|
|
}
|
|
};
|
|
}
|
|
});
|
|
const NodeType: GraphQLInterfaceType = new GraphQLInterfaceType({
|
|
description: "A globally unique object. The `id` here is intended only for use within\nGraphQL.\nhttps://graphql.org/learn/global-object-identification/",
|
|
name: "Node",
|
|
fields() {
|
|
return {
|
|
id: {
|
|
name: "id",
|
|
type: new GraphQLNonNull(GraphQLID)
|
|
}
|
|
};
|
|
}
|
|
});
|
|
const ModernSkinType: GraphQLObjectType = new GraphQLObjectType({
|
|
name: "ModernSkin",
|
|
description: "A \"modern\" Winamp skin. These skins use the `.wal` file extension and are free-form.\n\nMost functionality in the Winamp Skin Museum is centered around \"classic\" skins,\nwhich are currently called just `Skin` in this schema.",
|
|
fields() {
|
|
return {
|
|
archive_files: {
|
|
description: "List of files contained within the skin's .wsz archive",
|
|
name: "archive_files",
|
|
type: new GraphQLList(ArchiveFileType),
|
|
resolve(source) {
|
|
return assertNonNull(modernSkinArchive_filesResolver(source));
|
|
}
|
|
},
|
|
average_color: {
|
|
description: "String representation (rgb usually) of the skin's average color",
|
|
name: "average_color",
|
|
type: GraphQLString,
|
|
resolve(source) {
|
|
return modernSkinAverage_colorResolver(source);
|
|
}
|
|
},
|
|
download_url: {
|
|
description: "URL to download the skin",
|
|
name: "download_url",
|
|
type: GraphQLString,
|
|
resolve(source) {
|
|
return assertNonNull(modernSkinDownload_urlResolver(source));
|
|
}
|
|
},
|
|
filename: {
|
|
description: "Filename of skin when uploaded to the Museum. Note: In some cases a skin\nhas been uploaded under multiple names. Here we just pick one.",
|
|
name: "filename",
|
|
type: GraphQLString,
|
|
args: {
|
|
include_museum_id: {
|
|
description: "If true, the museum ID will be appended to the filename to ensure filenames are globally unique.",
|
|
type: new GraphQLNonNull(GraphQLBoolean),
|
|
defaultValue: false
|
|
},
|
|
normalize_extension: {
|
|
description: "If true, the the correct file extension (.wsz or .wal) will be .\nOtherwise, the original user-uploaded file extension will be used.",
|
|
type: new GraphQLNonNull(GraphQLBoolean),
|
|
defaultValue: false
|
|
}
|
|
},
|
|
resolve(source, args) {
|
|
return assertNonNull(modernSkinFilenameResolver(source, args));
|
|
}
|
|
},
|
|
id: {
|
|
description: "GraphQL ID of the skin",
|
|
name: "id",
|
|
type: new GraphQLNonNull(GraphQLID),
|
|
resolve(source) {
|
|
return modernSkinIdResolver(source);
|
|
}
|
|
},
|
|
internet_archive_item: {
|
|
description: "The skin's \"item\" at archive.org",
|
|
name: "internet_archive_item",
|
|
type: InternetArchiveItemType,
|
|
resolve(source) {
|
|
return modernSkinInternet_archive_itemResolver(source);
|
|
}
|
|
},
|
|
md5: {
|
|
description: "MD5 hash of the skin's file",
|
|
name: "md5",
|
|
type: GraphQLString,
|
|
resolve(source) {
|
|
return assertNonNull(modernSkinMd5Resolver(source));
|
|
}
|
|
},
|
|
museum_url: {
|
|
description: "URL of the skin on the Winamp Skin Museum",
|
|
name: "museum_url",
|
|
type: GraphQLString,
|
|
resolve(source) {
|
|
return modernSkinMuseum_urlResolver(source);
|
|
}
|
|
},
|
|
nsfw: {
|
|
description: "Has the skin been flagged as \"not safe for work\"?\"",
|
|
name: "nsfw",
|
|
type: GraphQLBoolean,
|
|
resolve(source) {
|
|
return modernSkinNsfwResolver(source);
|
|
}
|
|
},
|
|
readme_text: {
|
|
description: "Text of the readme file extracted from the skin",
|
|
name: "readme_text",
|
|
type: GraphQLString,
|
|
resolve(source) {
|
|
return modernSkinReadme_textResolver(source);
|
|
}
|
|
},
|
|
reviews: {
|
|
description: "Times that the skin has been reviewed either on the Museum's Tinder-style\nreview page, or via the Discord bot.",
|
|
name: "reviews",
|
|
type: new GraphQLList(ReviewType),
|
|
resolve(source) {
|
|
return assertNonNull(modernSkinReviewsResolver(source));
|
|
}
|
|
},
|
|
screenshot_url: {
|
|
description: "URL of a screenshot of the skin",
|
|
name: "screenshot_url",
|
|
type: GraphQLString,
|
|
resolve(source) {
|
|
return modernSkinScreenshot_urlResolver(source);
|
|
}
|
|
},
|
|
tweeted: {
|
|
description: "Has the skin been tweeted?",
|
|
name: "tweeted",
|
|
type: GraphQLBoolean,
|
|
resolve(source) {
|
|
return assertNonNull(modernSkinTweetedResolver(source));
|
|
}
|
|
},
|
|
tweets: {
|
|
description: "List of",
|
|
name: "tweets",
|
|
type: new GraphQLList(TweetType),
|
|
resolve(source) {
|
|
return assertNonNull(modernSkinTweetsResolver(source));
|
|
}
|
|
},
|
|
webamp_url: {
|
|
description: "URL of webamp.org with the skin loaded",
|
|
name: "webamp_url",
|
|
type: GraphQLString,
|
|
resolve(source) {
|
|
return modernSkinWebamp_urlResolver(source);
|
|
}
|
|
}
|
|
};
|
|
},
|
|
interfaces() {
|
|
return [NodeType, SkinType];
|
|
}
|
|
});
|
|
const ModernSkinsConnectionType: GraphQLObjectType = new GraphQLObjectType({
|
|
name: "ModernSkinsConnection",
|
|
description: "A collection of \"modern\" Winamp skins",
|
|
fields() {
|
|
return {
|
|
count: {
|
|
description: "The total number of skins matching the filter",
|
|
name: "count",
|
|
type: GraphQLInt,
|
|
resolve(source, args, context, info) {
|
|
return assertNonNull(defaultFieldResolver(source, args, context, info));
|
|
}
|
|
},
|
|
nodes: {
|
|
description: "The list of skins",
|
|
name: "nodes",
|
|
type: new GraphQLList(ModernSkinType),
|
|
resolve(source, _args, context) {
|
|
return assertNonNull(source.nodes(getUserContext(context)));
|
|
}
|
|
}
|
|
};
|
|
}
|
|
});
|
|
const ClassicSkinType: GraphQLObjectType = new GraphQLObjectType({
|
|
name: "ClassicSkin",
|
|
description: "A classic Winamp skin",
|
|
fields() {
|
|
return {
|
|
archive_files: {
|
|
description: "List of files contained within the skin's .wsz archive",
|
|
name: "archive_files",
|
|
type: new GraphQLList(ArchiveFileType),
|
|
resolve(source) {
|
|
return assertNonNull(classicSkinArchive_filesResolver(source));
|
|
}
|
|
},
|
|
average_color: {
|
|
description: "String representation (rgb usually) of the skin's average color",
|
|
name: "average_color",
|
|
type: GraphQLString,
|
|
resolve(source) {
|
|
return classicSkinAverage_colorResolver(source);
|
|
}
|
|
},
|
|
download_url: {
|
|
description: "URL to download the skin",
|
|
name: "download_url",
|
|
type: GraphQLString,
|
|
resolve(source) {
|
|
return assertNonNull(classicSkinDownload_urlResolver(source));
|
|
}
|
|
},
|
|
filename: {
|
|
description: "Filename of skin when uploaded to the Museum. Note: In some cases a skin\nhas been uploaded under multiple names. Here we just pick one.",
|
|
name: "filename",
|
|
type: GraphQLString,
|
|
args: {
|
|
include_museum_id: {
|
|
description: "If true, the museum ID will be appended to the filename to ensure filenames are globally unique.",
|
|
type: new GraphQLNonNull(GraphQLBoolean),
|
|
defaultValue: false
|
|
},
|
|
normalize_extension: {
|
|
description: "If true, the the correct file extension (.wsz or .wal) will be .\nOtherwise, the original user-uploaded file extension will be used.",
|
|
type: new GraphQLNonNull(GraphQLBoolean),
|
|
defaultValue: false
|
|
}
|
|
},
|
|
resolve(source, args) {
|
|
return assertNonNull(classicSkinFilenameResolver(source, args));
|
|
}
|
|
},
|
|
has_media_library: {
|
|
description: "Does the skin include sprite sheets for the media library?",
|
|
name: "has_media_library",
|
|
type: GraphQLBoolean,
|
|
resolve(source, args, context, info) {
|
|
return assertNonNull(defaultFieldResolver(source, args, context, info));
|
|
}
|
|
},
|
|
id: {
|
|
description: "GraphQL ID of the skin",
|
|
name: "id",
|
|
type: new GraphQLNonNull(GraphQLID),
|
|
resolve(source) {
|
|
return classicSkinIdResolver(source);
|
|
}
|
|
},
|
|
internet_archive_item: {
|
|
description: "The skin's \"item\" at archive.org",
|
|
name: "internet_archive_item",
|
|
type: InternetArchiveItemType,
|
|
resolve(source) {
|
|
return classicSkinInternet_archive_itemResolver(source);
|
|
}
|
|
},
|
|
last_algolia_index_update_date: {
|
|
description: "The date on which this skin was last updated in the Algolia search index.\nGiven in simplified extended ISO format (ISO 8601).",
|
|
name: "last_algolia_index_update_date",
|
|
type: GraphQLString
|
|
},
|
|
md5: {
|
|
description: "MD5 hash of the skin's file",
|
|
name: "md5",
|
|
type: GraphQLString,
|
|
resolve(source) {
|
|
return assertNonNull(classicSkinMd5Resolver(source));
|
|
}
|
|
},
|
|
museum_url: {
|
|
description: "URL of the skin on the Winamp Skin Museum",
|
|
name: "museum_url",
|
|
type: GraphQLString,
|
|
resolve(source) {
|
|
return classicSkinMuseum_urlResolver(source);
|
|
}
|
|
},
|
|
nsfw: {
|
|
description: "Has the skin been flagged as \"not safe for work\"?\"",
|
|
name: "nsfw",
|
|
type: GraphQLBoolean,
|
|
resolve(source) {
|
|
return classicSkinNsfwResolver(source);
|
|
}
|
|
},
|
|
readme_text: {
|
|
description: "Text of the readme file extracted from the skin",
|
|
name: "readme_text",
|
|
type: GraphQLString,
|
|
resolve(source) {
|
|
return classicSkinReadme_textResolver(source);
|
|
}
|
|
},
|
|
reviews: {
|
|
description: "Times that the skin has been reviewed either on the Museum's Tinder-style\nreview page, or via the Discord bot.",
|
|
name: "reviews",
|
|
type: new GraphQLList(ReviewType),
|
|
resolve(source) {
|
|
return assertNonNull(classicSkinReviewsResolver(source));
|
|
}
|
|
},
|
|
screenshot_url: {
|
|
description: "URL of a screenshot of the skin",
|
|
name: "screenshot_url",
|
|
type: GraphQLString,
|
|
resolve(source) {
|
|
return classicSkinScreenshot_urlResolver(source);
|
|
}
|
|
},
|
|
transparent_pixels: {
|
|
description: "The number of transparent pixels rendered by the skin.",
|
|
name: "transparent_pixels",
|
|
type: GraphQLInt,
|
|
resolve(source, args, context, info) {
|
|
return assertNonNull(defaultFieldResolver(source, args, context, info));
|
|
}
|
|
},
|
|
tweeted: {
|
|
description: "Has the skin been tweeted?",
|
|
name: "tweeted",
|
|
type: GraphQLBoolean,
|
|
resolve(source) {
|
|
return assertNonNull(classicSkinTweetedResolver(source));
|
|
}
|
|
},
|
|
tweets: {
|
|
description: "List of",
|
|
name: "tweets",
|
|
type: new GraphQLList(TweetType),
|
|
resolve(source) {
|
|
return assertNonNull(classicSkinTweetsResolver(source));
|
|
}
|
|
},
|
|
webamp_url: {
|
|
description: "URL of webamp.org with the skin loaded",
|
|
name: "webamp_url",
|
|
type: GraphQLString,
|
|
resolve(source) {
|
|
return classicSkinWebamp_urlResolver(source);
|
|
}
|
|
}
|
|
};
|
|
},
|
|
interfaces() {
|
|
return [NodeType, SkinType];
|
|
}
|
|
});
|
|
const SkinsConnectionType: GraphQLObjectType = new GraphQLObjectType({
|
|
name: "SkinsConnection",
|
|
description: "A collection of classic Winamp skins",
|
|
fields() {
|
|
return {
|
|
count: {
|
|
description: "The total number of skins matching the filter",
|
|
name: "count",
|
|
type: GraphQLInt,
|
|
resolve(source, args, context, info) {
|
|
return assertNonNull(defaultFieldResolver(source, args, context, info));
|
|
}
|
|
},
|
|
nodes: {
|
|
description: "The list of skins",
|
|
name: "nodes",
|
|
type: new GraphQLList(SkinType),
|
|
resolve(source, _args, context) {
|
|
return assertNonNull(source.nodes(getUserContext(context)));
|
|
}
|
|
}
|
|
};
|
|
}
|
|
});
|
|
const SkinsFilterOptionType: GraphQLEnumType = new GraphQLEnumType({
|
|
name: "SkinsFilterOption",
|
|
values: {
|
|
APPROVED: {
|
|
value: "APPROVED"
|
|
},
|
|
NSFW: {
|
|
value: "NSFW"
|
|
},
|
|
REJECTED: {
|
|
value: "REJECTED"
|
|
},
|
|
TWEETED: {
|
|
value: "TWEETED"
|
|
}
|
|
}
|
|
});
|
|
const SkinsSortOptionType: GraphQLEnumType = new GraphQLEnumType({
|
|
name: "SkinsSortOption",
|
|
values: {
|
|
MUSEUM: {
|
|
value: "MUSEUM"
|
|
}
|
|
}
|
|
});
|
|
const DatabaseStatisticsType: GraphQLObjectType = new GraphQLObjectType({
|
|
name: "DatabaseStatistics",
|
|
description: "Statistics about the contents of the Museum's database.",
|
|
fields() {
|
|
return {
|
|
approved_skins_count: {
|
|
description: "The number of skins that have been approved for tweeting. This includes both\ntweeted and untweeted skins.\n\n**Note:** Skins can be both approved and rejected by different users.",
|
|
name: "approved_skins_count",
|
|
type: GraphQLInt,
|
|
resolve(source, args, context, info) {
|
|
return assertNonNull(defaultFieldResolver(source, args, context, info));
|
|
}
|
|
},
|
|
nsfw_skins_count: {
|
|
description: "The number of skins that have been marked as NSFW.\n\n**Note:** Skins can be approved and rejected by different users.\n**Note:** Generally skins that have been marked NSFW are also marked as rejected.",
|
|
name: "nsfw_skins_count",
|
|
type: GraphQLInt,
|
|
resolve(source, args, context, info) {
|
|
return assertNonNull(defaultFieldResolver(source, args, context, info));
|
|
}
|
|
},
|
|
rejected_skins_count: {
|
|
description: "The number of skins that have been rejected for tweeting.\n\n**Note:** Skins can be both approved and rejected by different users.\n**Note:** Generally skins that have been marked NSFW are also marked as rejected.",
|
|
name: "rejected_skins_count",
|
|
type: GraphQLInt,
|
|
resolve(source, args, context, info) {
|
|
return assertNonNull(defaultFieldResolver(source, args, context, info));
|
|
}
|
|
},
|
|
tweetable_skins_count: {
|
|
description: "The number of skins that have been approved for tweeting, but not yet tweeted.",
|
|
name: "tweetable_skins_count",
|
|
type: GraphQLInt,
|
|
resolve(source, args, context, info) {
|
|
return assertNonNull(defaultFieldResolver(source, args, context, info));
|
|
}
|
|
},
|
|
tweeted_skins_count: {
|
|
description: "The number of skins in the Museum that have been tweeted by",
|
|
name: "tweeted_skins_count",
|
|
type: GraphQLInt,
|
|
resolve(source, args, context, info) {
|
|
return assertNonNull(defaultFieldResolver(source, args, context, info));
|
|
}
|
|
},
|
|
unique_classic_skins_count: {
|
|
description: "The total number of classic skins in the Museum's database",
|
|
name: "unique_classic_skins_count",
|
|
type: GraphQLInt,
|
|
resolve(source, args, context, info) {
|
|
return assertNonNull(defaultFieldResolver(source, args, context, info));
|
|
}
|
|
},
|
|
unreviewed_skins_count: {
|
|
description: "The number of skins that have never been reviewed.",
|
|
name: "unreviewed_skins_count",
|
|
type: GraphQLInt,
|
|
resolve(source, args, context, info) {
|
|
return assertNonNull(defaultFieldResolver(source, args, context, info));
|
|
}
|
|
},
|
|
uploads_in_error_state_count: {
|
|
description: "Skins uploads that have errored during processing.",
|
|
name: "uploads_in_error_state_count",
|
|
type: GraphQLInt,
|
|
resolve(source, args, context, info) {
|
|
return assertNonNull(defaultFieldResolver(source, args, context, info));
|
|
}
|
|
},
|
|
uploads_pending_processing_count: {
|
|
description: "Skins uplaods awaiting processing. This can happen when there are a large\nnumber of skin uplaods at the same time, or when the skin uploading processing\npipeline gets stuck.",
|
|
name: "uploads_pending_processing_count",
|
|
type: GraphQLInt,
|
|
resolve(source, args, context, info) {
|
|
return assertNonNull(defaultFieldResolver(source, args, context, info));
|
|
}
|
|
},
|
|
web_uploads_count: {
|
|
description: "Number of skins that have been uploaded to the Museum via the web interface.",
|
|
name: "web_uploads_count",
|
|
type: GraphQLInt,
|
|
resolve(source, args, context, info) {
|
|
return assertNonNull(defaultFieldResolver(source, args, context, info));
|
|
}
|
|
}
|
|
};
|
|
}
|
|
});
|
|
const TweetsConnectionType: GraphQLObjectType = new GraphQLObjectType({
|
|
name: "TweetsConnection",
|
|
description: "A collection of tweets made by the",
|
|
fields() {
|
|
return {
|
|
count: {
|
|
description: "The total number of tweets",
|
|
name: "count",
|
|
type: GraphQLInt,
|
|
resolve(source, args, context, info) {
|
|
return assertNonNull(defaultFieldResolver(source, args, context, info));
|
|
}
|
|
},
|
|
nodes: {
|
|
description: "The list of tweets",
|
|
name: "nodes",
|
|
type: new GraphQLList(TweetType),
|
|
resolve(source, args, context, info) {
|
|
return assertNonNull(defaultFieldResolver(source, args, context, info));
|
|
}
|
|
}
|
|
};
|
|
}
|
|
});
|
|
const TweetsSortOptionType: GraphQLEnumType = new GraphQLEnumType({
|
|
name: "TweetsSortOption",
|
|
values: {
|
|
LIKES: {
|
|
value: "LIKES"
|
|
},
|
|
RETWEETS: {
|
|
value: "RETWEETS"
|
|
}
|
|
}
|
|
});
|
|
const SkinUploadStatusType: GraphQLEnumType = new GraphQLEnumType({
|
|
description: "The current status of a pending upload.\n\n**Note:** Expect more values here as we try to be more transparent about\nthe status of a pending uploads.",
|
|
name: "SkinUploadStatus",
|
|
values: {
|
|
ARCHIVED: {
|
|
value: "ARCHIVED"
|
|
},
|
|
DELAYED: {
|
|
value: "DELAYED"
|
|
},
|
|
ERRORED: {
|
|
value: "ERRORED"
|
|
},
|
|
UPLOAD_REPORTED: {
|
|
value: "UPLOAD_REPORTED"
|
|
},
|
|
URL_REQUESTED: {
|
|
value: "URL_REQUESTED"
|
|
}
|
|
}
|
|
});
|
|
const SkinUploadType: GraphQLObjectType = new GraphQLObjectType({
|
|
name: "SkinUpload",
|
|
description: "Information about an attempt to upload a skin to the Museum.",
|
|
fields() {
|
|
return {
|
|
id: {
|
|
name: "id",
|
|
type: GraphQLString,
|
|
resolve(source, args, context, info) {
|
|
return assertNonNull(defaultFieldResolver(source, args, context, info));
|
|
}
|
|
},
|
|
skin: {
|
|
description: "Skin that was uploaded. **Note:** This is null if the skin has not yet been\nfully processed. (status == ARCHIVED)",
|
|
name: "skin",
|
|
type: SkinType
|
|
},
|
|
status: {
|
|
name: "status",
|
|
type: SkinUploadStatusType,
|
|
resolve(source, args, context, info) {
|
|
return assertNonNull(defaultFieldResolver(source, args, context, info));
|
|
}
|
|
},
|
|
upload_md5: {
|
|
description: "Md5 hash given when requesting the upload URL.",
|
|
name: "upload_md5",
|
|
type: GraphQLString,
|
|
resolve(source, args, context, info) {
|
|
return assertNonNull(defaultFieldResolver(source, args, context, info));
|
|
}
|
|
}
|
|
};
|
|
}
|
|
});
|
|
const QueryType: GraphQLObjectType = new GraphQLObjectType({
|
|
name: "Query",
|
|
fields() {
|
|
return {
|
|
bulkDownload: {
|
|
description: "Get metadata for bulk downloading all skins in the museum",
|
|
name: "bulkDownload",
|
|
type: BulkDownloadConnectionType,
|
|
args: {
|
|
first: {
|
|
type: new GraphQLNonNull(GraphQLInt),
|
|
defaultValue: 1000
|
|
},
|
|
offset: {
|
|
type: new GraphQLNonNull(GraphQLInt),
|
|
defaultValue: 0
|
|
}
|
|
},
|
|
resolve(_source, args) {
|
|
return assertNonNull(queryBulkDownloadResolver(args));
|
|
}
|
|
},
|
|
fetch_archive_file_by_md5: {
|
|
description: "Fetch archive file by it's MD5 hash\n\nGet information about a file found within a skin's wsz/wal/zip archive.",
|
|
name: "fetch_archive_file_by_md5",
|
|
type: ArchiveFileType,
|
|
args: {
|
|
md5: {
|
|
type: new GraphQLNonNull(GraphQLString)
|
|
}
|
|
},
|
|
resolve(_source, args, context) {
|
|
return queryFetch_archive_file_by_md5Resolver(args.md5, getUserContext(context));
|
|
}
|
|
},
|
|
fetch_internet_archive_item_by_identifier: {
|
|
description: "Get an archive.org item by its identifier. You can find this in the URL:\n\nhttps://archive.org/details/<identifier>/",
|
|
name: "fetch_internet_archive_item_by_identifier",
|
|
type: InternetArchiveItemType,
|
|
args: {
|
|
identifier: {
|
|
type: new GraphQLNonNull(GraphQLString)
|
|
}
|
|
},
|
|
resolve(_source, args, context) {
|
|
return queryFetch_internet_archive_item_by_identifierResolver(args.identifier, getUserContext(context));
|
|
}
|
|
},
|
|
fetch_skin_by_md5: {
|
|
description: "Get a skin by its MD5 hash",
|
|
name: "fetch_skin_by_md5",
|
|
type: SkinType,
|
|
args: {
|
|
md5: {
|
|
type: new GraphQLNonNull(GraphQLString)
|
|
}
|
|
},
|
|
resolve(_source, args, context) {
|
|
return queryFetch_skin_by_md5Resolver(args.md5, getUserContext(context));
|
|
}
|
|
},
|
|
fetch_tweet_by_url: {
|
|
description: "Get a tweet by its URL",
|
|
name: "fetch_tweet_by_url",
|
|
type: TweetType,
|
|
args: {
|
|
url: {
|
|
type: new GraphQLNonNull(GraphQLString)
|
|
}
|
|
},
|
|
resolve(_source, args, context) {
|
|
return queryFetch_tweet_by_urlResolver(args.url, getUserContext(context));
|
|
}
|
|
},
|
|
me: {
|
|
description: "The currently authenticated user, if any.",
|
|
name: "me",
|
|
type: UserType,
|
|
resolve() {
|
|
return queryMeResolver();
|
|
}
|
|
},
|
|
modern_skins: {
|
|
description: "All modern skins in the database",
|
|
name: "modern_skins",
|
|
type: ModernSkinsConnectionType,
|
|
args: {
|
|
first: {
|
|
type: new GraphQLNonNull(GraphQLInt),
|
|
defaultValue: 10
|
|
},
|
|
offset: {
|
|
type: new GraphQLNonNull(GraphQLInt),
|
|
defaultValue: 0
|
|
}
|
|
},
|
|
resolve(_source, args) {
|
|
return assertNonNull(queryModern_skinsResolver(args.first, args.offset));
|
|
}
|
|
},
|
|
node: {
|
|
description: "Get a globally unique object by its ID.\n\nhttps://graphql.org/learn/global-object-identification/",
|
|
name: "node",
|
|
type: NodeType,
|
|
args: {
|
|
id: {
|
|
type: new GraphQLNonNull(GraphQLID)
|
|
}
|
|
},
|
|
resolve(_source, args, context) {
|
|
return queryNodeResolver(args.id, getUserContext(context));
|
|
}
|
|
},
|
|
search_classic_skins: {
|
|
description: "Search the database using SQLite's FTS (full text search) index.\n\nUseful for locating a particular skin.",
|
|
name: "search_classic_skins",
|
|
type: new GraphQLList(ClassicSkinType),
|
|
args: {
|
|
first: {
|
|
type: new GraphQLNonNull(GraphQLInt),
|
|
defaultValue: 10
|
|
},
|
|
offset: {
|
|
type: new GraphQLNonNull(GraphQLInt),
|
|
defaultValue: 0
|
|
},
|
|
query: {
|
|
type: new GraphQLNonNull(GraphQLString)
|
|
}
|
|
},
|
|
resolve(_source, args, context) {
|
|
return assertNonNull(querySearch_classic_skinsResolver(args.query, args.first, args.offset, getUserContext(context)));
|
|
}
|
|
},
|
|
search_skins: {
|
|
description: "Search the database using the Algolia search index used by the Museum.\n\nUseful for locating a particular skin.",
|
|
name: "search_skins",
|
|
type: new GraphQLList(SkinType),
|
|
args: {
|
|
first: {
|
|
type: new GraphQLNonNull(GraphQLInt),
|
|
defaultValue: 10
|
|
},
|
|
offset: {
|
|
type: new GraphQLNonNull(GraphQLInt),
|
|
defaultValue: 0
|
|
},
|
|
query: {
|
|
type: new GraphQLNonNull(GraphQLString)
|
|
}
|
|
},
|
|
resolve(_source, args, context) {
|
|
return assertNonNull(querySearch_skinsResolver(args.query, args.first, args.offset, getUserContext(context)));
|
|
}
|
|
},
|
|
skin_to_review: {
|
|
description: "A random skin that needs to be reviewed",
|
|
name: "skin_to_review",
|
|
type: SkinType,
|
|
resolve(_source, _args, context) {
|
|
return querySkin_to_reviewResolver(getUserContext(context));
|
|
}
|
|
},
|
|
skins: {
|
|
description: "All classic skins in the database\n\n**Note:** We don't currently support combining sorting and filtering.",
|
|
name: "skins",
|
|
type: SkinsConnectionType,
|
|
args: {
|
|
filter: {
|
|
type: SkinsFilterOptionType
|
|
},
|
|
first: {
|
|
type: new GraphQLNonNull(GraphQLInt),
|
|
defaultValue: 10
|
|
},
|
|
offset: {
|
|
type: new GraphQLNonNull(GraphQLInt),
|
|
defaultValue: 0
|
|
},
|
|
sort: {
|
|
type: SkinsSortOptionType
|
|
}
|
|
},
|
|
resolve(_source, args) {
|
|
return assertNonNull(querySkinsResolver(args));
|
|
}
|
|
},
|
|
statistics: {
|
|
description: "A namespace for statistics about the database",
|
|
name: "statistics",
|
|
type: DatabaseStatisticsType,
|
|
resolve() {
|
|
return assertNonNull(queryStatisticsResolver());
|
|
}
|
|
},
|
|
tweets: {
|
|
description: "Tweets tweeted by",
|
|
name: "tweets",
|
|
type: TweetsConnectionType,
|
|
args: {
|
|
first: {
|
|
type: new GraphQLNonNull(GraphQLInt),
|
|
defaultValue: 10
|
|
},
|
|
offset: {
|
|
type: new GraphQLNonNull(GraphQLInt),
|
|
defaultValue: 0
|
|
},
|
|
sort: {
|
|
type: TweetsSortOptionType
|
|
}
|
|
},
|
|
resolve(_source, args) {
|
|
return assertNonNull(queryTweetsResolver(args));
|
|
}
|
|
},
|
|
upload_statuses: {
|
|
description: "Get the status of a batch of uploads by ids",
|
|
name: "upload_statuses",
|
|
type: new GraphQLList(SkinUploadType),
|
|
args: {
|
|
ids: {
|
|
type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(GraphQLString)))
|
|
}
|
|
},
|
|
resolve(_source, args, context) {
|
|
return assertNonNull(queryUpload_statusesResolver(args.ids, getUserContext(context)));
|
|
}
|
|
},
|
|
upload_statuses_by_md5: {
|
|
description: "Get the status of a batch of uploads by md5s",
|
|
deprecationReason: "Prefer `upload_statuses` instead, were we operate on ids.",
|
|
name: "upload_statuses_by_md5",
|
|
type: new GraphQLList(SkinUploadType),
|
|
args: {
|
|
md5s: {
|
|
type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(GraphQLString)))
|
|
}
|
|
},
|
|
resolve(_source, args, context) {
|
|
return assertNonNull(queryUpload_statuses_by_md5Resolver(args.md5s, getUserContext(context)));
|
|
}
|
|
}
|
|
};
|
|
}
|
|
});
|
|
const UploadUrlType: GraphQLObjectType = new GraphQLObjectType({
|
|
name: "UploadUrl",
|
|
description: "A URL that the client can use to upload a skin to S3, and then notify the server\nwhen they're done.",
|
|
fields() {
|
|
return {
|
|
id: {
|
|
name: "id",
|
|
type: GraphQLString,
|
|
resolve(source, args, context, info) {
|
|
return assertNonNull(defaultFieldResolver(source, args, context, info));
|
|
}
|
|
},
|
|
md5: {
|
|
name: "md5",
|
|
type: GraphQLString,
|
|
resolve(source, args, context, info) {
|
|
return assertNonNull(defaultFieldResolver(source, args, context, info));
|
|
}
|
|
},
|
|
url: {
|
|
name: "url",
|
|
type: GraphQLString,
|
|
resolve(source, args, context, info) {
|
|
return assertNonNull(defaultFieldResolver(source, args, context, info));
|
|
}
|
|
}
|
|
};
|
|
}
|
|
});
|
|
const UploadUrlRequestType: GraphQLInputObjectType = new GraphQLInputObjectType({
|
|
description: "Input object used for a user to request an UploadUrl",
|
|
name: "UploadUrlRequest",
|
|
fields() {
|
|
return {
|
|
filename: {
|
|
name: "filename",
|
|
type: new GraphQLNonNull(GraphQLString)
|
|
},
|
|
md5: {
|
|
name: "md5",
|
|
type: new GraphQLNonNull(GraphQLString)
|
|
}
|
|
};
|
|
}
|
|
});
|
|
const UploadMutationsType: GraphQLObjectType = new GraphQLObjectType({
|
|
name: "UploadMutations",
|
|
description: "Mutations for the upload flow\n\n1. The user finds the md5 hash of their local files.\n2. (`get_upload_urls`) The user requests upload URLs for each of their files.\n3. The server returns upload URLs for each of their files which are not already in the collection.\n4. The user uploads each of their files to the URLs returned in step 3.\n5. (`report_skin_uploaded`) The user notifies the server that they're done uploading.\n6. (TODO) The user polls for the status of their uploads.",
|
|
fields() {
|
|
return {
|
|
get_upload_urls: {
|
|
description: "Get a (possibly incomplete) list of UploadUrls for each of the files. If an\nUploadUrl is not returned for a given hash, it means the file is already in\nthe collection.",
|
|
name: "get_upload_urls",
|
|
type: new GraphQLList(UploadUrlType),
|
|
args: {
|
|
files: {
|
|
type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(UploadUrlRequestType)))
|
|
}
|
|
},
|
|
resolve(source, args, context) {
|
|
return assertNonNull(source.get_upload_urls(args.files, getUserContext(context)));
|
|
}
|
|
},
|
|
report_skin_uploaded: {
|
|
description: "Notify the server that the user is done uploading.",
|
|
name: "report_skin_uploaded",
|
|
type: GraphQLBoolean,
|
|
args: {
|
|
id: {
|
|
type: new GraphQLNonNull(GraphQLString)
|
|
},
|
|
md5: {
|
|
type: new GraphQLNonNull(GraphQLString)
|
|
}
|
|
},
|
|
resolve(source, args, context) {
|
|
return assertNonNull(source.report_skin_uploaded(args.id, args.md5, context));
|
|
}
|
|
}
|
|
};
|
|
}
|
|
});
|
|
const MutationType: GraphQLObjectType = new GraphQLObjectType({
|
|
name: "Mutation",
|
|
fields() {
|
|
return {
|
|
approve_skin: {
|
|
description: "Approve skin for tweeting\n\n**Note:** Requires being logged in",
|
|
name: "approve_skin",
|
|
type: GraphQLBoolean,
|
|
args: {
|
|
md5: {
|
|
type: new GraphQLNonNull(GraphQLString)
|
|
}
|
|
},
|
|
resolve(_source, args, context) {
|
|
return assertNonNull(mutationApprove_skinResolver(args.md5, context));
|
|
}
|
|
},
|
|
mark_skin_nsfw: {
|
|
description: "Mark a skin as NSFW\n\n**Note:** Requires being logged in",
|
|
name: "mark_skin_nsfw",
|
|
type: GraphQLBoolean,
|
|
args: {
|
|
md5: {
|
|
type: new GraphQLNonNull(GraphQLString)
|
|
}
|
|
},
|
|
resolve(_source, args, context) {
|
|
return assertNonNull(mutationMark_skin_nsfwResolver(args.md5, context));
|
|
}
|
|
},
|
|
reject_skin: {
|
|
description: "Reject skin for tweeting\n\n**Note:** Requires being logged in",
|
|
name: "reject_skin",
|
|
type: GraphQLBoolean,
|
|
args: {
|
|
md5: {
|
|
type: new GraphQLNonNull(GraphQLString)
|
|
}
|
|
},
|
|
resolve(_source, args, context) {
|
|
return assertNonNull(mutationReject_skinResolver(args.md5, context));
|
|
}
|
|
},
|
|
request_nsfw_review_for_skin: {
|
|
description: "Request that an admin check if this skin is NSFW.\nUnlike other review mutation endpoints, this one does not require being logged\nin.",
|
|
name: "request_nsfw_review_for_skin",
|
|
type: GraphQLBoolean,
|
|
args: {
|
|
md5: {
|
|
type: new GraphQLNonNull(GraphQLString)
|
|
}
|
|
},
|
|
resolve(_source, args, context) {
|
|
return assertNonNull(mutationRequest_nsfw_review_for_skinResolver(args.md5, context));
|
|
}
|
|
},
|
|
send_feedback: {
|
|
description: "Send a message to the admin of the site. Currently this appears in Discord.",
|
|
name: "send_feedback",
|
|
type: GraphQLBoolean,
|
|
args: {
|
|
email: {
|
|
type: GraphQLString
|
|
},
|
|
message: {
|
|
type: new GraphQLNonNull(GraphQLString)
|
|
},
|
|
url: {
|
|
type: GraphQLString
|
|
}
|
|
},
|
|
resolve(_source, args, context) {
|
|
return assertNonNull(mutationSend_feedbackResolver(context, args.message, args.email, args.url));
|
|
}
|
|
},
|
|
upload: {
|
|
description: "Mutations for the upload flow",
|
|
name: "upload",
|
|
type: UploadMutationsType,
|
|
resolve() {
|
|
return assertNonNull(mutationUploadResolver());
|
|
}
|
|
}
|
|
};
|
|
}
|
|
});
|
|
return new GraphQLSchema({
|
|
directives: [...specifiedDirectives, new GraphQLDirective({
|
|
name: "semanticNonNull",
|
|
locations: [DirectiveLocation.FIELD_DEFINITION],
|
|
description: "Indicates that a position is semantically non null: it is only null if there is a matching error in the `errors` array.\nIn all other cases, the position is non-null.\n\nTools doing code generation may use this information to generate the position as non-null if field errors are handled out of band:\n\n```graphql\ntype User {\n # email is semantically non-null and can be generated as non-null by error-handling clients.\n email: String @semanticNonNull\n}\n```\n\nThe `levels` argument indicates what levels are semantically non null in case of lists:\n\n```graphql\ntype User {\n # friends is semantically non null\n friends: [User] @semanticNonNull # same as @semanticNonNull(levels: [0])\n\n # every friends[k] is semantically non null\n friends: [User] @semanticNonNull(levels: [1])\n\n # friends as well as every friends[k] is semantically non null\n friends: [User] @semanticNonNull(levels: [0, 1])\n}\n```\n\n`levels` are zero indexed.\nPassing a negative level or a level greater than the list dimension is an error.",
|
|
args: {
|
|
levels: {
|
|
type: new GraphQLList(GraphQLInt),
|
|
defaultValue: [0]
|
|
}
|
|
}
|
|
})],
|
|
query: QueryType,
|
|
mutation: MutationType,
|
|
types: [RatingType, SkinUploadStatusType, SkinsFilterOptionType, SkinsSortOptionType, TweetsSortOptionType, NodeType, SkinType, UploadUrlRequestType, ArchiveFileType, BulkDownloadConnectionType, ClassicSkinType, DatabaseStatisticsType, InternetArchiveItemType, ModernSkinType, ModernSkinsConnectionType, MutationType, QueryType, ReviewType, SkinUploadType, SkinsConnectionType, TweetType, TweetsConnectionType, UploadMutationsType, UploadUrlType, UserType]
|
|
});
|
|
}
|