modrinthjs
Version:
A type safe Modrinth implementation.
205 lines (204 loc) • 8.06 kB
TypeScript
import type { CreateProjectBody } from '../models/CreateProjectBody';
import type { EditableProject } from '../models/EditableProject';
import type { PatchProjectsBody } from '../models/PatchProjectsBody';
import type { Project } from '../models/Project';
import type { ProjectDependencyList } from '../models/ProjectDependencyList';
import type { ProjectIdentifier } from '../models/ProjectIdentifier';
import type { Schedule } from '../models/Schedule';
import type { SearchResults } from '../models/SearchResults';
import type { CancelablePromise } from '../core/CancelablePromise';
export declare class ProjectsService {
/**
* Search projects
* @param query The query to search for
* @param facets Facets are an essential concept for understanding how to filter out results.
*
* These are the most commonly used facet types:
* - `project_type`
* - `categories` (loaders are lumped in with categories in search)
* - `versions`
* - `client_side`
* - `server_side`
* - `open_source`
*
* Several others are also available for use, though these should not be used outside very specific use cases.
* - `title`
* - `author`
* - `follows`
* - `project_id`
* - `license`
* - `downloads`
* - `color`
* - `created_timestamp`
* - `modified_timestamp`
*
* In order to then use these facets, you need a value to filter by, as well as an operation to perform on this value.
* The most common operation is `:` (same as `=`), though you can also use `!=`, `>=`, `>`, `<=`, and `<`.
* Join together the type, operation, and value, and you've got your string.
* ```
* {type} {operation} {value}
* ```
*
* Examples:
* ```
* categories = adventure
* versions != 1.20.1
* downloads <= 100
* ```
*
* You then join these strings together in arrays to signal `AND` and `OR` operators.
*
* ##### OR
* All elements in a single array are considered to be joined by OR statements.
* For example, the search `[["versions:1.16.5", "versions:1.17.1"]]` translates to `Projects that support 1.16.5 OR 1.17.1`.
*
* ##### AND
* Separate arrays are considered to be joined by AND statements.
* For example, the search `[["versions:1.16.5"], ["project_type:modpack"]]` translates to `Projects that support 1.16.5 AND are modpacks`.
*
* @param index The sorting method used for sorting search results
* @param offset The offset into the search. Skips this number of results
* @param limit The number of results returned by the search
* @returns SearchResults Expected response to a valid request
* @throws ApiError
*/
static searchProjects(query?: string, facets?: string, index?: 'relevance' | 'downloads' | 'follows' | 'newest' | 'updated', offset?: number, limit?: number): CancelablePromise<SearchResults>;
/**
* Get a project
* @param idSlug The ID or slug of the project
* @returns Project Expected response to a valid request
* @throws ApiError
*/
static getProject(idSlug: string): CancelablePromise<Project>;
/**
* Modify a project
* @param idSlug The ID or slug of the project
* @param requestBody Modified project fields
* @returns void
* @throws ApiError
*/
static modifyProject(idSlug: string, requestBody?: EditableProject): CancelablePromise<void>;
/**
* Delete a project
* @param idSlug The ID or slug of the project
* @returns void
* @throws ApiError
*/
static deleteProject(idSlug: string): CancelablePromise<void>;
/**
* Get multiple projects
* @param ids The IDs and/or slugs of the projects
* @returns Project Expected response to a valid request
* @throws ApiError
*/
static getProjects(ids: string): CancelablePromise<Array<Project>>;
/**
* Bulk-edit multiple projects
* @param ids The IDs and/or slugs of the projects
* @param requestBody Fields to edit on all projects specified
* @returns void
* @throws ApiError
*/
static patchProjects(ids: string, requestBody?: PatchProjectsBody): CancelablePromise<void>;
/**
* Get a list of random projects
* @param count The number of random projects to return
* @returns Project Expected response to a valid request
* @throws ApiError
*/
static randomProjects(count: number): CancelablePromise<Array<Project>>;
/**
* Create a project
* @param formData New project
* @returns Project Expected response to a valid request
* @throws ApiError
*/
static createProject(formData?: CreateProjectBody): CancelablePromise<Project>;
/**
* Change project's icon
* The new icon may be up to 256KiB in size.
* @param idSlug The ID or slug of the project
* @param ext Image extension
* @param requestBody
* @returns void
* @throws ApiError
*/
static changeProjectIcon(idSlug: string, ext: 'png' | 'jpg' | 'jpeg' | 'bmp' | 'gif' | 'webp' | 'svg' | 'svgz' | 'rgb', requestBody?: Blob): CancelablePromise<void>;
/**
* Delete project's icon
* @param idSlug The ID or slug of the project
* @returns void
* @throws ApiError
*/
static deleteProjectIcon(idSlug: string): CancelablePromise<void>;
/**
* Check project slug/ID validity
* @param idSlug The ID or slug of the project
* @returns ProjectIdentifier Expected response to a valid request
* @throws ApiError
*/
static checkProjectValidity(idSlug: string): CancelablePromise<ProjectIdentifier>;
/**
* Add a gallery image
* Modrinth allows you to upload files of up to 5MiB to a project's gallery.
* @param idSlug The ID or slug of the project
* @param ext Image extension
* @param featured Whether an image is featured
* @param title Title of the image
* @param description Description of the image
* @param ordering Ordering of the image
* @param requestBody
* @returns void
* @throws ApiError
*/
static addGalleryImage(idSlug: string, ext: 'png' | 'jpg' | 'jpeg' | 'bmp' | 'gif' | 'webp' | 'svg' | 'svgz' | 'rgb', featured: boolean, title?: string, description?: string, ordering?: number, requestBody?: Blob): CancelablePromise<void>;
/**
* Modify a gallery image
* @param idSlug The ID or slug of the project
* @param url URL link of the image to modify
* @param featured Whether the image is featured
* @param title New title of the image
* @param description New description of the image
* @param ordering New ordering of the image
* @returns void
* @throws ApiError
*/
static modifyGalleryImage(idSlug: string, url: string, featured?: boolean, title?: string, description?: string, ordering?: number): CancelablePromise<void>;
/**
* Delete a gallery image
* @param idSlug The ID or slug of the project
* @param url URL link of the image to delete
* @returns void
* @throws ApiError
*/
static deleteGalleryImage(idSlug: string, url: string): CancelablePromise<void>;
/**
* Get all of a project's dependencies
* @param idSlug The ID or slug of the project
* @returns ProjectDependencyList Expected response to a valid request
* @throws ApiError
*/
static getDependencies(idSlug: string): CancelablePromise<ProjectDependencyList>;
/**
* Follow a project
* @param idSlug The ID or slug of the project
* @returns void
* @throws ApiError
*/
static followProject(idSlug: string): CancelablePromise<void>;
/**
* Unfollow a project
* @param idSlug The ID or slug of the project
* @returns void
* @throws ApiError
*/
static unfollowProject(idSlug: string): CancelablePromise<void>;
/**
* Schedule a project
* @param idSlug The ID or slug of the project
* @param requestBody Information about date and requested status
* @returns void
* @throws ApiError
*/
static scheduleProject(idSlug: string, requestBody?: Schedule): CancelablePromise<void>;
}