Get unread count (#34)

* Adding GetUnreadCount

* v0.13.4-rc.1
This commit is contained in:
Dessalines 2021-10-17 13:42:40 -04:00 committed by GitHub
parent e88a992d25
commit 52b456827d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 1 deletions

View file

@ -1,7 +1,7 @@
{ {
"name": "lemmy-js-client", "name": "lemmy-js-client",
"description": "A javascript / typescript client for Lemmy", "description": "A javascript / typescript client for Lemmy",
"version": "0.13.1-rc.1", "version": "0.13.4-rc.1",
"author": "Dessalines <tyhou13@gmx.com>", "author": "Dessalines <tyhou13@gmx.com>",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"main": "./dist/index.js", "main": "./dist/index.js",

View file

@ -109,6 +109,8 @@ import {
BlockPersonResponse, BlockPersonResponse,
GetReportCount, GetReportCount,
GetReportCountResponse, GetReportCountResponse,
GetUnreadCount,
GetUnreadCountResponse,
} from './interfaces/api/person'; } from './interfaces/api/person';
import { VERSION } from './interfaces/others'; import { VERSION } from './interfaces/others';
@ -637,6 +639,13 @@ export class LemmyHttp {
return this.wrapper(HttpType.Get, '/user/report_count', form); return this.wrapper(HttpType.Get, '/user/report_count', form);
} }
/**
* Get your unread counts
*/
async getUnreadCount(form: GetUnreadCount): Promise<GetUnreadCountResponse> {
return this.wrapper(HttpType.Get, '/user/unread_count', form);
}
/** /**
* Add an admin to your site. * Add an admin to your site.
*/ */

View file

@ -275,6 +275,16 @@ export interface GetReportCountResponse {
post_reports: number; post_reports: number;
} }
export interface GetUnreadCount {
auth: string;
}
export interface GetUnreadCountResponse {
replies: number;
mentions: number;
private_messages: number;
}
export interface BlockPerson { export interface BlockPerson {
person_id: number; person_id: number;
block: boolean; block: boolean;

View file

@ -74,6 +74,7 @@ export enum UserOperation {
ResolvePostReport, ResolvePostReport,
ListPostReports, ListPostReports,
GetReportCount, GetReportCount,
GetUnreadCount,
} }
/** /**

View file

@ -73,6 +73,7 @@ import {
ChangePassword, ChangePassword,
BlockPerson, BlockPerson,
GetReportCount, GetReportCount,
GetUnreadCount,
} from './interfaces/api/person'; } from './interfaces/api/person';
import { UserJoin, PostJoin, CommunityJoin } from './interfaces/api/websocket'; import { UserJoin, PostJoin, CommunityJoin } from './interfaces/api/websocket';
import { UserOperation } from './interfaces/others'; import { UserOperation } from './interfaces/others';
@ -508,6 +509,12 @@ export class LemmyWebsocket {
return wrapper(UserOperation.GetReportCount, form); return wrapper(UserOperation.GetReportCount, form);
} }
/**
* Get your unread counts
*/
getUnreadCount(form: GetUnreadCount) {
return wrapper(UserOperation.GetUnreadCount, form);
}
/** /**
* Delete your account. * Delete your account.
*/ */