mirror of
https://github.com/LemmyNet/lemmy-js-client.git
synced 2024-12-11 21:41:26 +00:00
Merge branch 'main' into pkce
This commit is contained in:
commit
b76fce1cbe
15 changed files with 127 additions and 20 deletions
39
src/http.ts
39
src/http.ts
|
@ -129,8 +129,6 @@ import {
|
||||||
VERSION,
|
VERSION,
|
||||||
} from "./other_types";
|
} from "./other_types";
|
||||||
import { HideCommunity } from "./types/HideCommunity";
|
import { HideCommunity } from "./types/HideCommunity";
|
||||||
import { BlockInstance } from "./types/BlockInstance";
|
|
||||||
import { BlockInstanceResponse } from "./types/BlockInstanceResponse";
|
|
||||||
import { GenerateTotpSecretResponse } from "./types/GenerateTotpSecretResponse";
|
import { GenerateTotpSecretResponse } from "./types/GenerateTotpSecretResponse";
|
||||||
import { UpdateTotp } from "./types/UpdateTotp";
|
import { UpdateTotp } from "./types/UpdateTotp";
|
||||||
import { UpdateTotpResponse } from "./types/UpdateTotpResponse";
|
import { UpdateTotpResponse } from "./types/UpdateTotpResponse";
|
||||||
|
@ -160,6 +158,9 @@ import { GetCommunityPendingFollowsCountResponse } from "./types/GetCommunityPen
|
||||||
import { ListCommunityPendingFollowsResponse } from "./types/ListCommunityPendingFollowsResponse";
|
import { ListCommunityPendingFollowsResponse } from "./types/ListCommunityPendingFollowsResponse";
|
||||||
import { ListCommunityPendingFollows } from "./types/ListCommunityPendingFollows";
|
import { ListCommunityPendingFollows } from "./types/ListCommunityPendingFollows";
|
||||||
import { CommunityId } from "./types/CommunityId";
|
import { CommunityId } from "./types/CommunityId";
|
||||||
|
import { UserBlockInstanceParams } from "./types/UserBlockInstanceParams";
|
||||||
|
import { AdminAllowInstanceParams } from "./types/AdminAllowInstanceParams";
|
||||||
|
import { AdminBlockInstanceParams } from "./types/AdminBlockInstanceParams";
|
||||||
|
|
||||||
enum HttpType {
|
enum HttpType {
|
||||||
Get = "GET",
|
Get = "GET",
|
||||||
|
@ -1786,12 +1787,12 @@ export class LemmyHttp {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Block an instance.
|
* Block an instance as user.
|
||||||
*
|
*
|
||||||
* `HTTP.Post /site/block`
|
* `HTTP.Post /site/block`
|
||||||
*/
|
*/
|
||||||
blockInstance(form: BlockInstance, options?: RequestOptions) {
|
userBlockInstance(form: UserBlockInstanceParams, options?: RequestOptions) {
|
||||||
return this.#wrapper<BlockInstance, BlockInstanceResponse>(
|
return this.#wrapper<UserBlockInstanceParams, SuccessResponse>(
|
||||||
HttpType.Post,
|
HttpType.Post,
|
||||||
"/site/block",
|
"/site/block",
|
||||||
form,
|
form,
|
||||||
|
@ -1799,6 +1800,34 @@ export class LemmyHttp {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Globally block an instance as admin.
|
||||||
|
*
|
||||||
|
* `HTTP.Post /admin/block_instance`
|
||||||
|
*/
|
||||||
|
adminBlockInstance(form: AdminBlockInstanceParams, options?: RequestOptions) {
|
||||||
|
return this.#wrapper<AdminBlockInstanceParams, SuccessResponse>(
|
||||||
|
HttpType.Post,
|
||||||
|
"/admin/block_instance",
|
||||||
|
form,
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Globally allow an instance as admin.
|
||||||
|
*
|
||||||
|
* `HTTP.Post /admin/allow_instance`
|
||||||
|
*/
|
||||||
|
adminAllowInstance(form: AdminAllowInstanceParams, options?: RequestOptions) {
|
||||||
|
return this.#wrapper<AdminAllowInstanceParams, SuccessResponse>(
|
||||||
|
HttpType.Post,
|
||||||
|
"/admin/allow_instance",
|
||||||
|
form,
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Upload an image to the server.
|
* Upload an image to the server.
|
||||||
*/
|
*/
|
||||||
|
|
10
src/index.ts
10
src/index.ts
|
@ -10,6 +10,12 @@ export { AddAdmin } from "./types/AddAdmin";
|
||||||
export { AddAdminResponse } from "./types/AddAdminResponse";
|
export { AddAdminResponse } from "./types/AddAdminResponse";
|
||||||
export { AddModToCommunity } from "./types/AddModToCommunity";
|
export { AddModToCommunity } from "./types/AddModToCommunity";
|
||||||
export { AddModToCommunityResponse } from "./types/AddModToCommunityResponse";
|
export { AddModToCommunityResponse } from "./types/AddModToCommunityResponse";
|
||||||
|
export { AdminAllowInstance } from "./types/AdminAllowInstance";
|
||||||
|
export { AdminAllowInstanceParams } from "./types/AdminAllowInstanceParams";
|
||||||
|
export { AdminAllowInstanceView } from "./types/AdminAllowInstanceView";
|
||||||
|
export { AdminBlockInstance } from "./types/AdminBlockInstance";
|
||||||
|
export { AdminBlockInstanceParams } from "./types/AdminBlockInstanceParams";
|
||||||
|
export { AdminBlockInstanceView } from "./types/AdminBlockInstanceView";
|
||||||
export { AdminPurgeComment } from "./types/AdminPurgeComment";
|
export { AdminPurgeComment } from "./types/AdminPurgeComment";
|
||||||
export { AdminPurgeCommentView } from "./types/AdminPurgeCommentView";
|
export { AdminPurgeCommentView } from "./types/AdminPurgeCommentView";
|
||||||
export { AdminPurgeCommunity } from "./types/AdminPurgeCommunity";
|
export { AdminPurgeCommunity } from "./types/AdminPurgeCommunity";
|
||||||
|
@ -28,8 +34,6 @@ export { BanPersonResponse } from "./types/BanPersonResponse";
|
||||||
export { BannedPersonsResponse } from "./types/BannedPersonsResponse";
|
export { BannedPersonsResponse } from "./types/BannedPersonsResponse";
|
||||||
export { BlockCommunity } from "./types/BlockCommunity";
|
export { BlockCommunity } from "./types/BlockCommunity";
|
||||||
export { BlockCommunityResponse } from "./types/BlockCommunityResponse";
|
export { BlockCommunityResponse } from "./types/BlockCommunityResponse";
|
||||||
export { BlockInstance } from "./types/BlockInstance";
|
|
||||||
export { BlockInstanceResponse } from "./types/BlockInstanceResponse";
|
|
||||||
export { BlockPerson } from "./types/BlockPerson";
|
export { BlockPerson } from "./types/BlockPerson";
|
||||||
export { BlockPersonResponse } from "./types/BlockPersonResponse";
|
export { BlockPersonResponse } from "./types/BlockPersonResponse";
|
||||||
export { CaptchaResponse } from "./types/CaptchaResponse";
|
export { CaptchaResponse } from "./types/CaptchaResponse";
|
||||||
|
@ -95,6 +99,7 @@ export { EditPrivateMessage } from "./types/EditPrivateMessage";
|
||||||
export { EditSite } from "./types/EditSite";
|
export { EditSite } from "./types/EditSite";
|
||||||
export { FeaturePost } from "./types/FeaturePost";
|
export { FeaturePost } from "./types/FeaturePost";
|
||||||
export { FederatedInstances } from "./types/FederatedInstances";
|
export { FederatedInstances } from "./types/FederatedInstances";
|
||||||
|
export { FederationBlockList } from "./types/FederationBlockList";
|
||||||
export { FederationError } from "./types/FederationError";
|
export { FederationError } from "./types/FederationError";
|
||||||
export { FederationMode } from "./types/FederationMode";
|
export { FederationMode } from "./types/FederationMode";
|
||||||
export { FollowCommunity } from "./types/FollowCommunity";
|
export { FollowCommunity } from "./types/FollowCommunity";
|
||||||
|
@ -286,5 +291,6 @@ export { TransferCommunity } from "./types/TransferCommunity";
|
||||||
export { UpdateTagline } from "./types/UpdateTagline";
|
export { UpdateTagline } from "./types/UpdateTagline";
|
||||||
export { UpdateTotp } from "./types/UpdateTotp";
|
export { UpdateTotp } from "./types/UpdateTotp";
|
||||||
export { UpdateTotpResponse } from "./types/UpdateTotpResponse";
|
export { UpdateTotpResponse } from "./types/UpdateTotpResponse";
|
||||||
|
export { UserBlockInstanceParams } from "./types/UserBlockInstanceParams";
|
||||||
export { VerifyEmail } from "./types/VerifyEmail";
|
export { VerifyEmail } from "./types/VerifyEmail";
|
||||||
export { VoteView } from "./types/VoteView";
|
export { VoteView } from "./types/VoteView";
|
||||||
|
|
12
src/types/AdminAllowInstance.ts
Normal file
12
src/types/AdminAllowInstance.ts
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
// 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";
|
||||||
|
import type { PersonId } from "./PersonId";
|
||||||
|
|
||||||
|
export type AdminAllowInstance = {
|
||||||
|
id: number;
|
||||||
|
instance_id: InstanceId;
|
||||||
|
admin_person_id: PersonId;
|
||||||
|
allowed: boolean;
|
||||||
|
reason?: string;
|
||||||
|
published: string;
|
||||||
|
};
|
|
@ -1,3 +1,7 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||||
|
|
||||||
export type BlockInstanceResponse = { blocked: boolean };
|
export type AdminAllowInstanceParams = {
|
||||||
|
instance: string;
|
||||||
|
allow: boolean;
|
||||||
|
reason?: string;
|
||||||
|
};
|
13
src/types/AdminAllowInstanceView.ts
Normal file
13
src/types/AdminAllowInstanceView.ts
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||||
|
import type { AdminAllowInstance } from "./AdminAllowInstance";
|
||||||
|
import type { Instance } from "./Instance";
|
||||||
|
import type { Person } from "./Person";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When an admin purges a post.
|
||||||
|
*/
|
||||||
|
export type AdminAllowInstanceView = {
|
||||||
|
admin_block_instance: AdminAllowInstance;
|
||||||
|
instance: Instance;
|
||||||
|
admin?: Person;
|
||||||
|
};
|
13
src/types/AdminBlockInstance.ts
Normal file
13
src/types/AdminBlockInstance.ts
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
// 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";
|
||||||
|
import type { PersonId } from "./PersonId";
|
||||||
|
|
||||||
|
export type AdminBlockInstance = {
|
||||||
|
id: number;
|
||||||
|
instance_id: InstanceId;
|
||||||
|
admin_person_id: PersonId;
|
||||||
|
blocked: boolean;
|
||||||
|
reason?: string;
|
||||||
|
expires?: string;
|
||||||
|
published: string;
|
||||||
|
};
|
8
src/types/AdminBlockInstanceParams.ts
Normal file
8
src/types/AdminBlockInstanceParams.ts
Normal 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.
|
||||||
|
|
||||||
|
export type AdminBlockInstanceParams = {
|
||||||
|
instance: string;
|
||||||
|
block: boolean;
|
||||||
|
reason?: string;
|
||||||
|
expires?: string;
|
||||||
|
};
|
13
src/types/AdminBlockInstanceView.ts
Normal file
13
src/types/AdminBlockInstanceView.ts
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||||
|
import type { AdminBlockInstance } from "./AdminBlockInstance";
|
||||||
|
import type { Instance } from "./Instance";
|
||||||
|
import type { Person } from "./Person";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When an admin purges a post.
|
||||||
|
*/
|
||||||
|
export type AdminBlockInstanceView = {
|
||||||
|
admin_block_instance: AdminBlockInstance;
|
||||||
|
instance: Instance;
|
||||||
|
admin?: Person;
|
||||||
|
};
|
|
@ -48,8 +48,6 @@ export type CreateSite = {
|
||||||
federation_debug?: boolean;
|
federation_debug?: boolean;
|
||||||
captcha_enabled?: boolean;
|
captcha_enabled?: boolean;
|
||||||
captcha_difficulty?: string;
|
captcha_difficulty?: string;
|
||||||
allowed_instances?: Array<string>;
|
|
||||||
blocked_instances?: Array<string>;
|
|
||||||
registration_mode?: RegistrationMode;
|
registration_mode?: RegistrationMode;
|
||||||
oauth_registration?: boolean;
|
oauth_registration?: boolean;
|
||||||
content_warning?: string;
|
content_warning?: string;
|
||||||
|
|
|
@ -138,14 +138,6 @@ export type EditSite = {
|
||||||
* The captcha difficulty. Can be easy, medium, or hard
|
* The captcha difficulty. Can be easy, medium, or hard
|
||||||
*/
|
*/
|
||||||
captcha_difficulty?: string;
|
captcha_difficulty?: string;
|
||||||
/**
|
|
||||||
* A list of allowed instances. If none are set, federation is open.
|
|
||||||
*/
|
|
||||||
allowed_instances?: Array<string>;
|
|
||||||
/**
|
|
||||||
* A list of blocked instances.
|
|
||||||
*/
|
|
||||||
blocked_instances?: Array<string>;
|
|
||||||
/**
|
/**
|
||||||
* A list of blocked URLs
|
* A list of blocked URLs
|
||||||
*/
|
*/
|
||||||
|
|
9
src/types/FederationBlockList.ts
Normal file
9
src/types/FederationBlockList.ts
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
// 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 type FederationBlockList = {
|
||||||
|
instance_id: InstanceId;
|
||||||
|
published: string;
|
||||||
|
updated?: string;
|
||||||
|
expires?: string;
|
||||||
|
};
|
|
@ -1,4 +1,6 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||||
|
import type { AdminAllowInstanceView } from "./AdminAllowInstanceView";
|
||||||
|
import type { AdminBlockInstanceView } from "./AdminBlockInstanceView";
|
||||||
import type { AdminPurgeCommentView } from "./AdminPurgeCommentView";
|
import type { AdminPurgeCommentView } from "./AdminPurgeCommentView";
|
||||||
import type { AdminPurgeCommunityView } from "./AdminPurgeCommunityView";
|
import type { AdminPurgeCommunityView } from "./AdminPurgeCommunityView";
|
||||||
import type { AdminPurgePersonView } from "./AdminPurgePersonView";
|
import type { AdminPurgePersonView } from "./AdminPurgePersonView";
|
||||||
|
@ -34,4 +36,6 @@ export type GetModlogResponse = {
|
||||||
admin_purged_posts: Array<AdminPurgePostView>;
|
admin_purged_posts: Array<AdminPurgePostView>;
|
||||||
admin_purged_comments: Array<AdminPurgeCommentView>;
|
admin_purged_comments: Array<AdminPurgeCommentView>;
|
||||||
hidden_communities: Array<ModHideCommunityView>;
|
hidden_communities: Array<ModHideCommunityView>;
|
||||||
|
admin_block_instance: Array<AdminBlockInstanceView>;
|
||||||
|
admin_allow_instance: Array<AdminAllowInstanceView>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -137,4 +137,5 @@ export type LemmyErrorType =
|
||||||
| { error: "community_has_no_followers" }
|
| { error: "community_has_no_followers" }
|
||||||
| { error: "post_schedule_time_must_be_in_future" }
|
| { error: "post_schedule_time_must_be_in_future" }
|
||||||
| { error: "too_many_scheduled_posts" }
|
| { error: "too_many_scheduled_posts" }
|
||||||
|
| { error: "cannot_combine_federation_blocklist_and_allowlist" }
|
||||||
| { error: "federation_error"; message: { error?: FederationError } };
|
| { error: "federation_error"; message: { error?: FederationError } };
|
||||||
|
|
|
@ -19,4 +19,6 @@ export type ModlogActionType =
|
||||||
| "AdminPurgePerson"
|
| "AdminPurgePerson"
|
||||||
| "AdminPurgeCommunity"
|
| "AdminPurgeCommunity"
|
||||||
| "AdminPurgePost"
|
| "AdminPurgePost"
|
||||||
| "AdminPurgeComment";
|
| "AdminPurgeComment"
|
||||||
|
| "AdminBlockInstance"
|
||||||
|
| "AdminAllowInstance";
|
||||||
|
|
|
@ -4,4 +4,7 @@ import type { InstanceId } from "./InstanceId";
|
||||||
/**
|
/**
|
||||||
* Block an instance as user
|
* Block an instance as user
|
||||||
*/
|
*/
|
||||||
export type BlockInstance = { instance_id: InstanceId; block: boolean };
|
export type UserBlockInstanceParams = {
|
||||||
|
instance_id: InstanceId;
|
||||||
|
block: boolean;
|
||||||
|
};
|
Loading…
Reference in a new issue