diff --git a/pkiintergration-fe/src/services/operation.service.ts b/pkiintergration-fe/src/services/operation.service.ts new file mode 100644 index 0000000..ba41c98 --- /dev/null +++ b/pkiintergration-fe/src/services/operation.service.ts @@ -0,0 +1,19 @@ +import { Injectable } from '@angular/core'; +import { IOperation } from '@c8y/client'; +import { OperationService } from '@c8y/ngx-components/api'; + +@Injectable({ providedIn: 'root' }) +export class yourService { + constructor(private operationService: OperationService) {} + + async requestPubKey(deviceId: string): Promise { + // http://resources.cumulocity.com/documentation/websdk/client/interfaces/ioperation.html + const operation: IOperation = { + request_pubkey: {}, + deviceId + }; + // http://resources.cumulocity.com/documentation/websdk/client/classes/operationservice.html#create + const { res, data } = await this.operationService.create(operation); + return data; + } +}