chore: common services package (#6255)
* fix: initial services package setup * fix: services packages updates * fix: services changes * fix: merge conflicts * chore: file structuring * fix: import fixes
This commit is contained in:
parent
1ee0661ac1
commit
043f4eaa5e
47 changed files with 2345 additions and 10 deletions
1
packages/services/src/instance/index.ts
Normal file
1
packages/services/src/instance/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from "./instance.service";
|
||||
44
packages/services/src/instance/instance.service.ts
Normal file
44
packages/services/src/instance/instance.service.ts
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import { API_BASE_URL } from "@plane/constants";
|
||||
import type { IInstanceInfo, TPage } from "@plane/types";
|
||||
import { APIService } from "@/api.service";
|
||||
|
||||
/**
|
||||
* Service class for managing instance-related operations
|
||||
* Handles retrieval of instance information and changelog
|
||||
* @extends {APIService}
|
||||
*/
|
||||
export default class InstanceService extends APIService {
|
||||
/**
|
||||
* Creates an instance of InstanceService
|
||||
* Initializes the service with the base API URL
|
||||
*/
|
||||
constructor() {
|
||||
super(API_BASE_URL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves information about the current instance
|
||||
* @returns {Promise<IInstanceInfo>} Promise resolving to instance information
|
||||
* @throws {Error} If the API request fails
|
||||
*/
|
||||
async info(): Promise<IInstanceInfo> {
|
||||
return this.get("/api/instances/")
|
||||
.then((response) => response.data)
|
||||
.catch((error) => {
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the changelog for the current instance
|
||||
* @returns {Promise<TPage>} Promise resolving to the changelog page data
|
||||
* @throws {Error} If the API request fails
|
||||
*/
|
||||
async changelog(): Promise<TPage> {
|
||||
return this.get("/api/instances/changelog/")
|
||||
.then((response) => response.data)
|
||||
.catch((error) => {
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue