ftc_events_client 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +351 -101
  3. data/Rakefile +0 -2
  4. data/config.json +1 -1
  5. data/docs/AllianceModelVersion2.md +10 -28
  6. data/docs/AllianceScore2020.md +37 -82
  7. data/docs/AllianceSelectionApi.md +14 -14
  8. data/docs/AllianceSelectionModelVersion2.md +4 -16
  9. data/docs/ApiIndexModel.md +11 -30
  10. data/docs/AutoNavigatedStatus.md +6 -0
  11. data/docs/AwardAssignmentModel.md +13 -34
  12. data/docs/AwardsApi.md +47 -49
  13. data/docs/AwardsModel.md +3 -14
  14. data/docs/BarcodeElement.md +6 -0
  15. data/docs/EndgameParkedStatus.md +6 -0
  16. data/docs/EventMatchResultsModelVersion2.md +3 -14
  17. data/docs/EventRankingsModel.md +3 -14
  18. data/docs/EventScheduleHybridModelVersion2.md +3 -14
  19. data/docs/EventScheduleModelVersion2.md +3 -14
  20. data/docs/FTCEventLevel.md +6 -0
  21. data/docs/GeneralApi.md +9 -11
  22. data/docs/LeagueMemberListModel.md +7 -0
  23. data/docs/LeaguesApi.md +179 -0
  24. data/docs/MatchResultModelVersion2.md +16 -40
  25. data/docs/MatchResultTeamModelVersion2.md +6 -18
  26. data/docs/MatchResultsApi.md +33 -35
  27. data/docs/MatchScoresModel.md +3 -14
  28. data/docs/MatchScoresModelMatchScoresOneOf.md +5 -1
  29. data/docs/OneOfMatchScoresModelMatchScoresItems.md +6 -0
  30. data/docs/RankingsApi.md +16 -17
  31. data/docs/ScheduleApi.md +30 -32
  32. data/docs/ScheduleHybridModelTeamVersion2.md +8 -22
  33. data/docs/ScheduleHybridModelVersion2.md +18 -40
  34. data/docs/ScheduledMatchModelVersion2.md +10 -28
  35. data/docs/ScheduledMatchTeamModelVersion2.md +6 -20
  36. data/docs/ScoreDetailAllianceModel2020.md +39 -86
  37. data/docs/ScoreDetailAllianceModel2021.md +48 -0
  38. data/docs/ScoreDetailModel2019.md +6 -18
  39. data/docs/ScoreDetailModel2020.md +6 -18
  40. data/docs/ScoreDetailModel2021.md +10 -0
  41. data/docs/ScoreDetailModelAlliance2019.md +36 -80
  42. data/docs/ScoreDetailModelSinglePlayer2020.md +6 -20
  43. data/docs/ScoreDetailModelSinglePlayer2021.md +10 -0
  44. data/docs/ScoreDetailSinglePlayer2021.md +39 -0
  45. data/docs/SeasonAwardListingsModel.md +3 -14
  46. data/docs/SeasonAwardsModel.md +6 -20
  47. data/docs/SeasonDataApi.md +35 -37
  48. data/docs/SeasonEventListingsModelVersion2.md +4 -16
  49. data/docs/SeasonEventModelVersion2.md +24 -46
  50. data/docs/SeasonLeagueListingsModelVersion2.md +8 -0
  51. data/docs/SeasonLeagueModelVersion2.md +11 -0
  52. data/docs/SeasonSummaryModelChampionship.md +5 -18
  53. data/docs/SeasonSummaryModelVersion2.md +8 -24
  54. data/docs/SeasonTeamListingsModelVersion2.md +7 -22
  55. data/docs/SeasonTeamModelVersion2.md +14 -36
  56. data/docs/Stone.md +2 -11
  57. data/docs/TeamRankingModel.md +17 -42
  58. data/ftc_events_client.gemspec +5 -5
  59. data/git_push.sh +7 -10
  60. data/lib/ftc_events_client/api/alliance_selection_api.rb +17 -22
  61. data/lib/ftc_events_client/api/awards_api.rb +52 -74
  62. data/lib/ftc_events_client/api/general_api.rb +8 -17
  63. data/lib/ftc_events_client/api/leagues_api.rb +218 -0
  64. data/lib/ftc_events_client/api/match_results_api.rb +44 -45
  65. data/lib/ftc_events_client/api/rankings_api.rb +17 -22
  66. data/lib/ftc_events_client/api/schedule_api.rb +44 -45
  67. data/lib/ftc_events_client/api/season_data_api.rb +30 -53
  68. data/lib/ftc_events_client/api_client.rb +52 -54
  69. data/lib/ftc_events_client/api_error.rb +4 -4
  70. data/lib/ftc_events_client/configuration.rb +6 -76
  71. data/lib/ftc_events_client/models/alliance_model_version2.rb +19 -31
  72. data/lib/ftc_events_client/models/{alliance_score2020.rb → alliance_score_2020.rb} +46 -58
  73. data/lib/ftc_events_client/models/alliance_selection_model_version2.rb +13 -25
  74. data/lib/ftc_events_client/models/api_index_model.rb +20 -32
  75. data/lib/ftc_events_client/models/{tournament_level.rb → auto_navigated_status.rb} +11 -21
  76. data/lib/ftc_events_client/models/award_assignment_model.rb +22 -34
  77. data/lib/ftc_events_client/models/awards_model.rb +12 -24
  78. data/lib/ftc_events_client/models/barcode_element.rb +28 -0
  79. data/lib/ftc_events_client/models/endgame_parked_status.rb +29 -0
  80. data/lib/ftc_events_client/models/event_match_results_model_version2.rb +12 -24
  81. data/lib/ftc_events_client/models/event_rankings_model.rb +12 -24
  82. data/lib/ftc_events_client/models/event_schedule_hybrid_model_version2.rb +12 -24
  83. data/lib/ftc_events_client/models/event_schedule_model_version2.rb +12 -24
  84. data/lib/ftc_events_client/models/ftc_event_level.rb +31 -0
  85. data/lib/ftc_events_client/models/league_member_list_model.rb +209 -0
  86. data/lib/ftc_events_client/models/match_result_model_version2.rb +25 -37
  87. data/lib/ftc_events_client/models/match_result_team_model_version2.rb +26 -29
  88. data/lib/ftc_events_client/models/match_scores_model.rb +12 -24
  89. data/lib/ftc_events_client/models/one_of_match_scores_model_match_scores_items.rb +197 -0
  90. data/lib/ftc_events_client/models/schedule_hybrid_model_team_version2.rb +30 -32
  91. data/lib/ftc_events_client/models/schedule_hybrid_model_version2.rb +46 -38
  92. data/lib/ftc_events_client/models/scheduled_match_model_version2.rb +19 -31
  93. data/lib/ftc_events_client/models/scheduled_match_team_model_version2.rb +15 -27
  94. data/lib/ftc_events_client/models/{score_detail_alliance_model2020.rb → score_detail_alliance_model_2020.rb} +48 -60
  95. data/lib/ftc_events_client/models/score_detail_alliance_model_2021.rb +576 -0
  96. data/lib/ftc_events_client/models/{score_detail_model2019.rb → score_detail_model_2019.rb} +24 -27
  97. data/lib/ftc_events_client/models/{score_detail_model2020.rb → score_detail_model_2020.rb} +24 -27
  98. data/lib/ftc_events_client/models/score_detail_model_2021.rb +236 -0
  99. data/lib/ftc_events_client/models/{score_detail_model_alliance2019.rb → score_detail_model_alliance_2019.rb} +45 -57
  100. data/lib/ftc_events_client/models/{score_detail_model_single_player2020.rb → score_detail_model_single_player_2020.rb} +15 -27
  101. data/lib/ftc_events_client/models/score_detail_model_single_player_2021.rb +233 -0
  102. data/lib/ftc_events_client/models/score_detail_single_player_2021.rb +494 -0
  103. data/lib/ftc_events_client/models/season_award_listings_model.rb +12 -24
  104. data/lib/ftc_events_client/models/season_awards_model.rb +22 -34
  105. data/lib/ftc_events_client/models/season_event_listings_model_version2.rb +13 -25
  106. data/lib/ftc_events_client/models/season_event_model_version2.rb +77 -41
  107. data/lib/ftc_events_client/models/season_league_listings_model_version2.rb +218 -0
  108. data/lib/ftc_events_client/models/season_league_model_version2.rb +247 -0
  109. data/lib/ftc_events_client/models/season_summary_model_championship.rb +14 -26
  110. data/lib/ftc_events_client/models/season_summary_model_version2.rb +17 -29
  111. data/lib/ftc_events_client/models/season_team_listings_model_version2.rb +16 -28
  112. data/lib/ftc_events_client/models/season_team_model_version2.rb +23 -35
  113. data/lib/ftc_events_client/models/stone.rb +6 -15
  114. data/lib/ftc_events_client/models/team_ranking_model.rb +26 -38
  115. data/lib/ftc_events_client/version.rb +4 -5
  116. data/lib/ftc_events_client.rb +22 -12
  117. data/spec/api/leagues_api_spec.rb +77 -0
  118. data/spec/base_object_spec.rb +109 -0
  119. data/spec/configuration_spec.rb +3 -3
  120. data/spec/models/alliance_score_2020_spec.rb +244 -0
  121. data/spec/models/auto_navigated_status_spec.rb +28 -0
  122. data/spec/models/barcode_element_spec.rb +28 -0
  123. data/spec/models/endgame_parked_status_spec.rb +28 -0
  124. data/spec/models/ftc_event_level_spec.rb +28 -0
  125. data/spec/models/league_member_list_model_spec.rb +34 -0
  126. data/spec/models/one_of_match_scores_model_match_scores_items_spec.rb +34 -0
  127. data/spec/models/score_detail_alliance_model2021_spec.rb +280 -0
  128. data/spec/models/score_detail_alliance_model_2020_spec.rb +256 -0
  129. data/spec/models/score_detail_alliance_model_2021_spec.rb +286 -0
  130. data/spec/models/score_detail_model2021_spec.rb +52 -0
  131. data/spec/models/score_detail_model_2019_spec.rb +58 -0
  132. data/spec/models/score_detail_model_2020_spec.rb +58 -0
  133. data/spec/models/score_detail_model_2021_spec.rb +58 -0
  134. data/spec/models/score_detail_model_alliance_2019_spec.rb +238 -0
  135. data/spec/models/score_detail_model_single_player2021_spec.rb +52 -0
  136. data/spec/models/score_detail_model_single_player_2020_spec.rb +58 -0
  137. data/spec/models/score_detail_model_single_player_2021_spec.rb +58 -0
  138. data/spec/models/score_detail_single_player2021_spec.rb +226 -0
  139. data/spec/models/score_detail_single_player_2021_spec.rb +232 -0
  140. data/spec/models/season_league_listings_model_version2_spec.rb +40 -0
  141. data/{lib/ftc_events_client/models/match_scores_model_match_scores_one_of.rb → spec/models/season_league_model_version2_spec.rb} +35 -83
  142. data/update.sh +2 -2
  143. metadata +103 -11
