Skip to content

Commit

Permalink
Merge branch '219-saasclient-and-id---do-not-expose' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
countnazgul committed Sep 4, 2023
2 parents af6d612 + 6e3d583 commit d6d7129
Show file tree
Hide file tree
Showing 75 changed files with 734 additions and 730 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

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

## 0.14.3 - 2023-09-04

- [#219](https://github.com/Informatiqal/qlik-saas-api/issues/219) `saasClient` and `id` are private and should not be available

## 0.14.2 - 2023-08-29

- [#217](https://github.com/Informatiqal/qlik-saas-api/issues/217) import and update extension methods implemented
Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qlik-saas-api",
"version": "0.14.2",
"version": "0.14.3",
"description": "Interact with Qlik Sense SaaS REST API",
"author": {
"email": "info@informatiqal.com",
Expand Down Expand Up @@ -61,7 +61,7 @@
"devDependencies": {
"@rollup/plugin-typescript": "^11.1.3",
"@types/form-data": "^2.5.0",
"@types/node": "20.5.7",
"@types/node": "20.5.9",
"dotenv": "16.3.1",
"esm": "^3.2.25",
"nyc": "15.1.0",
Expand Down
66 changes: 33 additions & 33 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { Transports } from "./modules/Transports";

export namespace QlikSaaSApi {
export class client {
public saasClient: QlikSaaSClient;
#saasClient: QlikSaaSClient;
public apps: Apps;
public automations: Automations;
public apiKeys: APIKeys;
Expand Down Expand Up @@ -78,39 +78,39 @@ export namespace QlikSaaSApi {
public notifications: Notifications;

constructor(public saasConfig: any) {
this.saasClient = new QlikSaaSClient(saasConfig);
this.#saasClient = new QlikSaaSClient(saasConfig);

this.apps = new Apps(this.saasClient);
this.automations = new Automations(this.saasClient);
this.apiKeys = new APIKeys(this.saasClient);
this.audits = new Audits(this.saasClient);
this.brands = new Brands(this.saasClient);
this.dataAlerts = new DataAlerts(this.saasClient);
this.dataConnections = new DataConnections(this.saasClient);
this.dataCredentials = new DataCredentials(this.saasClient);
this.conditions = new Conditions(this.saasClient);
this.spaces = new Spaces(this.saasClient);
this.groups = new Groups(this.saasClient);
this.items = new Items(this.saasClient);
this.naturalLanguage = new NL(this.saasClient);
this.licenses = new Licenses(this.saasClient);
this.origins = new Origins(this.saasClient);
this.quotas = new Quotas(this.saasClient);
this.themes = new Themes(this.saasClient);
this.extensions = new Extensions(this.saasClient);
this.evaluations = new Evaluations(this.saasClient);
this.reloads = new Reloads(this.saasClient);
this.reloadTasks = new ReloadTasks(this.saasClient);
this.roles = new Roles(this.saasClient);
this.transports = new Transports(this.saasClient);
this.users = new Users(this.saasClient);
this.webHooks = new WebHooks(this.saasClient);
this.oauthTokens = new OAuthTokens(this.saasClient);
this.collections = new Collections(this.saasClient);
this.identityProviders = new IdentityProviders(this.saasClient);
this.tenants = new Tenants(this.saasClient);
this.webIntegrations = new WebIntegrations(this.saasClient);
this.notifications = new Notifications(this.saasClient);
this.apps = new Apps(this.#saasClient);
this.automations = new Automations(this.#saasClient);
this.apiKeys = new APIKeys(this.#saasClient);
this.audits = new Audits(this.#saasClient);
this.brands = new Brands(this.#saasClient);
this.dataAlerts = new DataAlerts(this.#saasClient);
this.dataConnections = new DataConnections(this.#saasClient);
this.dataCredentials = new DataCredentials(this.#saasClient);
this.conditions = new Conditions(this.#saasClient);
this.spaces = new Spaces(this.#saasClient);
this.groups = new Groups(this.#saasClient);
this.items = new Items(this.#saasClient);
this.naturalLanguage = new NL(this.#saasClient);
this.licenses = new Licenses(this.#saasClient);
this.origins = new Origins(this.#saasClient);
this.quotas = new Quotas(this.#saasClient);
this.themes = new Themes(this.#saasClient);
this.extensions = new Extensions(this.#saasClient);
this.evaluations = new Evaluations(this.#saasClient);
this.reloads = new Reloads(this.#saasClient);
this.reloadTasks = new ReloadTasks(this.#saasClient);
this.roles = new Roles(this.#saasClient);
this.transports = new Transports(this.#saasClient);
this.users = new Users(this.#saasClient);
this.webHooks = new WebHooks(this.#saasClient);
this.oauthTokens = new OAuthTokens(this.#saasClient);
this.collections = new Collections(this.#saasClient);
this.identityProviders = new IdentityProviders(this.#saasClient);
this.tenants = new Tenants(this.#saasClient);
this.webIntegrations = new WebIntegrations(this.#saasClient);
this.notifications = new Notifications(this.#saasClient);
}
}
}
20 changes: 10 additions & 10 deletions src/modules/APIKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,28 @@ export interface IAPIKey {
}

export class APIKey {
private id: string;
private saasClient: QlikSaaSClient;
#id: string;
#saasClient: QlikSaaSClient;
details: IAPIKey;
constructor(saasClient: QlikSaaSClient, id: string, details?: IAPIKey) {
if (!id) throw new Error(`apiKeys.get: "id" parameter is required`);

this.details = details ?? ({} as IAPIKey);
this.id = id;
this.saasClient = saasClient;
this.#id = id;
this.#saasClient = saasClient;
}

async init(arg?: { force: true }) {
if (Object.keys(this.details).length == 0 || arg?.force == true) {
this.details = await this.saasClient
.Get<IAPIKey>(`api-keys/${this.id}`)
this.details = await this.#saasClient
.Get<IAPIKey>(`api-keys/${this.#id}`)
.then((res) => res.data);
}
}

async remove() {
return await this.saasClient
.Delete(`api-keys/${this.id}`)
return await this.#saasClient
.Delete(`api-keys/${this.#id}`)
.then((res) => res.status);
}

Expand All @@ -50,8 +50,8 @@ export class APIKey {
}];

let updateStatus = 0;
return await this.saasClient
.Patch(`api-keys/${this.id}`, data)
return await this.#saasClient
.Patch(`api-keys/${this.#id}`, data)
.then((res) => {
updateStatus = res.status;
return this.init({ force: true });
Expand Down
18 changes: 9 additions & 9 deletions src/modules/APIKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,24 @@ export interface IAPIKeysConfigsUpdate {
}

export class APIKeys {
private saasClient: QlikSaaSClient;
#saasClient: QlikSaaSClient;
constructor(saasClient: QlikSaaSClient) {
this.saasClient = saasClient;
this.#saasClient = saasClient;
}

async get(arg: { id: string }) {
if (!arg.id) throw new Error(`apiKeys.get: "id" parameter is required`);
const apiKey: APIKey = new APIKey(this.saasClient, arg.id);
const apiKey: APIKey = new APIKey(this.#saasClient, arg.id);
await apiKey.init();

return apiKey;
}

async getAll() {
return await this.saasClient
return await this.#saasClient
.Get<IAPIKey[]>(`api-keys?limit=50`)
.then((res) => res.data)
.then((data) => data.map((t) => new APIKey(this.saasClient, t.id, t)));
.then((data) => data.map((t) => new APIKey(this.#saasClient, t.id, t)));
}

async getFilter(arg: { filter: string }) {
Expand Down Expand Up @@ -76,16 +76,16 @@ export class APIKeys {
if (!arg.description)
throw new Error(`apiKeys.create: "description" parameter is required`);

return await this.saasClient
return await this.#saasClient
.Post<IAPIKey>(`api-keys`, arg)
.then((res) => new APIKey(this.saasClient, res.data.id, res.data));
.then((res) => new APIKey(this.#saasClient, res.data.id, res.data));
}

async configs(arg: { tenantId: string }) {
if (!arg.tenantId)
throw new Error(`apiKeys.configs: "tenantId" parameter is required`);

return await this.saasClient
return await this.#saasClient
.Get<IAPIKeysConfigs>(`api-keys/configs/${arg.tenantId}`)
.then((res) => res.data);
}
Expand All @@ -106,7 +106,7 @@ export class APIKeys {
value: a.value,
}));

return await this.saasClient
return await this.#saasClient
.Patch(`api-keys/configs/${arg.tenantId}`, data)
.then((res) => res.status);
}
Expand Down
Loading

0 comments on commit d6d7129

Please sign in to comment.