diff --git a/src/abstractions/api.service.ts b/src/abstractions/api.service.ts index 3a8b104d82..359304b034 100644 --- a/src/abstractions/api.service.ts +++ b/src/abstractions/api.service.ts @@ -1,3 +1,5 @@ +import { PolicyType } from '../enums/policyType'; + import { EnvironmentUrls } from '../models/domain/environmentUrls'; import { BitPayInvoiceRequest } from '../models/request/bitPayInvoiceRequest'; @@ -188,11 +190,9 @@ export abstract class ApiService { deleteGroup: (organizationId: string, id: string) => Promise; deleteGroupUser: (organizationId: string, id: string, organizationUserId: string) => Promise; - getPolicy: (organizationId: string, id: string) => Promise; + getPolicy: (organizationId: string, type: PolicyType) => Promise; getPolicies: (organizationId: string) => Promise>; - postPolicy: (organizationId: string, request: PolicyRequest) => Promise; - putPolicy: (organizationId: string, id: string, request: PolicyRequest) => Promise; - deletePolicy: (organizationId: string, id: string) => Promise; + putPolicy: (organizationId: string, type: PolicyType, request: PolicyRequest) => Promise; getOrganizationUser: (organizationId: string, id: string) => Promise; getOrganizationUserGroups: (organizationId: string, id: string) => Promise; diff --git a/src/services/api.service.ts b/src/services/api.service.ts index 4ceec11601..4e28e24a1c 100644 --- a/src/services/api.service.ts +++ b/src/services/api.service.ts @@ -1,4 +1,5 @@ import { DeviceType } from '../enums/deviceType'; +import { PolicyType } from '../enums/policyType'; import { ApiService as ApiServiceAbstraction } from '../abstractions/api.service'; import { PlatformUtilsService } from '../abstractions/platformUtils.service'; @@ -553,8 +554,8 @@ export class ApiService implements ApiServiceAbstraction { // Policy APIs - async getPolicy(organizationId: string, id: string): Promise { - const r = await this.send('GET', '/organizations/' + organizationId + '/policies/' + id, null, true, true); + async getPolicy(organizationId: string, type: PolicyType): Promise { + const r = await this.send('GET', '/organizations/' + organizationId + '/policies/' + type, null, true, true); return new PolicyResponse(r); } @@ -563,20 +564,11 @@ export class ApiService implements ApiServiceAbstraction { return new ListResponse(r, PolicyResponse); } - async postPolicy(organizationId: string, request: PolicyRequest): Promise { - const r = await this.send('POST', '/organizations/' + organizationId + '/policies', request, true, true); + async putPolicy(organizationId: string, type: PolicyType, request: PolicyRequest): Promise { + const r = await this.send('PUT', '/organizations/' + organizationId + '/policies/' + type, request, true, true); return new PolicyResponse(r); } - async putPolicy(organizationId: string, id: string, request: PolicyRequest): Promise { - const r = await this.send('PUT', '/organizations/' + organizationId + '/policies/' + id, request, true, true); - return new PolicyResponse(r); - } - - deletePolicy(organizationId: string, id: string): Promise { - return this.send('DELETE', '/organizations/' + organizationId + '/policies/' + id, null, true, false); - } - // Organization User APIs async getOrganizationUser(organizationId: string, id: string): Promise {