@@ -3,15 +3,12 @@
3
3
 
4
4
  #FTC Events API is a service to return relevant information about the _FIRST_ Tech Challenge (FTC). Information is made available from events operating around the world Information is currently made available after the conclusion of the tournament. The API will provide data as soon as it has synced, and we do not add any artificial delays. ## Documentation Notes ### Timezones All times are listed in the local time to the event venue. HTTP-date values will show their timezone. ### Query Parameters If you specify a parameter, but no value for that parameter, it will be ignored. For example, if you request `URL?teamNumber=` the `teamNumber` parameter would be ignored. For all APIs that accept a query string in addition to the base URI, the order of parameters do not matter, but the name shown in the documentation must match exactly, as does the associated value format as described in details. For response codes that are not HTTP 200 (OK), the documentation will show a body message that represents a possible response value. While the \"title\" of the HTTP Status Code will match those shown in the response codes documentation section exactly, the body of the response will be a more detailed explanation of why that status code is being returned and may not always be exactly as shown in the examples. ### Experimenting with the API This documentation is rendered at both [api-docs](https://ftc-events.firstinspires.org/api-docs) and [try-it-out](https://ftc-events.firstinspires.org/try-it-out). [api-docs](https://ftc-events.firstinspires.org/api-docs) has a three panel, easy to read layout, while [try-it-out](https://ftc-events.firstinspires.org/try-it-out) has a feature that allows you try out endpoints from within the page. Additionally, the Open API Json is availabe at [Open API](https://ftc-events.firstinspires.org/swagger/v2.0/swagger.json). This can be imported into a tool such as [Postman](https://www.postman.com) for experimentation as well. ### Last-Modified, FMS-OnlyModifiedSince, and If-Modified-Since Headers The FTC Events API utilizes the `Last-Modified` and `If-Modified-Since` Headers to communicate with consumers regarding the age of the data they are requesting. With a couple of exceptions, all calls will return a `Last-Modified` Header set with the time at which the data at that endpoint was last modified. The Header will always be set in the HTTP-date format, as described in the HTTP Protocol. There are two exceptions: the `Last-Modified` Header is not set if the endpoint returns no results (such as a request for a schedule with no matches). Consumers should keep track of the `Last-Modified` Header, and return it on subsequent calls to the same endpoint as the If-Modified-Since. The server will recognize this request, and will only return a result if the data has been modified since the last request. If no changes have been made, an HTTP 304 will be returned. If data has been modified, ALL data on that call will be returned (for \"only modified\" data, see below). The FTC Events API also allows a custom header used to filter the return data to a specific subset. This is done by specifying a `FMS-OnlyModifiedSince` header with each call. As with the `If-Modified-Since` header, consumers should keep track of the Last-Modified Header, and return it on subsequent calls to the same endpoint as the `FMS-OnlyModifiedSince` Header. The server will recognize this request, and will only return a result if the data has been modified since the last request, and, if returned, the data will only be those portions modified since the included date. If no changes, have been made, an HTTP 304 will be returned. Using this method, the server and consumer save processing time by only receiving modified data that is in need of update on the consumer side. If the Headers are improperly passed (such as the wrong Day of Week for the matching date, or a date in the future), the endpoint will simply ignore the Header and return all results. If both headers are specified, the request will be denied. ## Response Codes The FTC Events API HTTP Status Codes correspond with the [common codes](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html), but occasionally with different \"titles\". The \"title\" used by the API is shown next to each of the below possible response HTTP Status Codes. Throughout the documentation, Apiary may automatically show the common \"title\" in example returns (like \"Not Found\" for 404) but on the production server, the \"title\" will instead match those listed below. ### HTTP 200 - \"OK\" The request has succeeded. An entity corresponding to the requested resource is sent in the response. This will be returned as the HTTP Status Code for all request that succeed, even if the body is empty (such as an event that has no rankings, but with a valid season and event code were used) ### HTTP 304 - \"Not Modified\" When utilizing a Header that allows filtered data returns, such as `If-Modified-Since`, this response indicates that no data meets the request. ### HTTP 400 - \"Invalid Season Requested\"/\"Malformed Parameter Format In Request\"/\"Missing Parameter In Request\"/\"Invalid API Version Requested\": The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications. Specifically for this API, a 400 response indicates that the requested URI matches with a valid API, but one or more required parameter was malformed or invalid. Examples include an event code that is too short or team number that contains a letter. ### HTTP 401 - \"Unauthorized\" All requests against the API require authentication via a valid user token. Failing to provide one, or providing an invalid one, will warrant a 401 response. The client MAY repeat the request with a suitable Authorization header field. ### HTTP 404 - \"Invalid Event Requested\" Even though the 404 code usually indicates any not found status, a 404 will only be issued in this API when an event cannot be found for the requested season and event code. If the request didn't match a valid API or there were malformed parameters, the response would not receive a 404 but rather a 400 or 501. If this HTTP code is received, the season was a valid season and the event code matched the acceptable style of an event code, but there were no records of an event matching the combination of that season and event code. For example, HTTP 404 would be issued when the event had a different code in the requested season (the codes can change year to year based on event location). ### HTTP 500 - \"Internal Server Error\" The server encountered an unexpected condition which prevented it from fulfilling the request. This is a code sent directly by the server, and has no special alternate definition specific to this API. ### HTTP 501 - \"Request Did Not Match Any Current API Pattern\" The server does not support the functionality required to fulfill the request. Specifically, the request pattern did not match any of the possible APIs, and thus processing was discontinued. This code is also issued when too many optional parameters were included in a single request and fulfilling it would make the result confusing or misleading. Each API will specify which parameters or combination of parameters can be used at the same time. ### HTTP 503 - \"Service Unavailable\" The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay. If known, the length of the delay MAY be indicated in a `Retry-After` header. This code will not always appear, sometimes the server may outright refuse the connection instead. This is a code sent directly by the server, and has no special alternate definition specific to this API. ## Authorization In order to make calls against the FTC Events API, you must include an HTTP Header called `Authorization` with the value set as specified below. If a request is made without this header, processing stops and an HTTP 401 is issued. All `Authorization` headers follow the same format: ``` Authorization: Basic 000000000000000000000000000000000000000000000000000000000000 ``` Where the Zeros are replaced by your Token. The Token can be formed by taking your username and your AuthorizationKey and adding a colon. For example, if your username is `sampleuser` and your AuthorizationKey is `7eaa6338-a097-4221-ac04-b6120fcc4d49` you would have this string: ``` sampleuser:7eaa6338-a097-4221-ac04-b6120fcc4d49 ``` This string must then be encoded using Base64 Encoded to form the Token, which will be the same length as the example above, but include letters and numbers. For our example, we would have: ``` c2FtcGxldXNlcjo3ZWFhNjMzOC1hMDk3LTQyMjEtYWMwNC1iNjEyMGZjYzRkNDk= ``` Most API client libraries can handle computing the authorization header using a username and password for you NOTICE: Publicly distributing an application, code snippet, etc, that has your username and token in it, encoded or not, WILL result in your token being blocked from the API. Each user should apply for their own token. If you wish to acquire a token for your development, you may do so by requesting a token through our automated system on this website.
