Merge pull request #147 from cinderisles/main

Add default value to client functions that have optional form data or query params
This commit is contained in:
SleeplessOne1917 2023-06-23 18:18:27 +00:00 committed by GitHub
commit 657c851cf3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -178,7 +178,7 @@ export class LemmyHttp {
* *
* `HTTP.GET /site` * `HTTP.GET /site`
*/ */
getSite(form: GetSite) { getSite(form: GetSite = {}) {
return this.#wrapper<GetSite, GetSiteResponse>(HttpType.Get, "/site", form); return this.#wrapper<GetSite, GetSiteResponse>(HttpType.Get, "/site", form);
} }
@ -222,7 +222,7 @@ export class LemmyHttp {
* *
* `HTTP.GET /modlog` * `HTTP.GET /modlog`
*/ */
getModlog(form: GetModlog) { getModlog(form: GetModlog = {}) {
return this.#wrapper<GetModlog, GetModlogResponse>( return this.#wrapper<GetModlog, GetModlogResponse>(
HttpType.Get, HttpType.Get,
"/modlog", "/modlog",
@ -270,7 +270,7 @@ export class LemmyHttp {
* *
* `HTTP.GET /community` * `HTTP.GET /community`
*/ */
getCommunity(form: GetCommunity) { getCommunity(form: GetCommunity = {}) {
return this.#wrapper<GetCommunity, GetCommunityResponse>( return this.#wrapper<GetCommunity, GetCommunityResponse>(
HttpType.Get, HttpType.Get,
"/community", "/community",
@ -296,7 +296,7 @@ export class LemmyHttp {
* *
* `HTTP.GET /community/list` * `HTTP.GET /community/list`
*/ */
listCommunities(form: ListCommunities) { listCommunities(form: ListCommunities = {}) {
return this.#wrapper<ListCommunities, ListCommunitiesResponse>( return this.#wrapper<ListCommunities, ListCommunitiesResponse>(
HttpType.Get, HttpType.Get,
"/community/list", "/community/list",
@ -413,7 +413,7 @@ export class LemmyHttp {
* *
* `HTTP.GET /post` * `HTTP.GET /post`
*/ */
getPost(form: GetPost) { getPost(form: GetPost = {}) {
return this.#wrapper<GetPost, GetPostResponse>(HttpType.Get, "/post", form); return this.#wrapper<GetPost, GetPostResponse>(HttpType.Get, "/post", form);
} }
@ -496,7 +496,7 @@ export class LemmyHttp {
* *
* `HTTP.GET /post/list` * `HTTP.GET /post/list`
*/ */
getPosts(form: GetPosts) { getPosts(form: GetPosts = {}) {
return this.#wrapper<GetPosts, GetPostsResponse>( return this.#wrapper<GetPosts, GetPostsResponse>(
HttpType.Get, HttpType.Get,
"/post/list", "/post/list",
@ -691,7 +691,7 @@ export class LemmyHttp {
* *
* `HTTP.GET /comment/list` * `HTTP.GET /comment/list`
*/ */
getComments(form: GetComments) { getComments(form: GetComments = {}) {
return this.#wrapper<GetComments, GetCommentsResponse>( return this.#wrapper<GetComments, GetCommentsResponse>(
HttpType.Get, HttpType.Get,
"/comment/list", "/comment/list",
@ -883,7 +883,7 @@ export class LemmyHttp {
* *
* `HTTP.GET /user` * `HTTP.GET /user`
*/ */
getPersonDetails(form: GetPersonDetails) { getPersonDetails(form: GetPersonDetails = {}) {
return this.#wrapper<GetPersonDetails, GetPersonDetailsResponse>( return this.#wrapper<GetPersonDetails, GetPersonDetailsResponse>(
HttpType.Get, HttpType.Get,
"/user", "/user",
@ -974,7 +974,7 @@ export class LemmyHttp {
* *
* `HTTP.GET /user/get_captcha` * `HTTP.GET /user/get_captcha`
*/ */
getCaptcha(form: GetCaptcha) { getCaptcha(form: GetCaptcha = {}) {
return this.#wrapper<GetCaptcha, GetCaptchaResponse>( return this.#wrapper<GetCaptcha, GetCaptchaResponse>(
HttpType.Get, HttpType.Get,
"/user/get_captcha", "/user/get_captcha",
@ -1246,7 +1246,7 @@ export class LemmyHttp {
* *
* `HTTP.Get /federated_instances` * `HTTP.Get /federated_instances`
*/ */
async getFederatedInstances(form: GetFederatedInstances) { async getFederatedInstances(form: GetFederatedInstances = {}) {
return this.#wrapper<GetFederatedInstances, GetFederatedInstancesResponse>( return this.#wrapper<GetFederatedInstances, GetFederatedInstancesResponse>(
HttpType.Get, HttpType.Get,
"/federated_instances", "/federated_instances",