Add swagger api

Signed-off-by: Jonas Kuche <Jonas.kuche@gmail.com>
pull/1/head
Jonas Kuche 5 years ago
parent 275da56bb5
commit d4424c880f
  1. 574
      ApiClient.js
  2. 83
      api/ExaminationSchedulingApi.js
  3. 211
      api/ReplacementLessonsApi.js
  4. 83
      api/TimetableApi.js
  5. 111
      index.js
  6. 111
      model/Exam.js
  7. 127
      model/Lesson.js
  8. 102
      model/ReplacementLesson.js
  9. 88
      model/Subject.js
  10. 89
      model/Teacher.js

@ -0,0 +1,574 @@
/**
* Organizer
* Dies ist eine API, die es ermöglicht Daten zu Stunden-, Vertretungs-, oder Klausurplänen zu erhalten.
*
* OpenAPI spec version: 1.0.0
* Contact: info@jonasfranz.software
*
* 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.
*
*/
import superagent from "superagent";
import querystring from "querystring";
/**
* @module ApiClient
* @version 1.0.0
*/
/**
* Manages low level client-server communications, parameter marshalling, etc. There should not be any need for an
* application to use this class directly - the *Api and model classes provide the public API for the service. The
* contents of this file should be regarded as internal but are documented for completeness.
* @alias module:ApiClient
* @class
*/
export default class ApiClient {
constructor() {
/**
* The base URL against which to resolve every API call's (relative) path.
* @type {String}
* @default http://api.organizer.martin-luther.schule/v1
*/
this.basePath = 'http://api.organizer.martin-luther.schule/v1'.replace(/\/+$/, '');
/**
* The authentication methods to be included for all API calls.
* @type {Array.<String>}
*/
this.authentications = {
'passwordAuth': {type: 'basic'}
}
/**
* The default HTTP headers to be included for all API calls.
* @type {Array.<String>}
* @default {}
*/
this.defaultHeaders = {};
/**
* The default HTTP timeout for all API calls.
* @type {Number}
* @default 60000
*/
this.timeout = 60000;
/**
* If set to false an additional timestamp parameter is added to all API GET calls to
* prevent browser caching
* @type {Boolean}
* @default true
*/
this.cache = true;
/**
* If set to true, the client will save the cookies from each server
* response, and return them in the next request.
* @default false
*/
this.enableCookies = false;
/*
* Used to save and return cookies in a node.js (non-browser) setting,
* if this.enableCookies is set to true.
*/
if (typeof window === 'undefined') {
this.agent = new superagent.agent();
}
}
/**
* Returns a string representation for an actual parameter.
* @param param The actual parameter.
* @returns {String} The string representation of <code>param</code>.
*/
paramToString(param) {
if (param == undefined || param == null) {
return '';
}
if (param instanceof Date) {
return param.toJSON();
}
return param.toString();
}
/**
* Builds full URL by appending the given path to the base URL and replacing path parameter place-holders with parameter values.
* NOTE: query parameters are not handled here.
* @param {String} path The path to append to the base URL.
* @param {Object} pathParams The parameter values to append.
* @returns {String} The encoded path with parameter values substituted.
*/
buildUrl(path, pathParams) {
if (!path.match(/^\//)) {
path = '/' + path;
}
var url = this.basePath + path;
url = url.replace(/\{([\w-]+)\}/g, (fullMatch, key) => {
var value;
if (pathParams.hasOwnProperty(key)) {
value = this.paramToString(pathParams[key]);
} else {
value = fullMatch;
}
return encodeURIComponent(value);
});
return url;
}
/**
* Checks whether the given content type represents JSON.<br>
* JSON content type examples:<br>
* <ul>
* <li>application/json</li>
* <li>application/json; charset=UTF8</li>
* <li>APPLICATION/JSON</li>
* </ul>
* @param {String} contentType The MIME content type to check.
* @returns {Boolean} <code>true</code> if <code>contentType</code> represents JSON, otherwise <code>false</code>.
*/
isJsonMime(contentType) {
return Boolean(contentType != null && contentType.match(/^application\/json(;.*)?$/i));
}
/**
* Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first.
* @param {Array.<String>} contentTypes
* @returns {String} The chosen content type, preferring JSON.
*/
jsonPreferredMime(contentTypes) {
for (var i = 0; i < contentTypes.length; i++) {
if (this.isJsonMime(contentTypes[i])) {
return contentTypes[i];
}
}
return contentTypes[0];
}
/**
* Checks whether the given parameter value represents file-like content.
* @param param The parameter to check.
* @returns {Boolean} <code>true</code> if <code>param</code> represents a file.
*/
isFileParam(param) {
// fs.ReadStream in Node.js and Electron (but not in runtime like browserify)
if (typeof require === 'function') {
let fs;
try {
fs = require('fs');
} catch (err) {}
if (fs && fs.ReadStream && param instanceof fs.ReadStream) {
return true;
}
}
// Buffer in Node.js
if (typeof Buffer === 'function' && param instanceof Buffer) {
return true;
}
// Blob in browser
if (typeof Blob === 'function' && param instanceof Blob) {
return true;
}
// File in browser (it seems File object is also instance of Blob, but keep this for safe)
if (typeof File === 'function' && param instanceof File) {
return true;
}
return false;
}
/**
* Normalizes parameter values:
* <ul>
* <li>remove nils</li>
* <li>keep files and arrays</li>
* <li>format to string with `paramToString` for other cases</li>
* </ul>
* @param {Object.<String, Object>} params The parameters as object properties.
* @returns {Object.<String, Object>} normalized parameters.
*/
normalizeParams(params) {
var newParams = {};
for (var key in params) {
if (params.hasOwnProperty(key) && params[key] != undefined && params[key] != null) {
var value = params[key];
if (this.isFileParam(value) || Array.isArray(value)) {
newParams[key] = value;
} else {
newParams[key] = this.paramToString(value);
}
}
}
return newParams;
}
/**
* Enumeration of collection format separator strategies.
* @enum {String}
* @readonly
*/
static CollectionFormatEnum = {
/**
* Comma-separated values. Value: <code>csv</code>
* @const
*/
CSV: ',',
/**
* Space-separated values. Value: <code>ssv</code>
* @const
*/
SSV: ' ',
/**
* Tab-separated values. Value: <code>tsv</code>
* @const
*/
TSV: '\t',
/**
* Pipe(|)-separated values. Value: <code>pipes</code>
* @const
*/
PIPES: '|',
/**
* Native array. Value: <code>multi</code>
* @const
*/
MULTI: 'multi'
};
/**
* Builds a string representation of an array-type actual parameter, according to the given collection format.
* @param {Array} param An array parameter.
* @param {module:ApiClient.CollectionFormatEnum} collectionFormat The array element separator strategy.
* @returns {String|Array} A string representation of the supplied collection, using the specified delimiter. Returns
* <code>param</code> as is if <code>collectionFormat</code> is <code>multi</code>.
*/
buildCollectionParam(param, collectionFormat) {
if (param == null) {
return null;
}
switch (collectionFormat) {
case 'csv':
return param.map(this.paramToString).join(',');
case 'ssv':
return param.map(this.paramToString).join(' ');
case 'tsv':
return param.map(this.paramToString).join('\t');
case 'pipes':
return param.map(this.paramToString).join('|');
case 'multi':
//return the array directly as SuperAgent will handle it as expected
return param.map(this.paramToString);
default:
throw new Error('Unknown collection format: ' + collectionFormat);
}
}
/**
* Applies authentication headers to the request.
* @param {Object} request The request object created by a <code>superagent()</code> call.
* @param {Array.<String>} authNames An array of authentication method names.
*/
applyAuthToRequest(request, authNames) {
authNames.forEach((authName) => {
var auth = this.authentications[authName];
switch (auth.type) {
case 'basic':
if (auth.username || auth.password) {
request.auth(auth.username || '', auth.password || '');
}
break;
case 'apiKey':
if (auth.apiKey) {
var data = {};
if (auth.apiKeyPrefix) {
data[auth.name] = auth.apiKeyPrefix + ' ' + auth.apiKey;
} else {
data[auth.name] = auth.apiKey;
}
if (auth['in'] === 'header') {
request.set(data);
} else {
request.query(data);
}
}
break;
case 'oauth2':
if (auth.accessToken) {
request.set({'Authorization': 'Bearer ' + auth.accessToken});
}
break;
default:
throw new Error('Unknown authentication type: ' + auth.type);
}
});
}
/**
* Deserializes an HTTP response body into a value of the specified type.
* @param {Object} response A SuperAgent response object.
* @param {(String|Array.<String>|Object.<String, Object>|Function)} returnType The type to return. Pass a string for simple types
* or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To
* return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type:
* all properties on <code>data<code> will be converted to this type.
* @returns A value of the specified type.
*/
deserialize(response, returnType) {
if (response == null || returnType == null || response.status == 204) {
return null;
}
// Rely on SuperAgent for parsing response body.
// See http://visionmedia.github.io/superagent/#parsing-response-bodies
var data = response.body;
if (data == null || (typeof data === 'object' && typeof data.length === 'undefined' && !Object.keys(data).length)) {
// SuperAgent does not always produce a body; use the unparsed response as a fallback
data = response.text;
}
return ApiClient.convertToType(data, returnType);
}
/**
* Callback function to receive the result of the operation.
* @callback module:ApiClient~callApiCallback
* @param {String} error Error message, if any.
* @param data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Invokes the REST service using the supplied settings and parameters.
* @param {String} path The base URL to invoke.
* @param {String} httpMethod The HTTP method to use.
* @param {Object.<String, String>} pathParams A map of path parameters and their values.
* @param {Object.<String, Object>} queryParams A map of query parameters and their values.
* @param {Object.<String, Object>} headerParams A map of header parameters and their values.
* @param {Object.<String, Object>} formParams A map of form parameters and their values.
* @param {Object} bodyParam The value to pass as the request body.
* @param {Array.<String>} authNames An array of authentication type names.
* @param {Array.<String>} contentTypes An array of request MIME types.
* @param {Array.<String>} accepts An array of acceptable response MIME types.
* @param {(String|Array|ObjectFunction)} returnType The required type to return; can be a string for simple types or the
* constructor for a complex type.
* @param {module:ApiClient~callApiCallback} callback The callback function.
* @returns {Object} The SuperAgent request object.
*/
callApi(path, httpMethod, pathParams,
queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts,
returnType, callback) {
var url = this.buildUrl(path, pathParams);
var request = superagent(httpMethod, url);
// apply authentications
this.applyAuthToRequest(request, authNames);
// set query parameters
if (httpMethod.toUpperCase() === 'GET' && this.cache === false) {
queryParams['_'] = new Date().getTime();
}
request.query(this.normalizeParams(queryParams));
// set header parameters
request.set(this.defaultHeaders).set(this.normalizeParams(headerParams));
// set request timeout
request.timeout(this.timeout);
var contentType = this.jsonPreferredMime(contentTypes);
if (contentType) {
// Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746)
if(contentType != 'multipart/form-data') {
request.type(contentType);
}
} else if (!request.header['Content-Type']) {
request.type('application/json');
}
if (contentType === 'application/x-www-form-urlencoded') {
request.send(querystring.stringify(this.normalizeParams(formParams)));
} else if (contentType == 'multipart/form-data') {
var _formParams = this.normalizeParams(formParams);
for (var key in _formParams) {
if (_formParams.hasOwnProperty(key)) {
if (this.isFileParam(_formParams[key])) {
// file field
request.attach(key, _formParams[key]);
} else {
request.field(key, _formParams[key]);
}
}
}
} else if (bodyParam) {
request.send(bodyParam);
}
var accept = this.jsonPreferredMime(accepts);
if (accept) {
request.accept(accept);
}
if (returnType === 'Blob') {
request.responseType('blob');
} else if (returnType === 'String') {
request.responseType('string');
}
// Attach previously saved cookies, if enabled
if (this.enableCookies){
if (typeof window === 'undefined') {
this.agent.attachCookies(request);
}
else {
request.withCredentials();
}
}
request.end((error, response) => {
if (callback) {
var data = null;
if (!error) {
try {
data = this.deserialize(response, returnType);
if (this.enableCookies && typeof window === 'undefined'){
this.agent.saveCookies(response);
}
} catch (err) {
error = err;
}
}
callback(error, data, response);
}
});
return request;
}
/**
* Parses an ISO-8601 string representation of a date value.
* @param {String} str The date value as a string.
* @returns {Date} The parsed date object.
*/
static parseDate(str) {
return new Date(str.replace(/T/i, ' '));
}
/**
* Converts a value to the specified type.
* @param {(String|Object)} data The data to convert, as a string or object.
* @param {(String|Array.<String>|Object.<String, Object>|Function)} type The type to return. Pass a string for simple types
* or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To
* return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type:
* all properties on <code>data<code> will be converted to this type.
* @returns An instance of the specified type or null or undefined if data is null or undefined.
*/
static convertToType(data, type) {
if (data === null || data === undefined)
return data
switch (type) {
case 'Boolean':
return Boolean(data);
case 'Integer':
return parseInt(data, 10);
case 'Number':
return parseFloat(data);
case 'String':
return String(data);
case 'Date':
return ApiClient.parseDate(String(data));
case 'Blob':
return data;
default:
if (type === Object) {
// generic object, return directly
return data;
} else if (typeof type === 'function') {
// for model type like: User
return type.constructFromObject(data);
} else if (Array.isArray(type)) {
// for array type like: ['String']
var itemType = type[0];
return data.map((item) => {
return ApiClient.convertToType(item, itemType);
});
} else if (typeof type === 'object') {
// for plain object type like: {'String': 'Integer'}
var keyType, valueType;
for (var k in type) {
if (type.hasOwnProperty(k)) {
keyType = k;
valueType = type[k];
break;
}
}
var result = {};
for (var k in data) {
if (data.hasOwnProperty(k)) {
var key = ApiClient.convertToType(k, keyType);
var value = ApiClient.convertToType(data[k], valueType);
result[key] = value;
}
}
return result;
} else {
// for unknown type, return the data directly
return data;
}
}
}
/**
* Constructs a new map or array model from REST data.
* @param data {Object|Array} The REST data.
* @param obj {Object|Array} The target object or array.
*/
static constructFromObject(data, obj, itemType) {
if (Array.isArray(data)) {
for (var i = 0; i < data.length; i++) {
if (data.hasOwnProperty(i))
obj[i] = ApiClient.convertToType(data[i], itemType);
}
} else {
for (var k in data) {
if (data.hasOwnProperty(k))
obj[k] = ApiClient.convertToType(data[k], itemType);
}
}
};
}
/**
* The default API client implementation.
* @type {module:ApiClient}
*/
ApiClient.instance = new ApiClient();

@ -0,0 +1,83 @@
/**
* Organizer
* Dies ist eine API, die es ermöglicht Daten zu Stunden-, Vertretungs-, oder Klausurplänen zu erhalten.
*
* OpenAPI spec version: 1.0.0
* Contact: info@jonasfranz.software
*
* 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.
*
*/
import ApiClient from "../ApiClient";
import Exam from '../model/Exam';
/**
* ExaminationScheduling service.
* @module api/ExaminationSchedulingApi
* @version 1.0.0
*/
export default class ExaminationSchedulingApi {
/**
* Constructs a new ExaminationSchedulingApi.
* @alias module:api/ExaminationSchedulingApi
* @class
* @param {module:ApiClient} apiClient Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
constructor(apiClient) {
this.apiClient = apiClient || ApiClient.instance;
}
/**
* Callback function to receive the result of the getExams operation.
* @callback module:api/ExaminationSchedulingApi~getExamsCallback
* @param {String} error Error message, if any.
* @param {Array.<module:model/Exam>} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Returns course&#39;s exams
* @param {String} course
* @param {module:api/ExaminationSchedulingApi~getExamsCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link Array.<module:model/Exam>}
*/
getExams(course, callback) {
let postBody = null;
// verify the required parameter 'course' is set
if (course === undefined || course === null) {
throw new Error("Missing the required parameter 'course' when calling getExams");
}
let pathParams = {
'course': course
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = ['passwordAuth'];
let contentTypes = [];
let accepts = ['application/json'];
let returnType = [Exam];
return this.apiClient.callApi(
'/course/{course}/exams', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
}
}

@ -0,0 +1,211 @@
/**
* Organizer
* Dies ist eine API, die es ermöglicht Daten zu Stunden-, Vertretungs-, oder Klausurplänen zu erhalten.
*
* OpenAPI spec version: 1.0.0
* Contact: info@jonasfranz.software
*
* 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.
*
*/
import ApiClient from "../ApiClient";
import ReplacementLesson from '../model/ReplacementLesson';
/**
* ReplacementLessons service.
* @module api/ReplacementLessonsApi
* @version 1.0.0
*/
export default class ReplacementLessonsApi {
/**
* Constructs a new ReplacementLessonsApi.
* @alias module:api/ReplacementLessonsApi
* @class
* @param {module:ApiClient} apiClient Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
constructor(apiClient) {
this.apiClient = apiClient || ApiClient.instance;
}
/**
* Callback function to receive the result of the findReplacementLessons operation.
* @callback module:api/ReplacementLessonsApi~findReplacementLessonsCallback
* @param {String} error Error message, if any.
* @param {Array.<module:model/ReplacementLesson>} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Finds all available replacement lessons
* @param {module:api/ReplacementLessonsApi~findReplacementLessonsCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link Array.<module:model/ReplacementLesson>}
*/
findReplacementLessons(callback) {
let postBody = null;
let pathParams = {
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = ['passwordAuth'];
let contentTypes = [];
let accepts = ['application/json'];
let returnType = [ReplacementLesson];
return this.apiClient.callApi(
'/replacement/findAll', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
}
/**
* Callback function to receive the result of the findReplacementLessonsByDate operation.
* @callback module:api/ReplacementLessonsApi~findReplacementLessonsByDateCallback
* @param {String} error Error message, if any.
* @param {Array.<module:model/ReplacementLesson>} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Finds replacement lessons by date
* @param {Date} _date Date of the searched replacement lessons
* @param {module:api/ReplacementLessonsApi~findReplacementLessonsByDateCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link Array.<module:model/ReplacementLesson>}
*/
findReplacementLessonsByDate(_date, callback) {
let postBody = null;
// verify the required parameter '_date' is set
if (_date === undefined || _date === null) {
throw new Error("Missing the required parameter '_date' when calling findReplacementLessonsByDate");
}
let pathParams = {
};
let queryParams = {
'date': _date
};
let headerParams = {
};
let formParams = {
};
let authNames = ['passwordAuth'];
let contentTypes = [];
let accepts = ['application/json'];
let returnType = [ReplacementLesson];
return this.apiClient.callApi(
'/replacement/findByDate', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
}
/**
* Callback function to receive the result of the getReplacement operation.
* @callback module:api/ReplacementLessonsApi~getReplacementCallback
* @param {String} error Error message, if any.
* @param {module:model/ReplacementLesson} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Get replacement lesson by id
* @param {Number} id Replacement lesson&#39;s id
* @param {module:api/ReplacementLessonsApi~getReplacementCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/ReplacementLesson}
*/
getReplacement(id, callback) {
let postBody = null;
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
throw new Error("Missing the required parameter 'id' when calling getReplacement");
}
let pathParams = {
'id': id
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = ['passwordAuth'];
let contentTypes = [];
let accepts = ['application/json'];
let returnType = ReplacementLesson;
return this.apiClient.callApi(
'/replacement/{id}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
}
/**
* Callback function to receive the result of the getReplacementByCourse operation.
* @callback module:api/ReplacementLessonsApi~getReplacementByCourseCallback
* @param {String} error Error message, if any.
* @param {Array.<module:model/ReplacementLesson>} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Get replacement lesson of a course/class
* @param {String} course
* @param {module:api/ReplacementLessonsApi~getReplacementByCourseCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link Array.<module:model/ReplacementLesson>}
*/
getReplacementByCourse(course, callback) {
let postBody = null;
// verify the required parameter 'course' is set
if (course === undefined || course === null) {
throw new Error("Missing the required parameter 'course' when calling getReplacementByCourse");
}
let pathParams = {
'course': course
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = ['passwordAuth'];
let contentTypes = [];
let accepts = ['application/json'];
let returnType = [ReplacementLesson];
return this.apiClient.callApi(
'/course/{course}/replacements', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
}
}

@ -0,0 +1,83 @@
/**
* Organizer
* Dies ist eine API, die es ermöglicht Daten zu Stunden-, Vertretungs-, oder Klausurplänen zu erhalten.
*
* OpenAPI spec version: 1.0.0
* Contact: info@jonasfranz.software
*
* 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.
*
*/
import ApiClient from "../ApiClient";
import Lesson from '../model/Lesson';
/**
* Timetable service.
* @module api/TimetableApi
* @version 1.0.0
*/
export default class TimetableApi {
/**
* Constructs a new TimetableApi.
* @alias module:api/TimetableApi
* @class
* @param {module:ApiClient} apiClient Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
constructor(apiClient) {
this.apiClient = apiClient || ApiClient.instance;
}
/**
* Callback function to receive the result of the getTimetable operation.
* @callback module:api/TimetableApi~getTimetableCallback
* @param {String} error Error message, if any.
* @param {Array.<module:model/Lesson>} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Returns course&#39;s timetable
* @param {String} course
* @param {module:api/TimetableApi~getTimetableCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link Array.<module:model/Lesson>}
*/
getTimetable(course, callback) {
let postBody = null;
// verify the required parameter 'course' is set
if (course === undefined || course === null) {
throw new Error("Missing the required parameter 'course' when calling getTimetable");
}
let pathParams = {
'course': course
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = ['passwordAuth'];
let contentTypes = [];
let accepts = ['application/json'];
let returnType = [Lesson];
return this.apiClient.callApi(
'/course/{course}/timetable', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
}
}

@ -0,0 +1,111 @@
/**
* Organizer
* Dies ist eine API, die es ermöglicht Daten zu Stunden-, Vertretungs-, oder Klausurplänen zu erhalten.
*
* OpenAPI spec version: 1.0.0
* Contact: info@jonasfranz.software
*
* 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.
*
*/
import ApiClient from './ApiClient';
import Exam from './model/Exam';
import Lesson from './model/Lesson';
import ReplacementLesson from './model/ReplacementLesson';
import Subject from './model/Subject';
import Teacher from './model/Teacher';
import ExaminationSchedulingApi from './api/ExaminationSchedulingApi';
import ReplacementLessonsApi from './api/ReplacementLessonsApi';
import TimetableApi from './api/TimetableApi';
/**
* Dies_ist_eine_API_die_es_ermglicht_Daten_zu_Stunden__Vertretungs__oder_Klausurplnen_zu_erhalten_.<br>
* The <code>index</code> module provides access to constructors for all the classes which comprise the public API.
* <p>
* An AMD (recommended!) or CommonJS application will generally do something equivalent to the following:
* <pre>
* var Organizer = require('index'); // See note below*.
* var xxxSvc = new Organizer.XxxApi(); // Allocate the API class we're going to use.
* var yyyModel = new Organizer.Yyy(); // Construct a model instance.
* yyyModel.someProperty = 'someValue';
* ...
* var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.
* ...
* </pre>
* <em>*NOTE: For a top-level AMD script, use require(['index'], function(){...})
* and put the application logic within the callback function.</em>
* </p>
* <p>
* A non-AMD browser application (discouraged) might do something like this:
* <pre>
* var xxxSvc = new Organizer.XxxApi(); // Allocate the API class we're going to use.
* var yyy = new Organizer.Yyy(); // Construct a model instance.
* yyyModel.someProperty = 'someValue';
* ...
* var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.
* ...
* </pre>
* </p>
* @module index
* @version 1.0.0
*/
export {
/**
* The ApiClient constructor.
* @property {module:ApiClient}
*/
ApiClient,
/**
* The Exam model constructor.
* @property {module:model/Exam}
*/
Exam,
/**
* The Lesson model constructor.
* @property {module:model/Lesson}
*/
Lesson,
/**
* The ReplacementLesson model constructor.
* @property {module:model/ReplacementLesson}
*/
ReplacementLesson,
/**
* The Subject model constructor.
* @property {module:model/Subject}
*/
Subject,
/**
* The Teacher model constructor.
* @property {module:model/Teacher}
*/
Teacher,
/**
* The ExaminationSchedulingApi service constructor.
* @property {module:api/ExaminationSchedulingApi}
*/
ExaminationSchedulingApi,
/**
* The ReplacementLessonsApi service constructor.
* @property {module:api/ReplacementLessonsApi}
*/
ReplacementLessonsApi,
/**
* The TimetableApi service constructor.
* @property {module:api/TimetableApi}
*/
TimetableApi
};

@ -0,0 +1,111 @@
/**
* Organizer
* Dies ist eine API, die es ermöglicht Daten zu Stunden-, Vertretungs-, oder Klausurplänen zu erhalten.
*
* OpenAPI spec version: 1.0.0
* Contact: info@jonasfranz.software
*
* 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.
*
*/
import ApiClient from '../ApiClient';
import Lesson from './Lesson';
/**
* The Exam model module.
* @module model/Exam
* @version 1.0.0
*/
export default class Exam {
/**
* Constructs a new <code>Exam</code>.
* @alias module:model/Exam
* @class
*/
constructor() {
}
/**
* Constructs a <code>Exam</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {module:model/Exam} obj Optional instance to populate.
* @return {module:model/Exam} The populated <code>Exam</code> instance.
*/
static constructFromObject(data, obj) {
if (data) {
obj = obj || new Exam();
if (data.hasOwnProperty('id')) {
obj['id'] = ApiClient.convertToType(data['id'], 'Number');
}
if (data.hasOwnProperty('date')) {
obj['date'] = ApiClient.convertToType(data['date'], 'Date');
}
if (data.hasOwnProperty('startPeriod')) {
obj['startPeriod'] = ApiClient.convertToType(data['startPeriod'], 'Number');
}
if (data.hasOwnProperty('endPeriod')) {
obj['endPeriod'] = ApiClient.convertToType(data['endPeriod'], 'Number');
}
if (data.hasOwnProperty('lesson')) {
obj['lesson'] = Lesson.constructFromObject(data['lesson']);
}
}
return obj;
}
/**
* @member {Number} id
*/
id = undefined;
/**
* @member {Date} date
*/
date = undefined;
/**
* The period of the day where the exam starts
* @member {Number} startPeriod
*/
startPeriod = undefined;
/**
* The period of the day where the exam ends
* @member {Number} endPeriod
*/
endPeriod = undefined;
/**
* @member {module:model/Lesson} lesson
*/
lesson = undefined;
}

@ -0,0 +1,127 @@
/**
* Organizer
* Dies ist eine API, die es ermöglicht Daten zu Stunden-, Vertretungs-, oder Klausurplänen zu erhalten.
*
* OpenAPI spec version: 1.0.0
* Contact: info@jonasfranz.software
*
* 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.
*
*/
import ApiClient from '../ApiClient';
import Subject from './Subject';
import Teacher from './Teacher';
/**
* The Lesson model module.
* @module model/Lesson
* @version 1.0.0
*/
export default class Lesson {
/**
* Constructs a new <code>Lesson</code>.
* @alias module:model/Lesson
* @class
*/
constructor() {
}
/**
* Constructs a <code>Lesson</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {module:model/Lesson} obj Optional instance to populate.
* @return {module:model/Lesson} The populated <code>Lesson</code> instance.
*/
static constructFromObject(data, obj) {
if (data) {
obj = obj || new Lesson();
if (data.hasOwnProperty('weekday')) {
obj['weekday'] = ApiClient.convertToType(data['weekday'], 'Number');
}
if (data.hasOwnProperty('period')) {
obj['period'] = ApiClient.convertToType(data['period'], 'Number');
}
if (data.hasOwnProperty('course')) {
obj['course'] = ApiClient.convertToType(data['course'], 'String');
}
if (data.hasOwnProperty('subject')) {
obj['subject'] = Subject.constructFromObject(data['subject']);
}
if (data.hasOwnProperty('teacher')) {
obj['teacher'] = Teacher.constructFromObject(data['teacher']);
}
if (data.hasOwnProperty('additionalInformation')) {
obj['additionalInformation'] = ApiClient.convertToType(data['additionalInformation'], 'String');
}
if (data.hasOwnProperty('room')) {
obj['room'] = ApiClient.convertToType(data['room'], 'String');
}
}
return obj;
}
/**
* @member {Number} weekday
*/
weekday = undefined;
/**
* The period of the day where the lesson is
* @member {Number} period
*/
period = undefined;
/**
* Class or Course
* @member {String} course
*/
course = undefined;
/**
* @member {module:model/Subject} subject
*/
subject = undefined;
/**
* @member {module:model/Teacher} teacher
*/
teacher = undefined;
/**
* An additional information like 'Every 14 days only'
* @member {String} additionalInformation
*/
additionalInformation = undefined;
/**
* @member {String} room
*/
room = undefined;
}

@ -0,0 +1,102 @@
/**
* Organizer
* Dies ist eine API, die es ermöglicht Daten zu Stunden-, Vertretungs-, oder Klausurplänen zu erhalten.
*
* OpenAPI spec version: 1.0.0
* Contact: info@jonasfranz.software
*
* 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.
*
*/
import ApiClient from '../ApiClient';
import Lesson from './Lesson';
/**
* The ReplacementLesson model module.
* @module model/ReplacementLesson
* @version 1.0.0
*/
export default class ReplacementLesson {
/**
* Constructs a new <code>ReplacementLesson</code>.
* @alias module:model/ReplacementLesson
* @class
*/
constructor() {
}
/**
* Constructs a <code>ReplacementLesson</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {module:model/ReplacementLesson} obj Optional instance to populate.
* @return {module:model/ReplacementLesson} The populated <code>ReplacementLesson</code> instance.
*/
static constructFromObject(data, obj) {
if (data) {
obj = obj || new ReplacementLesson();