5
5
 
6
- The version of the OpenAPI document: v2.0
7
-
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.0.0-SNAPSHOT
6
+ OpenAPI spec version: v2.0
10
7
 
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.29
11
10
  =end
12
11
 
13
- require 'cgi'
14
-
15
12
  module FtcEventsClient
16
13
  class SeasonDataApi
17
14
  attr_accessor :api_client
@@ -21,9 +18,9 @@ module FtcEventsClient
21
18
  end
22
19
  # Event Listings
23
20
  # The event listings API returns all FTC official regional events in a particular season. You can specify an `eventCode` if you would only like data about one specific event. If you specify an `eventCode` you cannot specify any other optional parameters. Alternately, you can specify a `teamNumber` to retrieve only the listings of events being attended by the particular team. If you specify a `teamNumber` you cannot specify an `eventCode`. The response for event listings contains a special field called divisionCode. For example, the FIRST Championship contains two Divisions. As an example of a response, the event listings for a Division will have a divisionCode that matches the FIRST Championship event code (as they are divisions of that event). This allows you to see the full structure of events, and how they relate to each other.
24
- # @param season [Integer] Numeric year from which the event listings are requested. Must be 4 digits
21
+ # @param season Numeric year from which the event listings are requested. Must be 4 digits
25
22
  # @param [Hash] opts the optional parameters
26
- # @option opts [String] :event_code Case insensitive alphanumeric `eventCode` of the event about which details are requested. (default to '0')
23
+ # @option opts [String] :event_code Case insensitive alphanumeric `eventCode` of the event about which details are requested. (default to 0)
27
24
  # @option opts [Integer] :team_number Numeric `teamNumber` of the team from which the attending event listings are requested. (default to 0)
28
25
  # @return [SeasonEventListingsModelVersion2]
29
26
  def v20_season_events_get(season, opts = {})
@@ -33,7 +30,7 @@ module FtcEventsClient
33
30
 
34
31
  # Event Listings
35
32
  # The event listings API returns all FTC official regional events in a particular season. You can specify an `eventCode` if you would only like data about one specific event. If you specify an `eventCode` you cannot specify any other optional parameters. Alternately, you can specify a `teamNumber` to retrieve only the listings of events being attended by the particular team. If you specify a `teamNumber` you cannot specify an `eventCode`. The response for event listings contains a special field called divisionCode. For example, the FIRST Championship contains two Divisions. As an example of a response, the event listings for a Division will have a divisionCode that matches the FIRST Championship event code (as they are divisions of that event). This allows you to see the full structure of events, and how they relate to each other.
36
- # @param season [Integer] Numeric year from which the event listings are requested. Must be 4 digits
33
+ # @param season Numeric year from which the event listings are requested. Must be 4 digits
37
34
  # @param [Hash] opts the optional parameters
38
35
  # @option opts [String] :event_code Case insensitive alphanumeric `eventCode` of the event about which details are requested.
39
36
  # @option opts [Integer] :team_number Numeric `teamNumber` of the team from which the attending event listings are requested.
@@ -47,7 +44,7 @@ module FtcEventsClient
47
44
  fail ArgumentError, "Missing the required parameter 'season' when calling SeasonDataApi.v20_season_events_get"
48
45
  end
49
46
  # resource path
50
- local_var_path = '/v2.0/{season}/events'.sub('{' + 'season' + '}', CGI.escape(season.to_s))
47
+ local_var_path = '/v2.0/{season}/events'.sub('{' + 'season' + '}', season.to_s)
51
48
 
52
49
  # query parameters
53
50
  query_params = opts[:query_params] || {}
@@ -63,34 +60,27 @@ module FtcEventsClient
63
60
  form_params = opts[:form_params] || {}
64
61
 
65
62
  # http body (model)
66
- post_body = opts[:debug_body]
63
+ post_body = opts[:body]
67
64
 
68
- # return_type
69
- return_type = opts[:debug_return_type] || 'SeasonEventListingsModelVersion2'
65
+ return_type = opts[:return_type] || 'SeasonEventListingsModelVersion2'
70
66
 
71
- # auth_names
72
- auth_names = opts[:debug_auth_names] || ['basic']
73
-
74
- new_options = opts.merge(
75
- :operation => :"SeasonDataApi.v20_season_events_get",
67
+ auth_names = opts[:auth_names] || ['basic']
68
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
76
69
  :header_params => header_params,
77
70
  :query_params => query_params,
78
71
  :form_params => form_params,
79
72
  :body => post_body,
80
73
  :auth_names => auth_names,
81
- :return_type => return_type
82
- )
74
+ :return_type => return_type)
83
75
 
84
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
85
76
  if @api_client.config.debugging
86
77
  @api_client.config.logger.debug "API called: SeasonDataApi#v20_season_events_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
87
78
  end
88
79
  return data, status_code, headers
89
80
  end
90
-
91
81
  # Season Summary
92
82
  # The season summary API returns a high level glance of a particular FTC season.
93
- # @param season [Integer] Numeric year of the event from which the season summary is requested. Must be 4 digits.
83
+ # @param season Numeric year of the event from which the season summary is requested. Must be 4 digits.
94
84
  # @param [Hash] opts the optional parameters
