Skip to content

Commit

Permalink
Merge pull request #752 from inplayer-org/new-daily-env-config
Browse files Browse the repository at this point in the history
New daily env config
  • Loading branch information
vkochovski authored Mar 18, 2022
2 parents e0e2d38 + 23499cb commit d0e5d11
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

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

# [3.12.4] - 03-17-2022

### Changes

- Add config object for daily environment

# [3.12.3] - 07-12-2021

### Changes
Expand Down
3 changes: 1 addition & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { AxiosResponse } from 'axios';
export enum Env {
Development = 'development',
Production = 'production',
Daily = 'daily',
}

// Common response
Expand Down Expand Up @@ -971,8 +972,6 @@ export declare class Notifications {
unsubscribe(): void;
}

type Env = 'development' | 'production';

export interface LocalStorageMethods {
setItem: <R = void>(key: string, value: string) => R | void;
getItem: <R = string | null>(key: string) => R | (string | null);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@inplayer-org/inplayer.js",
"version": "3.12.2",
"version": "3.12.4",
"author": "InPlayer",
"license": "MIT",
"description": "A Javascript SDK for Inplayer's RESTful API",
Expand Down
17 changes: 17 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@ export const commonConfig = {
IOT_NOTIF_URL: 'a3gkl64duktvc4-ats.iot.eu-west-1.amazonaws.com',
};

/**
* ```typescript
* INPLAYER_TOKEN_KEY = 'inplayer_token';
* INPLAYER_IOT_KEY = 'inplayer_iot';
* INPLAYER_ACCESS_CODE_NAME = (assetId: number) => `access_code_${assetId}`;
* IOT_NOTIF_URL = 'a3gkl64duktvc4-ats.iot.eu-west-1.amazonaws.com';
* BASE_URL = 'https://services-daily.inplayer.com';
* AWS_IOT_URL = 'https://o3871l8vj7.execute-api.eu-west-1.amazonaws.com/staging/iot/keys';
* ```
*/
export const dailyConfig = {
...commonConfig,
BASE_URL: 'https://services-daily.inplayer.com',
AWS_IOT_URL: 'https://o3871l8vj7.execute-api.eu-west-1.amazonaws.com/staging/iot/keys',
};

/**
* ```typescript
* INPLAYER_TOKEN_KEY = 'inplayer_token';
Expand Down Expand Up @@ -42,6 +58,7 @@ export const prodConfig = {
export const config = {
development: devConfig,
production: prodConfig,
daily: dailyConfig,
};

export default config;
4 changes: 4 additions & 0 deletions src/endpoints/payment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ class Payment extends BaseExtend {
* })
* .then(data => console.log(data));
* @returns {AxiosResponse<GeneratePayPalParameters>} Contains the data:
* ```typescript
* {
* endpoint: string;
* business: string;
Expand All @@ -399,6 +400,7 @@ class Payment extends BaseExtend {
* return: string;
* cancel_return: string;
* }
* ```
*/
// object types must be anonymous(don't use interface or type alias)
// in order to data params description to be shown in typedoc
Expand Down Expand Up @@ -450,6 +452,7 @@ class Payment extends BaseExtend {
* .getPurchaseHistory('active', 0, 5)
* .then(data => console.log(data));
* @returns {AxiosResponse<PurchaseHistoryCollection[]>} Contains the data:
* ```typescript
* {
* total: number;
* page: number;
Expand Down Expand Up @@ -478,6 +481,7 @@ class Payment extends BaseExtend {
* type: string;
* }];
* }
* ```
*/
async getPurchaseHistory(
status = 'active',
Expand Down
12 changes: 7 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,12 @@ export class InPlayer {
* InPlayer.subscribe(
* 'adsasd-d1-cjc1c-1ajaveo',
* {
* onMessage: (message) =>
* { let body = JSON.parse(message.body); console.log(body, 'message') },
* onOpen: (e) => console.log('open'),
* onClose: (e) => console.log('close', e)
* onMessage: (message) =>
* {
* let body = JSON.parse(message.body); console.log(body, 'message')
* },
* onOpen: (e) => console.log('open'),
* onClose: (e) => console.log('close', e)
* }
* )
*/
Expand Down Expand Up @@ -128,7 +130,7 @@ export class InPlayer {
/**
* Overrides the default configs
* @method setConfig
* @param {String} config 'production', 'development'
* @param {String} config 'production', 'development', 'daily'
* @example
* InPlayer.setConfig('development');
*/
Expand Down
1 change: 1 addition & 0 deletions src/models/CommonInterfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ApiConfig, Request } from './Config';
export enum Env {
Development = 'development',
Production = 'production',
Daily = 'daily',
}

export interface BaseExtend {
Expand Down

0 comments on commit d0e5d11

Please sign in to comment.