@com.adaptavist.hapi.cloud.analytics.CloudTracked @com.onresolve.scriptrunner.hapi.annotation.Implements(parentInterface: ProjectsApi) class Projects extends java.lang.Object
Provides methods for managing Jira Cloud projects, such as retrieving, creating, and listing projects.
Example Usage:
// Retrieve a project by key
def project = Projects.getByKey("SR");
println "Project name: ${project.name
";
// Create a new project with default settings
def newProject = Projects.create("NEW", "New Project");
println "Created project with ID: ${newProject.id}";
// Customize project creation
Projects.create("DOCS", "Documentation Project") {
description = "Project for managing documentation tasks."
setProjectTypeKey("business");
setProjectTemplateKey("com.atlassian.jira-core-project-templates:jira-core-simplified-project-management");
}
// List all projects visible to the current user
Projects.getAllProjects().each { println it.name }
}
Constructor and description |
---|
Projects() |
Type Params | Return Type | Name and description |
---|---|---|
|
static Project |
create(java.lang.String key, java.lang.String name, groovy.lang.Closure<?> specification) Creates a project with the given key and name, example usage: |
|
static ProjectIterator |
getAllProjects() Gets all projects visible to the current logged in user |
|
static Project |
getById(java.lang.Long id) Get a project by its id |
|
static Project |
getByKey(java.lang.String key) Get a project by its current key |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Creates a project with the given key and name, example usage:
Projects.create('SR', 'ScriptRunner')By default, the project lead is set to the current user and the default assignee is
unassigned
key
- The key the project should havename
- The name the project should havespecification
- Closure containing parameters to set on the created projectGets all projects visible to the current logged in user
Get a project by its id
id
- project idGet a project by its current key