@umbraco-cms/backoffice Sending a request to the server
I am gradually learning a new approach to developing plugins for v14 and I have a question.
Why the methods from the file: Umbraco.CMS.Backoffice\src\external\backend-api\src\core\request.ts are not exported so that other developers can use the same approach to send requests to the server?
Why did you hide these methods and types from other developers?
From my understanding, these methods are not exported for external use because they are specifically designed for internal purposes.
They act as low-level APIs intended to power higher-level abstractions, such as service classes like CultureService and DataTypeService. These service classes encapsulate the complexities of server communication, providing a simpler, safer, and more consistent interface for external developers.
To use these higher-level abstractions, you can follow an example like this:
import { CultureService } from '@umbraco-cms/backoffice/external/backend-api';
const data = {
skip: 0,
take: 10,
};
CultureService.getCulture(data).then((result) => {
console.log(result);
});
Types and services are already exported, as demonstrated in:
@umbraco-cms/backoffice/external/backend-api
export { ApiError } from './core/ApiError';
export { CancelablePromise, CancelError } from './core/CancelablePromise';
export { OpenAPI, type OpenAPIConfig } from './core/OpenAPI';
export * from './services.gen';
export * from './types.gen';
This shows that developers are meant to use the exported services and types, not internal methods like request. It keeps things consistent, safer, and easier to work with.
@umbraco-cms/backoffice Sending a request to the server
I am gradually learning a new approach to developing plugins for v14 and I have a question.
Why the methods from the file:
Umbraco.CMS.Backoffice\src\external\backend-api\src\core\request.ts
are not exported so that other developers can use the same approach to send requests to the server?Why did you hide these methods and types from other developers?
Thanks
From my understanding, these methods are not exported for external use because they are specifically designed for internal purposes.
They act as low-level APIs intended to power higher-level abstractions, such as service classes like CultureService and DataTypeService. These service classes encapsulate the complexities of server communication, providing a simpler, safer, and more consistent interface for external developers.
To use these higher-level abstractions, you can follow an example like this:
Types and services are already exported, as demonstrated in:
This shows that developers are meant to use the exported services and types, not internal methods like request. It keeps things consistent, safer, and easier to work with.
is working on a reply...