feat: Update agent device token api. (#244)

* feat: Update agent device token api.

* fix: typedef for DeviceTokenRequest.
improve-workflow
Zhiming Ma 2023-06-17 01:43:47 +08:00 committed by GitHub
parent 7cb9f2f07e
commit 6f7a6afcd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 27 additions and 20 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -524,10 +524,11 @@ var ApiService = class {
* @returns DeviceTokenResponse Success
* @throws ApiError
*/
deviceToken() {
deviceToken(body) {
return this.httpRequest.request({
method: "POST",
url: "/device-token"
url: "/device-token",
body
});
}
/**
@ -680,7 +681,7 @@ var _Auth = class extends import_events.EventEmitter {
async requestToken() {
try {
await this.reset();
const deviceToken = await this.authApi.api.deviceToken();
const deviceToken = await this.authApi.api.deviceToken({ auth_url: this.endpoint });
this.logger.debug({ deviceToken }, "Request device token response");
const authUrl = new URL(_Auth.authPageUrl);
authUrl.searchParams.append("code", deviceToken.data.code);

File diff suppressed because one or more lines are too long

View File

@ -13183,10 +13183,11 @@ var ApiService = class {
* @returns DeviceTokenResponse Success
* @throws ApiError
*/
deviceToken() {
deviceToken(body) {
return this.httpRequest.request({
method: "POST",
url: "/device-token"
url: "/device-token",
body
});
}
/**
@ -13341,7 +13342,7 @@ var _Auth = class extends EventEmitter {
async requestToken() {
try {
await this.reset();
const deviceToken = await this.authApi.api.deviceToken();
const deviceToken = await this.authApi.api.deviceToken({ auth_url: this.endpoint });
this.logger.debug({ deviceToken }, "Request device token response");
const authUrl = new URL(_Auth.authPageUrl);
authUrl.searchParams.append("code", deviceToken.data.code);

File diff suppressed because one or more lines are too long

View File

@ -92,7 +92,7 @@ export class Auth extends EventEmitter {
async requestToken(): Promise<string> {
try {
await this.reset();
const deviceToken = await this.authApi.api.deviceToken();
const deviceToken = await this.authApi.api.deviceToken({ auth_url: this.endpoint });
this.logger.debug({ deviceToken }, "Request device token response");
const authUrl = new URL(Auth.authPageUrl);
authUrl.searchParams.append("code", deviceToken.data.code);

View File

@ -0,0 +1,3 @@
export type DeviceTokenResponse = {
auth_url: string;
};

View File

@ -1,6 +1,7 @@
import type { CancelablePromise } from "../../generated/core/CancelablePromise";
import type { BaseHttpRequest } from "../../generated/core/BaseHttpRequest";
import { DeviceTokenRequest } from "../models/DeviceTokenRequest";
import { DeviceTokenResponse } from "../models/DeviceTokenResponse";
import { DeviceTokenAcceptResponse } from "../models/DeviceTokenAcceptResponse";
@ -11,10 +12,11 @@ export class ApiService {
* @returns DeviceTokenResponse Success
* @throws ApiError
*/
public deviceToken(): CancelablePromise<DeviceTokenResponse> {
public deviceToken(body: DeviceTokenRequest): CancelablePromise<DeviceTokenResponse> {
return this.httpRequest.request({
method: "POST",
url: "/device-token",
body,
});
}