Skip to content

Commit

Permalink
Merge pull request #55 from LemmyNet/use_enum_types
Browse files Browse the repository at this point in the history
Use enum types
  • Loading branch information
Nutomic authored May 16, 2022
2 parents 7203e3d + 0a61424 commit dd615bf
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 51 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lemmy-js-client",
"description": "A javascript / typescript client for Lemmy",
"version": "0.16.4-rc.2",
"version": "0.17.0-rc.9",
"author": "Dessalines <tyhou13@gmx.com>",
"license": "AGPL-3.0",
"main": "./dist/index.js",
Expand Down
11 changes: 3 additions & 8 deletions src/interfaces/api/comment.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ListingType, SortType } from "../others";
import { CommentReportView, CommentView } from "../views";

export interface CreateComment {
Expand Down Expand Up @@ -77,14 +78,8 @@ export interface CreateCommentLike {
* To get posts for a federated community by name, use `name@instance.tld` .
*/
export interface GetComments {
/**
* The [[ListingType]].
*/
type_?: string;
/**
* The [[SortType]].
*/
sort?: string;
type_?: ListingType;
sort?: SortType;
page?: number;
limit?: number;
community_id?: number;
Expand Down
12 changes: 3 additions & 9 deletions src/interfaces/api/community.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ListingType, SortType } from "../others";
import { Site } from "../source";
import {
CommunityModeratorView,
Expand Down Expand Up @@ -39,15 +40,8 @@ export interface CommunityResponse {
}

export interface ListCommunities {
/**
* The [[ListingType]].
*/
type_?: string;

/**
* The [[SortType]].
*/
sort?: string;
type_?: ListingType;
sort?: SortType;
page?: number;
limit?: number;
auth?: string;
Expand Down
13 changes: 4 additions & 9 deletions src/interfaces/api/person.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { SortType } from "../others";
import {
CommentView,
CommunityModeratorView,
Expand Down Expand Up @@ -127,7 +128,7 @@ export interface GetPersonDetails {
* To get details for a federated user, use `person@instance.tld`.
*/
username?: string;
sort?: string;
sort?: SortType;
page?: number;
limit?: number;
community_id?: number;
Expand Down Expand Up @@ -186,21 +187,15 @@ export interface BanPersonResponse {
}

export interface GetReplies {
/**
* The [[SortType]].
*/
sort?: string;
sort?: SortType;
page?: number;
limit?: number;
unread_only?: boolean;
auth: string;
}

export interface GetPersonMentions {
/**
* The [[SortType]].
*/
sort?: string;
sort?: SortType;
page?: number;
limit?: number;
unread_only?: boolean;
Expand Down
14 changes: 3 additions & 11 deletions src/interfaces/api/post.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SiteMetadata } from "..";
import { ListingType, SiteMetadata, SortType } from "../others";
import {
CommentView,
CommunityModeratorView,
Expand Down Expand Up @@ -35,16 +35,8 @@ export interface GetPostResponse {
}

export interface GetPosts {
/**
* The [[ListingType]].
*
* Post listing types are `All, Subscribed, Community`
*/
type_?: string;
/**
* The [[SortType]].
*/
sort?: string;
type_?: ListingType;
sort?: SortType;
page?: number;
limit?: number;
community_id?: number;
Expand Down
17 changes: 4 additions & 13 deletions src/interfaces/api/site.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ListingType, SearchType, SortType } from "../others";
import {
CommentView,
CommunityBlockView,
Expand Down Expand Up @@ -30,22 +31,12 @@ export interface Search {
* The search query string.
*/
q: string;

/**
* The [[SearchType]].
*/
type_?: string;
type_?: SearchType;
community_id?: number;
community_name?: string;
creator_id?: number;
/**
* The [[SortType]].
*/
sort?: string;
/**
* The [[ListingType]].
*/
listing_type?: string;
sort?: SortType;
listing_type?: ListingType;
page?: number;
limit?: number;
auth?: string;
Expand Down

0 comments on commit dd615bf

Please sign in to comment.