Merge branch 'makotech222-custom-emojis'
This commit is contained in:
commit
07b05025b0
8 changed files with 142 additions and 1 deletions
32
src/http.ts
32
src/http.ts
|
@ -36,6 +36,11 @@ import {
|
||||||
RemoveCommunity,
|
RemoveCommunity,
|
||||||
TransferCommunity,
|
TransferCommunity,
|
||||||
} from "./interfaces/api/community";
|
} from "./interfaces/api/community";
|
||||||
|
import {
|
||||||
|
CreateCustomEmoji,
|
||||||
|
DeleteCustomEmoji,
|
||||||
|
EditCustomEmoji,
|
||||||
|
} from "./interfaces/api/custom_emoji";
|
||||||
import {
|
import {
|
||||||
AddAdmin,
|
AddAdmin,
|
||||||
AddAdminResponse,
|
AddAdminResponse,
|
||||||
|
@ -1158,6 +1163,33 @@ export class LemmyHttp {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new custom emoji
|
||||||
|
*
|
||||||
|
* `HTTP.POST /custom_emoji`
|
||||||
|
*/
|
||||||
|
async createCustomEmoji(form: CreateCustomEmoji) {
|
||||||
|
return this.wrapper(HttpType.Post, "/custom_emoji", form);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit an existing custom emoji
|
||||||
|
*
|
||||||
|
* `HTTP.PUT /custom_emoji`
|
||||||
|
*/
|
||||||
|
async editCustomEmoji(form: EditCustomEmoji) {
|
||||||
|
return this.wrapper(HttpType.Put, "/custom_emoji", form);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a custom emoji
|
||||||
|
*
|
||||||
|
* `HTTP.Post /custom_emoji/delete`
|
||||||
|
*/
|
||||||
|
async deleteCustomEmoji(form: DeleteCustomEmoji) {
|
||||||
|
return this.wrapper(HttpType.Post, "/custom_emoji/delete", form);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Upload an image to the server.
|
* Upload an image to the server.
|
||||||
*/
|
*/
|
||||||
|
|
53
src/interfaces/api/custom_emoji.ts
Normal file
53
src/interfaces/api/custom_emoji.ts
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
import { CustomEmojiView } from "../views";
|
||||||
|
|
||||||
|
export class CreateCustomEmoji {
|
||||||
|
category: string;
|
||||||
|
shortcode: string;
|
||||||
|
image_url: string;
|
||||||
|
alt_text: string;
|
||||||
|
keywords: string[];
|
||||||
|
auth: string;
|
||||||
|
|
||||||
|
constructor(init: CreateCustomEmoji) {
|
||||||
|
Object.assign(this, init);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class EditCustomEmoji {
|
||||||
|
id: number;
|
||||||
|
category: string;
|
||||||
|
image_url: string;
|
||||||
|
alt_text: string;
|
||||||
|
keywords: string[];
|
||||||
|
auth: string;
|
||||||
|
|
||||||
|
constructor(init: EditCustomEmoji) {
|
||||||
|
Object.assign(this, init);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class DeleteCustomEmoji {
|
||||||
|
id: number;
|
||||||
|
auth: string;
|
||||||
|
|
||||||
|
constructor(init: DeleteCustomEmoji) {
|
||||||
|
Object.assign(this, init);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class DeleteCustomEmojiResponse {
|
||||||
|
id: number;
|
||||||
|
success: boolean;
|
||||||
|
|
||||||
|
constructor(init: DeleteCustomEmojiResponse) {
|
||||||
|
Object.assign(this, init);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CustomEmojiResponse {
|
||||||
|
custom_emoji: CustomEmojiView;
|
||||||
|
|
||||||
|
constructor(init: CustomEmojiResponse) {
|
||||||
|
Object.assign(this, init);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
export * from "./comment";
|
export * from "./comment";
|
||||||
export * from "./community";
|
export * from "./community";
|
||||||
|
export * from "./custom_emoji";
|
||||||
export * from "./person";
|
export * from "./person";
|
||||||
export * from "./post";
|
export * from "./post";
|
||||||
export * from "./site";
|
export * from "./site";
|
||||||
|
|
|
@ -10,6 +10,7 @@ import {
|
||||||
CommunityFollowerView,
|
CommunityFollowerView,
|
||||||
CommunityModeratorView,
|
CommunityModeratorView,
|
||||||
CommunityView,
|
CommunityView,
|
||||||
|
CustomEmojiView,
|
||||||
LocalUserSettingsView,
|
LocalUserSettingsView,
|
||||||
ModAddCommunityView,
|
ModAddCommunityView,
|
||||||
ModAddView,
|
ModAddView,
|
||||||
|
@ -195,7 +196,8 @@ export interface GetSiteResponse {
|
||||||
federated_instances?: FederatedInstances;
|
federated_instances?: FederatedInstances;
|
||||||
all_languages: Language[];
|
all_languages: Language[];
|
||||||
discussion_languages: number[];
|
discussion_languages: number[];
|
||||||
taglines?: Tagline[];
|
taglines: Tagline[];
|
||||||
|
custom_emojis: CustomEmojiView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -86,6 +86,9 @@ export enum UserOperation {
|
||||||
GetReportCount,
|
GetReportCount,
|
||||||
GetUnreadCount,
|
GetUnreadCount,
|
||||||
VerifyEmail,
|
VerifyEmail,
|
||||||
|
CreateCustomEmoji,
|
||||||
|
EditCustomEmoji,
|
||||||
|
DeleteCustomEmoji,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -391,3 +391,20 @@ export interface Tagline {
|
||||||
published: string;
|
published: string;
|
||||||
updated?: string;
|
updated?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class CustomEmoji {
|
||||||
|
id: number;
|
||||||
|
local_site_id: number;
|
||||||
|
shortcode: string;
|
||||||
|
image_url: string;
|
||||||
|
alt_text: string;
|
||||||
|
category: string;
|
||||||
|
published: string;
|
||||||
|
updated: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CustomEmojiKeyword {
|
||||||
|
id: number;
|
||||||
|
custom_emoji_id: number;
|
||||||
|
keyword: string;
|
||||||
|
}
|
||||||
|
|
|
@ -15,6 +15,8 @@ import {
|
||||||
CommentReply,
|
CommentReply,
|
||||||
CommentReport,
|
CommentReport,
|
||||||
CommunitySafe,
|
CommunitySafe,
|
||||||
|
CustomEmoji,
|
||||||
|
CustomEmojiKeyword,
|
||||||
LocalSite,
|
LocalSite,
|
||||||
LocalSiteRateLimit,
|
LocalSiteRateLimit,
|
||||||
LocalUserSettings,
|
LocalUserSettings,
|
||||||
|
@ -289,3 +291,8 @@ export interface PrivateMessageReportView {
|
||||||
creator: PersonSafe;
|
creator: PersonSafe;
|
||||||
resolver?: PersonSafe;
|
resolver?: PersonSafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class CustomEmojiView {
|
||||||
|
custom_emoji: CustomEmoji;
|
||||||
|
keywords: CustomEmojiKeyword[];
|
||||||
|
}
|
||||||
|
|
|
@ -23,6 +23,11 @@ import {
|
||||||
RemoveCommunity,
|
RemoveCommunity,
|
||||||
TransferCommunity,
|
TransferCommunity,
|
||||||
} from "./interfaces/api/community";
|
} from "./interfaces/api/community";
|
||||||
|
import {
|
||||||
|
CreateCustomEmoji,
|
||||||
|
DeleteCustomEmoji,
|
||||||
|
EditCustomEmoji,
|
||||||
|
} from "./interfaces/api/custom_emoji";
|
||||||
import {
|
import {
|
||||||
AddAdmin,
|
AddAdmin,
|
||||||
BanPerson,
|
BanPerson,
|
||||||
|
@ -682,6 +687,27 @@ export class LemmyWebsocket {
|
||||||
purgeComment(form: PurgeComment) {
|
purgeComment(form: PurgeComment) {
|
||||||
return wrapper(UserOperation.PurgeComment, form);
|
return wrapper(UserOperation.PurgeComment, form);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a custom emoji
|
||||||
|
*/
|
||||||
|
createCustomEmoji(form: CreateCustomEmoji) {
|
||||||
|
return wrapper(UserOperation.CreateCustomEmoji, form);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit a custom emoji
|
||||||
|
*/
|
||||||
|
editCustomEmoji(form: EditCustomEmoji) {
|
||||||
|
return wrapper(UserOperation.EditCustomEmoji, form);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a custom emoji
|
||||||
|
*/
|
||||||
|
deleteCustomEmoji(form: DeleteCustomEmoji) {
|
||||||
|
return wrapper(UserOperation.DeleteCustomEmoji, form);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function wrapper<MessageType>(op: UserOperation, data: MessageType) {
|
function wrapper<MessageType>(op: UserOperation, data: MessageType) {
|
||||||
|
|
Loading…
Reference in a new issue