From a20158614209c613aaec545bafd5ae26ddd8a5fb Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 23 Apr 2021 17:48:54 -0400 Subject: [PATCH] Feature/optional fields (#19) * Making more form fields optional. * v0.11.0-rc.9 --- package.json | 2 +- src/interfaces/api/comment.ts | 6 +++--- src/interfaces/api/community.ts | 8 ++++---- src/interfaces/api/person.ts | 16 ++++++++-------- src/interfaces/api/post.ts | 12 ++++++------ src/interfaces/api/site.ts | 20 ++++++++++---------- 6 files changed, 32 insertions(+), 32 deletions(-) diff --git a/package.json b/package.json index 8dcd864..c78f72d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "lemmy-js-client", "description": "A javascript / typescript client for Lemmy", - "version": "0.11.0-rc.8", + "version": "0.11.0-rc.9", "author": "Dessalines ", "license": "AGPL-3.0", "main": "./dist/index.js", diff --git a/src/interfaces/api/comment.ts b/src/interfaces/api/comment.ts index 078a285..a9b4b3e 100644 --- a/src/interfaces/api/comment.ts +++ b/src/interfaces/api/comment.ts @@ -67,13 +67,13 @@ export interface CreateCommentLike { * `community_name` can only be used for local communities. To get posts for a federated community, pass `community_id` instead. */ export interface GetComments { - type_: string; - sort: string; + type_?: string; + sort?: string; page?: number; limit?: number; community_id?: number; community_name?: string; - saved_only: boolean; + saved_only?: boolean; auth?: string; } diff --git a/src/interfaces/api/community.ts b/src/interfaces/api/community.ts index 2ed8f66..4371fc1 100644 --- a/src/interfaces/api/community.ts +++ b/src/interfaces/api/community.ts @@ -32,8 +32,8 @@ export interface CommunityResponse { } export interface ListCommunities { - type_: string; - sort: string; + type_?: string; + sort?: string; page?: number; limit?: number; auth?: string; @@ -47,7 +47,7 @@ export interface BanFromCommunity { community_id: number; person_id: number; ban: boolean; - remove_data: boolean; // Removes/Restores their comments and posts for that community + remove_data?: boolean; // Removes/Restores their comments and posts for that community reason?: string; expires?: number; auth: string; @@ -74,7 +74,7 @@ export interface AddModToCommunityResponse { */ export interface EditCommunity { community_id: number; - title: string; + title?: string; description?: string; icon?: string; banner?: string; diff --git a/src/interfaces/api/person.ts b/src/interfaces/api/person.ts index 7efbe93..2082062 100644 --- a/src/interfaces/api/person.ts +++ b/src/interfaces/api/person.ts @@ -76,11 +76,11 @@ export interface LoginResponse { export interface GetPersonDetails { person_id?: number; username?: string; - sort: string; + sort?: string; page?: number; limit?: number; community_id?: number; - saved_only: boolean; + saved_only?: boolean; auth?: string; } @@ -117,7 +117,7 @@ export interface AddAdminResponse { export interface BanPerson { person_id: number; ban: boolean; - remove_data: boolean; // Removes/Restores their comments, posts, and communities + remove_data?: boolean; // Removes/Restores their comments, posts, and communities reason?: string; expires?: number; auth: string; @@ -129,18 +129,18 @@ export interface BanPersonResponse { } export interface GetReplies { - sort: string; + sort?: string; page?: number; limit?: number; - unread_only: boolean; + unread_only?: boolean; auth: string; } export interface GetPersonMentions { - sort: string; + sort?: string; page?: number; limit?: number; - unread_only: boolean; + unread_only?: boolean; auth: string; } @@ -199,7 +199,7 @@ export interface MarkPrivateMessageAsRead { } export interface GetPrivateMessages { - unread_only: boolean; + unread_only?: boolean; page?: number; limit?: number; auth: string; diff --git a/src/interfaces/api/post.ts b/src/interfaces/api/post.ts index 48acbef..32afea5 100644 --- a/src/interfaces/api/post.ts +++ b/src/interfaces/api/post.ts @@ -10,7 +10,7 @@ export interface CreatePost { name: string; url?: string; body?: string; - nsfw: boolean; + nsfw?: boolean; community_id: number; auth: string; } @@ -38,13 +38,13 @@ export interface GetPostResponse { * `community_name` can only be used for local communities. To get posts for a federated community, pass `community_id` instead. */ export interface GetPosts { - type_: string; - sort: string; + type_?: string; + sort?: string; page?: number; limit?: number; community_id?: number; community_name?: string; - saved_only: boolean; + saved_only?: boolean; auth?: string; } @@ -63,10 +63,10 @@ export interface CreatePostLike { export interface EditPost { post_id: number; - name: string; + name?: string; url?: string; body?: string; - nsfw: boolean; + nsfw?: boolean; auth: string; } diff --git a/src/interfaces/api/site.ts b/src/interfaces/api/site.ts index 0b513f2..614cfc0 100644 --- a/src/interfaces/api/site.ts +++ b/src/interfaces/api/site.ts @@ -21,12 +21,12 @@ import { */ export interface Search { q: string; - type_: string; + type_?: string; community_id?: number; community_name?: string; creator_id?: number; - sort: string; - listing_type: string; + sort?: string; + listing_type?: string; page?: number; limit?: number; auth?: string; @@ -64,20 +64,20 @@ export interface CreateSite { description?: string; icon?: string; banner?: string; - enable_downvotes: boolean; - open_registration: boolean; - enable_nsfw: boolean; + enable_downvotes?: boolean; + open_registration?: boolean; + enable_nsfw?: boolean; auth: string; } export interface EditSite { - name: string; + name?: string; description?: string; icon?: string; banner?: string; - enable_downvotes: boolean; - open_registration: boolean; - enable_nsfw: boolean; + enable_downvotes?: boolean; + open_registration?: boolean; + enable_nsfw?: boolean; auth: string; }