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:
sriram veeraghanta 2024-12-23 01:51:30 +05:30 committed by GitHub
parent 1ee0661ac1
commit 043f4eaa5e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
47 changed files with 2345 additions and 10 deletions

View file

@ -0,0 +1 @@
export * from "./instance.service";

View 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;
});
}
}