File tree Expand file tree Collapse file tree 4 files changed +19
-12
lines changed Expand file tree Collapse file tree 4 files changed +19
-12
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ type getChannelsOptionsType = {
16
16
order ?: string ;
17
17
filter ?: number ;
18
18
tag ?: string ;
19
+ user_subscribed ?: string ;
19
20
} ;
20
21
21
22
export const getChannels = async ( options : getChannelsOptionsType ) => {
@@ -27,13 +28,16 @@ export const getChannels = async (options: getChannelsOptionsType) => {
27
28
order = CONSTANTS . FILTER . CHANNEL_LIST . ORDER . DESCENDING ,
28
29
filter,
29
30
tag,
31
+ user_subscribed,
30
32
} = options || { } ;
31
33
32
34
const API_BASE_URL = getAPIBaseUrls ( env ) ;
33
35
const apiEndpoint = `${ API_BASE_URL } /v1/channels` ;
34
36
const requestUrl = `${ apiEndpoint } ?page=${ page } &limit=${ limit } &sort=${ sort } &order=${ order } ${
35
- filter ? '&filter=' + filter : ''
36
- } ${ tag ? '&tag=' + tag : '' } `;
37
+ filter ? `&filter=${ filter } ` : ''
38
+ } ${ tag ? `&tag=${ tag } ` : '' } ${
39
+ user_subscribed ? `&user_subscribed=${ user_subscribed } ` : ''
40
+ } `;
37
41
return await axiosGet ( requestUrl )
38
42
. then ( ( response ) => {
39
43
return response . data ;
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ export type SearchChannelOptionsType = {
17
17
tag ?: string ;
18
18
// temp fix to support both new and old format
19
19
oldFormat ?: boolean ;
20
+ user_subscribed ?: string ;
20
21
} ;
21
22
22
23
export const search = async ( options : SearchChannelOptionsType ) => {
@@ -27,6 +28,7 @@ export const search = async (options: SearchChannelOptionsType) => {
27
28
limit = Constants . PAGINATION . LIMIT ,
28
29
filter,
29
30
tag,
31
+ user_subscribed,
30
32
oldFormat = true ,
31
33
} = options || { } ;
32
34
@@ -39,6 +41,7 @@ export const search = async (options: SearchChannelOptionsType) => {
39
41
query,
40
42
...( tag && { tag } ) ,
41
43
...( filter && { filter } ) ,
44
+ ...( user_subscribed && { user_subscribed } ) ,
42
45
} ;
43
46
const requestUrl = `${ apiEndpoint } ?${ getQueryParams ( queryObj ) } ` ;
44
47
return axiosGet ( requestUrl )
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ export type AliasOptions = Omit<GetAliasInfoOptionsType, 'env'>;
34
34
export type AliasInfoOptions = {
35
35
raw ?: boolean ;
36
36
version ?: number ;
37
- }
37
+ } ;
38
38
39
39
export enum FeedType {
40
40
INBOX = 'INBOX' ,
@@ -57,6 +57,7 @@ export type ChannelSearchOptions = {
57
57
// temp fix to support both new and old format
58
58
oldFormat ?: boolean ;
59
59
tag ?: string ;
60
+ user_subscribed ?: string ;
60
61
} ;
61
62
62
63
// Types related to notification
@@ -137,8 +138,6 @@ export type ChannelOptions = {
137
138
raw : boolean ;
138
139
} ;
139
140
140
-
141
-
142
141
export enum ChannelListType {
143
142
ALL = 'all' ,
144
143
VERIFIED = 'verified' ,
@@ -149,27 +148,24 @@ export enum ChannelListSortType {
149
148
SUBSCRIBER = 'subscribers' ,
150
149
}
151
150
152
-
153
-
154
151
export type ChannelListOptions = {
155
152
page ?: number ;
156
153
limit ?: number ;
157
154
sort ?: ChannelListSortType ;
158
155
order ?: ChannelListOrderType ;
159
156
filter ?: number ;
160
157
tag ?: string ;
158
+ user_subscribed ?: string ;
161
159
} ;
162
160
163
161
export type TagListOptions = {
164
162
page ?: number ;
165
163
limit ?: number ;
166
164
order ?: ChannelListOrderType ;
167
- filter ?: "PUSH" | "USER" | "*" ;
168
- }
169
-
170
-
165
+ filter ?: 'PUSH' | 'USER' | '*' ;
166
+ } ;
171
167
172
168
export enum ChannelListOrderType {
173
169
ASCENDING = 'asc' ,
174
170
DESCENDING = 'desc' ,
175
- } ;
171
+ }
Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ export class Channel extends PushNotificationBaseClass {
84
84
limit = Constants . PAGINATION . LIMIT ,
85
85
filter,
86
86
tag,
87
+ user_subscribed,
87
88
oldFormat = true ,
88
89
} = options || { } ;
89
90
return await PUSH_CHANNEL . search ( {
@@ -92,6 +93,7 @@ export class Channel extends PushNotificationBaseClass {
92
93
limit : limit ,
93
94
filter : filter ,
94
95
tag : tag ,
96
+ user_subscribed : user_subscribed ,
95
97
env : this . env ,
96
98
oldFormat,
97
99
} ) ;
@@ -489,6 +491,7 @@ export class Channel extends PushNotificationBaseClass {
489
491
order = ChannelListOrderType . DESCENDING ,
490
492
filter,
491
493
tag,
494
+ user_subscribed,
492
495
} = options || { } ;
493
496
494
497
return await PUSH_CHANNEL . getChannels ( {
@@ -499,6 +502,7 @@ export class Channel extends PushNotificationBaseClass {
499
502
order,
500
503
filter,
501
504
tag,
505
+ user_subscribed,
502
506
} ) ;
503
507
} catch ( error ) {
504
508
throw new Error ( `Push SDK Error: Contract : channel::list : ${ error } ` ) ;
You can’t perform that action at this time.
0 commit comments