Skip to content

Commit d831fe2

Browse files
Merge pull request #776 from inplayer-org/watch-history-endpoints-update
Fix: Watch history endpoints wrong names and type names
2 parents d0f3628 + 05fe60d commit d831fe2

File tree

7 files changed

+30
-28
lines changed

7 files changed

+30
-28
lines changed

.DS_Store

-2 KB
Binary file not shown.

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
# [3.13.4] - 15-12-2022
6+
7+
### Added
8+
9+
- Replaced watchlist history endpoint name with watch history
10+
511
# [3.13.3] - 06-12-2022
612

713
### Added

index.d.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export declare interface ExternalAccount {
173173
token: string;
174174
}
175175

176-
export interface WatchlistHistory {
176+
export interface WatchHistory {
177177
media_id: string;
178178
progress: number;
179179
created_at: number;
@@ -251,14 +251,12 @@ export declare class Account {
251251
deleteFromFavorites(mediaId: string): Promise<AxiosResponse<CommonResponse>>;
252252
getWatchHistory(
253253
args: CollectionWithCursorArgs
254-
): Promise<AxiosResponse<CollectionWithCursor<WatchlistHistory>>>;
255-
getWatchHistoryForItem(
256-
mediaId: string
257-
): Promise<AxiosResponse<WatchlistHistory>>;
254+
): Promise<AxiosResponse<CollectionWithCursor<WatchHistory>>>;
255+
getWatchHistoryForItem(mediaId: string): Promise<AxiosResponse<WatchHistory>>;
258256
updateWatchHistory(
259257
mediaId: string,
260258
progress: number
261-
): Promise<AxiosResponse<WatchlistHistory>>;
259+
): Promise<AxiosResponse<WatchHistory>>;
262260
deleteWatchHistoryForItem(
263261
mediaId: string
264262
): Promise<AxiosResponse<CommonResponse>>;

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@inplayer-org/inplayer.js",
3-
"version": "3.13.3",
3+
"version": "3.13.4",
44
"author": "InPlayer",
55
"license": "MIT",
66
"description": "A Javascript SDK for Inplayer's RESTful API",

src/constants/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ export const API = {
2525
`/v2/accounts/external/${integration}`,
2626
getFavorites: '/v2/accounts/media/favorites',
2727
getFavorite: (id: string): string => `/v2/accounts/media/favorites/${id}`,
28-
getWatchHistory: '/v2/accounts/media/watchlist-history',
29-
getWatchHistoryForItem: (id: string) =>
30-
`/v2/accounts/media/watchlist-history/${id}`,
28+
getWatchHistory: '/v2/accounts/media/watch-history',
29+
getWatchHistoryForItem: (id: string): string =>
30+
`/v2/accounts/media/watch-history/${id}`,
3131
// restrictions
3232
merchantRestrictionSettings: (merchantUuid: string): string =>
3333
`/restrictions/settings/${merchantUuid}`,

src/endpoints/account.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
AccountProfile,
1313
CollectionWithCursor,
1414
FavoritesData,
15-
WatchlistHistory,
15+
WatchHistory,
1616
CollectionWithCursorArgs,
1717
} from '../models/IAccount&Authentication';
1818
import {
@@ -1240,7 +1240,7 @@ class Account extends BaseExtend {
12401240
}
12411241

12421242
/**
1243-
* Returns the viewer's watchlist history
1243+
* Returns the viewer's watch history
12441244
* @method getWatchHistory
12451245
* @param {string} filter the filter can be one of all, watched or currently_watching.
12461246
* The default is: currently_watching
@@ -1250,7 +1250,7 @@ class Account extends BaseExtend {
12501250
* InPlayer.Account
12511251
* .getWatchHistory({filter:"all"})
12521252
* .then(data => console.log(data));
1253-
* @returns {CollectionWithCursor<WatchlistHistory>} Contains the data:
1253+
* @returns {CollectionWithCursor<WatchHistory>} Contains the data:
12541254
* ```typescript
12551255
* {
12561256
* "collection": [{
@@ -1259,15 +1259,15 @@ class Account extends BaseExtend {
12591259
* "created_at": 1532425425,
12601260
* "updated_at": 1532425425
12611261
* }],
1262-
* "cursor": "https://services.inplayer.com/v2/accounts/media/watchlist-history?cursor=Ksm34S"
1262+
* "cursor": "https://services.inplayer.com/v2/accounts/media/watch-history?cursor=Ksm34S"
12631263
* }
12641264
* ```
12651265
*/
12661266
async getWatchHistory({
12671267
filter = 'currently_watching',
12681268
cursor = '',
12691269
}: CollectionWithCursorArgs): Promise<
1270-
AxiosResponse<CollectionWithCursor<WatchlistHistory>>
1270+
AxiosResponse<CollectionWithCursor<WatchHistory>>
12711271
> {
12721272
const tokenObject = await this.request.getToken();
12731273
return this.request.get(
@@ -1282,15 +1282,15 @@ class Account extends BaseExtend {
12821282
}
12831283

12841284
/**
1285-
* Returns the viewer's watchlist history media item
1285+
* Returns the viewer's watch history media item
12861286
* @method getWatchHistoryForItem
12871287
* @param {string} mediaId The external ID
12881288
* @async
12891289
* @example
12901290
* InPlayer.Account
12911291
* .getWatchHistoryForItem("awWEFyPu")
12921292
* .then(data => console.log(data));
1293-
* @returns {AxiosResponse<WatchlistHistory>} Contains the data:
1293+
* @returns {AxiosResponse<WatchHistory>} Contains the data:
12941294
* ```typescript
12951295
* {
12961296
* "media_id": "awWEFyPu",
@@ -1302,7 +1302,7 @@ class Account extends BaseExtend {
13021302
*/
13031303
async getWatchHistoryForItem(
13041304
mediaId: string,
1305-
): Promise<AxiosResponse<WatchlistHistory>> {
1305+
): Promise<AxiosResponse<WatchHistory>> {
13061306
const tokenObject = await this.request.getToken();
13071307
return this.request.get(API.getWatchHistoryForItem(mediaId), {
13081308
headers: {
@@ -1313,7 +1313,7 @@ class Account extends BaseExtend {
13131313
}
13141314

13151315
/**
1316-
* Updates the viewer's watchlist history media item
1316+
* Updates the viewer's watch history media item
13171317
* @method updateWatchHistory
13181318
* @param {string} mediaId The external ID
13191319
* @param {number} progress The progress of the watched video in percent
@@ -1322,7 +1322,7 @@ class Account extends BaseExtend {
13221322
* InPlayer.Account
13231323
* .updateWatchHistory("awWEFyPu", 0.3434)
13241324
* .then(data => console.log(data));
1325-
* @returns {AxiosResponse<WatchlistHistory>} Contains the data:
1325+
* @returns {AxiosResponse<WatchHistory>} Contains the data:
13261326
* ```typescript
13271327
* {
13281328
* "media_id": "awWEFyPu",
@@ -1335,7 +1335,7 @@ class Account extends BaseExtend {
13351335
async updateWatchHistory(
13361336
mediaId: string,
13371337
progress: number,
1338-
): Promise<AxiosResponse<WatchlistHistory>> {
1338+
): Promise<AxiosResponse<WatchHistory>> {
13391339
const body = {
13401340
media_id: mediaId,
13411341
progress,
@@ -1350,7 +1350,7 @@ class Account extends BaseExtend {
13501350
}
13511351

13521352
/**
1353-
* Deletes viewer's watchlist history media item
1353+
* Deletes viewer's watch history media item
13541354
* @method deleteWatchHistoryForItem
13551355
* @param {string} mediaId The external ID
13561356
* @async

src/models/IAccount&Authentication.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export interface RestrictionSettingsData {
158158
created_at: number;
159159
updated_at: number;
160160
}
161-
export interface WatchlistHistory {
161+
export interface WatchHistory {
162162
media_id: string;
163163
progress: number;
164164
created_at: number;
@@ -224,14 +224,12 @@ export interface Account extends BaseExtend {
224224
deleteFromFavorites(mediaId: string): Promise<AxiosResponse<CommonResponse>>;
225225
getWatchHistory(
226226
args: CollectionWithCursorArgs
227-
): Promise<AxiosResponse<CollectionWithCursor<WatchlistHistory>>>;
228-
getWatchHistoryForItem(
229-
mediaId: string
230-
): Promise<AxiosResponse<WatchlistHistory>>;
227+
): Promise<AxiosResponse<CollectionWithCursor<WatchHistory>>>;
228+
getWatchHistoryForItem(mediaId: string): Promise<AxiosResponse<WatchHistory>>;
231229
updateWatchHistory(
232230
mediaId: string,
233231
progress: number
234-
): Promise<AxiosResponse<WatchlistHistory>>;
232+
): Promise<AxiosResponse<WatchHistory>>;
235233
deleteWatchHistoryForItem(
236234
mediaId: string
237235
): Promise<AxiosResponse<CommonResponse>>;

0 commit comments

Comments
 (0)