Skip to content

Commit

Permalink
Update parser for script and Crystal updates
Browse files Browse the repository at this point in the history
Remove now defunct `eve_search` function
  • Loading branch information
Blacksmoke16 committed Jul 12, 2022
1 parent 40940ae commit fda1ba0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 125 deletions.
2 changes: 1 addition & 1 deletion src/parser/GESI.cr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ base = EveSwagger.load

# Save the function list
File.open("#{EveSwagger::DIST_DIR}/functions.ts", "w") do |file|
base.endpoints.join("\n", file) { |endpoint, io| endpoint.to_function io }
base.endpoints.join(file, "\n") { |endpoint, io| endpoint.to_function io }
end

# Save the endpoint list
Expand Down
11 changes: 4 additions & 7 deletions src/parser/eve_swagger.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require "json"
require "http/client"

module EveSwagger
DIST_DIR = "../script"
DIST_DIR = "../script/src"
# Base url for the swagger spec
ESI_HOST = "https://esi.evetech.net"
IGNORE_PARAMS = %w(user_agent X-User-Agent token If-None-Match Accept-Language datasource)
Expand Down Expand Up @@ -139,11 +139,11 @@ module EveSwagger
io.puts "/**"
io.puts " * #{@description}"
io.puts " *"
parameters.join("", io) { |param, join_io| param.to_doc_s join_io }
parameters.join(io, "") { |param, join_io| param.to_doc_s join_io }
io.puts " * @customfunction"
io.puts " */"
io << "function #{@name}("
parameters.join(", ", io) { |param, join_io| param.to_s join_io }
parameters.join(io, ", ") { |param, join_io| param.to_s join_io }
io.puts "): SheetsArray {"

parameters.each do |p|
Expand All @@ -152,7 +152,7 @@ module EveSwagger

io << " return invoke('#{@name}', { "

parameters.join(", ", io) { |param, join_io| param.name.to_s join_io }
parameters.join(io, ", ") { |param, join_io| param.name.to_s join_io }

io << " });"

Expand Down Expand Up @@ -193,9 +193,6 @@ module EveSwagger

endpoint_name = route.operation_id.gsub(/^post_|^get_|_id/, "")

# Rename search endpoint to not conflict with Sheets' `Search` function
endpoint_name = "eve_search" if endpoint_name == "search"

# Rename universes to universe_ids due to regex matching `_ids`
endpoint_name = "universe_ids" if endpoint_name == "universes"

Expand Down
100 changes: 0 additions & 100 deletions src/script/src/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4171,106 +4171,6 @@ function getEndpoints(): IEndpointList {
"summary": "Get effect information",
"version": "v2"
},
"eve_search": {
"description": "Search for entities that match a given sub-string.",
"headers": [
{
"name": "agent",
"sub_headers": [
"agent_agents"
]
},
{
"name": "alliance",
"sub_headers": [
"alliance_alliances"
]
},
{
"name": "character",
"sub_headers": [
"character_characters"
]
},
{
"name": "constellation",
"sub_headers": [
"constellation_constellations"
]
},
{
"name": "corporation",
"sub_headers": [
"corporation_corporations"
]
},
{
"name": "faction",
"sub_headers": [
"faction_factions"
]
},
{
"name": "inventory_type",
"sub_headers": [
"inventory_types"
]
},
{
"name": "region",
"sub_headers": [
"region_regions"
]
},
{
"name": "solar_system",
"sub_headers": [
"solar_systems"
]
},
{
"name": "station",
"sub_headers": [
"station_stations"
]
}
],
"method": "get",
"paginated": false,
"parameters": [
{
"description": "The string to search on",
"in": "query",
"name": "search",
"type": "string",
"required": true
},
{
"description": "Type of entities to search for",
"in": "query",
"name": "categories",
"type": "string[]",
"required": true
},
{
"description": "Language to use in the response, takes precedence over Accept-Language",
"in": "query",
"name": "language",
"type": "string",
"required": false
},
{
"description": "Whether the search should be a strict match",
"in": "query",
"name": "strict",
"type": "boolean",
"required": false
}
],
"path": "/{version}/search/",
"summary": "Search on a string",
"version": "v2"
},
"eve_status": {
"description": "EVE Server status",
"headers": [
Expand Down
17 changes: 0 additions & 17 deletions src/script/src/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1404,23 +1404,6 @@ function dogma_effects_effect(effect_id: number, show_column_headings: boolean =
return invoke('dogma_effects_effect', { effect_id, show_column_headings, version });
}

/**
* Search for entities that match a given sub-string.
*
* @param {string} search - The string to search on
* @param {string|string[]} categories - Type of entities to search for
* @param {string} language - Language to use in the response, takes precedence over Accept-Language
* @param {boolean} strict - Whether the search should be a strict match
* @param {boolean} show_column_headings - If column headings should be shown.
* @param {string} version - Which ESI version to use for the request.
* @customfunction
*/
function eve_search(search: string, categories: string|string[], language?: string, strict?: boolean, show_column_headings: boolean = true, version: string = "v2"): SheetsArray {
if (!search) throw new Error(`search is required.`);
if (!categories) throw new Error(`categories is required.`);
return invoke('eve_search', { search, categories, language, strict, show_column_headings, version });
}

/**
* EVE Server status
*
Expand Down

0 comments on commit fda1ba0

Please sign in to comment.