feat: add linked issue api
This commit is contained in:
@@ -58,6 +58,13 @@ class Integrations::Linear::ProcessorService
|
||||
response['searchIssues']['nodes'].map(&:as_json)
|
||||
end
|
||||
|
||||
def linked_issue(url)
|
||||
response = linear_client.linked_issue(url)
|
||||
return response if response[:error]
|
||||
|
||||
response['attachmentsForURL']['nodes'].map(&:as_json)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def linear_hook
|
||||
|
||||
@@ -35,6 +35,12 @@ class Linear
|
||||
execute_query(LinearQueries.search_issue(term))
|
||||
end
|
||||
|
||||
def linked_issue(url)
|
||||
raise ArgumentError, 'Missing link' if url.blank?
|
||||
|
||||
execute_query(LinearQueries.linked_issue(url))
|
||||
end
|
||||
|
||||
def create_issue(params)
|
||||
validate_team_and_title(params)
|
||||
validate_priority(params[:priority])
|
||||
|
||||
@@ -58,4 +58,22 @@ module LinearQueries
|
||||
}
|
||||
GRAPHQL
|
||||
end
|
||||
|
||||
def self.linked_issue(url)
|
||||
<<~GRAPHQL
|
||||
query {
|
||||
attachmentsForURL(url: "#{url}") {
|
||||
nodes {
|
||||
id
|
||||
title
|
||||
issue {
|
||||
id
|
||||
title
|
||||
description
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
GRAPHQL
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user