File tree Expand file tree Collapse file tree 5 files changed +52
-7
lines changed Expand file tree Collapse file tree 5 files changed +52
-7
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ export interface IPosts {
1313 body : Object ,
1414 id : number | null ,
1515 } ) : Promise < PostsData > ;
16- like ( params : { id : number | null } ) : Promise < string > ;
17- unlike ( params : { id : number | null } ) : Promise < string > ;
16+ like ( params : { id : number | null } ) : Promise < PostsData > ;
17+ unlike ( params : { id : number | null } ) : Promise < PostsData > ;
1818 flag ( params : {
1919 id : number | null ,
2020 post_action_type_id : number ,
Original file line number Diff line number Diff line change 11import { buildQueryString } from '../utils' ;
22import { DiscourseInterface } from '../index' ;
3+ import { TagsListData } from '../types/Tags' ;
34
45interface TopicParams {
56 tag ?: string ;
@@ -9,8 +10,8 @@ interface TopicParams {
910}
1011
1112export interface ITags {
12- getTopic ( params : TopicParams ) : Promise < unknown > ;
13- getTopicsForCategory ( params : TopicParams ) : Promise < unknown > ;
13+ getTopic ( params : TopicParams ) : Promise < TagsListData > ;
14+ getTopicsForCategory ( params : TopicParams ) : Promise < TagsListData > ;
1415}
1516export default function Tags ( discourse : DiscourseInterface ) {
1617 this . getTopic = async ( { tag, ...inputs } : { tag ?: string } = { } ) => {
Original file line number Diff line number Diff line change 11import { buildQueryString } from '../utils' ;
22import { DiscourseInterface } from '../index' ;
3- import { GetTopicData , GetTopicsData } from '../types/Topics' ;
3+ import { GetTopicData , GetTopicsData , TopicByUserName } from '../types/Topics' ;
44import { PostsData } from '../types/Posts' ;
55
66interface TopicParams {
@@ -15,7 +15,7 @@ export interface ITopics {
1515 getTopic ( params : TopicParams ) : Promise < GetTopicsData > ;
1616 getTopicPosts ( params : TopicParams ) : Promise < GetTopicData > ;
1717 deleteTopic ( params : TopicParams ) : Promise < string > ;
18- getTopicsByUsername ( params : TopicParams ) : Promise < unknown > ;
18+ getTopicsByUsername ( params : TopicParams ) : Promise < TopicByUserName > ;
1919 createTopic ( params : TopicParams ) : Promise < PostsData > ;
2020}
2121
Original file line number Diff line number Diff line change 1+ export interface TagsGroupData {
2+ tag_groups : [
3+ {
4+ id : number ,
5+ name : string ,
6+ tag_names : string [ ] ,
7+ parent_tag_name : string ,
8+ one_per_topic : boolean ,
9+ } ,
10+ ] ;
11+ }
12+
13+ export interface TagsListData {
14+ topic_list : {
15+ can_create_topic : boolean ,
16+ draft : null ,
17+ draft_key : string ,
18+ draft_sequence : number ,
19+ per_page : number ,
20+ tags : TagData [ ] ,
21+ topics : [ ] ,
22+ } ;
23+ }
24+
25+ export interface TagData {
26+ id : number ;
27+ name : string ;
28+ topic_count : number ;
29+ staff : boolean ;
30+ }
Original file line number Diff line number Diff line change 11import { PostsData } from './Posts' ;
2+ import { DiscourseUser } from './Users' ;
23
34// ToDo clean up
45
@@ -294,7 +295,7 @@ export type DiscourseTopicSummaryType = {
294295 user_id : number ,
295296 primary_group_id : { } ,
296297 } > ,
297- participants : Array < {
298+ participants ? : Array < {
298299 extras : string ,
299300 description : string ,
300301 user_id : number ,
@@ -311,3 +312,16 @@ export type DiscourseTopicList = {
311312 more_topics_url : string , // If more than 1 page
312313 topics : Array < DiscourseTopicSummaryType > ,
313314} ;
315+
316+ export type TopicByUserName = {
317+ users : DiscourseUser [ ] ,
318+ primary_groups : [ ] ,
319+ topic_list : {
320+ can_create_topic : true ,
321+ draft : null ,
322+ draft_key : 'new_topic' ,
323+ draft_sequence : 1 ,
324+ per_page : 30 ,
325+ topics : DiscourseTopicSummaryType [ ] ,
326+ } ,
327+ } ;
You can’t perform that action at this time.
0 commit comments