Skip to content

Commit 69dae63

Browse files
authored
Merge pull request #42 from ctrl-hub/update-group-model-and-service
Update group model and service
2 parents 9a04100 + c104eca commit 69dae63

File tree

9 files changed

+472
-97
lines changed

9 files changed

+472
-97
lines changed

dist/index.js

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -360,11 +360,11 @@ class Group extends BaseModel {
360360
super(data);
361361
this.name = data?.attributes?.name ?? data?.name ?? "";
362362
this.description = data?.attributes?.description ?? data?.description ?? "";
363-
this.bindings = data?.attributes?.bindings ?? [];
363+
this.bindings = data?.attributes?.bindings ?? data?.bindings ?? [];
364364
}
365365
jsonApiMapping() {
366366
return {
367-
attributes: ["name", "description"],
367+
attributes: ["name", "description", "bindings"],
368368
relationships: {}
369369
};
370370
}
@@ -1618,19 +1618,6 @@ class GroupsService extends BaseService {
16181618
constructor(client) {
16191619
super(client, "/v3/orgs/:orgId/iam/groups");
16201620
}
1621-
async deleteBinding(groupId, bindingId) {
1622-
let deleteEndpoint = this.endpoint + "/" + groupId + "/bindings/" + bindingId;
1623-
return await this.client.makeDeleteRequest(deleteEndpoint);
1624-
}
1625-
async createBinding(groupId, body) {
1626-
let createBindingEndpoint = this.endpoint + "/" + groupId + "/bindings";
1627-
return await this.client.makePostRequest(createBindingEndpoint, {
1628-
data: {
1629-
type: "bindings",
1630-
attributes: JSON.parse(body)
1631-
}
1632-
});
1633-
}
16341621
}
16351622

16361623
// src/services/VehiclesService.ts

dist/models/Group.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ type Binding = {
99
rules: {
1010
type: string;
1111
operator: string;
12+
key: string;
1213
value: string;
1314
}[];
1415
};

dist/models/Group.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ export class Group extends BaseModel {
99
super(data);
1010
this.name = data?.attributes?.name ?? data?.name ?? '';
1111
this.description = data?.attributes?.description ?? data?.description ?? '';
12-
this.bindings = data?.attributes?.bindings ?? [];
12+
this.bindings = data?.attributes?.bindings ?? data?.bindings ?? [];
1313
}
1414
jsonApiMapping() {
1515
return {
16-
attributes: ['name', 'description'],
16+
attributes: ['name', 'description', 'bindings'],
1717
relationships: {},
1818
};
1919
}

dist/services/GroupService.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,4 @@ import { Client } from "../Client";
33
import { Group } from "../models/Group";
44
export declare class GroupsService extends BaseService<Group> {
55
constructor(client: Client);
6-
deleteBinding(groupId: string, bindingId: string): Promise<any>;
7-
createBinding(groupId: string, body: string): Promise<any>;
86
}

dist/services/GroupService.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,4 @@ export class GroupsService extends BaseService {
55
constructor(client) {
66
super(client, "/v3/orgs/:orgId/iam/groups");
77
}
8-
async deleteBinding(groupId, bindingId) {
9-
let deleteEndpoint = this.endpoint + '/' + groupId + '/bindings/' + bindingId;
10-
return await this.client.makeDeleteRequest(deleteEndpoint);
11-
}
12-
async createBinding(groupId, body) {
13-
let createBindingEndpoint = this.endpoint + '/' + groupId + '/bindings';
14-
return await this.client.makePostRequest(createBindingEndpoint, {
15-
data: {
16-
type: 'bindings',
17-
attributes: JSON.parse(body)
18-
}
19-
});
20-
}
218
}

0 commit comments

Comments
 (0)