getstream
Advanced tools
Comparing version 6.0.0 to 6.1.0
@@ -46,2 +46,14 @@ /// <reference path="../types/modules.d.ts" /> | ||
}; | ||
export declare type FollowStatsAPIResponse = APIResponse & { | ||
results: { | ||
followers: { | ||
count: number; | ||
feed: string; | ||
}; | ||
following: { | ||
count: number; | ||
feed: string; | ||
}; | ||
}; | ||
}; | ||
declare type BaseActivity<ActivityType> = ActivityType & { | ||
@@ -239,2 +251,17 @@ actor: string; | ||
/** | ||
* Retrieve the number of follower and following feed stats of the current feed. | ||
* For each count, feed slugs can be provided to filter counts accordingly. | ||
* @method followStats | ||
* @param {object} [options] | ||
* @param {string[]} [options.followerSlugs] find counts only on these slugs | ||
* @param {string[]} [options.followingSlugs] find counts only on these slugs | ||
* @return {Promise<FollowStatsAPIResponse>} | ||
* @example feed.followStats(); | ||
* @example feed.followStats({ followerSlugs:['user', 'news'], followingSlugs:['timeline'] }); | ||
*/ | ||
followStats(options?: { | ||
followerSlugs?: string[]; | ||
followingSlugs?: string[]; | ||
}): Promise<FollowStatsAPIResponse>; | ||
/** | ||
* Reads the feed | ||
@@ -241,0 +268,0 @@ * @method get |
@@ -262,2 +262,30 @@ "use strict"; | ||
/** | ||
* Retrieve the number of follower and following feed stats of the current feed. | ||
* For each count, feed slugs can be provided to filter counts accordingly. | ||
* @method followStats | ||
* @param {object} [options] | ||
* @param {string[]} [options.followerSlugs] find counts only on these slugs | ||
* @param {string[]} [options.followingSlugs] find counts only on these slugs | ||
* @return {Promise<FollowStatsAPIResponse>} | ||
* @example feed.followStats(); | ||
* @example feed.followStats({ followerSlugs:['user', 'news'], followingSlugs:['timeline'] }); | ||
*/ | ||
}, { | ||
key: "followStats", | ||
value: function followStats() { | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var qs = { | ||
followers: this.id, | ||
following: this.id | ||
}; | ||
if (options.followerSlugs && options.followerSlugs.length) qs.followers_slugs = options.followerSlugs.join(','); | ||
if (options.followingSlugs && options.followingSlugs.length) qs.following_slugs = options.followingSlugs.join(','); | ||
return this.client.get({ | ||
url: 'stats/follow/', | ||
qs: qs, | ||
signature: this.signature | ||
}); | ||
} | ||
/** | ||
* Reads the feed | ||
@@ -264,0 +292,0 @@ * @method get |
@@ -14,3 +14,3 @@ { | ||
"license": "BSD-3-Clause", | ||
"version": "6.0.0", | ||
"version": "6.1.0", | ||
"scripts": { | ||
@@ -17,0 +17,0 @@ "transpile": "babel src --out-dir lib --extensions '.ts'", |
@@ -53,2 +53,9 @@ /// <reference path="../types/modules.d.ts" /> | ||
export type FollowStatsAPIResponse = APIResponse & { | ||
results: { | ||
followers: { count: number; feed: string }; | ||
following: { count: number; feed: string }; | ||
}; | ||
}; | ||
type BaseActivity<ActivityType> = ActivityType & { | ||
@@ -426,2 +433,29 @@ actor: string; | ||
/** | ||
* Retrieve the number of follower and following feed stats of the current feed. | ||
* For each count, feed slugs can be provided to filter counts accordingly. | ||
* @method followStats | ||
* @param {object} [options] | ||
* @param {string[]} [options.followerSlugs] find counts only on these slugs | ||
* @param {string[]} [options.followingSlugs] find counts only on these slugs | ||
* @return {Promise<FollowStatsAPIResponse>} | ||
* @example feed.followStats(); | ||
* @example feed.followStats({ followerSlugs:['user', 'news'], followingSlugs:['timeline'] }); | ||
*/ | ||
followStats(options: { followerSlugs?: string[]; followingSlugs?: string[] } = {}) { | ||
const qs: { followers: string; following: string; followers_slugs?: string; following_slugs?: string } = { | ||
followers: this.id, | ||
following: this.id, | ||
}; | ||
if (options.followerSlugs && options.followerSlugs.length) qs.followers_slugs = options.followerSlugs.join(','); | ||
if (options.followingSlugs && options.followingSlugs.length) qs.following_slugs = options.followingSlugs.join(','); | ||
return this.client.get<FollowStatsAPIResponse>({ | ||
url: 'stats/follow/', | ||
qs, | ||
signature: this.signature, | ||
}); | ||
} | ||
/** | ||
* Reads the feed | ||
@@ -428,0 +462,0 @@ * @method get |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
15261
768042
67