feat: add linked issue api

This commit is contained in:
Muhsin Keloth
2024-05-09 22:40:42 +05:30
parent 5e1dbfb64d
commit 4645e57e9a
8 changed files with 134 additions and 0 deletions
@@ -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
+6
View File
@@ -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])
+18
View File
@@ -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