95
85
  # @return [SeasonSummaryModelVersion2]
96
86
  def v20_season_get(season, opts = {})
@@ -100,7 +90,7 @@ module FtcEventsClient
100
90
 
101
91
  # Season Summary
102
92
  # The season summary API returns a high level glance of a particular FTC season.
103
- # @param season [Integer] Numeric year of the event from which the season summary is requested. Must be 4 digits.
93
+ # @param season Numeric year of the event from which the season summary is requested. Must be 4 digits.
104
94
  # @param [Hash] opts the optional parameters
105
95
  # @return [Array<(SeasonSummaryModelVersion2, Integer, Hash)>] SeasonSummaryModelVersion2 data, response status code and response headers
106
96
  def v20_season_get_with_http_info(season, opts = {})
@@ -112,7 +102,7 @@ module FtcEventsClient
112
102
  fail ArgumentError, "Missing the required parameter 'season' when calling SeasonDataApi.v20_season_get"
113
103
  end
114
104
  # resource path
115
- local_var_path = '/v2.0/{season}'.sub('{' + 'season' + '}', CGI.escape(season.to_s))
105
+ local_var_path = '/v2.0/{season}'.sub('{' + 'season' + '}', season.to_s)
116
106
 
117
107
  # query parameters
118
108
  query_params = opts[:query_params] || {}
@@ -126,38 +116,31 @@ module FtcEventsClient
126
116
  form_params = opts[:form_params] || {}
127
117
 
128
118
  # http body (model)
129
- post_body = opts[:debug_body]
119
+ post_body = opts[:body]
130
120
 
131
- # return_type
132
- return_type = opts[:debug_return_type] || 'SeasonSummaryModelVersion2'
121
+ return_type = opts[:return_type] || 'SeasonSummaryModelVersion2'
133
122
 
134
- # auth_names
135
- auth_names = opts[:debug_auth_names] || ['basic']
136
-
137
- new_options = opts.merge(
138
- :operation => :"SeasonDataApi.v20_season_get",
123
+ auth_names = opts[:auth_names] || ['basic']
124
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
139
125
  :header_params => header_params,
140
126
  :query_params => query_params,
141
127
  :form_params => form_params,
142
128
  :body => post_body,
143
129
  :auth_names => auth_names,
144
- :return_type => return_type
145
- )
130
+ :return_type => return_type)
146
131
 
147
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
148
132
  if @api_client.config.debugging
149
133
  @api_client.config.logger.debug "API called: SeasonDataApi#v20_season_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
150
134
  end
151
135
  return data, status_code, headers
152
136
  end
153
-
154
137
  # Team Listings
155
138
  # The team listings API returns all FTC official teams in a particular season. If specified, the `teamNumber` parameter will return only one result with the details of the requested `teamNumber`. Alternately, the `eventCode` parameter allows sorting of the team list to only those teams attending a particular event in the particular season. If you specify a teamNumber parameter, you cannot additionally specify an `eventCode` and/or `state` in the same request, or you will receive an HTTP 501. If you specify the `state` parameter, it should be the full legal name of the US state or international state/prov, such as New Hampshire or Ontario. Values on this endpoint are \"pass through\" values from the TIMS registration system. As such, if the team does not specify a value for a field, it may be presented in the API as null.
156
- # @param season [Integer] Numeric year from which the team listings are requested. Must be 4 digits.
139
+ # @param season Numeric year from which the team listings are requested. Must be 4 digits.
157
140
  # @param [Hash] opts the optional parameters
158
141
  # @option opts [Integer] :team_number Numeric &#x60;teamNumber&#x60; of the team about which information is requested. Must be 1 to 5 digits. (default to 0)
159
- # @option opts [String] :event_code Case insensitive alphanumeric &#x60;eventCode&#x60; of the event from which details are requested. (default to '0')
160
- # @option opts [String] :state Full legal name of the US state or international state/prov (default to '')
142
+ # @option opts [String] :event_code Case insensitive alphanumeric &#x60;eventCode&#x60; of the event from which details are requested. (default to 0)
143
+ # @option opts [String] :state Full legal name of the US state or international state/prov
161
144
  # @option opts [Integer] :page Numeric page of results to return. (default to 1)
162
145
  # @return [SeasonTeamListingsModelVersion2]
163
146
  def v20_season_teams_get(season, opts = {})
@@ -167,7 +150,7 @@ module FtcEventsClient
167
150
 
168
151
  # Team Listings
169
152
  # The team listings API returns all FTC official teams in a particular season. If specified, the &#x60;teamNumber&#x60; parameter will return only one result with the details of the requested &#x60;teamNumber&#x60;. Alternately, the &#x60;eventCode&#x60; parameter allows sorting of the team list to only those teams attending a particular event in the particular season. If you specify a teamNumber parameter, you cannot additionally specify an &#x60;eventCode&#x60; and/or &#x60;state&#x60; in the same request, or you will receive an HTTP 501. If you specify the &#x60;state&#x60; parameter, it should be the full legal name of the US state or international state/prov, such as New Hampshire or Ontario. Values on this endpoint are \&quot;pass through\&quot; values from the TIMS registration system. As such, if the team does not specify a value for a field, it may be presented in the API as null.
170
- # @param season [Integer] Numeric year from which the team listings are requested. Must be 4 digits.
153
+ # @param season Numeric year from which the team listings are requested. Must be 4 digits.
171
154
  # @param [Hash] opts the optional parameters
172
155
  # @option opts [Integer] :team_number Numeric &#x60;teamNumber&#x60; of the team about which information is requested. Must be 1 to 5 digits.
173
156
  # @option opts [String] :event_code Case insensitive alphanumeric &#x60;eventCode&#x60; of the event from which details are requested.
@@ -183,7 +166,7 @@ module FtcEventsClient
183
166
  fail ArgumentError, "Missing the required parameter 'season' when calling SeasonDataApi.v20_season_teams_get"
184
167
  end
185
168
  # resource path
186
- local_var_path = '/v2.0/{season}/teams'.sub('{' + 'season' + '}', CGI.escape(season.to_s))
169
+ local_var_path = '/v2.0/{season}/teams'.sub('{' + 'season' + '}', season.to_s)
187
170
 
188
171
  # query parameters
189
172
  query_params = opts[:query_params] || {}
@@ -201,25 +184,19 @@ module FtcEventsClient
201
184
  form_params = opts[:form_params] || {}
202
185
 
203
186
  # http body (model)
204
- post_body = opts[:debug_body]
205
-
206
- # return_type
207
- return_type = opts[:debug_return_type] || 'SeasonTeamListingsModelVersion2'
187
+ post_body = opts[:body]
208
188
 
209
- # auth_names
210
- auth_names = opts[:debug_auth_names] || ['basic']
189
+ return_type = opts[:return_type] || 'SeasonTeamListingsModelVersion2'
211
190
 
212
- new_options = opts.merge(
213
- :operation => :"SeasonDataApi.v20_season_teams_get",
191
+ auth_names = opts[:auth_names] || ['basic']
192
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
214
193
  :header_params => header_params,
215
194
  :query_params => query_params,
216
195
  :form_params => form_params,
217
196
  :body => post_body,
218
197
  :auth_names => auth_names,
219
- :return_type => return_type
220
- )
198
+ :return_type => return_type)
221
199
 
222
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
223
200
  if @api_client.config.debugging
224
201
  @api_client.config.logger.debug "API called: SeasonDataApi#v20_season_teams_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
225
202
  end
@@ -3,19 +3,18 @@
3
3
 
