snoots-revived
Advanced tools
Comparing version 1.0.0-dev.1 to 1.0.0-dev.2
@@ -969,2 +969,11 @@ "use strict"; | ||
} | ||
/** | ||
* Get the post requirements for this subreddit. | ||
* @param subreddit The name of the subreddit. | ||
* @returns A promise that resolves to the {@link PostRequirements} for this subreddit. | ||
*/ | ||
async getPostRequirements(subreddit) { | ||
const raw = await this.gateway.get(`api/v1/${subreddit}/post_requirements`); | ||
return (0, util_2.fromRedditData)(raw); | ||
} | ||
async initializeWebSocket(websocketUrl) { | ||
@@ -971,0 +980,0 @@ const ws = new util_2.webSocket(websocketUrl); |
@@ -591,4 +591,11 @@ "use strict"; | ||
} | ||
/** | ||
* Get the post requirements for this subreddit. | ||
* @returns A promise that resolves to the {@link PostRequirements} for this subreddit. | ||
*/ | ||
getPostRequirements() { | ||
return this.controls.getPostRequirements(this.displayName); | ||
} | ||
} | ||
exports.Subreddit = Subreddit; | ||
//# sourceMappingURL=object.js.map |
{ | ||
"name": "snoots-revived", | ||
"version": "1.0.0-dev.1", | ||
"version": "1.0.0-dev.2", | ||
"description": "A modern, fully-featured, strongly-typed reddit api.", | ||
@@ -5,0 +5,0 @@ "module": "dist/index.mjs", |
@@ -20,3 +20,3 @@ export { BaseControls } from "./base-controls"; | ||
export { SubredditControls } from "./subreddit/controls"; | ||
export type { SubredditData } from "./subreddit/object"; | ||
export type { PostRequirements, SubredditData } from "./subreddit/object"; | ||
export { Subreddit } from "./subreddit/object"; | ||
@@ -23,0 +23,0 @@ export type { SubredditFlair, SubredditType } from "./subreddit/types"; |
@@ -11,2 +11,3 @@ /// <reference types="node" /> | ||
import type { ModeratorActionedUser } from "../user/moderator-actioned/base"; | ||
import type { PostRequirements } from "./object"; | ||
import type { SubredditFlair } from "./types"; | ||
@@ -689,2 +690,8 @@ import stream from "stream"; | ||
protected post(subreddit: string, options: PostOptions): Promise<string>; | ||
/** | ||
* Get the post requirements for this subreddit. | ||
* @param subreddit The name of the subreddit. | ||
* @returns A promise that resolves to the {@link PostRequirements} for this subreddit. | ||
*/ | ||
getPostRequirements(subreddit: string): Promise<PostRequirements>; | ||
private initializeWebSocket; | ||
@@ -691,0 +698,0 @@ private createRequestData; |
@@ -215,2 +215,49 @@ import type { Maybe } from "../../helper/types"; | ||
} | ||
/** The attributes specific to post requirements. */ | ||
export interface PostRequirements { | ||
/** An array of strings that are not allowed in the body of a post. */ | ||
bodyBlacklistedStrings: string[]; | ||
/** An array of regular expressions that the body of a post must match. */ | ||
bodyRegexes: string[]; | ||
/** An array of strings that the body of a post must contain. */ | ||
bodyRequiredStrings: string[]; | ||
/** The policy for the body of a post. */ | ||
bodyRestrictionPolicy: "none" | "required" | "notAllowed"; | ||
/** The maximum length of the body of a post. */ | ||
bodyTextMaxLength: Maybe<number>; | ||
/** The minimum length of the body of a post. */ | ||
bodyTextMixLength: Maybe<number>; | ||
/** An array of domains that are not allowed in the link of a post. */ | ||
domainBlacklist: string[]; | ||
/** An array of domains that are allowed in the link of a post. */ | ||
domainWhitelist: string[]; | ||
/** The policy for gallery captions. */ | ||
galleryCaptionsRequirement: "none" | "optional" | "required"; | ||
/** The maximum number of items in a gallery. */ | ||
galleryMaxItems: Maybe<number>; | ||
/** The minimum number of items in a gallery. */ | ||
galleryMinItems: Maybe<number>; | ||
/** The policy for gallery URLs. */ | ||
galleryUrlsRequirement: "none" | "optional" | "required"; | ||
/** The policy for the guidelines. */ | ||
guidelinesDisplayPolicy: "required" | "optional" | "hidden"; | ||
/** The text of the guidelines. */ | ||
guidelinesText: Maybe<string>; | ||
/** Whether a flair is required. */ | ||
isFlairRequired: boolean; | ||
/** The minimum days required for a repost of a link. */ | ||
linkRepostAge: Maybe<number>; | ||
/** The policy for the link of a post. */ | ||
linkRestrictionPolicy: "none" | "whitelist" | "blacklist"; | ||
/** An array of strings that are not allowed in the title of a post. */ | ||
titleBlacklistedStrings: string[]; | ||
/** An array of regular expressions that the title of a post must match. */ | ||
titleRegexes: string[]; | ||
/** An array of strings that the title of a post must contain. */ | ||
titleRequiredStrings: string[]; | ||
/** Maximum length of the title of a post. */ | ||
titleTextMaxLength: Maybe<number>; | ||
/** Minimum length of the title of a post. */ | ||
titleTextMixLength: Maybe<number>; | ||
} | ||
/** A single subreddit. */ | ||
@@ -669,2 +716,7 @@ export declare class Subreddit extends Content implements SubredditData { | ||
getBannedUsers(): Listing<BannedUser>; | ||
/** | ||
* Get the post requirements for this subreddit. | ||
* @returns A promise that resolves to the {@link PostRequirements} for this subreddit. | ||
*/ | ||
getPostRequirements(): Promise<PostRequirements>; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
409085
8552