@timetac/js-client-library
Advanced tools
Comparing version 0.1.7 to 0.1.8
@@ -12,2 +12,9 @@ export declare type Credentials = { | ||
password: string; | ||
} | { | ||
grant_type: 'authorization_code'; | ||
client_id: string; | ||
client_secret?: string; | ||
code: string; | ||
code_verifier: string; | ||
redirect_uri: string; | ||
}; |
import Base from '../baseApi'; | ||
import { ServerCommunication as Model } from './types'; | ||
export default class ServerCommunication extends Base { | ||
read(account: string): Promise<import("../utils/response/apiResponse").ApiResponseOnSuccess<unknown>>; | ||
read(account: string): Promise<Model>; | ||
} |
@@ -11,3 +11,3 @@ "use strict"; | ||
const response = axios_1.default.get(`${this.getApiPath()}${resourceName}/read`, { withCredentials: false }); | ||
return responseHandlers_1.default.toApiResponse(response); | ||
return responseHandlers_1.default.requiredObject(response); | ||
} | ||
@@ -14,0 +14,0 @@ } |
@@ -5,2 +5,3 @@ import { AxiosResponse } from 'axios'; | ||
toApiResponse<T>(promise: Promise<AxiosResponse>): Promise<ApiResponseOnSuccess<T>>; | ||
requiredObject<T>(promise: Promise<AxiosResponse>): Promise<T>; | ||
required<T>(promise: Promise<AxiosResponse>): Promise<T>; | ||
@@ -7,0 +8,0 @@ requiredList<T>(promise: Promise<AxiosResponse>): Promise<T[]>; |
@@ -23,2 +23,12 @@ "use strict"; | ||
} | ||
requiredObject(promise) { | ||
return this.toApiResponse(promise).then((response) => { | ||
if (response.NumResults > 0) { | ||
return response.Results; | ||
} | ||
else { | ||
throw 'There are no results.'; | ||
} | ||
}); | ||
} | ||
required(promise) { | ||
@@ -30,3 +40,3 @@ return this.toApiResponse(promise).then((response) => { | ||
else { | ||
throw new Error('There are no results.'); | ||
throw 'There are no results.'; | ||
} | ||
@@ -41,3 +51,3 @@ }); | ||
else { | ||
throw new Error('There are no results.'); | ||
throw 'There are no results.'; | ||
} | ||
@@ -44,0 +54,0 @@ }); |
{ | ||
"name": "@timetac/js-client-library", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "TimeTac API JS client library", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/TimeTac/js-client-library#readme", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
111874
114
1639