4
4
  #FTC Events API is a service to return relevant information about the _FIRST_ Tech Challenge (FTC). Information is made available from events operating around the world Information is currently made available after the conclusion of the tournament. The API will provide data as soon as it has synced, and we do not add any artificial delays. ## Documentation Notes ### Timezones All times are listed in the local time to the event venue. HTTP-date values will show their timezone. ### Query Parameters If you specify a parameter, but no value for that parameter, it will be ignored. For example, if you request `URL?teamNumber=` the `teamNumber` parameter would be ignored. For all APIs that accept a query string in addition to the base URI, the order of parameters do not matter, but the name shown in the documentation must match exactly, as does the associated value format as described in details. For response codes that are not HTTP 200 (OK), the documentation will show a body message that represents a possible response value. While the \"title\" of the HTTP Status Code will match those shown in the response codes documentation section exactly, the body of the response will be a more detailed explanation of why that status code is being returned and may not always be exactly as shown in the examples. ### Experimenting with the API This documentation is rendered at both [api-docs](https://ftc-events.firstinspires.org/api-docs) and [try-it-out](https://ftc-events.firstinspires.org/try-it-out). [api-docs](https://ftc-events.firstinspires.org/api-docs) has a three panel, easy to read layout, while [try-it-out](https://ftc-events.firstinspires.org/try-it-out) has a feature that allows you try out endpoints from within the page. Additionally, the Open API Json is availabe at [Open API](https://ftc-events.firstinspires.org/swagger/v2.0/swagger.json). This can be imported into a tool such as [Postman](https://www.postman.com) for experimentation as well. ### Last-Modified, FMS-OnlyModifiedSince, and If-Modified-Since Headers The FTC Events API utilizes the `Last-Modified` and `If-Modified-Since` Headers to communicate with consumers regarding the age of the data they are requesting. With a couple of exceptions, all calls will return a `Last-Modified` Header set with the time at which the data at that endpoint was last modified. The Header will always be set in the HTTP-date format, as described in the HTTP Protocol. There are two exceptions: the `Last-Modified` Header is not set if the endpoint returns no results (such as a request for a schedule with no matches). Consumers should keep track of the `Last-Modified` Header, and return it on subsequent calls to the same endpoint as the If-Modified-Since. The server will recognize this request, and will only return a result if the data has been modified since the last request. If no changes have been made, an HTTP 304 will be returned. If data has been modified, ALL data on that call will be returned (for \"only modified\" data, see below). The FTC Events API also allows a custom header used to filter the return data to a specific subset. This is done by specifying a `FMS-OnlyModifiedSince` header with each call. As with the `If-Modified-Since` header, consumers should keep track of the Last-Modified Header, and return it on subsequent calls to the same endpoint as the `FMS-OnlyModifiedSince` Header. The server will recognize this request, and will only return a result if the data has been modified since the last request, and, if returned, the data will only be those portions modified since the included date. If no changes, have been made, an HTTP 304 will be returned. Using this method, the server and consumer save processing time by only receiving modified data that is in need of update on the consumer side. If the Headers are improperly passed (such as the wrong Day of Week for the matching date, or a date in the future), the endpoint will simply ignore the Header and return all results. If both headers are specified, the request will be denied. ## Response Codes The FTC Events API HTTP Status Codes correspond with the [common codes](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html), but occasionally with different \"titles\". The \"title\" used by the API is shown next to each of the below possible response HTTP Status Codes. Throughout the documentation, Apiary may automatically show the common \"title\" in example returns (like \"Not Found\" for 404) but on the production server, the \"title\" will instead match those listed below. ### HTTP 200 - \"OK\" The request has succeeded. An entity corresponding to the requested resource is sent in the response. This will be returned as the HTTP Status Code for all request that succeed, even if the body is empty (such as an event that has no rankings, but with a valid season and event code were used) ### HTTP 304 - \"Not Modified\" When utilizing a Header that allows filtered data returns, such as `If-Modified-Since`, this response indicates that no data meets the request. ### HTTP 400 - \"Invalid Season Requested\"/\"Malformed Parameter Format In Request\"/\"Missing Parameter In Request\"/\"Invalid API Version Requested\": The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications. Specifically for this API, a 400 response indicates that the requested URI matches with a valid API, but one or more required parameter was malformed or invalid. Examples include an event code that is too short or team number that contains a letter. ### HTTP 401 - \"Unauthorized\" All requests against the API require authentication via a valid user token. Failing to provide one, or providing an invalid one, will warrant a 401 response. The client MAY repeat the request with a suitable Authorization header field. ### HTTP 404 - \"Invalid Event Requested\" Even though the 404 code usually indicates any not found status, a 404 will only be issued in this API when an event cannot be found for the requested season and event code. If the request didn't match a valid API or there were malformed parameters, the response would not receive a 404 but rather a 400 or 501. If this HTTP code is received, the season was a valid season and the event code matched the acceptable style of an event code, but there were no records of an event matching the combination of that season and event code. For example, HTTP 404 would be issued when the event had a different code in the requested season (the codes can change year to year based on event location). ### HTTP 500 - \"Internal Server Error\" The server encountered an unexpected condition which prevented it from fulfilling the request. This is a code sent directly by the server, and has no special alternate definition specific to this API. ### HTTP 501 - \"Request Did Not Match Any Current API Pattern\" The server does not support the functionality required to fulfill the request. Specifically, the request pattern did not match any of the possible APIs, and thus processing was discontinued. This code is also issued when too many optional parameters were included in a single request and fulfilling it would make the result confusing or misleading. Each API will specify which parameters or combination of parameters can be used at the same time. ### HTTP 503 - \"Service Unavailable\" The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay. If known, the length of the delay MAY be indicated in a `Retry-After` header. This code will not always appear, sometimes the server may outright refuse the connection instead. This is a code sent directly by the server, and has no special alternate definition specific to this API. ## Authorization In order to make calls against the FTC Events API, you must include an HTTP Header called `Authorization` with the value set as specified below. If a request is made without this header, processing stops and an HTTP 401 is issued. All `Authorization` headers follow the same format: ``` Authorization: Basic 000000000000000000000000000000000000000000000000000000000000 ``` Where the Zeros are replaced by your Token. The Token can be formed by taking your username and your AuthorizationKey and adding a colon. For example, if your username is `sampleuser` and your AuthorizationKey is `7eaa6338-a097-4221-ac04-b6120fcc4d49` you would have this string: ``` sampleuser:7eaa6338-a097-4221-ac04-b6120fcc4d49 ``` This string must then be encoded using Base64 Encoded to form the Token, which will be the same length as the example above, but include letters and numbers. For our example, we would have: ``` c2FtcGxldXNlcjo3ZWFhNjMzOC1hMDk3LTQyMjEtYWMwNC1iNjEyMGZjYzRkNDk= ``` Most API client libraries can handle computing the authorization header using a username and password for you NOTICE: Publicly distributing an application, code snippet, etc, that has your username and token in it, encoded or not, WILL result in your token being blocked from the API. Each user should apply for their own token. If you wish to acquire a token for your development, you may do so by requesting a token through our automated system on this website.
5
5
 
6
- The version of the OpenAPI document: v2.0
7
-
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.0.0-SNAPSHOT
6
+ OpenAPI spec version: v2.0
10
7
 
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.29
11
10
  =end
12
11
 
13
12
  require 'date'
14
13
  require 'json'
15
14
  require 'logger'
16
15
  require 'tempfile'
17
- require 'time'
18
16
  require 'typhoeus'
17
+ require 'uri'
19
18
 
20
19
  module FtcEventsClient
21
20
  class ApiClient
@@ -31,7 +30,7 @@ module FtcEventsClient
31
30
  # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
32
31
  def initialize(config = Configuration.default)
33
32
  @config = config
