UNPKG

@brayjamin/tba-api-v3client

Version:

_Overview__Information_and_statistics_about_FIRST_Robotics_Competition_teams_and_events___Authentication_All_endpoints_require_an_Auth_Key_to_be_passed_in_the_header_X_TBA_Auth_Key__If_you_do_not_have_an_auth_key_yet_you_can_obtain_one_from_your__Account_

442 lines (421 loc) 22 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); var _DistrictList = _interopRequireDefault(require("../model/DistrictList")); var _DistrictRanking = _interopRequireDefault(require("../model/DistrictRanking")); var _Event = _interopRequireDefault(require("../model/Event")); var _EventDistrictPoints = _interopRequireDefault(require("../model/EventDistrictPoints")); var _EventSimple = _interopRequireDefault(require("../model/EventSimple")); var _Team = _interopRequireDefault(require("../model/Team")); var _TeamSimple = _interopRequireDefault(require("../model/TeamSimple")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /** * District service. * @module api/DistrictApi * @version 3.8.0 */ var DistrictApi = /*#__PURE__*/function () { /** * Constructs a new DistrictApi. * @alias module:api/DistrictApi * @class * @param {module:ApiClient} [apiClient] Optional API client implementation to use, * default to {@link module:ApiClient#instance} if unspecified. */ function DistrictApi(apiClient) { _classCallCheck(this, DistrictApi); this.apiClient = apiClient || _ApiClient["default"].instance; } /** * Callback function to receive the result of the getDistrictEvents operation. * @callback module:api/DistrictApi~getDistrictEventsCallback * @param {String} error Error message, if any. * @param {Array.<module:model/Event>} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Gets a list of events in the given district. * @param {String} districtKey TBA District Key, eg `2016fim` * @param {Object} opts Optional parameters * @param {String} opts.ifModifiedSince Value of the `Last-Modified` header in the most recently cached response by the client. * @param {module:api/DistrictApi~getDistrictEventsCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link Array.<module:model/Event>} */ _createClass(DistrictApi, [{ key: "getDistrictEvents", value: function getDistrictEvents(districtKey, opts, callback) { opts = opts || {}; var postBody = null; // verify the required parameter 'districtKey' is set if (districtKey === undefined || districtKey === null) { throw new Error("Missing the required parameter 'districtKey' when calling getDistrictEvents"); } var pathParams = { 'district_key': districtKey }; var queryParams = {}; var headerParams = { 'If-Modified-Since': opts['ifModifiedSince'] }; var formParams = {}; var authNames = ['apiKey']; var contentTypes = []; var accepts = ['application/json']; var returnType = [_Event["default"]]; return this.apiClient.callApi('/district/{district_key}/events', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } /** * Callback function to receive the result of the getDistrictEventsKeys operation. * @callback module:api/DistrictApi~getDistrictEventsKeysCallback * @param {String} error Error message, if any. * @param {Array.<String>} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Gets a list of event keys for events in the given district. * @param {String} districtKey TBA District Key, eg `2016fim` * @param {Object} opts Optional parameters * @param {String} opts.ifModifiedSince Value of the `Last-Modified` header in the most recently cached response by the client. * @param {module:api/DistrictApi~getDistrictEventsKeysCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link Array.<String>} */ }, { key: "getDistrictEventsKeys", value: function getDistrictEventsKeys(districtKey, opts, callback) { opts = opts || {}; var postBody = null; // verify the required parameter 'districtKey' is set if (districtKey === undefined || districtKey === null) { throw new Error("Missing the required parameter 'districtKey' when calling getDistrictEventsKeys"); } var pathParams = { 'district_key': districtKey }; var queryParams = {}; var headerParams = { 'If-Modified-Since': opts['ifModifiedSince'] }; var formParams = {}; var authNames = ['apiKey']; var contentTypes = []; var accepts = ['application/json']; var returnType = ['String']; return this.apiClient.callApi('/district/{district_key}/events/keys', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } /** * Callback function to receive the result of the getDistrictEventsSimple operation. * @callback module:api/DistrictApi~getDistrictEventsSimpleCallback * @param {String} error Error message, if any. * @param {Array.<module:model/EventSimple>} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Gets a short-form list of events in the given district. * @param {String} districtKey TBA District Key, eg `2016fim` * @param {Object} opts Optional parameters * @param {String} opts.ifModifiedSince Value of the `Last-Modified` header in the most recently cached response by the client. * @param {module:api/DistrictApi~getDistrictEventsSimpleCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link Array.<module:model/EventSimple>} */ }, { key: "getDistrictEventsSimple", value: function getDistrictEventsSimple(districtKey, opts, callback) { opts = opts || {}; var postBody = null; // verify the required parameter 'districtKey' is set if (districtKey === undefined || districtKey === null) { throw new Error("Missing the required parameter 'districtKey' when calling getDistrictEventsSimple"); } var pathParams = { 'district_key': districtKey }; var queryParams = {}; var headerParams = { 'If-Modified-Since': opts['ifModifiedSince'] }; var formParams = {}; var authNames = ['apiKey']; var contentTypes = []; var accepts = ['application/json']; var returnType = [_EventSimple["default"]]; return this.apiClient.callApi('/district/{district_key}/events/simple', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } /** * Callback function to receive the result of the getDistrictRankings operation. * @callback module:api/DistrictApi~getDistrictRankingsCallback * @param {String} error Error message, if any. * @param {Array.<module:model/DistrictRanking>} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Gets a list of team district rankings for the given district. * @param {String} districtKey TBA District Key, eg `2016fim` * @param {Object} opts Optional parameters * @param {String} opts.ifModifiedSince Value of the `Last-Modified` header in the most recently cached response by the client. * @param {module:api/DistrictApi~getDistrictRankingsCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link Array.<module:model/DistrictRanking>} */ }, { key: "getDistrictRankings", value: function getDistrictRankings(districtKey, opts, callback) { opts = opts || {}; var postBody = null; // verify the required parameter 'districtKey' is set if (districtKey === undefined || districtKey === null) { throw new Error("Missing the required parameter 'districtKey' when calling getDistrictRankings"); } var pathParams = { 'district_key': districtKey }; var queryParams = {}; var headerParams = { 'If-Modified-Since': opts['ifModifiedSince'] }; var formParams = {}; var authNames = ['apiKey']; var contentTypes = []; var accepts = ['application/json']; var returnType = [_DistrictRanking["default"]]; return this.apiClient.callApi('/district/{district_key}/rankings', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } /** * Callback function to receive the result of the getDistrictTeams operation. * @callback module:api/DistrictApi~getDistrictTeamsCallback * @param {String} error Error message, if any. * @param {Array.<module:model/Team>} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Gets a list of `Team` objects that competed in events in the given district. * @param {String} districtKey TBA District Key, eg `2016fim` * @param {Object} opts Optional parameters * @param {String} opts.ifModifiedSince Value of the `Last-Modified` header in the most recently cached response by the client. * @param {module:api/DistrictApi~getDistrictTeamsCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link Array.<module:model/Team>} */ }, { key: "getDistrictTeams", value: function getDistrictTeams(districtKey, opts, callback) { opts = opts || {}; var postBody = null; // verify the required parameter 'districtKey' is set if (districtKey === undefined || districtKey === null) { throw new Error("Missing the required parameter 'districtKey' when calling getDistrictTeams"); } var pathParams = { 'district_key': districtKey }; var queryParams = {}; var headerParams = { 'If-Modified-Since': opts['ifModifiedSince'] }; var formParams = {}; var authNames = ['apiKey']; var contentTypes = []; var accepts = ['application/json']; var returnType = [_Team["default"]]; return this.apiClient.callApi('/district/{district_key}/teams', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } /** * Callback function to receive the result of the getDistrictTeamsKeys operation. * @callback module:api/DistrictApi~getDistrictTeamsKeysCallback * @param {String} error Error message, if any. * @param {Array.<String>} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Gets a list of `Team` objects that competed in events in the given district. * @param {String} districtKey TBA District Key, eg `2016fim` * @param {Object} opts Optional parameters * @param {String} opts.ifModifiedSince Value of the `Last-Modified` header in the most recently cached response by the client. * @param {module:api/DistrictApi~getDistrictTeamsKeysCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link Array.<String>} */ }, { key: "getDistrictTeamsKeys", value: function getDistrictTeamsKeys(districtKey, opts, callback) { opts = opts || {}; var postBody = null; // verify the required parameter 'districtKey' is set if (districtKey === undefined || districtKey === null) { throw new Error("Missing the required parameter 'districtKey' when calling getDistrictTeamsKeys"); } var pathParams = { 'district_key': districtKey }; var queryParams = {}; var headerParams = { 'If-Modified-Since': opts['ifModifiedSince'] }; var formParams = {}; var authNames = ['apiKey']; var contentTypes = []; var accepts = ['application/json']; var returnType = ['String']; return this.apiClient.callApi('/district/{district_key}/teams/keys', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } /** * Callback function to receive the result of the getDistrictTeamsSimple operation. * @callback module:api/DistrictApi~getDistrictTeamsSimpleCallback * @param {String} error Error message, if any. * @param {Array.<module:model/TeamSimple>} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Gets a short-form list of `Team` objects that competed in events in the given district. * @param {String} districtKey TBA District Key, eg `2016fim` * @param {Object} opts Optional parameters * @param {String} opts.ifModifiedSince Value of the `Last-Modified` header in the most recently cached response by the client. * @param {module:api/DistrictApi~getDistrictTeamsSimpleCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link Array.<module:model/TeamSimple>} */ }, { key: "getDistrictTeamsSimple", value: function getDistrictTeamsSimple(districtKey, opts, callback) { opts = opts || {}; var postBody = null; // verify the required parameter 'districtKey' is set if (districtKey === undefined || districtKey === null) { throw new Error("Missing the required parameter 'districtKey' when calling getDistrictTeamsSimple"); } var pathParams = { 'district_key': districtKey }; var queryParams = {}; var headerParams = { 'If-Modified-Since': opts['ifModifiedSince'] }; var formParams = {}; var authNames = ['apiKey']; var contentTypes = []; var accepts = ['application/json']; var returnType = [_TeamSimple["default"]]; return this.apiClient.callApi('/district/{district_key}/teams/simple', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } /** * Callback function to receive the result of the getDistrictsByYear operation. * @callback module:api/DistrictApi~getDistrictsByYearCallback * @param {String} error Error message, if any. * @param {Array.<module:model/DistrictList>} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Gets a list of districts and their corresponding district key, for the given year. * @param {Number} year Competition Year (or Season). Must be 4 digits. * @param {Object} opts Optional parameters * @param {String} opts.ifModifiedSince Value of the `Last-Modified` header in the most recently cached response by the client. * @param {module:api/DistrictApi~getDistrictsByYearCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link Array.<module:model/DistrictList>} */ }, { key: "getDistrictsByYear", value: function getDistrictsByYear(year, opts, callback) { opts = opts || {}; var postBody = null; // verify the required parameter 'year' is set if (year === undefined || year === null) { throw new Error("Missing the required parameter 'year' when calling getDistrictsByYear"); } var pathParams = { 'year': year }; var queryParams = {}; var headerParams = { 'If-Modified-Since': opts['ifModifiedSince'] }; var formParams = {}; var authNames = ['apiKey']; var contentTypes = []; var accepts = ['application/json']; var returnType = [_DistrictList["default"]]; return this.apiClient.callApi('/districts/{year}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } /** * Callback function to receive the result of the getEventDistrictPoints operation. * @callback module:api/DistrictApi~getEventDistrictPointsCallback * @param {String} error Error message, if any. * @param {module:model/EventDistrictPoints} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Gets a list of team rankings for the Event. * @param {String} eventKey TBA Event Key, eg `2016nytr` * @param {Object} opts Optional parameters * @param {String} opts.ifModifiedSince Value of the `Last-Modified` header in the most recently cached response by the client. * @param {module:api/DistrictApi~getEventDistrictPointsCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/EventDistrictPoints} */ }, { key: "getEventDistrictPoints", value: function getEventDistrictPoints(eventKey, opts, callback) { opts = opts || {}; var postBody = null; // verify the required parameter 'eventKey' is set if (eventKey === undefined || eventKey === null) { throw new Error("Missing the required parameter 'eventKey' when calling getEventDistrictPoints"); } var pathParams = { 'event_key': eventKey }; var queryParams = {}; var headerParams = { 'If-Modified-Since': opts['ifModifiedSince'] }; var formParams = {}; var authNames = ['apiKey']; var contentTypes = []; var accepts = ['application/json']; var returnType = _EventDistrictPoints["default"]; return this.apiClient.callApi('/event/{event_key}/district_points', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } /** * Callback function to receive the result of the getTeamDistricts operation. * @callback module:api/DistrictApi~getTeamDistrictsCallback * @param {String} error Error message, if any. * @param {Array.<module:model/DistrictList>} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Gets an array of districts representing each year the team was in a district. Will return an empty array if the team was never in a district. * @param {String} teamKey TBA Team Key, eg `frc254` * @param {Object} opts Optional parameters * @param {String} opts.ifModifiedSince Value of the `Last-Modified` header in the most recently cached response by the client. * @param {module:api/DistrictApi~getTeamDistrictsCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link Array.<module:model/DistrictList>} */ }, { key: "getTeamDistricts", value: function getTeamDistricts(teamKey, opts, callback) { opts = opts || {}; var postBody = null; // verify the required parameter 'teamKey' is set if (teamKey === undefined || teamKey === null) { throw new Error("Missing the required parameter 'teamKey' when calling getTeamDistricts"); } var pathParams = { 'team_key': teamKey }; var queryParams = {}; var headerParams = { 'If-Modified-Since': opts['ifModifiedSince'] }; var formParams = {}; var authNames = ['apiKey']; var contentTypes = []; var accepts = ['application/json']; var returnType = [_DistrictList["default"]]; return this.apiClient.callApi('/team/{team_key}/districts', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } }]); return DistrictApi; }(); exports["default"] = DistrictApi;