class Fastlane::Actions::LinearApiAction
Public Class Methods
available_options()
click to toggle source
# File lib/fastlane/plugin/linear_api/actions/linear_api_action.rb, line 38 def self.available_options [ FastlaneCore::ConfigItem.new(key: :api_key, env_name: "LINEAR_API_KEY", description: "Your personal auth key to access the API", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :query, env_name: "LINEAR_API_QUERY", description: "The GraphQL query to the api (without 'query')", optional: false, type: String) ] end
description()
click to toggle source
# File lib/fastlane/plugin/linear_api/actions/linear_api_action.rb, line 21 def self.description "Provide an interface to access the Linear API" end
details()
click to toggle source
# File lib/fastlane/plugin/linear_api/actions/linear_api_action.rb, line 33 def self.details # Optional: "This plugin will send your query to the Linear - Issue Tracking GraphQL API and return the result json" end
example_code()
click to toggle source
# File lib/fastlane/plugin/linear_api/actions/linear_api_action.rb, line 62 def self.example_code end
is_supported?(platform)
click to toggle source
# File lib/fastlane/plugin/linear_api/actions/linear_api_action.rb, line 54 def self.is_supported?(platform) # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example) # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform # # [:ios, :mac, :android].include?(platform) true end
return_value()
click to toggle source
# File lib/fastlane/plugin/linear_api/actions/linear_api_action.rb, line 29 def self.return_value # If your method provides a return value, you can describe here what it does end
run(params)
click to toggle source
# File lib/fastlane/plugin/linear_api/actions/linear_api_action.rb, line 8 def self.run(params) parsed_query = params[:query].gsub(/\s+/, " ").gsub(/\"/, "\\\"").strip() response = Faraday.post('https://api.linear.app/graphql', '{ "query": "%s" }' % [parsed_query], { 'Content-Type' => 'application/json', 'Authorization' => params[:api_key] } ) return JSON.parse(response.body)["data"] end