34
- @user_agent = "OpenAPI-Generator/#{VERSION}/ruby"
33
+ @user_agent = "Swagger-Codegen/#{VERSION}/ruby"
35
34
  @default_headers = {
36
35
  'Content-Type' => 'application/json',
37
36
  'User-Agent' => @user_agent
@@ -87,7 +86,7 @@ module FtcEventsClient
87
86
  # @option opts [Object] :body HTTP body (JSON/XML)
88
87
  # @return [Typhoeus::Request] A Typhoeus Request
89
88
  def build_request(http_method, path, opts = {})
90
- url = build_request_url(path, opts)
89
+ url = build_request_url(path)
91
90
  http_method = http_method.to_sym.downcase
92
91
 
93
92
  header_params = @default_headers.merge(opts[:header_params] || {})
@@ -156,44 +155,6 @@ module FtcEventsClient
156
155
  data
157
156
  end
158
157
 
159
- # Save response body into a file in (the defined) temporary folder, using the filename
160
- # from the "Content-Disposition" header if provided, otherwise a random filename.
161
- # The response body is written to the file in chunks in order to handle files which
162
- # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
163
- # process can use.
164
- #
165
- # @see Configuration#temp_folder_path
166
- def download_file(request)
167
- tempfile = nil
168
- encoding = nil
169
- request.on_headers do |response|
170
- content_disposition = response.headers['Content-Disposition']
171
- if content_disposition && content_disposition =~ /filename=/i
172
- filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
173
- prefix = sanitize_filename(filename)
174
- else
175
- prefix = 'download-'
176
- end
177
- prefix = prefix + '-' unless prefix.end_with?('-')
178
- encoding = response.body.encoding
179
- tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
180
- @tempfile = tempfile
181
- end
182
- request.on_body do |chunk|
183
- chunk.force_encoding(encoding)
184
- tempfile.write(chunk)
185
- end
186
- request.on_complete do |response|
187
- if tempfile
188
- tempfile.close
189
- @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
190
- "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
191
- "will be deleted automatically with GC. It's also recommended to delete the temp file "\
192
- "explicitly with `tempfile.delete`"
193
- end
194
- end
195
- end
196
-
197
158
  # Check if the given MIME is a JSON MIME.
198
159
  # JSON MIME examples:
199
160
  # application/json
@@ -230,7 +191,7 @@ module FtcEventsClient
230
191
  begin
231
192
  data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
232
193
  rescue JSON::ParserError => e
233
- if %w(String Date Time).include?(return_type)
194
+ if %w(String Date DateTime).include?(return_type)
234
195
  data = body
235
196
  else
236
197
  raise e
@@ -255,9 +216,9 @@ module FtcEventsClient
255
216
  data.to_f
256
217
  when 'Boolean'
257
218
  data == true
258
- when 'Time'
219
+ when 'DateTime'
259
220
  # parse date time (expecting ISO 8601 format)
260
- Time.parse data
221
+ DateTime.parse data
261
222
  when 'Date'
262
223
  # parse date time (expecting ISO 8601 format)
263
224
  Date.parse data
@@ -275,9 +236,46 @@ module FtcEventsClient
275
236
  data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
276
237
  end
277
238
  else
278
- # models (e.g. Pet) or oneOf
279
- klass = FtcEventsClient.const_get(return_type)
280
- klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)
239
+ # models, e.g. Pet
240
+ FtcEventsClient.const_get(return_type).build_from_hash(data)
241
+ end
242
+ end
243
+
244
+ # Save response body into a file in (the defined) temporary folder, using the filename
245
+ # from the "Content-Disposition" header if provided, otherwise a random filename.
246
+ # The response body is written to the file in chunks in order to handle files which
247
+ # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
248
+ # process can use.
249
+ #
250
+ # @see Configuration#temp_folder_path
251
+ def download_file(request)
252
+ tempfile = nil
253
+ encoding = nil
254
+ request.on_headers do |response|
255
+ content_disposition = response.headers['Content-Disposition']
256
+ if content_disposition && content_disposition =~ /filename=/i
257
+ filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
258
+ prefix = sanitize_filename(filename)
259
+ else
260
+ prefix = 'download-'
261
+ end
262
+ prefix = prefix + '-' unless prefix.end_with?('-')
263
+ encoding = response.body.encoding
264
+ tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
265
+ @tempfile = tempfile
266
+ end
267
+ request.on_body do |chunk|
268
+ chunk.force_encoding(encoding)
269
+ tempfile.write(chunk)
270
+ end
271
+ request.on_complete do |response|
272
+ if tempfile
273
+ tempfile.close
274
+ @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
275
+ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
276
+ "will be deleted automatically with GC. It's also recommended to delete the temp file "\
277
+ "explicitly with `tempfile.delete`"
278
+ end
281
279
  end
282
280
  end
283
281
 
@@ -290,10 +288,10 @@ module FtcEventsClient
290
288
  filename.gsub(/.*[\/\\]/, '')
291
289
  end
292
290
 
293
- def build_request_url(path, opts = {})
291
+ def build_request_url(path)
294
292
  # Add leading and trailing slashes to path
295
293
  path = "/#{path}".gsub(/\/+/, '/')
296
- @config.base_url(opts[:operation]) + path
294
+ @config.base_url + path
297
295
  end
298
296
 
299
297
  # Update hearder and query params based on authentication settings.
@@ -315,7 +313,7 @@ module FtcEventsClient
315
313
 
316
314
  # Sets user agent in HTTP header
317
315
  #
318
- # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0)
316
+ # @param [String] user_agent User agent (e.g. swagger-codegen/ruby/1.0.0)
319
317
  def user_agent=(user_agent)
320
318
  @user_agent = user_agent
321
319
  @default_headers['User-Agent'] = @user_agent
@@ -3,11 +3,10 @@
3
3
 
