feat: Update agent device token api. (#244)
* feat: Update agent device token api. * fix: typedef for DeviceTokenRequest.improve-workflow
parent
7cb9f2f07e
commit
6f7a6afcd1
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
|
|
@ -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
|
|
@ -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
|
|
@ -32,7 +32,7 @@ export class Auth extends EventEmitter {
|
|||
this.endpoint = options.endpoint;
|
||||
this.dataStore = options.dataStore || dataStore;
|
||||
|
||||
// From tabby endpoint: http[s]://{namespace}.app.tabbyml.com/tabby[/]
|
||||
// From tabby endpoint: http[s]://{namespace}.app.tabbyml.com/tabby[/]
|
||||
// To auth endpoint: http[s]://{namespace}.app.tabbyml.com/api
|
||||
const authApiBase = this.endpoint.replace(/\/tabby\/?$/, "/api");
|
||||
this.authApi = new CloudApi({ BASE: authApiBase });
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
export type DeviceTokenResponse = {
|
||||
auth_url: string;
|
||||
};
|
||||
|
|
@ -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,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue