mirror of
https://github.com/LemmyNet/lemmy-js-client.git
synced 2024-11-26 14:21:12 +00:00
Adding block instance. (#178)
* Adding block instance. - https://github.com/LemmyNet/lemmy/pull/3869 * v0.19.0-rc.4 * Forgot to add types. * v0.19.0-rc.5 * Fixing optional site issue.
This commit is contained in:
parent
e487c34176
commit
4439d22157
12 changed files with 60 additions and 7 deletions
|
@ -24,3 +24,5 @@ find src/types -type f -name '*.ts' -exec sed -i 's/bigint/number/g' {} +
|
||||||
|
|
||||||
node putTypesInIndex.js
|
node putTypesInIndex.js
|
||||||
|
|
||||||
|
prettier -w src/types
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "lemmy-js-client",
|
"name": "lemmy-js-client",
|
||||||
"version": "0.19.0-rc.3",
|
"version": "0.19.0-rc.5",
|
||||||
"description": "A javascript / typescript client for Lemmy",
|
"description": "A javascript / typescript client for Lemmy",
|
||||||
"repository": "https://github.com/LemmyNet/lemmy-js-client",
|
"repository": "https://github.com/LemmyNet/lemmy-js-client",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
|
|
23
src/http.ts
23
src/http.ts
|
@ -134,6 +134,8 @@ import { TransferCommunity } from "./types/TransferCommunity";
|
||||||
import { VerifyEmail } from "./types/VerifyEmail";
|
import { VerifyEmail } from "./types/VerifyEmail";
|
||||||
import { VerifyEmailResponse } from "./types/VerifyEmailResponse";
|
import { VerifyEmailResponse } from "./types/VerifyEmailResponse";
|
||||||
import { UploadImage, UploadImageResponse, VERSION } from "./types/others";
|
import { UploadImage, UploadImageResponse, VERSION } from "./types/others";
|
||||||
|
import { BlockInstance } from "./types/BlockInstance";
|
||||||
|
import { BlockInstanceResponse } from "./types/BlockInstanceResponse";
|
||||||
|
|
||||||
enum HttpType {
|
enum HttpType {
|
||||||
Get = "GET",
|
Get = "GET",
|
||||||
|
@ -1207,7 +1209,7 @@ export class LemmyHttp {
|
||||||
*
|
*
|
||||||
* `HTTP.POST /custom_emoji`
|
* `HTTP.POST /custom_emoji`
|
||||||
*/
|
*/
|
||||||
async createCustomEmoji(form: CreateCustomEmoji) {
|
createCustomEmoji(form: CreateCustomEmoji) {
|
||||||
return this.#wrapper<CreateCustomEmoji, CustomEmojiResponse>(
|
return this.#wrapper<CreateCustomEmoji, CustomEmojiResponse>(
|
||||||
HttpType.Post,
|
HttpType.Post,
|
||||||
"/custom_emoji",
|
"/custom_emoji",
|
||||||
|
@ -1220,7 +1222,7 @@ export class LemmyHttp {
|
||||||
*
|
*
|
||||||
* `HTTP.PUT /custom_emoji`
|
* `HTTP.PUT /custom_emoji`
|
||||||
*/
|
*/
|
||||||
async editCustomEmoji(form: EditCustomEmoji) {
|
editCustomEmoji(form: EditCustomEmoji) {
|
||||||
return this.#wrapper<EditCustomEmoji, CustomEmojiResponse>(
|
return this.#wrapper<EditCustomEmoji, CustomEmojiResponse>(
|
||||||
HttpType.Put,
|
HttpType.Put,
|
||||||
"/custom_emoji",
|
"/custom_emoji",
|
||||||
|
@ -1233,7 +1235,7 @@ export class LemmyHttp {
|
||||||
*
|
*
|
||||||
* `HTTP.Post /custom_emoji/delete`
|
* `HTTP.Post /custom_emoji/delete`
|
||||||
*/
|
*/
|
||||||
async deleteCustomEmoji(form: DeleteCustomEmoji) {
|
deleteCustomEmoji(form: DeleteCustomEmoji) {
|
||||||
return this.#wrapper<DeleteCustomEmoji, DeleteCustomEmojiResponse>(
|
return this.#wrapper<DeleteCustomEmoji, DeleteCustomEmojiResponse>(
|
||||||
HttpType.Post,
|
HttpType.Post,
|
||||||
"/custom_emoji/delete",
|
"/custom_emoji/delete",
|
||||||
|
@ -1246,7 +1248,7 @@ export class LemmyHttp {
|
||||||
*
|
*
|
||||||
* `HTTP.Get /federated_instances`
|
* `HTTP.Get /federated_instances`
|
||||||
*/
|
*/
|
||||||
async getFederatedInstances(form: GetFederatedInstances = {}) {
|
getFederatedInstances(form: GetFederatedInstances = {}) {
|
||||||
return this.#wrapper<GetFederatedInstances, GetFederatedInstancesResponse>(
|
return this.#wrapper<GetFederatedInstances, GetFederatedInstancesResponse>(
|
||||||
HttpType.Get,
|
HttpType.Get,
|
||||||
"/federated_instances",
|
"/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.
|
* Upload an image to the server.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -19,6 +19,8 @@ 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";
|
||||||
|
@ -117,6 +119,7 @@ export { GetUnreadRegistrationApplicationCount } from "./types/GetUnreadRegistra
|
||||||
export { GetUnreadRegistrationApplicationCountResponse } from "./types/GetUnreadRegistrationApplicationCountResponse";
|
export { GetUnreadRegistrationApplicationCountResponse } from "./types/GetUnreadRegistrationApplicationCountResponse";
|
||||||
export { HideCommunity } from "./types/HideCommunity";
|
export { HideCommunity } from "./types/HideCommunity";
|
||||||
export { Instance } from "./types/Instance";
|
export { Instance } from "./types/Instance";
|
||||||
|
export { InstanceBlockView } from "./types/InstanceBlockView";
|
||||||
export { InstanceId } from "./types/InstanceId";
|
export { InstanceId } from "./types/InstanceId";
|
||||||
export { Language } from "./types/Language";
|
export { Language } from "./types/Language";
|
||||||
export { LanguageId } from "./types/LanguageId";
|
export { LanguageId } from "./types/LanguageId";
|
||||||
|
@ -194,6 +197,7 @@ export { PostFeatureType } from "./types/PostFeatureType";
|
||||||
export { PostId } from "./types/PostId";
|
export { PostId } from "./types/PostId";
|
||||||
export { PostJoin } from "./types/PostJoin";
|
export { PostJoin } from "./types/PostJoin";
|
||||||
export { PostJoinResponse } from "./types/PostJoinResponse";
|
export { PostJoinResponse } from "./types/PostJoinResponse";
|
||||||
|
export { PostListingMode } from "./types/PostListingMode";
|
||||||
export { PostOrCommentId } from "./types/PostOrCommentId";
|
export { PostOrCommentId } from "./types/PostOrCommentId";
|
||||||
export { PostReport } from "./types/PostReport";
|
export { PostReport } from "./types/PostReport";
|
||||||
export { PostReportId } from "./types/PostReportId";
|
export { PostReportId } from "./types/PostReportId";
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// 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 { LocalUserId } from "./LocalUserId";
|
import type { PersonId } from "./PersonId";
|
||||||
|
|
||||||
export interface AddAdmin {
|
export interface AddAdmin {
|
||||||
local_user_id: LocalUserId;
|
person_id: PersonId;
|
||||||
added: boolean;
|
added: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
}
|
}
|
||||||
|
|
8
src/types/BlockInstance.ts
Normal file
8
src/types/BlockInstance.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.
|
||||||
|
import type { InstanceId } from "./InstanceId";
|
||||||
|
|
||||||
|
export interface BlockInstance {
|
||||||
|
instance_id: InstanceId;
|
||||||
|
block: boolean;
|
||||||
|
auth: string;
|
||||||
|
}
|
5
src/types/BlockInstanceResponse.ts
Normal file
5
src/types/BlockInstanceResponse.ts
Normal 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;
|
||||||
|
}
|
10
src/types/InstanceBlockView.ts
Normal file
10
src/types/InstanceBlockView.ts
Normal 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;
|
||||||
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
import type { ListingType } from "./ListingType";
|
import type { ListingType } from "./ListingType";
|
||||||
import type { LocalUserId } from "./LocalUserId";
|
import type { LocalUserId } from "./LocalUserId";
|
||||||
import type { PersonId } from "./PersonId";
|
import type { PersonId } from "./PersonId";
|
||||||
|
import type { PostListingMode } from "./PostListingMode";
|
||||||
import type { SortType } from "./SortType";
|
import type { SortType } from "./SortType";
|
||||||
|
|
||||||
export interface LocalUser {
|
export interface LocalUser {
|
||||||
|
@ -28,4 +29,5 @@ export interface LocalUser {
|
||||||
auto_expand: boolean;
|
auto_expand: boolean;
|
||||||
infinite_scroll_enabled: boolean;
|
infinite_scroll_enabled: boolean;
|
||||||
admin: boolean;
|
admin: boolean;
|
||||||
|
post_listing_mode: PostListingMode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import type { CommunityBlockView } from "./CommunityBlockView";
|
import type { CommunityBlockView } from "./CommunityBlockView";
|
||||||
import type { CommunityFollowerView } from "./CommunityFollowerView";
|
import type { CommunityFollowerView } from "./CommunityFollowerView";
|
||||||
import type { CommunityModeratorView } from "./CommunityModeratorView";
|
import type { CommunityModeratorView } from "./CommunityModeratorView";
|
||||||
|
import type { InstanceBlockView } from "./InstanceBlockView";
|
||||||
import type { LanguageId } from "./LanguageId";
|
import type { LanguageId } from "./LanguageId";
|
||||||
import type { LocalUserView } from "./LocalUserView";
|
import type { LocalUserView } from "./LocalUserView";
|
||||||
import type { PersonBlockView } from "./PersonBlockView";
|
import type { PersonBlockView } from "./PersonBlockView";
|
||||||
|
@ -11,6 +12,7 @@ export interface MyUserInfo {
|
||||||
follows: Array<CommunityFollowerView>;
|
follows: Array<CommunityFollowerView>;
|
||||||
moderates: Array<CommunityModeratorView>;
|
moderates: Array<CommunityModeratorView>;
|
||||||
community_blocks: Array<CommunityBlockView>;
|
community_blocks: Array<CommunityBlockView>;
|
||||||
|
instance_blocks: Array<InstanceBlockView>;
|
||||||
person_blocks: Array<PersonBlockView>;
|
person_blocks: Array<PersonBlockView>;
|
||||||
discussion_languages: Array<LanguageId>;
|
discussion_languages: Array<LanguageId>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +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 { CommunityId } from "./CommunityId";
|
import type { CommunityId } from "./CommunityId";
|
||||||
|
import type { InstanceId } from "./InstanceId";
|
||||||
import type { PersonId } from "./PersonId";
|
import type { PersonId } from "./PersonId";
|
||||||
import type { PostId } from "./PostId";
|
import type { PostId } from "./PostId";
|
||||||
|
|
||||||
|
@ -20,4 +21,5 @@ export interface PostAggregates {
|
||||||
community_id: CommunityId;
|
community_id: CommunityId;
|
||||||
creator_id: PersonId;
|
creator_id: PersonId;
|
||||||
controversy_rank: number;
|
controversy_rank: number;
|
||||||
|
instance_id: InstanceId;
|
||||||
}
|
}
|
||||||
|
|
3
src/types/PostListingMode.ts
Normal file
3
src/types/PostListingMode.ts
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||||
|
|
||||||
|
export type PostListingMode = "List" | "Card" | "SmallCard";
|
Loading…
Reference in a new issue