4
4
  #FTC Events API is a service to return relevant information about the _FIRST_ Tech Challenge (FTC). Information is made available from events operating around the world Information is currently made available after the conclusion of the tournament. The API will provide data as soon as it has synced, and we do not add any artificial delays. ## Documentation Notes ### Timezones All times are listed in the local time to the event venue. HTTP-date values will show their timezone. ### Query Parameters If you specify a parameter, but no value for that parameter, it will be ignored. For example, if you request `URL?teamNumber=` the `teamNumber` parameter would be ignored. For all APIs that accept a query string in addition to the base URI, the order of parameters do not matter, but the name shown in the documentation must match exactly, as does the associated value format as described in details. For response codes that are not HTTP 200 (OK), the documentation will show a body message that represents a possible response value. While the \"title\" of the HTTP Status Code will match those shown in the response codes documentation section exactly, the body of the response will be a more detailed explanation of why that status code is being returned and may not always be exactly as shown in the examples. ### Experimenting with the API This documentation is rendered at both [api-docs](https://ftc-events.firstinspires.org/api-docs) and [try-it-out](https://ftc-events.firstinspires.org/try-it-out). [api-docs](https://ftc-events.firstinspires.org/api-docs) has a three panel, easy to read layout, while [try-it-out](https://ftc-events.firstinspires.org/try-it-out) has a feature that allows you try out endpoints from within the page. Additionally, the Open API Json is availabe at [Open API](https://ftc-events.firstinspires.org/swagger/v2.0/swagger.json). This can be imported into a tool such as [Postman](https://www.postman.com) for experimentation as well. ### Last-Modified, FMS-OnlyModifiedSince, and If-Modified-Since Headers The FTC Events API utilizes the `Last-Modified` and `If-Modified-Since` Headers to communicate with consumers regarding the age of the data they are requesting. With a couple of exceptions, all calls will return a `Last-Modified` Header set with the time at which the data at that endpoint was last modified. The Header will always be set in the HTTP-date format, as described in the HTTP Protocol. There are two exceptions: the `Last-Modified` Header is not set if the endpoint returns no results (such as a request for a schedule with no matches). Consumers should keep track of the `Last-Modified` Header, and return it on subsequent calls to the same endpoint as the If-Modified-Since. The server will recognize this request, and will only return a result if the data has been modified since the last request. If no changes have been made, an HTTP 304 will be returned. If data has been modified, ALL data on that call will be returned (for \"only modified\" data, see below). The FTC Events API also allows a custom header used to filter the return data to a specific subset. This is done by specifying a `FMS-OnlyModifiedSince` header with each call. As with the `If-Modified-Since` header, consumers should keep track of the Last-Modified Header, and return it on subsequent calls to the same endpoint as the `FMS-OnlyModifiedSince` Header. The server will recognize this request, and will only return a result if the data has been modified since the last request, and, if returned, the data will only be those portions modified since the included date. If no changes, have been made, an HTTP 304 will be returned. Using this method, the server and consumer save processing time by only receiving modified data that is in need of update on the consumer side. If the Headers are improperly passed (such as the wrong Day of Week for the matching date, or a date in the future), the endpoint will simply ignore the Header and return all results. If both headers are specified, the request will be denied. ## Response Codes The FTC Events API HTTP Status Codes correspond with the [common codes](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html), but occasionally with different \"titles\". The \"title\" used by the API is shown next to each of the below possible response HTTP Status Codes. Throughout the documentation, Apiary may automatically show the common \"title\" in example returns (like \"Not Found\" for 404) but on the production server, the \"title\" will instead match those listed below. ### HTTP 200 - \"OK\" The request has succeeded. An entity corresponding to the requested resource is sent in the response. This will be returned as the HTTP Status Code for all request that succeed, even if the body is empty (such as an event that has no rankings, but with a valid season and event code were used) ### HTTP 304 - \"Not Modified\" When utilizing a Header that allows filtered data returns, such as `If-Modified-Since`, this response indicates that no data meets the request. ### HTTP 400 - \"Invalid Season Requested\"/\"Malformed Parameter Format In Request\"/\"Missing Parameter In Request\"/\"Invalid API Version Requested\": The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications. Specifically for this API, a 400 response indicates that the requested URI matches with a valid API, but one or more required parameter was malformed or invalid. Examples include an event code that is too short or team number that contains a letter. ### HTTP 401 - \"Unauthorized\" All requests against the API require authentication via a valid user token. Failing to provide one, or providing an invalid one, will warrant a 401 response. The client MAY repeat the request with a suitable Authorization header field. ### HTTP 404 - \"Invalid Event Requested\" Even though the 404 code usually indicates any not found status, a 404 will only be issued in this API when an event cannot be found for the requested season and event code. If the request didn't match a valid API or there were malformed parameters, the response would not receive a 404 but rather a 400 or 501. If this HTTP code is received, the season was a valid season and the event code matched the acceptable style of an event code, but there were no records of an event matching the combination of that season and event code. For example, HTTP 404 would be issued when the event had a different code in the requested season (the codes can change year to year based on event location). ### HTTP 500 - \"Internal Server Error\" The server encountered an unexpected condition which prevented it from fulfilling the request. This is a code sent directly by the server, and has no special alternate definition specific to this API. ### HTTP 501 - \"Request Did Not Match Any Current API Pattern\" The server does not support the functionality required to fulfill the request. Specifically, the request pattern did not match any of the possible APIs, and thus processing was discontinued. This code is also issued when too many optional parameters were included in a single request and fulfilling it would make the result confusing or misleading. Each API will specify which parameters or combination of parameters can be used at the same time. ### HTTP 503 - \"Service Unavailable\" The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay. If known, the length of the delay MAY be indicated in a `Retry-After` header. This code will not always appear, sometimes the server may outright refuse the connection instead. This is a code sent directly by the server, and has no special alternate definition specific to this API. ## Authorization In order to make calls against the FTC Events API, you must include an HTTP Header called `Authorization` with the value set as specified below. If a request is made without this header, processing stops and an HTTP 401 is issued. All `Authorization` headers follow the same format: ``` Authorization: Basic 000000000000000000000000000000000000000000000000000000000000 ``` Where the Zeros are replaced by your Token. The Token can be formed by taking your username and your AuthorizationKey and adding a colon. For example, if your username is `sampleuser` and your AuthorizationKey is `7eaa6338-a097-4221-ac04-b6120fcc4d49` you would have this string: ``` sampleuser:7eaa6338-a097-4221-ac04-b6120fcc4d49 ``` This string must then be encoded using Base64 Encoded to form the Token, which will be the same length as the example above, but include letters and numbers. For our example, we would have: ``` c2FtcGxldXNlcjo3ZWFhNjMzOC1hMDk3LTQyMjEtYWMwNC1iNjEyMGZjYzRkNDk= ``` Most API client libraries can handle computing the authorization header using a username and password for you NOTICE: Publicly distributing an application, code snippet, etc, that has your username and token in it, encoded or not, WILL result in your token being blocked from the API. Each user should apply for their own token. If you wish to acquire a token for your development, you may do so by requesting a token through our automated system on this website.
5
5
 
6
- The version of the OpenAPI document: v2.0
7
-
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.0.0-SNAPSHOT
6
+ OpenAPI spec version: v2.0
10
7
 
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.29
11
10
  =end
12
11
 
13
12
  module FtcEventsClient
@@ -53,5 +52,6 @@ module FtcEventsClient
53
52
 
54
53
  msg
55
54
  end
55
+
56
56
  end
57
57
  end
@@ -3,11 +3,10 @@
3
3
 
