INNER CODE UNIT · TypeScript
AppService
modal-labs/modal-client · js/src/app.ts:16
export class AppService {
readonly #client: ModalClient;
constructor(client: ModalClient) {
this.#client = client;
}
/**
* Reference a deployed {@link App} by name, or create if it does not exist.
*/
async fromName(name: string, params: AppFromNameParams = {}): Promise<App> {
const environmentName = this.#client.environmentName(params.environment);
try {
const resp = await this.#client.cpClient.appGetOrCreate({
appName: name,
environmentName,
objectCreationType: params.createIfMissing
? ObjectCreationType.OBJECT_CREATION_TYPE_CREATE_IF_MISSING
: ObjectCreationType.OBJECT_CREATION_TYPE_UNSPECIFIED,