Files
plane/dev-wiki/core/services/api_token.service.ts
M. Palanikannan 22ae10cf88 [WIKI-383] feat: dev wiki app (#3411)
* dev: 1

* fix: tubro name

* fix : floating sidebar

* --wip-- [skip ci]

* wip-2

* --wip-- [skip ci]

* wip

* fix: working wiki

---------

Co-authored-by: VipinDevelops <vipinchaudhary1809@gmail.com>
2025-06-18 21:19:30 +05:30

42 lines
1.3 KiB
TypeScript

import { IApiToken } from "@plane/types";
import { API_BASE_URL } from "@/helpers/common.helper";
import { APIService } from "./api.service";
export class APITokenService extends APIService {
constructor() {
super(API_BASE_URL);
}
async getApiTokens(workspaceSlug: string): Promise<IApiToken[]> {
return this.get(`/api/workspaces/${workspaceSlug}/api-tokens/`)
.then((response) => response?.data)
.catch((error) => {
throw error?.response?.data;
});
}
async retrieveApiToken(workspaceSlug: string, tokenId: string): Promise<IApiToken> {
return this.get(`/api/workspaces/${workspaceSlug}/api-tokens/${tokenId}`)
.then((response) => response?.data)
.catch((error) => {
throw error?.response?.data;
});
}
async createApiToken(workspaceSlug: string, data: Partial<IApiToken>): Promise<IApiToken> {
return this.post(`/api/workspaces/${workspaceSlug}/api-tokens/`, data)
.then((response) => response?.data)
.catch((error) => {
throw error?.response?.data;
});
}
async deleteApiToken(workspaceSlug: string, tokenId: string): Promise<IApiToken> {
return this.delete(`/api/workspaces/${workspaceSlug}/api-tokens/${tokenId}`)
.then((response) => response?.data)
.catch((error) => {
throw error?.response?.data;
});
}
}