Merge branch 'main' into fix_add_admin

This commit is contained in:
SleeplessOne1917 2023-09-06 12:48:55 -04:00 committed by GitHub
commit 4c5cbaf2a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 51 additions and 4 deletions

View file

@ -24,3 +24,5 @@ find src/types -type f -name '*.ts' -exec sed -i 's/bigint/number/g' {} +
node putTypesInIndex.js
prettier -w src/types

View file

@ -134,6 +134,8 @@ import { TransferCommunity } from "./types/TransferCommunity";
import { VerifyEmail } from "./types/VerifyEmail";
import { VerifyEmailResponse } from "./types/VerifyEmailResponse";
import { UploadImage, UploadImageResponse, VERSION } from "./types/others";
import { BlockInstance } from "./types/BlockInstance";
import { BlockInstanceResponse } from "./types/BlockInstanceResponse";
enum HttpType {
Get = "GET",
@ -1207,7 +1209,7 @@ export class LemmyHttp {
*
* `HTTP.POST /custom_emoji`
*/
async createCustomEmoji(form: CreateCustomEmoji) {
createCustomEmoji(form: CreateCustomEmoji) {
return this.#wrapper<CreateCustomEmoji, CustomEmojiResponse>(
HttpType.Post,
"/custom_emoji",
@ -1220,7 +1222,7 @@ export class LemmyHttp {
*
* `HTTP.PUT /custom_emoji`
*/
async editCustomEmoji(form: EditCustomEmoji) {
editCustomEmoji(form: EditCustomEmoji) {
return this.#wrapper<EditCustomEmoji, CustomEmojiResponse>(
HttpType.Put,
"/custom_emoji",
@ -1233,7 +1235,7 @@ export class LemmyHttp {
*
* `HTTP.Post /custom_emoji/delete`
*/
async deleteCustomEmoji(form: DeleteCustomEmoji) {
deleteCustomEmoji(form: DeleteCustomEmoji) {
return this.#wrapper<DeleteCustomEmoji, DeleteCustomEmojiResponse>(
HttpType.Post,
"/custom_emoji/delete",
@ -1246,7 +1248,7 @@ export class LemmyHttp {
*
* `HTTP.Get /federated_instances`
*/
async getFederatedInstances(form: GetFederatedInstances = {}) {
getFederatedInstances(form: GetFederatedInstances = {}) {
return this.#wrapper<GetFederatedInstances, GetFederatedInstancesResponse>(
HttpType.Get,
"/federated_instances",
@ -1254,6 +1256,19 @@ export class LemmyHttp {
);
}
/**
* Block an instance
*
* `HTTP.POST /site/block`
*/
blockInstance(form: BlockInstance) {
return this.#wrapper<BlockInstance, BlockInstanceResponse>(
HttpType.Post,
"/site/block",
form,
);
}
/**
* Upload an image to the server.
*/

View file

@ -19,6 +19,8 @@ export { BanPersonResponse } from "./types/BanPersonResponse";
export { BannedPersonsResponse } from "./types/BannedPersonsResponse";
export { BlockCommunity } from "./types/BlockCommunity";
export { BlockCommunityResponse } from "./types/BlockCommunityResponse";
export { BlockInstance } from "./types/BlockInstance";
export { BlockInstanceResponse } from "./types/BlockInstanceResponse";
export { BlockPerson } from "./types/BlockPerson";
export { BlockPersonResponse } from "./types/BlockPersonResponse";
export { CaptchaResponse } from "./types/CaptchaResponse";
@ -117,6 +119,7 @@ export { GetUnreadRegistrationApplicationCount } from "./types/GetUnreadRegistra
export { GetUnreadRegistrationApplicationCountResponse } from "./types/GetUnreadRegistrationApplicationCountResponse";
export { HideCommunity } from "./types/HideCommunity";
export { Instance } from "./types/Instance";
export { InstanceBlockView } from "./types/InstanceBlockView";
export { InstanceId } from "./types/InstanceId";
export { Language } from "./types/Language";
export { LanguageId } from "./types/LanguageId";

View file

@ -0,0 +1,8 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { InstanceId } from "./InstanceId";
export interface BlockInstance {
instance_id: InstanceId;
block: boolean;
auth: string;
}

View file

@ -0,0 +1,5 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export interface BlockInstanceResponse {
blocked: boolean;
}

View file

@ -0,0 +1,10 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Instance } from "./Instance";
import type { Person } from "./Person";
import type { Site } from "./Site";
export interface InstanceBlockView {
person: Person;
instance: Instance;
site?: Site;
}

View file

@ -2,6 +2,7 @@
import type { CommunityBlockView } from "./CommunityBlockView";
import type { CommunityFollowerView } from "./CommunityFollowerView";
import type { CommunityModeratorView } from "./CommunityModeratorView";
import type { InstanceBlockView } from "./InstanceBlockView";
import type { LanguageId } from "./LanguageId";
import type { LocalUserView } from "./LocalUserView";
import type { PersonBlockView } from "./PersonBlockView";
@ -11,6 +12,7 @@ export interface MyUserInfo {
follows: Array<CommunityFollowerView>;
moderates: Array<CommunityModeratorView>;
community_blocks: Array<CommunityBlockView>;
instance_blocks: Array<InstanceBlockView>;
person_blocks: Array<PersonBlockView>;
discussion_languages: Array<LanguageId>;
}

View file

@ -1,5 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { CommunityId } from "./CommunityId";
import type { InstanceId } from "./InstanceId";
import type { PersonId } from "./PersonId";
import type { PostId } from "./PostId";
@ -20,4 +21,5 @@ export interface PostAggregates {
community_id: CommunityId;
creator_id: PersonId;
controversy_rank: number;
instance_id: InstanceId;
}