UNPKG

biojs-rest-tessapi

Version:

API client to interface with the TeSS Rest API. Retrieve a list of metedata about upcoming Life science events, training materials, and other training opportunities. Return results filtered by metadata facets

185 lines (166 loc) 10.1 kB
/** * TeSS API * Access, search and filter through collections of training materials, events, packages, and workflows in TeSS. As a rule of thumb - You can add .json to the end of most pages to retrieve the data in a common exchange format. e.g - https://tess.elixir-europe.org/events/software-carpentry-west-virginia-university.json - https://tess.elixir-europe.org/materials/rna-seq-de-novo-transcriptome-reconstruction-with-rna-seq.json - https://tess.elixir-europe.org/packages/biocomp-computing-skills-collection.json - https://tess.elixir-europe.org/workflows/das-internet-fur-biologen.json - https://tess.elixir-europe.org/nodes/united-kingdom.json * * OpenAPI spec version: 1.0.0 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['ApiClient', 'model/Event'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient'), require('../model/Event')); } else { // Browser globals (root is window) if (!root.TeSsApi) { root.TeSsApi = {}; } root.TeSsApi.EventsApi = factory(root.TeSsApi.ApiClient, root.TeSsApi.Event); } }(this, function(ApiClient, Event) { 'use strict'; /** * Events service. * @module api/EventsApi * @version 1.0.0 */ /** * Constructs a new EventsApi. * @alias module:api/EventsApi * @class * @param {module:ApiClient} apiClient Optional API client implementation to use, * default to {@link module:ApiClient#instance} if unspecified. */ var exports = function(apiClient) { this.apiClient = apiClient || ApiClient.instance; /** * Callback function to receive the result of the eventsJsonGet operation. * @callback module:api/EventsApi~eventsJsonGetCallback * @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. */ /** * Search over the collection of events * The base endpoint (events.json) returns the first page of events as seen on the UI (if you just go to &lt;tess&gt;/events). To navigate through and filter by attributes; use the below parameters. The returned value is an array of JSON objects described below. * @param {Object} opts Optional parameters * @param {String} opts.q This is the search parameter. Enter terms and the resulting events will be those that include this term in their description, name, keywords, or URL. * @param {Boolean} opts.includeExpired When true; the results will return include events that have already occured. By default this is false and will only return upcoming events. * @param {String} opts.sort Sorts the results by a particular attribute. The options are &#39;asc&#39; (Title ascending), &#39;desc&#39; (Title descending), &#39;early&#39; (Earliest first), and &#39;late&#39; (Latest first). * @param {Number} opts.page Selects which page of results to return (e.g. 2) * @param {Array.<String>} opts.eventTypes Returns all events of a categorical type. These can be &#39;Meetings and conferences&#39; and &#39;Workshops and courses&#39; * @param {Boolean} opts.online Filters returned events by whether or not is an online event. This can include things like telecons, webinars, and MOOCs. * @param {Array.<String>} opts.country Returns all the events that will be hosted in a certain country (e.g. Portugal or United Kingdom) * @param {Array.<String>} opts.scientificTopics Returns all events annotated with a given scientific topic from the EDAM ontology. * @param {String} opts.tools Returns all events that have been associated with a given tool from the ELIXIR bio.tools registry. * @param {String} opts.standardDatabaseOrPolicy returns all events that have been associated with a database, standard, or policy from the ELIXIR biosharing.org registry * @param {Array.<String>} opts.organizer Returns all events that have been created by an organizing institution. This is different to content provider in that the content provider is the website that provided the information whereas the organizer was involved in creating it. * @param {Array.<String>} opts.city Returns all the events that are held in a certain city (e.g. London or Daghstul) * @param {Array.<String>} opts.sponsor Returns all the events that have been sponsored by a given institution or organization * @param {Array.<String>} opts.keyword Returns all the events that have been tagged with the given free text keywords * @param {Array.<String>} opts.contentProvider Returns all events from the content provider that provided records to TeSS (e.g. DTLS, GOBLET, Software Carpentry) * @param {Array.<String>} opts.venue Returns all events that are held in a venue (e.g. University of Melbourne or Harvard) * @param {Array.<String>} opts.node Returns all events that are associated with a specified ELIXIR node (e.g. Belgium or United+Kingdom) * @param {Array.<String>} opts.targetAudience Returns all events that have a selected target audience (e.g. Graduate students, Academics, Post-Docs) * @param {module:api/EventsApi~eventsJsonGetCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link Array.<module:model/Event>} */ this.eventsJsonGet = function(opts, callback) { opts = opts || {}; var postBody = null; var pathParams = { }; var queryParams = { 'q': opts['q'], 'include_expired': opts['includeExpired'], 'sort': opts['sort'], 'page': opts['page'], 'event_types': this.apiClient.buildCollectionParam(opts['eventTypes'], 'multi'), 'online': opts['online'], 'country': this.apiClient.buildCollectionParam(opts['country'], 'multi'), 'scientific_topics': this.apiClient.buildCollectionParam(opts['scientificTopics'], 'multi'), 'tools': opts['tools'], 'standard_database_or_policy': opts['standardDatabaseOrPolicy'], 'organizer': this.apiClient.buildCollectionParam(opts['organizer'], 'multi'), 'city': this.apiClient.buildCollectionParam(opts['city'], 'multi'), 'sponsor': this.apiClient.buildCollectionParam(opts['sponsor'], 'multi'), 'keyword': this.apiClient.buildCollectionParam(opts['keyword'], 'multi'), 'content_provider': this.apiClient.buildCollectionParam(opts['contentProvider'], 'multi'), 'venue': this.apiClient.buildCollectionParam(opts['venue'], 'multi'), 'node': this.apiClient.buildCollectionParam(opts['node'], 'multi'), 'target_audience': this.apiClient.buildCollectionParam(opts['targetAudience'], 'multi') }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = []; var accepts = ['application/json']; var returnType = [Event]; return this.apiClient.callApi( '/events.json', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the eventsSlugJsonGet operation. * @callback module:api/EventsApi~eventsSlugJsonGetCallback * @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. */ /** * Get all the information stored about a particular event in TeSS. * Use the slug name of the event (lowercase hypenathed) to return a JSON object. e.g. https://tess.elixir-europe.org/events/software-carpentry-229th-aas-meeting.json - See the response schema to find out what fields are returned and what type each field is. This operation does not permit any parameters except the name as part of the URL. the name is a _slug_ of the title (lowercase + hypenated) * @param {String} slug The _slug_ id of an event e.g. software-carpentry-229th-aas-meeting * @param {module:api/EventsApi~eventsSlugJsonGetCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link Array.<module:model/Event>} */ this.eventsSlugJsonGet = function(slug, callback) { var postBody = null; // verify the required parameter 'slug' is set if (slug == undefined || slug == null) { throw new Error("Missing the required parameter 'slug' when calling eventsSlugJsonGet"); } var pathParams = { 'slug': slug }; var queryParams = { }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = []; var accepts = ['application/json']; var returnType = [Event]; return this.apiClient.callApi( '/events/{slug}.json', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } }; return exports; }));