feat: search issue API
This commit is contained in:
@@ -50,6 +50,14 @@ class Integrations::Linear::ProcessorService
|
||||
}
|
||||
end
|
||||
|
||||
def search_issue(term)
|
||||
response = linear_client.search_issue(term)
|
||||
|
||||
return response if response[:error]
|
||||
|
||||
response['searchIssues']['nodes'].map(&:as_json)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def linear_hook
|
||||
|
||||
@@ -29,6 +29,12 @@ class Linear
|
||||
execute_query(LinearQueries.team_entites_query(team_id))
|
||||
end
|
||||
|
||||
def search_issue(term)
|
||||
raise ArgumentError, 'Missing search term' if term.blank?
|
||||
|
||||
execute_query(LinearQueries.search_issue(term))
|
||||
end
|
||||
|
||||
def create_issue(params)
|
||||
validate_team_and_title(params)
|
||||
validate_priority(params[:priority])
|
||||
|
||||
@@ -44,4 +44,18 @@ module LinearQueries
|
||||
}
|
||||
GRAPHQL
|
||||
end
|
||||
|
||||
def self.search_issue(term)
|
||||
<<~GRAPHQL
|
||||
query {
|
||||
searchIssues(term: "#{term}") {
|
||||
nodes {
|
||||
id
|
||||
title
|
||||
description
|
||||
}
|
||||
}
|
||||
}
|
||||
GRAPHQL
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user