View Source Jiraffe.Issue (Jiraffe v0.1.1)

Jira issue CRUD operations and struct.

Reference

Summary

Functions

Creates up to 50 issues and, where the option to create subtasks is enabled in Jira, subtasks.

Get an issue by ID or key

(DEPRECATED) Returns details of projects, issue types within projects, and, when requested, the create screen fields for each issue type for the user.

Returns the edit screen fields for an issue that are visible to and editable by the user.

Searches for issues using JQL. Returns a page of issues found using the JQL query.

Searches for issues using JQL. Returns the issues found using the JQL query.

Searches for issues using JQL. Returns the issues found using the JQL query.

Creates a link between two issues. Use this operation to indicate a relationship between two issues and optionally add a comment to the from (outward) issue.

Converts a map (received from Jira API) to Jiraffe.Issue struct.

Edits an issue. A transition may be applied and issue properties updated as part of the edit.

Types

@type jql_search_params() :: [
  jql: String.t(),
  start_at: non_neg_integer(),
  max_results: non_neg_integer(),
  validate_query: String.t(),
  fields: [String.t()],
  expand: String.t(),
  properties: [String.t()],
  fields_by_keys: boolean()
]
@type t() :: %Jiraffe.Issue{
  changelog: map() | nil,
  edit_meta: Jiraffe.Issue.EditMetadata.t(),
  expand: String.t() | nil,
  fields: map(),
  fields_to_include: map() | nil,
  id: String.t() | nil,
  key: String.t() | nil,
  names: map(),
  operations: list(),
  properties: map(),
  rendered_fields: map(),
  schema: map(),
  self: String.t() | nil,
  transitions: list(),
  versioned_representations: map() | nil
}

Functions

Link to this function

bulk_create(client, updates)

View Source
@spec bulk_create(
  client :: Jiraffe.Client.t(),
  updates :: [
    %{
      optional(:transition) => map(),
      optional(:fields) => map(),
      optional(:update) => map(),
      optional(:history_metadata) => map(),
      optional(:properties) => [term()]
    }
  ]
) :: {:ok, Jiraffe.Issue.BulkCreateResult.t()} | {:error, Jiraffe.Error.t()}

Creates up to 50 issues and, where the option to create subtasks is enabled in Jira, subtasks.

Reference

Link to this function

get(client, id_or_key, params \\ [])

View Source
@spec get(
  client :: Jiraffe.Client.t(),
  id_or_key :: String.t(),
  params :: [
    fields: [String.t()],
    expand: String.t(),
    properties: [String.t()],
    fields_by_keys: boolean(),
    update_history: boolean()
  ]
) :: {:ok, t()} | {:error, Jiraffe.Error.t()}

Get an issue by ID or key

Reference

Link to this function

get_create_metadata(client, params)

View Source
@spec get_create_metadata(
  client :: Jiraffe.Client.t(),
  params :: [
    project_ids: [non_neg_integer()],
    project_keys: [String.t()],
    issue_type_ids: [non_neg_integer()],
    issue_type_names: [String.t()],
    expand: String.t()
  ]
) :: {:ok, Jiraffe.Issue.CreateMetadata.t()} | {:error, Jiraffe.Error.t()}

(DEPRECATED) Returns details of projects, issue types within projects, and, when requested, the create screen fields for each issue type for the user.

Examples

Jiraffe.Issue.get_create_metadata(
  client,
  expand: "projects.issuetypes.fields"
)

{:ok,
  %Jiraffe.Issue.CreateMetadata{
    expand: "projects.issuetypes.fields",
    projects: []
  }
}
Link to this function

get_edit_metadata(client, issue_id_or_key, params \\ [])

View Source
@spec get_edit_metadata(
  client :: Jiraffe.Client.t(),
  issue_id_or_key :: String.t(),
  params :: [
    override_screen_security: boolean(),
    override_editable_flag: boolean()
  ]
) :: {:ok, Jiraffe.Issue.EditMetadata.t()} | {:error, Jiraffe.Error.t()}

Returns the edit screen fields for an issue that are visible to and editable by the user.

