AppService
¶
The AppService
is the base class from which all services must inherit.
A service may override the setup()
method to perform any
service setup that does not require configuration. If a service requires configuration,
this should be done using a configure()
method. This is not implemented in
AppService
because the parameters will be service-specific.
Convenience properties _build_info
and
_project
allow convenient retrieval of the rendered project and
the info for the current build.
API documentation¶
- class craft_application.services.base.AppService(app: AppMetadata, services: ServiceFactory)¶
A service class, containing application business logic.
The AppService base class is for services that do not need access to an existing project.
- property _build_info: BuildInfo¶
The information about the current build.
This will error if the build plan is not configured, if the build plan contains multiple entries, or if the build plan is empty.
- property _project: Project¶
The rendered project to use.
This will error if the project is not yet fully configured.
- setup() None ¶
Service-specific setup to perform.
Child classes should always call
super().setup()
.