4
4
  #FTC Events API is a service to return relevant information about the _FIRST_ Tech Challenge (FTC). Information is made available from events operating around the world Information is currently made available after the conclusion of the tournament. The API will provide data as soon as it has synced, and we do not add any artificial delays. ## Documentation Notes ### Timezones All times are listed in the local time to the event venue. HTTP-date values will show their timezone. ### Query Parameters If you specify a parameter, but no value for that parameter, it will be ignored. For example, if you request `URL?teamNumber=` the `teamNumber` parameter would be ignored. For all APIs that accept a query string in addition to the base URI, the order of parameters do not matter, but the name shown in the documentation must match exactly, as does the associated value format as described in details. For response codes that are not HTTP 200 (OK), the documentation will show a body message that represents a possible response value. While the \"title\" of the HTTP Status Code will match those shown in the response codes documentation section exactly, the body of the response will be a more detailed explanation of why that status code is being returned and may not always be exactly as shown in the examples. ### Experimenting with the API This documentation is rendered at both [api-docs](https://ftc-events.firstinspires.org/api-docs) and [try-it-out](https://ftc-events.firstinspires.org/try-it-out). [api-docs](https://ftc-events.firstinspires.org/api-docs) has a three panel, easy to read layout, while [try-it-out](https://ftc-events.firstinspires.org/try-it-out) has a feature that allows you try out endpoints from within the page. Additionally, the Open API Json is availabe at [Open API](https://ftc-events.firstinspires.org/swagger/v2.0/swagger.json). This can be imported into a tool such as [Postman](https://www.postman.com) for experimentation as well. ### Last-Modified, FMS-OnlyModifiedSince, and If-Modified-Since Headers The FTC Events API utilizes the `Last-Modified` and `If-Modified-Since` Headers to communicate with consumers regarding the age of the data they are requesting. With a couple of exceptions, all calls will return a `Last-Modified` Header set with the time at which the data at that endpoint was last modified. The Header will always be set in the HTTP-date format, as described in the HTTP Protocol. There are two exceptions: the `Last-Modified` Header is not set if the endpoint returns no results (such as a request for a schedule with no matches). Consumers should keep track of the `Last-Modified` Header, and return it on subsequent calls to the same endpoint as the If-Modified-Since. The server will recognize this request, and will only return a result if the data has been modified since the last request. If no changes have been made, an HTTP 304 will be returned. If data has been modified, ALL data on that call will be returned (for \"only modified\" data, see below). The FTC Events API also allows a custom header used to filter the return data to a specific subset. This is done by specifying a `FMS-OnlyModifiedSince` header with each call. As with the `If-Modified-Since` header, consumers should keep track of the Last-Modified Header, and return it on subsequent calls to the same endpoint as the `FMS-OnlyModifiedSince` Header. The server will recognize this request, and will only return a result if the data has been modified since the last request, and, if returned, the data will only be those portions modified since the included date. If no changes, have been made, an HTTP 304 will be returned. Using this method, the server and consumer save processing time by only receiving modified data that is in need of update on the consumer side. If the Headers are improperly passed (such as the wrong Day of Week for the matching date, or a date in the future), the endpoint will simply ignore the Header and return all results. If both headers are specified, the request will be denied. ## Response Codes The FTC Events API HTTP Status Codes correspond with the [common codes](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html), but occasionally with different \"titles\". The \"title\" used by the API is shown next to each of the below possible response HTTP Status Codes. Throughout the documentation, Apiary may automatically show the common \"title\" in example returns (like \"Not Found\" for 404) but on the production server, the \"title\" will instead match those listed below. ### HTTP 200 - \"OK\" The request has succeeded. An entity corresponding to the requested resource is sent in the response. This will be returned as the HTTP Status Code for all request that succeed, even if the body is empty (such as an event that has no rankings, but with a valid season and event code were used) ### HTTP 304 - \"Not Modified\" When utilizing a Header that allows filtered data returns, such as `If-Modified-Since`, this response indicates that no data meets the request. ### HTTP 400 - \"Invalid Season Requested\"/\"Malformed Parameter Format In Request\"/\"Missing Parameter In Request\"/\"Invalid API Version Requested\": The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications. Specifically for this API, a 400 response indicates that the requested URI matches with a valid API, but one or more required parameter was malformed or invalid. Examples include an event code that is too short or team number that contains a letter. ### HTTP 401 - \"Unauthorized\" All requests against the API require authentication via a valid user token. Failing to provide one, or providing an invalid one, will warrant a 401 response. The client MAY repeat the request with a suitable Authorization header field. ### HTTP 404 - \"Invalid Event Requested\" Even though the 404 code usually indicates any not found status, a 404 will only be issued in this API when an event cannot be found for the requested season and event code. If the request didn't match a valid API or there were malformed parameters, the response would not receive a 404 but rather a 400 or 501. If this HTTP code is received, the season was a valid season and the event code matched the acceptable style of an event code, but there were no records of an event matching the combination of that season and event code. For example, HTTP 404 would be issued when the event had a different code in the requested season (the codes can change year to year based on event location). ### HTTP 500 - \"Internal Server Error\" The server encountered an unexpected condition which prevented it from fulfilling the request. This is a code sent directly by the server, and has no special alternate definition specific to this API. ### HTTP 501 - \"Request Did Not Match Any Current API Pattern\" The server does not support the functionality required to fulfill the request. Specifically, the request pattern did not match any of the possible APIs, and thus processing was discontinued. This code is also issued when too many optional parameters were included in a single request and fulfilling it would make the result confusing or misleading. Each API will specify which parameters or combination of parameters can be used at the same time. ### HTTP 503 - \"Service Unavailable\" The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay. If known, the length of the delay MAY be indicated in a `Retry-After` header. This code will not always appear, sometimes the server may outright refuse the connection instead. This is a code sent directly by the server, and has no special alternate definition specific to this API. ## Authorization In order to make calls against the FTC Events API, you must include an HTTP Header called `Authorization` with the value set as specified below. If a request is made without this header, processing stops and an HTTP 401 is issued. All `Authorization` headers follow the same format: ``` Authorization: Basic 000000000000000000000000000000000000000000000000000000000000 ``` Where the Zeros are replaced by your Token. The Token can be formed by taking your username and your AuthorizationKey and adding a colon. For example, if your username is `sampleuser` and your AuthorizationKey is `7eaa6338-a097-4221-ac04-b6120fcc4d49` you would have this string: ``` sampleuser:7eaa6338-a097-4221-ac04-b6120fcc4d49 ``` This string must then be encoded using Base64 Encoded to form the Token, which will be the same length as the example above, but include letters and numbers. For our example, we would have: ``` c2FtcGxldXNlcjo3ZWFhNjMzOC1hMDk3LTQyMjEtYWMwNC1iNjEyMGZjYzRkNDk= ``` Most API client libraries can handle computing the authorization header using a username and password for you NOTICE: Publicly distributing an application, code snippet, etc, that has your username and token in it, encoded or not, WILL result in your token being blocked from the API. Each user should apply for their own token. If you wish to acquire a token for your development, you may do so by requesting a token through our automated system on this website.
5
5
 
6
- The version of the OpenAPI document: v2.0
7
-
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.0.0-SNAPSHOT
6
+ OpenAPI spec version: v2.0
10
7
 
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.29
11
10
  =end
12
11
 
13
12
  module FtcEventsClient
@@ -21,18 +20,6 @@ module FtcEventsClient
21
20
  # Defines url base path
22
21
  attr_accessor :base_path
23
22
 
24
- # Define server configuration index
25
- attr_accessor :server_index
26
-
27
- # Define server operation configuration index
28
- attr_accessor :server_operation_index
29
-
30
- # Default server variables
31
- attr_accessor :server_variables
32
-
33
- # Default server operation variables
34
- attr_accessor :server_operation_variables
35
-
36
23
  # Defines API keys used with API Key authentications.
37
24
  #
38
25
  # @return [Hash] key: parameter name, value: parameter value (API key)
@@ -140,11 +127,7 @@ module FtcEventsClient
140
127
  def initialize
141
128
  @scheme = 'https'
142
129
  @host = 'ftc-api.firstinspires.org'
143
- @base_path = ''
144
- @server_index = nil
145
- @server_operation_index = {}
146
- @server_variables = {}
147
- @server_operation_variables = {}
130
+ @base_path = 'http://ftc-api.firstinspires.org'
148
131
  @api_key = {}
149
132
  @api_key_prefix = {}
150
133
  @timeout = 0
@@ -187,12 +170,8 @@ module FtcEventsClient
187
170
  @base_path = '' if @base_path == '/'
188
171
  end
189
172
 
190
- # Returns base URL for specified operation based on server settings
191
- def base_url(operation = nil)
192
- index = server_operation_index.fetch(operation, server_index)
193
- return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil
194
-
195
- server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
173
+ def base_url
174
+ "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
196
175
  end
197
176
 
198
177
  # Gets API key (with prefix if set).
@@ -222,54 +201,5 @@ module FtcEventsClient
222
201
  },
223
202
  }
224
203
  end
225
-
226
- # Returns an array of Server setting
227
- def server_settings
228
- [
229
- {
230
- url: "/",
231
- description: "No description provided",
232
- }
233
- ]
234
- end
235
-
236
- def operation_server_settings
237
- {
238
- }
239
- end
240
-
241
- # Returns URL based on server settings
242
- #
243
- # @param index array index of the server settings
244
- # @param variables hash of variable and the corresponding value
245
- def server_url(index, variables = {}, servers = nil)
246
- servers = server_settings if servers == nil
247
-
248
- # check array index out of bound
249
- if (index < 0 || index >= servers.size)
250
- fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
251
- end
252
-
253
- server = servers[index]
254
- url = server[:url]
255
-
256
- return url unless server.key? :variables
257
-
258
- # go through variable and assign a value
259
- server[:variables].each do |name, variable|
260
- if variables.key?(name)
261
- if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
262
- url.gsub! "{" + name.to_s + "}", variables[name]
263
- else
264
- fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
265
- end
266
- else
267
- # use default value
268
- url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
269
- end
270
- end
271
-
272
- url
273
- end
274
204
  end
275
205
  end