@camunda8/sdk
Version:
[](https://www.npmjs.com/package/@camunda8/sdk)
268 lines (267 loc) • 12.3 kB
TypeScript
import { CamundaPlatform8Configuration, DeepPartial } from '../../lib';
import { IHeadersProvider } from '../../oauth';
import * as Dto from './ModelerDto';
/**
* Modeler REST API Client.
* All constructor parameters for configuration are optional. If no configuration is provided, the SDK will use environment variables to configure itself.
* See {@link CamundaSDKConfiguration} for the complete list of configuration parameters. Values can be passed in explicitly in code, or set via environment variables (recommended: separate configuration and application logic).
* Explicitly set values will override environment variables, which are merged into the configuration.
*/
export declare class ModelerApiClient {
private userAgentString;
private oAuthProvider;
private rest;
constructor(options?: {
config?: DeepPartial<CamundaPlatform8Configuration>;
oAuthProvider?: IHeadersProvider;
});
private getHeaders;
private decodeResponseOrThrow;
/**
* Adds a new collaborator to a project or modifies the permission level of an existing collaborator.
* Note: Only users that are part of the authorized organization (see GET /api/v1/info) and logged in to Web Modeler at least once can be added to a project.
* @throws {RESTError}
*/
addCollaborator(req: Dto.CreateCollaboratorDto): Promise<null>;
/**
* Searches for collaborators.
* filter specifies which fields should match. Only items that match the given fields will be returned.
* sort specifies by which fields and direction (ASC/DESC) the result should be sorted.
* page specifies the page number to return.
* size specifies the number of items per page. The default value is 10.
* @throws {RESTError}
*/
searchCollaborators(req: Dto.PubSearchDtoProjectCollaboratorDto): Promise<Dto.PubSearchResultDtoProjectCollaboratorDto>;
/**
*
* @throws {RESTError}
* @returns
*/
deleteCollaborator({ email, projectId, }: {
projectId: string;
email: string;
}): Promise<null>;
/**
* This endpoint creates a file.
*
* To create a file, specify projectId and/or folderId:
*
* When only folderId is given, the file will be created in that folder. The folder can be in any project of the same organization.
*
* When projectId is given and folderId is either null or omitted altogether, the file will be created in the root of the project.
*
* When projectId and folderId are both given, they must be consistent - i.e. the folder is in the project.
*
* For connector templates, the following constraints apply:
*
* The value of content.$schema will be replaced with https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json and validated against it.
*
* The value of name takes precedence over content.name. In case of mismatch, the latter will be adjusted to match the former automatically.
*
* The value of content.id will be replaced with the file id generated by Web Modeler.
*
* The value of content.version is managed by Web Modeler and will be updated automatically.
*
* Note: The simplePath transforms any occurrences of slashes ("/") in file and folder names into an escape sequence consisting of a backslash followed by a slash ("\/").
* This form of escaping facilitates the processing of path-like structures within file and folder names.
* @throws {RESTError}
*/
createFile(req: Dto.CreateFileDto): Promise<Dto.FileMetadataDto>;
/**
* Retrieves a file.
*
* Note: The simplePath transforms any occurrences of slashes ("/") in file and folder names into an
* escape sequence consisting of a backslash followed by a slash ("\/"). This form of escaping
* facilitates the processing of path-like structures within file and folder names.
*
* Does this throw if it is not found?
* @throws {RESTError}
*/
getFile(fileId: string): Promise<Dto.FileDto>;
/**
* Deletes a file.
* Note: Deleting a file will also delete other resources attached to the file (comments, call activity/business rule task links, milestones and shares) which might have side-effects.
* Deletion of resources is recursive and cannot be undone.
* @throws {RESTError}
*/
deleteFile(fileId: string): Promise<null>;
/**
* Updates the content, name, or location of a file, or all at the same time.
*
* To move a file, specify projectId and/or folderId:
* When only folderId is given, the file will be moved to that folder. The folder can be in another project of the same organization.
* When projectId is given and folderId is either null or omitted altogether, the file will be moved to the root of the project.
* When projectId and folderId are both given, they must be consistent - i.e. the new parent folder is in the new project.
* The field revision holds the current revision of the file. This is used for detecting and preventing concurrent modifications.
* For connector templates, the following constraints apply:
* The value of content.$schema is not updatable.
* The value of content.name can only be changed via name.
* The value of content.id is not updatable.
* The value of content.version is managed by Web Modeler and will be updated automatically.
* Note: The simplePath transforms any occurrences of slashes ("/") in file and folder names into an escape sequence consisting of a backslash followed by a slash ("\/").
* This form of escaping facilitates the processing of path-like structures within file and folder names.
* @throws {RESTError}
*/
updateFile(fileId: string, update: Dto.UpdateFileDto): Promise<Dto.FileMetadataDto>;
/**
* Searches for files.
* filter specifies which fields should match. Only items that match the given fields will be returned.
*
* Note: Date fields need to be specified in a format compatible with java.time.ZonedDateTime; for example 2023-09-20T11:31:20.206801604Z.
*
* You can use suffixes to match date ranges:
*
* Modifier Description
* ||/y Within a year
* ||/M Within a month
* ||/w Within a week
* ||/d Within a day
* ||/h Within an hour
* ||/m Within a minute
* ||/s Within a second
*
* sort specifies by which fields and direction (ASC/DESC) the result should be sorted.
*
* page specifies the page number to return.
* size specifies the number of items per page. The default value is 10.
*
* Note: The simplePath transform any occurrences of slashes ("/") in file and folder names into an escape sequence consisting of a backslash followed by a slash ("\/").
* This form of escaping facilitates the processing of path-like structures within file and folder names.
* @throws {RESTError}
*/
searchFiles(req: Dto.PubSearchDtoFileMetadataDto): Promise<Dto.PubSearchResultDtoFileMetadataDto>;
/**
*
* Creates a new folder.
*
* When only parentId is given, the folder will be created in that folder. The folder can be in any project of the same organization.
*
* When projectId is given and parentId is either null or omitted altogether, the folder will be created in the root of the project.
*
* When projectId and parentId are both given, they must be consistent - i.e. the parent folder is in the project.
* @throws {RESTError}
*/
createFolder(req: Dto.CreateFolderDto): Promise<Dto.FolderMetadataDto>;
/**
*
* @throws {RESTError}
* @returns
*/
getFolder(folderId: string): Promise<Dto.FolderDto>;
/**
*
* Deletes an empty folder. A folder is considered empty if there are no files in it. Deletion of resources is recursive and cannot be undone.
* @throws {RESTError}
*/
deleteFolder(folderId: string): Promise<null>;
/**
* Updates the name or location of a folder, or both at the same time.
*
* To move a folder, specify projectId and/or parentId:
*
* When only parentId is given, the file will be moved to that folder. The folder must keep in the same organization.
*
* When projectId is given and parentId is either null or omitted altogether, the file will be moved to the root of the project.
*
* When projectId and parentId are both given, they must be consistent - i.e. the new parent folder is in the new project.
* @throws {RESTError}
*/
updateFolder(folderId: string, update: Dto.UpdateFolderDto): Promise<Dto.FolderMetadataDto>;
/**
*
* @throws {RESTError}
*/
getInfo(): Promise<Dto.InfoDto>;
/**
*
* @throws {RESTError}
*/
createMilestone(req: Dto.CreateMilestoneDto): Promise<Dto.MilestoneMetadataDto>;
/**
*
* @throws {RESTError}
*/
getMilestone(milestoneId: string): Promise<Dto.MilestoneDto>;
/**
* Deletion of resources is recursive and cannot be undone.
* @throws {RESTError}
*/
deleteMilestone(milestoneId: string): Promise<string>;
/**
* Returns a link to a visual comparison between two milestones where the milestone referenced by milestone1Id acts as a baseline to compare the milestone referenced by milestone2Id against.
* @throws {RESTError}
*/
getMilestoneComparison(milestone1Id: string, milestone2Id: string): Promise<string>;
/**
* Searches for milestones.
*
* filter specifies which fields should match. Only items that match the given fields will be returned.
*
* Note: Date fields need to be specified in a format compatible with java.time.ZonedDateTime; for example 2023-09-20T11:31:20.206801604Z.
*
* You can use suffixes to match date ranges:
*
* Modifier Description
* ||/y Within a year
* ||/M Within a month
* ||/w Within a week
* ||/d Within a day
* ||/h Within an hour
* ||/m Within a minute
* ||/s Within a second
* sort specifies by which fields and direction (ASC/DESC) the result should be sorted.
*
* page specifies the page number to return.
*
* size specifies the number of items per page. The default value is 10.
* @throws {RESTError}
*/
searchMilestones(req: Dto.PubSearchDtoMilestoneMetadataDto): Promise<Dto.PubSearchResultDtoMilestoneMetadataDto>;
/**
* Creates a new project. This project will be created without any collaborators, so it will not be visible in the UI by default. To assign collaborators, use `addCollaborator()`.
* @throws {RESTError}
*/
createProject(name: string): Promise<Dto.ProjectMetadataDto>;
/**
*
* @throws {RESTError}
* @returns
*/
getProject(projectId: string): Promise<Dto.ProjectDto>;
/**
* This endpoint deletes an empty project. A project is considered empty if there are no files in it. Deletion of resources is recursive and cannot be undone.
* @throws {RESTError}
*/
deleteProject(projectId: string): Promise<any>;
/**
*
* @throws {RESTError}
*/
renameProject(projectId: string, name: string): Promise<Dto.ProjectMetadataDto>;
/**
* Searches for projects.
*
* filter specifies which fields should match. Only items that match the given fields will be returned.
*
* Note: Date fields need to be specified in a format compatible with java.time.ZonedDateTime; for example 2023-09-20T11:31:20.206801604Z.
*
* You can use suffixes to match date ranges:
*
* Modifier Description
* ||/y Within a year
* ||/M Within a month
* ||/w Within a week
* ||/d Within a day
* ||/h Within an hour
* ||/m Within a minute
* ||/s Within a second
*
* sort specifies by which fields and direction (ASC/DESC) the result should be sorted.
*
* page specifies the page number to return.
*
* size specifies the number of items per page. The default value is 10.
* @throws {RESTError}
*/
searchProjects(req: Dto.PubSearchDtoProjectMetadataDto): Promise<Dto.PubSearchResultDtoProjectMetadataDto>;
}