discourse-js
Advanced tools
Comparing version 3.0.5 to 3.0.6
@@ -342,13 +342,9 @@ 'use strict'; | ||
}); }; | ||
this.send = function (_a) { | ||
var topic_id = _a.topic_id, raw = _a.raw; | ||
this.send = function (inputs) { | ||
if (inputs === void 0) { inputs = {}; } | ||
return __awaiter(_this, void 0, void 0, function () { | ||
return __generator(this, function (_b) { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, discourse.post({ | ||
path: 'posts', | ||
body: { | ||
topic_id: topic_id, | ||
raw: raw, | ||
archetype: 'private_message', | ||
}, | ||
body: inputs, | ||
})]; | ||
@@ -355,0 +351,0 @@ }); |
@@ -338,13 +338,9 @@ import { camelizeKeys } from 'humps'; | ||
}); }; | ||
this.send = function (_a) { | ||
var topic_id = _a.topic_id, raw = _a.raw; | ||
this.send = function (inputs) { | ||
if (inputs === void 0) { inputs = {}; } | ||
return __awaiter(_this, void 0, void 0, function () { | ||
return __generator(this, function (_b) { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, discourse.post({ | ||
path: 'posts', | ||
body: { | ||
topic_id: topic_id, | ||
raw: raw, | ||
archetype: 'private_message', | ||
}, | ||
body: inputs, | ||
})]; | ||
@@ -351,0 +347,0 @@ }); |
@@ -342,13 +342,9 @@ (function (global, factory) { | ||
}); }; | ||
this.send = function (_a) { | ||
var topic_id = _a.topic_id, raw = _a.raw; | ||
this.send = function (inputs) { | ||
if (inputs === void 0) { inputs = {}; } | ||
return __awaiter(_this, void 0, void 0, function () { | ||
return __generator(this, function (_b) { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, discourse.post({ | ||
path: 'posts', | ||
body: { | ||
topic_id: topic_id, | ||
raw: raw, | ||
archetype: 'private_message', | ||
}, | ||
body: inputs, | ||
})]; | ||
@@ -355,0 +351,0 @@ }); |
import Discourse from '../index'; | ||
import { PrivateMessageList } from '../types/Messages'; | ||
import { Post } from '../types/Posts'; | ||
export interface SendMessageBody { | ||
topic_id: number; | ||
raw: string; | ||
[key: string]: string | number; | ||
} | ||
export interface IMessages { | ||
@@ -10,8 +15,5 @@ get(): Promise<PrivateMessageList>; | ||
getSentMessages(): Promise<PrivateMessageList>; | ||
getAllMessages(): Promise<PrivateMessageList[]>; | ||
send(params: { | ||
topic_id: number; | ||
raw: string; | ||
}): Promise<Post>; | ||
getAllMessages(): Promise<[PrivateMessageList, PrivateMessageList]>; | ||
send(inputs: SendMessageBody): Promise<Post>; | ||
} | ||
export default function Messages(discourse: Discourse): void; |
@@ -0,10 +1,11 @@ | ||
import { UserBase } from './Users'; | ||
export interface GroupMember extends Omit<UserBase, 'moderator' | 'admin'> { | ||
addedAt: string; | ||
title: string; | ||
lastPostedAt: string; | ||
lastSeenAt: string; | ||
} | ||
export interface GroupMemberList { | ||
members: [ | ||
{ | ||
id: number; | ||
username: string; | ||
avatarTemplate: string; | ||
} | ||
]; | ||
owners: [{}]; | ||
members: GroupMember[]; | ||
owners: []; | ||
meta: { | ||
@@ -16,11 +17,2 @@ total: number; | ||
} | ||
export interface GroupMember { | ||
id: number; | ||
username: string; | ||
name: string; | ||
avatarTemplate: string; | ||
title: string; | ||
lastPostedAt: string; | ||
lastSeenAt: string; | ||
} | ||
export interface Group { | ||
@@ -27,0 +19,0 @@ id: number; |
@@ -36,3 +36,3 @@ export declare enum NotificationType { | ||
read: boolean; | ||
created_at: string; | ||
createdAt: string; | ||
postNumber: string | null; | ||
@@ -66,2 +66,6 @@ topicId: string | null; | ||
} | ||
export interface UnknownNotification { | ||
id: number; | ||
notificationType: NotificationType.watchingFirstPost | NotificationType.mentioned; | ||
} | ||
export interface NotificationList { | ||
@@ -68,0 +72,0 @@ notifications: Array<TopicNotification | GroupNotification>; |
{ | ||
"name": "discourse-js", | ||
"version": "3.0.5", | ||
"version": "3.0.6", | ||
"description": "A client-side javascript wrapper for the discourse API.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
@@ -5,2 +5,8 @@ import Discourse from '../index'; | ||
export interface SendMessageBody { | ||
topic_id: number; | ||
raw: string; | ||
[key: string]: string | number; | ||
} | ||
export interface IMessages { | ||
@@ -10,4 +16,4 @@ get(): Promise<PrivateMessageList>; | ||
getSentMessages(): Promise<PrivateMessageList>; | ||
getAllMessages(): Promise<PrivateMessageList[]>; | ||
send(params: { topic_id: number; raw: string }): Promise<Post>; | ||
getAllMessages(): Promise<[PrivateMessageList, PrivateMessageList]>; | ||
send(inputs: SendMessageBody): Promise<Post>; | ||
} | ||
@@ -44,12 +50,8 @@ | ||
this.send = async ({ topic_id, raw }: { topic_id: number; raw: string }) => { | ||
this.send = async (inputs: Partial<SendMessageBody> = {}) => { | ||
return discourse.post({ | ||
path: 'posts', | ||
body: { | ||
topic_id, | ||
raw, | ||
archetype: 'private_message', | ||
}, | ||
body: inputs, | ||
}); | ||
}; | ||
} |
@@ -0,10 +1,13 @@ | ||
import { UserBase } from './Users'; | ||
export interface GroupMember extends Omit<UserBase, 'moderator' | 'admin'> { | ||
addedAt: string; | ||
title: string; | ||
lastPostedAt: string; | ||
lastSeenAt: string; | ||
} | ||
export interface GroupMemberList { | ||
members: [ | ||
{ | ||
id: number; | ||
username: string; | ||
avatarTemplate: string; | ||
}, | ||
]; | ||
owners: [{}]; | ||
members: GroupMember[]; | ||
owners: []; | ||
meta: { | ||
@@ -17,12 +20,2 @@ total: number; | ||
export interface GroupMember { | ||
id: number; | ||
username: string; | ||
name: string; | ||
avatarTemplate: string; | ||
title: string; | ||
lastPostedAt: string; | ||
lastSeenAt: string; | ||
} | ||
export interface Group { | ||
@@ -29,0 +22,0 @@ id: number; |
@@ -40,3 +40,3 @@ export enum NotificationType { | ||
read: boolean; | ||
created_at: string; | ||
createdAt: string; | ||
postNumber: string | null; | ||
@@ -76,2 +76,10 @@ topicId: string | null; | ||
} | ||
export interface UnknownNotification { | ||
id: number; | ||
notificationType: | ||
| NotificationType.watchingFirstPost | ||
| NotificationType.mentioned; | ||
} | ||
export interface NotificationList { | ||
@@ -78,0 +86,0 @@ notifications: Array<TopicNotification | GroupNotification>; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
338329
4432