Class: Leash::Integration::JiraClient

Inherits:
Object
  • Object
show all
Defined in:
lib/leash/integration/jira.rb

Instance Method Summary collapse

Constructor Details

#initialize(leash) ⇒ JiraClient

Create a new Jira integration client.

Parameters:

  • leash (Leash::Client)

    the Leash SDK client



11
12
13
# File 'lib/leash/integration/jira.rb', line 11

def initialize(leash)
  @leash = leash
end

Instance Method Details

#jira_delete(path, queryparams: nil, jq: nil, outputformat: nil) ⇒ Object

Delete Jira resources. Returns TOON format by default. **Output format:** TOON (default) or JSON (‘outputFormat: “json”`) **Common operations:** 1. **Delete issue:** `/rest/api/3/issue/{issueIdOrKe…

Parameters:

  • path (String)

    The Jira API endpoint path (without base URL). Must start with “/”. Examples: “/rest/api/3/project”, “/rest/api/3/search/jql”, “/rest/api/3/issue/issueIdOrKey”

  • queryparams (Hash, nil) (defaults to: nil)

    Optional query parameters as key-value pairs. Examples: “50”, “startAt”: “0”, “jql”: “project=PROJ”, “fields”: “summary,status”

  • jq (String, nil) (defaults to: nil)

    JMESPath expression to filter/transform the response. IMPORTANT: Always use this to extract only needed fields and reduce token costs. Examples: “issues.key, summary: fields.summary” (extract specific fields), “issues” (first result), “issues.key” (keys only). See jmespath.org

  • outputformat (String, nil) (defaults to: nil)

    Output format: “toon” (default, 30-60% fewer tokens) or “json”. TOON is optimized for LLMs with tabular arrays and minimal syntax.

Returns:

  • (Object)


96
97
98
99
100
101
102
103
104
# File 'lib/leash/integration/jira.rb', line 96

def jira_delete(path, queryparams: nil, jq: nil, outputformat: nil)
  params = {
    'path' => path,
    'queryParams' => queryparams,
    'jq' => jq,
    'outputFormat' => outputformat
  }.compact
  @leash.call('jira', 'jira_delete', params)
end

#jira_get(path, queryparams: nil, jq: nil, outputformat: nil) ⇒ Object

Read any Jira data. Returns TOON format by default (30-60% fewer tokens than JSON). **IMPORTANT - Cost Optimization:** - ALWAYS use ‘jq` param to filter response fields. Unfiltered responses are ve…

Parameters:

  • path (String)

    The Jira API endpoint path (without base URL). Must start with “/”. Examples: “/rest/api/3/project”, “/rest/api/3/search/jql”, “/rest/api/3/issue/issueIdOrKey”

  • queryparams (Hash, nil) (defaults to: nil)

    Optional query parameters as key-value pairs. Examples: “50”, “startAt”: “0”, “jql”: “project=PROJ”, “fields”: “summary,status”

  • jq (String, nil) (defaults to: nil)

    JMESPath expression to filter/transform the response. IMPORTANT: Always use this to extract only needed fields and reduce token costs. Examples: “issues.key, summary: fields.summary” (extract specific fields), “issues” (first result), “issues.key” (keys only). See jmespath.org

  • outputformat (String, nil) (defaults to: nil)

    Output format: “toon” (default, 30-60% fewer tokens) or “json”. TOON is optimized for LLMs with tabular arrays and minimal syntax.

Returns:

  • (Object)


22
23
24
25
26
27
28
29
30
# File 'lib/leash/integration/jira.rb', line 22

def jira_get(path, queryparams: nil, jq: nil, outputformat: nil)
  params = {
    'path' => path,
    'queryParams' => queryparams,
    'jq' => jq,
    'outputFormat' => outputformat
  }.compact
  @leash.call('jira', 'jira_get', params)
end

#jira_patch(path, body, queryparams: nil, jq: nil, outputformat: nil) ⇒ Object

Partially update Jira resources. Returns TOON format by default. **IMPORTANT - Cost Optimization:** Use ‘jq` param to filter response fields. **Output format:** TOON (default) or JSON (`outputForma…

Parameters:

  • path (String)

    The Jira API endpoint path (without base URL). Must start with “/”. Examples: “/rest/api/3/project”, “/rest/api/3/search/jql”, “/rest/api/3/issue/issueIdOrKey”

  • queryparams (Hash, nil) (defaults to: nil)

    Optional query parameters as key-value pairs. Examples: “50”, “startAt”: “0”, “jql”: “project=PROJ”, “fields”: “summary,status”

  • jq (String, nil) (defaults to: nil)

    JMESPath expression to filter/transform the response. IMPORTANT: Always use this to extract only needed fields and reduce token costs. Examples: “issues.key, summary: fields.summary” (extract specific fields), “issues” (first result), “issues.key” (keys only). See jmespath.org

  • outputformat (String, nil) (defaults to: nil)

    Output format: “toon” (default, 30-60% fewer tokens) or “json”. TOON is optimized for LLMs with tabular arrays and minimal syntax.

  • body (Hash)

    Request body as a JSON object. Structure depends on the endpoint. Example for issue: {“project”: {“key”: “PROJ”, “summary”: “Issue title”, “issuetype”: “Task”}}

Returns:

  • (Object)


78
79
80
81
82
83
84
85
86
87
# File 'lib/leash/integration/jira.rb', line 78

def jira_patch(path, body, queryparams: nil, jq: nil, outputformat: nil)
  params = {
    'path' => path,
    'queryParams' => queryparams,
    'jq' => jq,
    'outputFormat' => outputformat,
    'body' => body
  }.compact
  @leash.call('jira', 'jira_patch', params)
end

#jira_post(path, body, queryparams: nil, jq: nil, outputformat: nil) ⇒ Object

Create Jira resources. Returns TOON format by default (token-efficient). **IMPORTANT - Cost Optimization:** - Use ‘jq` param to extract only needed fields from response (e.g., `jq: “{key: key, id:…

Parameters:

  • path (String)

    The Jira API endpoint path (without base URL). Must start with “/”. Examples: “/rest/api/3/project”, “/rest/api/3/search/jql”, “/rest/api/3/issue/issueIdOrKey”

  • queryparams (Hash, nil) (defaults to: nil)

    Optional query parameters as key-value pairs. Examples: “50”, “startAt”: “0”, “jql”: “project=PROJ”, “fields”: “summary,status”

  • jq (String, nil) (defaults to: nil)

    JMESPath expression to filter/transform the response. IMPORTANT: Always use this to extract only needed fields and reduce token costs. Examples: “issues.key, summary: fields.summary” (extract specific fields), “issues” (first result), “issues.key” (keys only). See jmespath.org

  • outputformat (String, nil) (defaults to: nil)

    Output format: “toon” (default, 30-60% fewer tokens) or “json”. TOON is optimized for LLMs with tabular arrays and minimal syntax.

  • body (Hash)

    Request body as a JSON object. Structure depends on the endpoint. Example for issue: {“project”: {“key”: “PROJ”, “summary”: “Issue title”, “issuetype”: “Task”}}

Returns:

  • (Object)


40
41
42
43
44
45
46
47
48
49
# File 'lib/leash/integration/jira.rb', line 40

def jira_post(path, body, queryparams: nil, jq: nil, outputformat: nil)
  params = {
    'path' => path,
    'queryParams' => queryparams,
    'jq' => jq,
    'outputFormat' => outputformat,
    'body' => body
  }.compact
  @leash.call('jira', 'jira_post', params)
end

#jira_put(path, body, queryparams: nil, jq: nil, outputformat: nil) ⇒ Object

Replace Jira resources (full update). Returns TOON format by default. **IMPORTANT - Cost Optimization:** Use ‘jq` param to extract only needed fields from response **Output format:** TOON (default)…

Parameters:

  • path (String)

    The Jira API endpoint path (without base URL). Must start with “/”. Examples: “/rest/api/3/project”, “/rest/api/3/search/jql”, “/rest/api/3/issue/issueIdOrKey”

  • queryparams (Hash, nil) (defaults to: nil)

    Optional query parameters as key-value pairs. Examples: “50”, “startAt”: “0”, “jql”: “project=PROJ”, “fields”: “summary,status”

  • jq (String, nil) (defaults to: nil)

    JMESPath expression to filter/transform the response. IMPORTANT: Always use this to extract only needed fields and reduce token costs. Examples: “issues.key, summary: fields.summary” (extract specific fields), “issues” (first result), “issues.key” (keys only). See jmespath.org

  • outputformat (String, nil) (defaults to: nil)

    Output format: “toon” (default, 30-60% fewer tokens) or “json”. TOON is optimized for LLMs with tabular arrays and minimal syntax.

  • body (Hash)

    Request body as a JSON object. Structure depends on the endpoint. Example for issue: {“project”: {“key”: “PROJ”, “summary”: “Issue title”, “issuetype”: “Task”}}

Returns:

  • (Object)


59
60
61
62
63
64
65
66
67
68
# File 'lib/leash/integration/jira.rb', line 59

def jira_put(path, body, queryparams: nil, jq: nil, outputformat: nil)
  params = {
    'path' => path,
    'queryParams' => queryparams,
    'jq' => jq,
    'outputFormat' => outputformat,
    'body' => body
  }.compact
  @leash.call('jira', 'jira_put', params)
end