attlaz-client 1.47.1 → 1.47.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { ApiRecord } from './ApiRecord.js';
1
+ import { ApiRecord } from '../ApiRecord.js';
2
2
  export declare class ProviderToken {
3
3
  id: string;
4
4
  state: string;
@@ -7,5 +7,5 @@ export declare class ProviderToken {
7
7
  id: string;
8
8
  icon: string | null;
9
9
  } | null;
10
- static parse(rawAdapter: ApiRecord): ProviderToken;
10
+ static parse(rawToken: ApiRecord): ProviderToken;
11
11
  }
@@ -0,0 +1,12 @@
1
+ export class ProviderToken {
2
+ id;
3
+ state;
4
+ details;
5
+ static parse(rawToken) {
6
+ const token = new ProviderToken();
7
+ token.id = rawToken.id;
8
+ token.state = rawToken.state;
9
+ token.details = rawToken.details;
10
+ return token;
11
+ }
12
+ }
@@ -0,0 +1,5 @@
1
+ import { ApiRecord } from '../ApiRecord.js';
2
+ export declare class ProviderTokenAccessToken {
3
+ accessToken: string;
4
+ static parse(rawToken: ApiRecord): ProviderTokenAccessToken;
5
+ }
@@ -0,0 +1,8 @@
1
+ export class ProviderTokenAccessToken {
2
+ accessToken;
3
+ static parse(rawToken) {
4
+ const token = new ProviderTokenAccessToken();
5
+ token.accessToken = rawToken.access_token;
6
+ return token;
7
+ }
8
+ }
@@ -1,6 +1,8 @@
1
- import { ProviderToken } from '../Model/ProviderToken.js';
1
+ import { ProviderToken } from '../Model/ProviderToken/ProviderToken.js';
2
+ import { ProviderTokenAccessToken } from '../Model/ProviderToken/ProviderTokenAccessToken.js';
2
3
  import { Endpoint } from './Endpoint.js';
3
4
  export declare class ProviderTokenEndpoint extends Endpoint {
4
5
  getProviderToken(providerTokenId: string): Promise<ProviderToken | null>;
5
- getProviderTokenAccessToken(providerTokenId: string): Promise<ProviderToken | null>;
6
+ getProviderTokenAccessToken(providerTokenId: string): Promise<ProviderTokenAccessToken | null>;
7
+ revokeProviderToken(providerTokenId: string): Promise<boolean>;
6
8
  }
@@ -1,5 +1,6 @@
1
1
  import { QueryString } from '../Http/Data/QueryString.js';
2
- import { ProviderToken } from '../Model/ProviderToken.js';
2
+ import { ProviderToken } from '../Model/ProviderToken/ProviderToken.js';
3
+ import { ProviderTokenAccessToken } from '../Model/ProviderToken/ProviderTokenAccessToken.js';
3
4
  import { Endpoint } from './Endpoint.js';
4
5
  export class ProviderTokenEndpoint extends Endpoint {
5
6
  async getProviderToken(providerTokenId) {
@@ -8,9 +9,26 @@ export class ProviderTokenEndpoint extends Endpoint {
8
9
  return result.getData();
9
10
  }
10
11
  async getProviderTokenAccessToken(providerTokenId) {
11
- // TODO: further implement this
12
12
  const queryString = new QueryString('/provider-tokens/' + providerTokenId + '/access-token');
13
- const result = await this.requestObject(queryString, null, ProviderToken.parse);
13
+ const result = await this.requestObject(queryString, null, ProviderTokenAccessToken.parse);
14
14
  return result.getData();
15
15
  }
16
+ async revokeProviderToken(providerTokenId) {
17
+ const queryString = new QueryString('/provider-tokens/' + providerTokenId);
18
+ try {
19
+ const parser = (raw) => ({ deleted: raw.deleted });
20
+ const result = await this.requestObject(queryString, null, parser, 'DELETE');
21
+ const re = result.getData();
22
+ if (re === null) {
23
+ throw new Error('Unable to revoke provider token: wrong response from API');
24
+ }
25
+ return re.deleted;
26
+ }
27
+ catch (e) {
28
+ if (this.httpClient.isDebugEnabled()) {
29
+ console.error('Failed to revoke provider token: ', e);
30
+ }
31
+ throw e;
32
+ }
33
+ }
16
34
  }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.47.0";
1
+ export declare const VERSION = "1.47.2";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.47.0";
1
+ export const VERSION = "1.47.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.47.1",
3
+ "version": "1.47.3",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -1,24 +0,0 @@
1
- export class ProviderToken {
2
- id;
3
- state;
4
- details;
5
- static parse(rawAdapter) {
6
- // const adapter: Adapter = MetaDataWithIconAware.parseMetaData(new Adapter(), rawAdapter);
7
- //
8
- // // adapter.id = rawAdapter.id as string;
9
- // // adapter.name = rawAdapter.name as string;
10
- // // adapter.description = rawAdapter.description as string;
11
- // adapter.vendor = rawAdapter.vendor as string;
12
- //
13
- // adapter.longDescription = rawAdapter.long_description as string | null;
14
- // adapter.capabilities = rawAdapter.capabilities as unknown as string[];
15
- //
16
- // // adapter.icon = rawAdapter.icon as string;
17
- // adapter.logo = MetaDataWithIconAware.parseIcon(rawAdapter.logo);
18
- // adapter.type = rawAdapter.type as string;
19
- // adapter.categoryIds = rawAdapter.categories as unknown as string[];
20
- // adapter.docs = rawAdapter.docs as string | null;
21
- // adapter.website = rawAdapter.website as string | null;
22
- return rawAdapter;
23
- }
24
- }