bizzabo-api
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -111,3 +111,4 @@ "use strict"; | ||
case 0: return [4 /*yield*/, this.instance.get("/events/".concat(eventId, "/speakers/").concat(speakerId))]; | ||
case 1: return [2 /*return*/, (_a.sent()).data]; | ||
case 1: return [2 /*return*/, (_a.sent()) | ||
.data]; | ||
} | ||
@@ -114,0 +115,0 @@ }); |
@@ -6,3 +6,2 @@ export interface Token { | ||
export declare class Authentication { | ||
private baseAuthUrl; | ||
private clientId; | ||
@@ -12,4 +11,7 @@ private accountId; | ||
private apiAudience; | ||
private readonly instance; | ||
constructor(clientId: string, clientSecret: string, accountId: number, apiAudience?: string, baseAuthUrl?: string); | ||
getToken(): Promise<Token>; | ||
private _handleRequest; | ||
private _handleError; | ||
} |
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -47,3 +58,13 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
if (baseAuthUrl === void 0) { baseAuthUrl = DEFAULT_AUTH_BASE_URL; } | ||
this.baseAuthUrl = baseAuthUrl; | ||
this._handleRequest = function (config) { | ||
var fixedHeaders = { | ||
'User-Agent': "Bizzabo-JS-Sdk-V1", | ||
}; | ||
var headers = __assign(__assign({}, config.headers), fixedHeaders); | ||
return __assign(__assign({}, config), { headers: headers }); | ||
}; | ||
this._handleError = function (error) { | ||
console.error(error.response.data); | ||
return Promise.reject(error); | ||
}; | ||
this.clientId = clientId; | ||
@@ -53,10 +74,13 @@ this.accountId = accountId; | ||
this.apiAudience = apiAudience; | ||
this.instance = axios_1.default.create({ | ||
baseURL: baseAuthUrl, | ||
}); | ||
this.instance.interceptors.request.use(this._handleRequest, this._handleError); | ||
} | ||
Authentication.prototype.getToken = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var oauthPayload, resp, returnedToken, error_1; | ||
var oauthPayload, resp, returnedToken; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 2, , 3]); | ||
oauthPayload = { | ||
@@ -69,3 +93,3 @@ grant_type: 'client_credentials', | ||
}; | ||
return [4 /*yield*/, axios_1.default.post("".concat(this.baseAuthUrl, "/oauth/token"), oauthPayload)]; | ||
return [4 /*yield*/, this.instance.post('/oauth/token', oauthPayload)]; | ||
case 1: | ||
@@ -78,7 +102,2 @@ resp = _a.sent(); | ||
}]; | ||
case 2: | ||
error_1 = _a.sent(); | ||
console.error(error_1); | ||
throw Error('Not Authorized'); | ||
case 3: return [2 /*return*/]; | ||
} | ||
@@ -85,0 +104,0 @@ }); |
@@ -22,3 +22,6 @@ "use strict"; | ||
this._handleRequest = function (config) { | ||
var headers = __assign(__assign({}, config.headers), _this.contextHeaders); | ||
var fixedHeaders = { | ||
'User-Agent': "Bizzabo-JS-Sdk-V1", | ||
}; | ||
var headers = __assign(__assign(__assign({}, config.headers), _this.contextHeaders), fixedHeaders); | ||
return __assign(__assign({}, config), { headers: headers }); | ||
@@ -25,0 +28,0 @@ }; |
import { ContactsApi } from './api/contacts-client'; | ||
import { EventsApi } from './api/events-client'; | ||
import { SpeakersApi } from './api/speakers-client'; | ||
import { Authentication, Token } from './auth/token'; | ||
import { Token } from './auth/token'; | ||
export * from './auth/token'; | ||
export * from './api/contacts-client'; | ||
export * from './api/speakers-client'; | ||
export * from './api/events-client'; | ||
export declare class Bizzabo { | ||
contactsApi: ContactsApi; | ||
speakersApi: SpeakersApi; | ||
eventsApi: EventsApi; | ||
constructor(token: Token); | ||
} | ||
declare const _default: { | ||
Authentication: typeof Authentication; | ||
ContactsApi: typeof ContactsApi; | ||
SpeakersApi: typeof SpeakersApi; | ||
}; | ||
export default _default; |
@@ -19,7 +19,8 @@ "use strict"; | ||
var contacts_client_1 = require("./api/contacts-client"); | ||
var events_client_1 = require("./api/events-client"); | ||
var speakers_client_1 = require("./api/speakers-client"); | ||
var token_1 = require("./auth/token"); | ||
__exportStar(require("./auth/token"), exports); | ||
__exportStar(require("./api/contacts-client"), exports); | ||
__exportStar(require("./api/speakers-client"), exports); | ||
__exportStar(require("./api/events-client"), exports); | ||
var Bizzabo = /** @class */ (function () { | ||
@@ -29,2 +30,3 @@ function Bizzabo(token) { | ||
this.speakersApi = new speakers_client_1.SpeakersApi(token); | ||
this.eventsApi = new events_client_1.EventsApi(token); | ||
} | ||
@@ -34,6 +36,1 @@ return Bizzabo; | ||
exports.Bizzabo = Bizzabo; | ||
exports.default = { | ||
Authentication: token_1.Authentication, | ||
ContactsApi: contacts_client_1.ContactsApi, | ||
SpeakersApi: speakers_client_1.SpeakersApi, | ||
}; |
{ | ||
"name": "bizzabo-api", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "The Bizzabo API is a Typescript client that allows calling Bizzabo public APIs", | ||
@@ -5,0 +5,0 @@ "author": "Bizzabo", |
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
32824
14
621