Link to this function

jql_search(client, params)

View Source
@spec jql_search(
  Jiraffe.Client.t(),
  params :: jql_search_params()
) :: {:ok, t()} | {:error, Jiraffe.Error.t()}

Searches for issues using JQL. Returns a page of issues found using the JQL query.

Params

  • jql - The JQL search query.
  • start_at - The index of the first item to return in a page of results (page offset).
  • max_results - The maximum number of issues to return per page (defaults to 50).
  • validate_query - Determines how to validate the JQL query and treat the validation results.
    • strict
    • warn
    • none
  • fields - A list of fields to return for each issue, use it to retrieve a subset of fields.
    • ["summary", "comment"] - Returns only the summary and comments fields.
    • ["-description"] - Returns all navigable (default) fields except description. -["*all", "-comment"] - Returns all fields except comments.
  • expand - Use expand to include additional information about issues in the response.
    • renderedFields - Returns field values rendered in HTML format.
    • names - Returns the display name of each field.
    • schema - Returns the schema describing a field type.
    • transitions - Returns all possible transitions for the issue.
    • operations - Returns all possible operations for the issue.
    • editmeta - Returns information about how each field can be edited.
    • changelog - Returns a list of recent updates to an issue, sorted by date, starting from the most recent.
    • versionedRepresentations - Instead of fields, returns versionedRepresentations a JSON array containing each version of a field's value, with the highest numbered item representing the most recent version.
  • properties - A list of issue property keys for issue properties to include in the results.
  • fields_by_keys - Whether fields in fields are referenced by keys rather than IDs.

Examples:

Jiraffe.Issue.jql_search(
  client, jql: "project = EX",
  max_results: 2
  )

{:ok, %{
  start_at: 0,
  max_results: 2,
  is_last: true,
  total: 2,
  values: [
    %Jiraffe.Issue{
      fields: %{"description" => "Bar", "summary" => "Foo"},
      id: "10002",
      key: "EX-1",
      self: "https://your-domain.atlassian.net/rest/api/2/issue/10002"
    },
    %Jiraffe.Issue{
      fields: %{"description" => "Qux", "summary" => "Baz"},
      id: "10003",
      key: "EX-2",
      self: "https://your-domain.atlassian.net/rest/api/2/issue/10003"
    }
]}}
Link to this function

jql_search_all(client, params)

View Source
@spec jql_search_all(
  Jiraffe.Client.t(),
  params :: jql_search_params()
) :: Enum.t()
@spec jql_search_all(
  Jiraffe.Client.t(),
  params :: jql_search_params()
) :: {:ok, [t()]} | {:error, Jiraffe.Error.t()}

Searches for issues using JQL. Returns the issues found using the JQL query.

Link to this function

jql_search_stream(client, params)

View Source

Searches for issues using JQL. Returns the issues found using the JQL query.

@spec link(
  client :: Jiraffe.Client.t(),
  params :: [
    type_id: String.t(),
    inward_issue_id: String.t(),
    outward_issue_id: String.t(),
    comment: map()
  ]
) :: {:ok, Jiraffe.Issue.Link.t()} | {:error, Exception.t()}

Creates a link between two issues. Use this operation to indicate a relationship between two issues and optionally add a comment to the from (outward) issue.

Converts a map (received from Jira API) to Jiraffe.Issue struct.

Link to this function

update(client, id, body, params \\ [])

View Source
@spec update(
  client :: Jiraffe.Client.t(),
  id :: String.t(),
  body :: %{
    optional(:transition) => map(),
    optional(:fields) => map(),
    optional(:update) => map(),
    optional(:history_metadata) => map(),
    optional(:properties) => [term()]
  },
  params :: [
    notify_users: boolean(),
    override_screen_security: boolean(),
    override_editable_flag: boolean(),
    return_issue: boolean(),
    expand: String.t()
  ]
) :: {:ok, t()} | {:ok, term()} | {:error, Jiraffe.Error.t()}

Edits an issue. A transition may be applied and issue properties updated as part of the edit.