Class: Infrawrench::LinearNamespace

Inherits:
Object
  • Object
show all
Defined in:
lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs

Overview

client.linear

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ LinearNamespace

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of LinearNamespace.

Parameters:



8797
8798
8799
# File 'lib/infrawrench/client.rb', line 8797

def initialize(transport)
  @transport = transport
end

Instance Method Details

#delete(org_id: nil, request_options: nil) ⇒ Hash

Disconnect Linear

Issue links already recorded are kept, so filed findings stay marked as filed.

Requires permission: linear:write.

DELETE /api/org/orgId/linear

Raises on 404: Not found

Parameters:

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

    Organization id. Defaults to the org_id the client was constructed with.

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

    Per-call :headers, :timeout and :open_timeout.

  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as Ok — see sig/infrawrench/sdk.rbs.

Raises:



8817
8818
8819
8820
8821
8822
8823
8824
# File 'lib/infrawrench/client.rb', line 8817

def delete(org_id: nil, request_options: nil)
  @transport.request(
    http_method: "DELETE",
    path: "/api/org/{orgId}/linear",
    path_params: { "orgId" => org_id },
    request_options: request_options
  )
end

#get(org_id: nil, request_options: nil) ⇒ Hash

Get the org's Linear connection

The stored API key is never returned; keyHint stands in for it.

Requires permission: linear:read.

GET /api/org/orgId/linear

Parameters:

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

    Organization id. Defaults to the org_id the client was constructed with.

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

    Per-call :headers, :timeout and :open_timeout.

  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as Hash — see sig/infrawrench/sdk.rbs.

Raises:



8839
8840
8841
8842
8843
8844
8845
8846
# File 'lib/infrawrench/client.rb', line 8839

def get(org_id: nil, request_options: nil)
  @transport.request(
    http_method: "GET",
    path: "/api/org/{orgId}/linear",
    path_params: { "orgId" => org_id },
    request_options: request_options
  )
end

#issues(body:, org_id: nil, request_options: nil) ⇒ Hash

File a finding as a Linear issue

Creates the issue via the issueCreate mutation, then records the link between it and the finding. The link is what lets a list view show "already filed" instead of offering the button again.

Requires permission: linear:write.

POST /api/org/orgId/linear/issues

Raises on 400: Bad request

Raises on 502: Linear refused to create the issue, or was unreachable

Parameters:

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

    Organization id. Defaults to the org_id the client was constructed with.

  • body (Hash)

    Request body, shaped as CreateLinearIssueInput.

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

    Per-call :headers, :timeout and :open_timeout.

  • body: (create_linear_issue_input)
  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as CreateLinearIssueResult — see sig/infrawrench/sdk.rbs.

Raises:



8869
8870
8871
8872
8873
8874
8875
8876
8877
# File 'lib/infrawrench/client.rb', line 8869

def issues(body:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/org/{orgId}/linear/issues",
    path_params: { "orgId" => org_id },
    body: body,
    request_options: request_options
  )
end

Look up filed issues for a set of findings

Requires permission: linear:read.

GET /api/org/orgId/linear/links

Raises on 400: Bad request

Parameters:

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

    Organization id. Defaults to the org_id the client was constructed with.

  • source_kind (String, nil) (defaults to: nil)
  • source_id (Array<String>, nil) (defaults to: nil)

    Repeat to narrow to specific findings. Omit to return every link of the kind — this is the batch lookup a list view makes once instead of one request per row.

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

    Per-call :headers, :timeout and :open_timeout.

  • org_id: (String, nil) (defaults to: nil)
  • source_kind: (linear_source_kind, nil) (defaults to: nil)
  • source_id: (Array[String], nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Array<Hash>)

    Parsed JSON, shaped as Array<LinearIssueLink> — see sig/infrawrench/sdk.rbs.

Raises:



8897
8898
8899
8900
8901
8902
8903
8904
8905
# File 'lib/infrawrench/client.rb', line 8897

def links(org_id: nil, source_kind: nil, source_id: nil, request_options: nil)
  @transport.request(
    http_method: "GET",
    path: "/api/org/{orgId}/linear/links",
    path_params: { "orgId" => org_id },
    query: { "sourceKind" => source_kind, "sourceId" => source_id },
    request_options: request_options
  )
end

#teams(org_id: nil, request_options: nil) ⇒ Array<Hash>

List Linear teams

Backs the team picker, so nobody has to know a team id by hand — issueCreate requires one, and every issue belongs to exactly one team.

Requires permission: linear:read.

GET /api/org/orgId/linear/teams

Raises on 400: Bad request

Parameters:

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

    Organization id. Defaults to the org_id the client was constructed with.

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

    Per-call :headers, :timeout and :open_timeout.

  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Array<Hash>)

    Parsed JSON, shaped as Array<LinearTeam> — see sig/infrawrench/sdk.rbs.

Raises:



8924
8925
8926
8927
8928
8929
8930
8931
# File 'lib/infrawrench/client.rb', line 8924

def teams(org_id: nil, request_options: nil)
  @transport.request(
    http_method: "GET",
    path: "/api/org/{orgId}/linear/teams",
    path_params: { "orgId" => org_id },
    request_options: request_options
  )
end

#update(body:, org_id: nil, request_options: nil) ⇒ Hash

Connect Linear, or update the connection

Requires permission: linear:write.

PUT /api/org/orgId/linear

Raises on 400: Bad request

Parameters:

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

    Organization id. Defaults to the org_id the client was constructed with.

  • body (Hash)

    Request body, shaped as LinearIntegrationInput.

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

    Per-call :headers, :timeout and :open_timeout.

  • body: (linear_integration_input)
  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as LinearIntegration & Hash — see sig/infrawrench/sdk.rbs.

Raises:



8948
8949
8950
8951
8952
8953
8954
8955
8956
# File 'lib/infrawrench/client.rb', line 8948

def update(body:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "PUT",
    path: "/api/org/{orgId}/linear",
    path_params: { "orgId" => org_id },
    body: body,
    request_options: request_options
  )
end

#verify(org_id: nil, body: nil, request_options: nil) ⇒ Hash

Check Linear credentials

Runs the viewer query against the Linear GraphQL API, so a mistyped or revoked key is reported on the settings form rather than on the first attempt to file an issue.

Requires permission: linear:write.

POST /api/org/orgId/linear/verify

Raises on 400: Bad request

Raises on 502: Linear rejected the key or was unreachable

Parameters:

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

    Organization id. Defaults to the org_id the client was constructed with.

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

    Request body, shaped as LinearVerifyInput.

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

    Per-call :headers, :timeout and :open_timeout.

  • org_id: (String, nil) (defaults to: nil)
  • body: (linear_verify_input, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as LinearVerifyResult — see sig/infrawrench/sdk.rbs.

Raises:



8979
8980
8981
8982
8983
8984
8985
8986
8987
# File 'lib/infrawrench/client.rb', line 8979

def verify(org_id: nil, body: nil, request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/org/{orgId}/linear/verify",
    path_params: { "orgId" => org_id },
    body: body,
    request_options: request_options
  )
end