vyze
Advanced tools
Comparing version 0.1.15 to 0.1.16
@@ -26,10 +26,10 @@ import { Id, RequestOptions, Response } from '../shared'; | ||
private decoder; | ||
private token?; | ||
private universeIdCache; | ||
private universeCache; | ||
private userCache; | ||
private _token?; | ||
private _decoder; | ||
constructor(url?: string); | ||
setUrl(url: string): void; | ||
setToken(token: string | undefined): void; | ||
set token(token: string | undefined); | ||
get token(): string | undefined; | ||
login(username: string, password: string): Promise<AccountResponse | ServiceError>; | ||
@@ -36,0 +36,0 @@ newAccount(): Promise<AccountResponse | ServiceError>; |
@@ -23,7 +23,7 @@ import { request } from '../shared'; | ||
} | ||
setUrl(url) { | ||
this.url = url; | ||
set token(token) { | ||
this._token = token; | ||
} | ||
setToken(token) { | ||
this.token = token; | ||
get token() { | ||
return this._token; | ||
} | ||
@@ -474,4 +474,4 @@ // Account | ||
const requestHeaders = {}; | ||
if (this.token) { | ||
requestHeaders["Authorization"] = `Bearer ${this.token}`; | ||
if (this._token) { | ||
requestHeaders["Authorization"] = `Bearer ${this._token}`; | ||
} | ||
@@ -478,0 +478,0 @@ for (const e of Object.entries(headers ?? {})) { |
@@ -50,3 +50,3 @@ /* eslint @typescript-eslint/no-non-null-assertion: "off" */ | ||
const client = newServiceClient(globalUrl); | ||
client.setToken('AcTnSLTMXZeD3m9Rj8LfOVZCyGIAAAAA____fwIAYgAAADJwcm9maWxlL2U0ZjkwNTc2MzQzMjgzNWQ2Mjc0Y2NhNjQ0MzUxZjlkL2dldFRva2VuczB1bml2ZXJzZS9jNWZhY2JjOWRjYjljMzlhYzM0Yjk4OWE4ZTc1ZGU2YS9leHBvcnS5QQPEH11r1YaJrgAzRh01909Xyg'); | ||
client.token = 'AcTnSLTMXZeD3m9Rj8LfOVZCyGIAAAAA____fwIAYgAAADJwcm9maWxlL2U0ZjkwNTc2MzQzMjgzNWQ2Mjc0Y2NhNjQ0MzUxZjlkL2dldFRva2VuczB1bml2ZXJzZS9jNWZhY2JjOWRjYjljMzlhYzM0Yjk4OWE4ZTc1ZGU2YS9leHBvcnS5QQPEH11r1YaJrgAzRh01909Xyg'; | ||
const lp = await client.getLayerProfile('e4f905763432835d6274cca644351f9d'); | ||
@@ -53,0 +53,0 @@ expect(lp).toBeTruthy(); |
{ | ||
"name": "vyze", | ||
"version": "0.1.15", | ||
"version": "0.1.16", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "Client for VYZE", |
@@ -43,4 +43,2 @@ import {Id, request, RequestBody, RequestOptions, Response} from '../shared'; | ||
private token?: string; | ||
private universeIdCache = new Map<string, Id>(); | ||
@@ -50,2 +48,3 @@ private universeCache = new Map<Id, Universe>(); | ||
private _token?: string; | ||
private _decoder = new TextDecoder(); | ||
@@ -56,8 +55,8 @@ | ||
public setUrl(url: string) { | ||
this.url = url; | ||
public set token(token: string | undefined) { | ||
this._token = token; | ||
} | ||
public setToken(token: string | undefined) { | ||
this.token = token; | ||
public get token(): string | undefined { | ||
return this._token; | ||
} | ||
@@ -572,4 +571,4 @@ | ||
const requestHeaders: { [key: string]: string } = {}; | ||
if (this.token) { | ||
requestHeaders["Authorization"] = `Bearer ${this.token}`; | ||
if (this._token) { | ||
requestHeaders["Authorization"] = `Bearer ${this._token}`; | ||
} | ||
@@ -576,0 +575,0 @@ for (const e of Object.entries(headers ?? {})) { |
@@ -57,3 +57,3 @@ /* eslint @typescript-eslint/no-non-null-assertion: "off" */ | ||
const client = newServiceClient(globalUrl); | ||
client.setToken('AcTnSLTMXZeD3m9Rj8LfOVZCyGIAAAAA____fwIAYgAAADJwcm9maWxlL2U0ZjkwNTc2MzQzMjgzNWQ2Mjc0Y2NhNjQ0MzUxZjlkL2dldFRva2VuczB1bml2ZXJzZS9jNWZhY2JjOWRjYjljMzlhYzM0Yjk4OWE4ZTc1ZGU2YS9leHBvcnS5QQPEH11r1YaJrgAzRh01909Xyg'); | ||
client.token = 'AcTnSLTMXZeD3m9Rj8LfOVZCyGIAAAAA____fwIAYgAAADJwcm9maWxlL2U0ZjkwNTc2MzQzMjgzNWQ2Mjc0Y2NhNjQ0MzUxZjlkL2dldFRva2VuczB1bml2ZXJzZS9jNWZhY2JjOWRjYjljMzlhYzM0Yjk4OWE4ZTc1ZGU2YS9leHBvcnS5QQPEH11r1YaJrgAzRh01909Xyg'; | ||
const lp = await client.getLayerProfile('e4f905763432835d6274cca644351f9d'); | ||
@@ -60,0 +60,0 @@ expect(lp).toBeTruthy(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
960463