From 8ca193836ac86fff73cb8b8f6bb4be955c2ac655 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Wed, 20 Nov 2024 17:45:39 -0500 Subject: [PATCH] Add initial support for reports --- js/.openapi-generator/FILES | 9 + js/README.md | 5 + js/docs/ArrayOfReports.md | 8 + js/docs/DefaultApi.md | 84 +++ js/docs/Report.md | 11 + js/docs/ReportSectionsInner.md | 10 + js/src/api/DefaultApi.js | 79 +++ js/src/index.js | 21 + js/src/model/ArrayOfReports.js | 81 +++ js/src/model/Report.js | 124 ++++ js/src/model/ReportSectionsInner.js | 116 ++++ js/test/api/DefaultApi.spec.js | 20 + js/test/model/ArrayOfReports.spec.js | 59 ++ js/test/model/Report.spec.js | 77 +++ js/test/model/ReportSectionsInner.spec.js | 71 +++ .../api/default/get_reports.py | 133 ++++ .../api/default/get_reports_id.py | 146 +++++ .../letsrolld_api_client/models/__init__.py | 30 + .../models/array_of_reports_item.py | 93 +++ .../array_of_reports_item_sections_item.py | 80 +++ ...f_reports_item_sections_item_films_item.py | 266 ++++++++ ...sections_item_films_item_countries_item.py | 80 +++ ...sections_item_films_item_directors_item.py | 77 +++ ...em_sections_item_films_item_offers_item.py | 72 +++ .../letsrolld_api_client/models/report.py | 93 +++ .../models/report_sections_item.py | 80 +++ .../models/report_sections_item_films_item.py | 254 ++++++++ ...sections_item_films_item_countries_item.py | 80 +++ ...sections_item_films_item_directors_item.py | 77 +++ ...rt_sections_item_films_item_offers_item.py | 72 +++ src/letsrolld/config.py | 11 + src/letsrolld/webapi/app.py | 92 +++ src/letsrolld/webapi/models.py | 30 + src/letsrolld/webcli/cli.py | 74 ++- src/letsrolld/webcli/templates/film-full.j2 | 2 +- src/letsrolld/webcli/templates/report-full.j2 | 7 + src/letsrolld/webcli/templates/report.j2 | 1 + swagger.json | 572 ++++++++++++++++++ ts/.openapi-generator/FILES | 3 + ts/api/defaultApi.ts | 132 ++++ ts/model/arrayOfReports.ts | 26 + ts/model/models.ts | 9 + ts/model/report.ts | 44 ++ ts/model/reportSectionsInner.ts | 38 ++ 44 files changed, 3439 insertions(+), 10 deletions(-) create mode 100644 js/docs/ArrayOfReports.md create mode 100644 js/docs/Report.md create mode 100644 js/docs/ReportSectionsInner.md create mode 100644 js/src/model/ArrayOfReports.js create mode 100644 js/src/model/Report.js create mode 100644 js/src/model/ReportSectionsInner.js create mode 100644 js/test/model/ArrayOfReports.spec.js create mode 100644 js/test/model/Report.spec.js create mode 100644 js/test/model/ReportSectionsInner.spec.js create mode 100644 letsrolld-api-client/letsrolld_api_client/api/default/get_reports.py create mode 100644 letsrolld-api-client/letsrolld_api_client/api/default/get_reports_id.py create mode 100644 letsrolld-api-client/letsrolld_api_client/models/array_of_reports_item.py create mode 100644 letsrolld-api-client/letsrolld_api_client/models/array_of_reports_item_sections_item.py create mode 100644 letsrolld-api-client/letsrolld_api_client/models/array_of_reports_item_sections_item_films_item.py create mode 100644 letsrolld-api-client/letsrolld_api_client/models/array_of_reports_item_sections_item_films_item_countries_item.py create mode 100644 letsrolld-api-client/letsrolld_api_client/models/array_of_reports_item_sections_item_films_item_directors_item.py create mode 100644 letsrolld-api-client/letsrolld_api_client/models/array_of_reports_item_sections_item_films_item_offers_item.py create mode 100644 letsrolld-api-client/letsrolld_api_client/models/report.py create mode 100644 letsrolld-api-client/letsrolld_api_client/models/report_sections_item.py create mode 100644 letsrolld-api-client/letsrolld_api_client/models/report_sections_item_films_item.py create mode 100644 letsrolld-api-client/letsrolld_api_client/models/report_sections_item_films_item_countries_item.py create mode 100644 letsrolld-api-client/letsrolld_api_client/models/report_sections_item_films_item_directors_item.py create mode 100644 letsrolld-api-client/letsrolld_api_client/models/report_sections_item_films_item_offers_item.py create mode 100644 src/letsrolld/webcli/templates/report-full.j2 create mode 100644 src/letsrolld/webcli/templates/report.j2 create mode 100644 ts/model/arrayOfReports.ts create mode 100644 ts/model/report.ts create mode 100644 ts/model/reportSectionsInner.ts diff --git a/js/.openapi-generator/FILES b/js/.openapi-generator/FILES index e89eb3e..ed0830e 100644 --- a/js/.openapi-generator/FILES +++ b/js/.openapi-generator/FILES @@ -5,6 +5,7 @@ README.md docs/ArrayOfDirectors.md docs/ArrayOfFilms.md +docs/ArrayOfReports.md docs/DefaultApi.md docs/Director.md docs/DirectorFilmsInner.md @@ -12,6 +13,8 @@ docs/DirectorFilmsInnerCountriesInner.md docs/DirectorFilmsInnerOffersInner.md docs/DirectorInfo.md docs/Film.md +docs/Report.md +docs/ReportSectionsInner.md git_push.sh mocha.opts package.json @@ -20,18 +23,24 @@ src/api/DefaultApi.js src/index.js src/model/ArrayOfDirectors.js src/model/ArrayOfFilms.js +src/model/ArrayOfReports.js src/model/Director.js src/model/DirectorFilmsInner.js src/model/DirectorFilmsInnerCountriesInner.js src/model/DirectorFilmsInnerOffersInner.js src/model/DirectorInfo.js src/model/Film.js +src/model/Report.js +src/model/ReportSectionsInner.js test/api/DefaultApi.spec.js test/model/ArrayOfDirectors.spec.js test/model/ArrayOfFilms.spec.js +test/model/ArrayOfReports.spec.js test/model/Director.spec.js test/model/DirectorFilmsInner.spec.js test/model/DirectorFilmsInnerCountriesInner.spec.js test/model/DirectorFilmsInnerOffersInner.spec.js test/model/DirectorInfo.spec.js test/model/Film.spec.js +test/model/Report.spec.js +test/model/ReportSectionsInner.spec.js diff --git a/js/README.md b/js/README.md index 0f740c6..f83fc59 100644 --- a/js/README.md +++ b/js/README.md @@ -127,18 +127,23 @@ Class | Method | HTTP request | Description *LetsrolldApi.DefaultApi* | [**directorsIdGet**](docs/DefaultApi.md#directorsIdGet) | **GET** /directors/{id} | Get Director *LetsrolldApi.DefaultApi* | [**filmsGet**](docs/DefaultApi.md#filmsGet) | **GET** /films | Get Films *LetsrolldApi.DefaultApi* | [**filmsIdGet**](docs/DefaultApi.md#filmsIdGet) | **GET** /films/{id} | Get Film +*LetsrolldApi.DefaultApi* | [**reportsGet**](docs/DefaultApi.md#reportsGet) | **GET** /reports | List Reports +*LetsrolldApi.DefaultApi* | [**reportsIdGet**](docs/DefaultApi.md#reportsIdGet) | **GET** /reports/{id} | Execute Report ## Documentation for Models - [LetsrolldApi.ArrayOfDirectors](docs/ArrayOfDirectors.md) - [LetsrolldApi.ArrayOfFilms](docs/ArrayOfFilms.md) + - [LetsrolldApi.ArrayOfReports](docs/ArrayOfReports.md) - [LetsrolldApi.Director](docs/Director.md) - [LetsrolldApi.DirectorFilmsInner](docs/DirectorFilmsInner.md) - [LetsrolldApi.DirectorFilmsInnerCountriesInner](docs/DirectorFilmsInnerCountriesInner.md) - [LetsrolldApi.DirectorFilmsInnerOffersInner](docs/DirectorFilmsInnerOffersInner.md) - [LetsrolldApi.DirectorInfo](docs/DirectorInfo.md) - [LetsrolldApi.Film](docs/Film.md) + - [LetsrolldApi.Report](docs/Report.md) + - [LetsrolldApi.ReportSectionsInner](docs/ReportSectionsInner.md) ## Documentation for Authorization diff --git a/js/docs/ArrayOfReports.md b/js/docs/ArrayOfReports.md new file mode 100644 index 0000000..2a974f1 --- /dev/null +++ b/js/docs/ArrayOfReports.md @@ -0,0 +1,8 @@ +# LetsrolldApi.ArrayOfReports + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + diff --git a/js/docs/DefaultApi.md b/js/docs/DefaultApi.md index d4fde9d..714601e 100644 --- a/js/docs/DefaultApi.md +++ b/js/docs/DefaultApi.md @@ -8,6 +8,8 @@ Method | HTTP request | Description [**directorsIdGet**](DefaultApi.md#directorsIdGet) | **GET** /directors/{id} | Get Director [**filmsGet**](DefaultApi.md#filmsGet) | **GET** /films | Get Films [**filmsIdGet**](DefaultApi.md#filmsIdGet) | **GET** /films/{id} | Get Film +[**reportsGet**](DefaultApi.md#reportsGet) | **GET** /reports | List Reports +[**reportsIdGet**](DefaultApi.md#reportsIdGet) | **GET** /reports/{id} | Execute Report @@ -192,3 +194,85 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/json + +## reportsGet + +> [Object] reportsGet() + +List Reports + +### Example + +```javascript +import LetsrolldApi from 'letsrolld_api'; + +let apiInstance = new LetsrolldApi.DefaultApi(); +apiInstance.reportsGet((error, data, response) => { + if (error) { + console.error(error); + } else { + console.log('API called successfully. Returned data: ' + data); + } +}); +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**[Object]** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## reportsIdGet + +> Report reportsIdGet(id) + +Execute Report + +### Example + +```javascript +import LetsrolldApi from 'letsrolld_api'; + +let apiInstance = new LetsrolldApi.DefaultApi(); +let id = 56; // Number | id +apiInstance.reportsIdGet(id, (error, data, response) => { + if (error) { + console.error(error); + } else { + console.log('API called successfully. Returned data: ' + data); + } +}); +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **Number**| id | + +### Return type + +[**Report**](Report.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/js/docs/Report.md b/js/docs/Report.md new file mode 100644 index 0000000..c5b2f55 --- /dev/null +++ b/js/docs/Report.md @@ -0,0 +1,11 @@ +# LetsrolldApi.Report + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Number** | | +**name** | **String** | | +**sections** | [**[ReportSectionsInner]**](ReportSectionsInner.md) | | [optional] + + diff --git a/js/docs/ReportSectionsInner.md b/js/docs/ReportSectionsInner.md new file mode 100644 index 0000000..2e212a4 --- /dev/null +++ b/js/docs/ReportSectionsInner.md @@ -0,0 +1,10 @@ +# LetsrolldApi.ReportSectionsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | +**films** | [**[DirectorFilmsInner]**](DirectorFilmsInner.md) | | + + diff --git a/js/src/api/DefaultApi.js b/js/src/api/DefaultApi.js index 2706e79..6dbc71b 100644 --- a/js/src/api/DefaultApi.js +++ b/js/src/api/DefaultApi.js @@ -15,6 +15,7 @@ import ApiClient from "../ApiClient"; import Director from '../model/Director'; import Film from '../model/Film'; +import Report from '../model/Report'; /** * Default service. @@ -205,5 +206,83 @@ export default class DefaultApi { ); } + /** + * Callback function to receive the result of the reportsGet operation. + * @callback module:api/DefaultApi~reportsGetCallback + * @param {String} error Error message, if any. + * @param {Array.} data The data returned by the service call. + * @param {String} response The complete HTTP response. + */ + + /** + * List Reports + * @param {module:api/DefaultApi~reportsGetCallback} callback The callback function, accepting three arguments: error, data, response + * data is of type: {@link Array.} + */ + reportsGet(callback) { + let postBody = null; + + let pathParams = { + }; + let queryParams = { + }; + let headerParams = { + }; + let formParams = { + }; + + let authNames = []; + let contentTypes = []; + let accepts = ['application/json']; + let returnType = [Object]; + return this.apiClient.callApi( + '/reports', 'GET', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, null, callback + ); + } + + /** + * Callback function to receive the result of the reportsIdGet operation. + * @callback module:api/DefaultApi~reportsIdGetCallback + * @param {String} error Error message, if any. + * @param {module:model/Report} data The data returned by the service call. + * @param {String} response The complete HTTP response. + */ + + /** + * Execute Report + * @param {Number} id id + * @param {module:api/DefaultApi~reportsIdGetCallback} callback The callback function, accepting three arguments: error, data, response + * data is of type: {@link module:model/Report} + */ + reportsIdGet(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 reportsIdGet"); + } + + let pathParams = { + 'id': id + }; + let queryParams = { + }; + let headerParams = { + }; + let formParams = { + }; + + let authNames = []; + let contentTypes = []; + let accepts = ['application/json']; + let returnType = Report; + return this.apiClient.callApi( + '/reports/{id}', 'GET', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, null, callback + ); + } + } diff --git a/js/src/index.js b/js/src/index.js index 94c35eb..ae08e6f 100644 --- a/js/src/index.js +++ b/js/src/index.js @@ -15,12 +15,15 @@ import ApiClient from './ApiClient'; import ArrayOfDirectors from './model/ArrayOfDirectors'; import ArrayOfFilms from './model/ArrayOfFilms'; +import ArrayOfReports from './model/ArrayOfReports'; import Director from './model/Director'; import DirectorFilmsInner from './model/DirectorFilmsInner'; import DirectorFilmsInnerCountriesInner from './model/DirectorFilmsInnerCountriesInner'; import DirectorFilmsInnerOffersInner from './model/DirectorFilmsInnerOffersInner'; import DirectorInfo from './model/DirectorInfo'; import Film from './model/Film'; +import Report from './model/Report'; +import ReportSectionsInner from './model/ReportSectionsInner'; import DefaultApi from './api/DefaultApi'; @@ -74,6 +77,12 @@ export { */ ArrayOfFilms, + /** + * The ArrayOfReports model constructor. + * @property {module:model/ArrayOfReports} + */ + ArrayOfReports, + /** * The Director model constructor. * @property {module:model/Director} @@ -110,6 +119,18 @@ export { */ Film, + /** + * The Report model constructor. + * @property {module:model/Report} + */ + Report, + + /** + * The ReportSectionsInner model constructor. + * @property {module:model/ReportSectionsInner} + */ + ReportSectionsInner, + /** * The DefaultApi service constructor. * @property {module:api/DefaultApi} diff --git a/js/src/model/ArrayOfReports.js b/js/src/model/ArrayOfReports.js new file mode 100644 index 0000000..4bb2b13 --- /dev/null +++ b/js/src/model/ArrayOfReports.js @@ -0,0 +1,81 @@ +/** + * letsrolld API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; + +/** + * The ArrayOfReports model module. + * @module model/ArrayOfReports + * @version 0.1 + */ +class ArrayOfReports extends Array { + /** + * Constructs a new ArrayOfReports. + * @alias module:model/ArrayOfReports + * @extends Array + */ + constructor() { + super(); + + + ArrayOfReports.initialize(this); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj) { + } + + /** + * Constructs a ArrayOfReports from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/ArrayOfReports} obj Optional instance to populate. + * @return {module:model/ArrayOfReports} The populated ArrayOfReports instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ArrayOfReports(); + + ApiClient.constructFromObject(data, obj, 'Object'); + + + } + return obj; + } + + /** + * Validates the JSON data with respect to ArrayOfReports. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArrayOfReports. + */ + static validateJSON(data) { + + return true; + } + + +} + + + + + + + + +export default ArrayOfReports; + diff --git a/js/src/model/Report.js b/js/src/model/Report.js new file mode 100644 index 0000000..d7957ad --- /dev/null +++ b/js/src/model/Report.js @@ -0,0 +1,124 @@ +/** + * letsrolld API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; +import ReportSectionsInner from './ReportSectionsInner'; + +/** + * The Report model module. + * @module model/Report + * @version 0.1 + */ +class Report { + /** + * Constructs a new Report. + * @alias module:model/Report + * @param id {Number} + * @param name {String} + */ + constructor(id, name) { + + Report.initialize(this, id, name); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj, id, name) { + obj['id'] = id; + obj['name'] = name; + } + + /** + * Constructs a Report from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/Report} obj Optional instance to populate. + * @return {module:model/Report} The populated Report instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Report(); + + if (data.hasOwnProperty('id')) { + obj['id'] = ApiClient.convertToType(data['id'], 'Number'); + } + if (data.hasOwnProperty('name')) { + obj['name'] = ApiClient.convertToType(data['name'], 'String'); + } + if (data.hasOwnProperty('sections')) { + obj['sections'] = ApiClient.convertToType(data['sections'], [ReportSectionsInner]); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to Report. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to Report. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of Report.RequiredProperties) { + if (!data.hasOwnProperty(property)) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) { + throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']); + } + if (data['sections']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['sections'])) { + throw new Error("Expected the field `sections` to be an array in the JSON data but got " + data['sections']); + } + // validate the optional field `sections` (array) + for (const item of data['sections']) { + ReportSectionsInner.validateJSON(item); + }; + } + + return true; + } + + +} + +Report.RequiredProperties = ["id", "name"]; + +/** + * @member {Number} id + */ +Report.prototype['id'] = undefined; + +/** + * @member {String} name + */ +Report.prototype['name'] = undefined; + +/** + * @member {Array.} sections + */ +Report.prototype['sections'] = undefined; + + + + + + +export default Report; + diff --git a/js/src/model/ReportSectionsInner.js b/js/src/model/ReportSectionsInner.js new file mode 100644 index 0000000..696e6e3 --- /dev/null +++ b/js/src/model/ReportSectionsInner.js @@ -0,0 +1,116 @@ +/** + * letsrolld API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; +import DirectorFilmsInner from './DirectorFilmsInner'; + +/** + * The ReportSectionsInner model module. + * @module model/ReportSectionsInner + * @version 0.1 + */ +class ReportSectionsInner { + /** + * Constructs a new ReportSectionsInner. + * @alias module:model/ReportSectionsInner + * @param name {String} + * @param films {Array.} + */ + constructor(name, films) { + + ReportSectionsInner.initialize(this, name, films); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj, name, films) { + obj['name'] = name; + obj['films'] = films; + } + + /** + * Constructs a ReportSectionsInner from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/ReportSectionsInner} obj Optional instance to populate. + * @return {module:model/ReportSectionsInner} The populated ReportSectionsInner instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ReportSectionsInner(); + + if (data.hasOwnProperty('name')) { + obj['name'] = ApiClient.convertToType(data['name'], 'String'); + } + if (data.hasOwnProperty('films')) { + obj['films'] = ApiClient.convertToType(data['films'], [DirectorFilmsInner]); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to ReportSectionsInner. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ReportSectionsInner. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of ReportSectionsInner.RequiredProperties) { + if (!data.hasOwnProperty(property)) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) { + throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']); + } + if (data['films']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['films'])) { + throw new Error("Expected the field `films` to be an array in the JSON data but got " + data['films']); + } + // validate the optional field `films` (array) + for (const item of data['films']) { + DirectorFilmsInner.validateJSON(item); + }; + } + + return true; + } + + +} + +ReportSectionsInner.RequiredProperties = ["name", "films"]; + +/** + * @member {String} name + */ +ReportSectionsInner.prototype['name'] = undefined; + +/** + * @member {Array.} films + */ +ReportSectionsInner.prototype['films'] = undefined; + + + + + + +export default ReportSectionsInner; + diff --git a/js/test/api/DefaultApi.spec.js b/js/test/api/DefaultApi.spec.js index 9193569..c54f5f7 100644 --- a/js/test/api/DefaultApi.spec.js +++ b/js/test/api/DefaultApi.spec.js @@ -88,6 +88,26 @@ done(); }); }); + describe('reportsGet', function() { + it('should call reportsGet successfully', function(done) { + //uncomment below and update the code to test reportsGet + //instance.reportsGet(function(error) { + // if (error) throw error; + //expect().to.be(); + //}); + done(); + }); + }); + describe('reportsIdGet', function() { + it('should call reportsIdGet successfully', function(done) { + //uncomment below and update the code to test reportsIdGet + //instance.reportsIdGet(function(error) { + // if (error) throw error; + //expect().to.be(); + //}); + done(); + }); + }); }); })); diff --git a/js/test/model/ArrayOfReports.spec.js b/js/test/model/ArrayOfReports.spec.js new file mode 100644 index 0000000..fb8a22a --- /dev/null +++ b/js/test/model/ArrayOfReports.spec.js @@ -0,0 +1,59 @@ +/** + * letsrolld API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.LetsrolldApi); + } +}(this, function(expect, LetsrolldApi) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new LetsrolldApi.ArrayOfReports(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('ArrayOfReports', function() { + it('should create an instance of ArrayOfReports', function() { + // uncomment below and update the code to test ArrayOfReports + //var instance = new LetsrolldApi.ArrayOfReports(); + //expect(instance).to.be.a(LetsrolldApi.ArrayOfReports); + }); + + }); + +})); diff --git a/js/test/model/Report.spec.js b/js/test/model/Report.spec.js new file mode 100644 index 0000000..d80227f --- /dev/null +++ b/js/test/model/Report.spec.js @@ -0,0 +1,77 @@ +/** + * letsrolld API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.LetsrolldApi); + } +}(this, function(expect, LetsrolldApi) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new LetsrolldApi.Report(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('Report', function() { + it('should create an instance of Report', function() { + // uncomment below and update the code to test Report + //var instance = new LetsrolldApi.Report(); + //expect(instance).to.be.a(LetsrolldApi.Report); + }); + + it('should have the property id (base name: "id")', function() { + // uncomment below and update the code to test the property id + //var instance = new LetsrolldApi.Report(); + //expect(instance).to.be(); + }); + + it('should have the property name (base name: "name")', function() { + // uncomment below and update the code to test the property name + //var instance = new LetsrolldApi.Report(); + //expect(instance).to.be(); + }); + + it('should have the property sections (base name: "sections")', function() { + // uncomment below and update the code to test the property sections + //var instance = new LetsrolldApi.Report(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/js/test/model/ReportSectionsInner.spec.js b/js/test/model/ReportSectionsInner.spec.js new file mode 100644 index 0000000..6a2925a --- /dev/null +++ b/js/test/model/ReportSectionsInner.spec.js @@ -0,0 +1,71 @@ +/** + * letsrolld API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.LetsrolldApi); + } +}(this, function(expect, LetsrolldApi) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new LetsrolldApi.ReportSectionsInner(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('ReportSectionsInner', function() { + it('should create an instance of ReportSectionsInner', function() { + // uncomment below and update the code to test ReportSectionsInner + //var instance = new LetsrolldApi.ReportSectionsInner(); + //expect(instance).to.be.a(LetsrolldApi.ReportSectionsInner); + }); + + it('should have the property name (base name: "name")', function() { + // uncomment below and update the code to test the property name + //var instance = new LetsrolldApi.ReportSectionsInner(); + //expect(instance).to.be(); + }); + + it('should have the property films (base name: "films")', function() { + // uncomment below and update the code to test the property films + //var instance = new LetsrolldApi.ReportSectionsInner(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/letsrolld-api-client/letsrolld_api_client/api/default/get_reports.py b/letsrolld-api-client/letsrolld_api_client/api/default/get_reports.py new file mode 100644 index 0000000..5b03620 --- /dev/null +++ b/letsrolld-api-client/letsrolld_api_client/api/default/get_reports.py @@ -0,0 +1,133 @@ +from http import HTTPStatus +from typing import Any, Dict, List, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.array_of_reports_item import ArrayOfReportsItem +from ...types import Response + + +def _get_kwargs() -> Dict[str, Any]: + _kwargs: Dict[str, Any] = { + "method": "get", + "url": "/reports", + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[List["ArrayOfReportsItem"]]: + if response.status_code == 200: + response_200 = [] + _response_200 = response.json() + for componentsschemas_array_of_reports_item_data in _response_200: + componentsschemas_array_of_reports_item = ArrayOfReportsItem.from_dict( + componentsschemas_array_of_reports_item_data + ) + + response_200.append(componentsschemas_array_of_reports_item) + + return response_200 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[List["ArrayOfReportsItem"]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: Union[AuthenticatedClient, Client], +) -> Response[List["ArrayOfReportsItem"]]: + """List Reports + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[List['ArrayOfReportsItem']] + """ + + kwargs = _get_kwargs() + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: Union[AuthenticatedClient, Client], +) -> Optional[List["ArrayOfReportsItem"]]: + """List Reports + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + List['ArrayOfReportsItem'] + """ + + return sync_detailed( + client=client, + ).parsed + + +async def asyncio_detailed( + *, + client: Union[AuthenticatedClient, Client], +) -> Response[List["ArrayOfReportsItem"]]: + """List Reports + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[List['ArrayOfReportsItem']] + """ + + kwargs = _get_kwargs() + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: Union[AuthenticatedClient, Client], +) -> Optional[List["ArrayOfReportsItem"]]: + """List Reports + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + List['ArrayOfReportsItem'] + """ + + return ( + await asyncio_detailed( + client=client, + ) + ).parsed diff --git a/letsrolld-api-client/letsrolld_api_client/api/default/get_reports_id.py b/letsrolld-api-client/letsrolld_api_client/api/default/get_reports_id.py new file mode 100644 index 0000000..81fa5b7 --- /dev/null +++ b/letsrolld-api-client/letsrolld_api_client/api/default/get_reports_id.py @@ -0,0 +1,146 @@ +from http import HTTPStatus +from typing import Any, Dict, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.report import Report +from ...types import Response + + +def _get_kwargs( + id: int, +) -> Dict[str, Any]: + _kwargs: Dict[str, Any] = { + "method": "get", + "url": f"/reports/{id}", + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Report]: + if response.status_code == 200: + response_200 = Report.from_dict(response.json()) + + return response_200 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Report]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + id: int, + *, + client: Union[AuthenticatedClient, Client], +) -> Response[Report]: + """Execute Report + + Args: + id (int): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Report] + """ + + kwargs = _get_kwargs( + id=id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + id: int, + *, + client: Union[AuthenticatedClient, Client], +) -> Optional[Report]: + """Execute Report + + Args: + id (int): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Report + """ + + return sync_detailed( + id=id, + client=client, + ).parsed + + +async def asyncio_detailed( + id: int, + *, + client: Union[AuthenticatedClient, Client], +) -> Response[Report]: + """Execute Report + + Args: + id (int): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Report] + """ + + kwargs = _get_kwargs( + id=id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + id: int, + *, + client: Union[AuthenticatedClient, Client], +) -> Optional[Report]: + """Execute Report + + Args: + id (int): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Report + """ + + return ( + await asyncio_detailed( + id=id, + client=client, + ) + ).parsed diff --git a/letsrolld-api-client/letsrolld_api_client/models/__init__.py b/letsrolld-api-client/letsrolld_api_client/models/__init__.py index c8a6bdd..7fa0ea9 100644 --- a/letsrolld-api-client/letsrolld_api_client/models/__init__.py +++ b/letsrolld-api-client/letsrolld_api_client/models/__init__.py @@ -10,6 +10,18 @@ from .array_of_films_item_countries_item import ArrayOfFilmsItemCountriesItem from .array_of_films_item_directors_item import ArrayOfFilmsItemDirectorsItem from .array_of_films_item_offers_item import ArrayOfFilmsItemOffersItem +from .array_of_reports_item import ArrayOfReportsItem +from .array_of_reports_item_sections_item import ArrayOfReportsItemSectionsItem +from .array_of_reports_item_sections_item_films_item import ArrayOfReportsItemSectionsItemFilmsItem +from .array_of_reports_item_sections_item_films_item_countries_item import ( + ArrayOfReportsItemSectionsItemFilmsItemCountriesItem, +) +from .array_of_reports_item_sections_item_films_item_directors_item import ( + ArrayOfReportsItemSectionsItemFilmsItemDirectorsItem, +) +from .array_of_reports_item_sections_item_films_item_offers_item import ( + ArrayOfReportsItemSectionsItemFilmsItemOffersItem, +) from .director import Director from .director_films_item import DirectorFilmsItem from .director_films_item_countries_item import DirectorFilmsItemCountriesItem @@ -20,6 +32,12 @@ from .film_countries_item import FilmCountriesItem from .film_directors_item import FilmDirectorsItem from .film_offers_item import FilmOffersItem +from .report import Report +from .report_sections_item import ReportSectionsItem +from .report_sections_item_films_item import ReportSectionsItemFilmsItem +from .report_sections_item_films_item_countries_item import ReportSectionsItemFilmsItemCountriesItem +from .report_sections_item_films_item_directors_item import ReportSectionsItemFilmsItemDirectorsItem +from .report_sections_item_films_item_offers_item import ReportSectionsItemFilmsItemOffersItem __all__ = ( "ArrayOfDirectorsItem", @@ -32,6 +50,12 @@ "ArrayOfFilmsItemCountriesItem", "ArrayOfFilmsItemDirectorsItem", "ArrayOfFilmsItemOffersItem", + "ArrayOfReportsItem", + "ArrayOfReportsItemSectionsItem", + "ArrayOfReportsItemSectionsItemFilmsItem", + "ArrayOfReportsItemSectionsItemFilmsItemCountriesItem", + "ArrayOfReportsItemSectionsItemFilmsItemDirectorsItem", + "ArrayOfReportsItemSectionsItemFilmsItemOffersItem", "Director", "DirectorFilmsItem", "DirectorFilmsItemCountriesItem", @@ -42,4 +66,10 @@ "FilmCountriesItem", "FilmDirectorsItem", "FilmOffersItem", + "Report", + "ReportSectionsItem", + "ReportSectionsItemFilmsItem", + "ReportSectionsItemFilmsItemCountriesItem", + "ReportSectionsItemFilmsItemDirectorsItem", + "ReportSectionsItemFilmsItemOffersItem", ) diff --git a/letsrolld-api-client/letsrolld_api_client/models/array_of_reports_item.py b/letsrolld-api-client/letsrolld_api_client/models/array_of_reports_item.py new file mode 100644 index 0000000..bf34f43 --- /dev/null +++ b/letsrolld-api-client/letsrolld_api_client/models/array_of_reports_item.py @@ -0,0 +1,93 @@ +from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.array_of_reports_item_sections_item import ArrayOfReportsItemSectionsItem + + +T = TypeVar("T", bound="ArrayOfReportsItem") + + +@_attrs_define +class ArrayOfReportsItem: + """ + Attributes: + id (int): + name (str): + sections (Union[Unset, List['ArrayOfReportsItemSectionsItem']]): + """ + + id: int + name: str + sections: Union[Unset, List["ArrayOfReportsItemSectionsItem"]] = UNSET + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + id = self.id + + name = self.name + + sections: Union[Unset, List[Dict[str, Any]]] = UNSET + if not isinstance(self.sections, Unset): + sections = [] + for sections_item_data in self.sections: + sections_item = sections_item_data.to_dict() + sections.append(sections_item) + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "id": id, + "name": name, + } + ) + if sections is not UNSET: + field_dict["sections"] = sections + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.array_of_reports_item_sections_item import ArrayOfReportsItemSectionsItem + + d = src_dict.copy() + id = d.pop("id") + + name = d.pop("name") + + sections = [] + _sections = d.pop("sections", UNSET) + for sections_item_data in _sections or []: + sections_item = ArrayOfReportsItemSectionsItem.from_dict(sections_item_data) + + sections.append(sections_item) + + array_of_reports_item = cls( + id=id, + name=name, + sections=sections, + ) + + array_of_reports_item.additional_properties = d + return array_of_reports_item + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/letsrolld-api-client/letsrolld_api_client/models/array_of_reports_item_sections_item.py b/letsrolld-api-client/letsrolld_api_client/models/array_of_reports_item_sections_item.py new file mode 100644 index 0000000..057fc4a --- /dev/null +++ b/letsrolld-api-client/letsrolld_api_client/models/array_of_reports_item_sections_item.py @@ -0,0 +1,80 @@ +from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.array_of_reports_item_sections_item_films_item import ArrayOfReportsItemSectionsItemFilmsItem + + +T = TypeVar("T", bound="ArrayOfReportsItemSectionsItem") + + +@_attrs_define +class ArrayOfReportsItemSectionsItem: + """ + Attributes: + name (str): + films (List['ArrayOfReportsItemSectionsItemFilmsItem']): + """ + + name: str + films: List["ArrayOfReportsItemSectionsItemFilmsItem"] + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + name = self.name + + films = [] + for films_item_data in self.films: + films_item = films_item_data.to_dict() + films.append(films_item) + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + "films": films, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.array_of_reports_item_sections_item_films_item import ArrayOfReportsItemSectionsItemFilmsItem + + d = src_dict.copy() + name = d.pop("name") + + films = [] + _films = d.pop("films") + for films_item_data in _films: + films_item = ArrayOfReportsItemSectionsItemFilmsItem.from_dict(films_item_data) + + films.append(films_item) + + array_of_reports_item_sections_item = cls( + name=name, + films=films, + ) + + array_of_reports_item_sections_item.additional_properties = d + return array_of_reports_item_sections_item + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/letsrolld-api-client/letsrolld_api_client/models/array_of_reports_item_sections_item_films_item.py b/letsrolld-api-client/letsrolld_api_client/models/array_of_reports_item_sections_item_films_item.py new file mode 100644 index 0000000..1627f1e --- /dev/null +++ b/letsrolld-api-client/letsrolld_api_client/models/array_of_reports_item_sections_item_films_item.py @@ -0,0 +1,266 @@ +from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.array_of_reports_item_sections_item_films_item_countries_item import ( + ArrayOfReportsItemSectionsItemFilmsItemCountriesItem, + ) + from ..models.array_of_reports_item_sections_item_films_item_directors_item import ( + ArrayOfReportsItemSectionsItemFilmsItemDirectorsItem, + ) + from ..models.array_of_reports_item_sections_item_films_item_offers_item import ( + ArrayOfReportsItemSectionsItemFilmsItemOffersItem, + ) + + +T = TypeVar("T", bound="ArrayOfReportsItemSectionsItemFilmsItem") + + +@_attrs_define +class ArrayOfReportsItemSectionsItemFilmsItem: + """ + Attributes: + title (str): + id (Union[Unset, int]): + description (Union[Unset, str]): + year (Union[None, Unset, int]): + rating (Union[Unset, str]): + runtime (Union[None, Unset, int]): + lb_url (Union[Unset, str]): + jw_url (Union[None, Unset, str]): + trailer_url (Union[None, Unset, str]): + genres (Union[Unset, List[str]]): + countries (Union[Unset, List['ArrayOfReportsItemSectionsItemFilmsItemCountriesItem']]): + offers (Union[Unset, List['ArrayOfReportsItemSectionsItemFilmsItemOffersItem']]): + directors (Union[Unset, List['ArrayOfReportsItemSectionsItemFilmsItemDirectorsItem']]): + """ + + title: str + id: Union[Unset, int] = UNSET + description: Union[Unset, str] = UNSET + year: Union[None, Unset, int] = UNSET + rating: Union[Unset, str] = UNSET + runtime: Union[None, Unset, int] = UNSET + lb_url: Union[Unset, str] = UNSET + jw_url: Union[None, Unset, str] = UNSET + trailer_url: Union[None, Unset, str] = UNSET + genres: Union[Unset, List[str]] = UNSET + countries: Union[Unset, List["ArrayOfReportsItemSectionsItemFilmsItemCountriesItem"]] = UNSET + offers: Union[Unset, List["ArrayOfReportsItemSectionsItemFilmsItemOffersItem"]] = UNSET + directors: Union[Unset, List["ArrayOfReportsItemSectionsItemFilmsItemDirectorsItem"]] = UNSET + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + title = self.title + + id = self.id + + description = self.description + + year: Union[None, Unset, int] + if isinstance(self.year, Unset): + year = UNSET + else: + year = self.year + + rating = self.rating + + runtime: Union[None, Unset, int] + if isinstance(self.runtime, Unset): + runtime = UNSET + else: + runtime = self.runtime + + lb_url = self.lb_url + + jw_url: Union[None, Unset, str] + if isinstance(self.jw_url, Unset): + jw_url = UNSET + else: + jw_url = self.jw_url + + trailer_url: Union[None, Unset, str] + if isinstance(self.trailer_url, Unset): + trailer_url = UNSET + else: + trailer_url = self.trailer_url + + genres: Union[Unset, List[str]] = UNSET + if not isinstance(self.genres, Unset): + genres = self.genres + + countries: Union[Unset, List[Dict[str, Any]]] = UNSET + if not isinstance(self.countries, Unset): + countries = [] + for countries_item_data in self.countries: + countries_item = countries_item_data.to_dict() + countries.append(countries_item) + + offers: Union[Unset, List[Dict[str, Any]]] = UNSET + if not isinstance(self.offers, Unset): + offers = [] + for offers_item_data in self.offers: + offers_item = offers_item_data.to_dict() + offers.append(offers_item) + + directors: Union[Unset, List[Dict[str, Any]]] = UNSET + if not isinstance(self.directors, Unset): + directors = [] + for directors_item_data in self.directors: + directors_item = directors_item_data.to_dict() + directors.append(directors_item) + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "title": title, + } + ) + if id is not UNSET: + field_dict["id"] = id + if description is not UNSET: + field_dict["description"] = description + if year is not UNSET: + field_dict["year"] = year + if rating is not UNSET: + field_dict["rating"] = rating + if runtime is not UNSET: + field_dict["runtime"] = runtime + if lb_url is not UNSET: + field_dict["lb_url"] = lb_url + if jw_url is not UNSET: + field_dict["jw_url"] = jw_url + if trailer_url is not UNSET: + field_dict["trailer_url"] = trailer_url + if genres is not UNSET: + field_dict["genres"] = genres + if countries is not UNSET: + field_dict["countries"] = countries + if offers is not UNSET: + field_dict["offers"] = offers + if directors is not UNSET: + field_dict["directors"] = directors + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.array_of_reports_item_sections_item_films_item_countries_item import ( + ArrayOfReportsItemSectionsItemFilmsItemCountriesItem, + ) + from ..models.array_of_reports_item_sections_item_films_item_directors_item import ( + ArrayOfReportsItemSectionsItemFilmsItemDirectorsItem, + ) + from ..models.array_of_reports_item_sections_item_films_item_offers_item import ( + ArrayOfReportsItemSectionsItemFilmsItemOffersItem, + ) + + d = src_dict.copy() + title = d.pop("title") + + id = d.pop("id", UNSET) + + description = d.pop("description", UNSET) + + def _parse_year(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + year = _parse_year(d.pop("year", UNSET)) + + rating = d.pop("rating", UNSET) + + def _parse_runtime(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + runtime = _parse_runtime(d.pop("runtime", UNSET)) + + lb_url = d.pop("lb_url", UNSET) + + def _parse_jw_url(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + jw_url = _parse_jw_url(d.pop("jw_url", UNSET)) + + def _parse_trailer_url(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + trailer_url = _parse_trailer_url(d.pop("trailer_url", UNSET)) + + genres = cast(List[str], d.pop("genres", UNSET)) + + countries = [] + _countries = d.pop("countries", UNSET) + for countries_item_data in _countries or []: + countries_item = ArrayOfReportsItemSectionsItemFilmsItemCountriesItem.from_dict(countries_item_data) + + countries.append(countries_item) + + offers = [] + _offers = d.pop("offers", UNSET) + for offers_item_data in _offers or []: + offers_item = ArrayOfReportsItemSectionsItemFilmsItemOffersItem.from_dict(offers_item_data) + + offers.append(offers_item) + + directors = [] + _directors = d.pop("directors", UNSET) + for directors_item_data in _directors or []: + directors_item = ArrayOfReportsItemSectionsItemFilmsItemDirectorsItem.from_dict(directors_item_data) + + directors.append(directors_item) + + array_of_reports_item_sections_item_films_item = cls( + title=title, + id=id, + description=description, + year=year, + rating=rating, + runtime=runtime, + lb_url=lb_url, + jw_url=jw_url, + trailer_url=trailer_url, + genres=genres, + countries=countries, + offers=offers, + directors=directors, + ) + + array_of_reports_item_sections_item_films_item.additional_properties = d + return array_of_reports_item_sections_item_films_item + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/letsrolld-api-client/letsrolld_api_client/models/array_of_reports_item_sections_item_films_item_countries_item.py b/letsrolld-api-client/letsrolld_api_client/models/array_of_reports_item_sections_item_films_item_countries_item.py new file mode 100644 index 0000000..2f4e068 --- /dev/null +++ b/letsrolld-api-client/letsrolld_api_client/models/array_of_reports_item_sections_item_films_item_countries_item.py @@ -0,0 +1,80 @@ +from typing import Any, Dict, List, Type, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="ArrayOfReportsItemSectionsItemFilmsItemCountriesItem") + + +@_attrs_define +class ArrayOfReportsItemSectionsItemFilmsItemCountriesItem: + """ + Attributes: + name (str): + flag (Union[None, Unset, str]): + """ + + name: str + flag: Union[None, Unset, str] = UNSET + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + name = self.name + + flag: Union[None, Unset, str] + if isinstance(self.flag, Unset): + flag = UNSET + else: + flag = self.flag + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + } + ) + if flag is not UNSET: + field_dict["flag"] = flag + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + name = d.pop("name") + + def _parse_flag(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + flag = _parse_flag(d.pop("flag", UNSET)) + + array_of_reports_item_sections_item_films_item_countries_item = cls( + name=name, + flag=flag, + ) + + array_of_reports_item_sections_item_films_item_countries_item.additional_properties = d + return array_of_reports_item_sections_item_films_item_countries_item + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/letsrolld-api-client/letsrolld_api_client/models/array_of_reports_item_sections_item_films_item_directors_item.py b/letsrolld-api-client/letsrolld_api_client/models/array_of_reports_item_sections_item_films_item_directors_item.py new file mode 100644 index 0000000..173e8da --- /dev/null +++ b/letsrolld-api-client/letsrolld_api_client/models/array_of_reports_item_sections_item_films_item_directors_item.py @@ -0,0 +1,77 @@ +from typing import Any, Dict, List, Type, TypeVar, Union + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="ArrayOfReportsItemSectionsItemFilmsItemDirectorsItem") + + +@_attrs_define +class ArrayOfReportsItemSectionsItemFilmsItemDirectorsItem: + """ + Attributes: + id (int): + name (str): + lb_url (Union[Unset, str]): + """ + + id: int + name: str + lb_url: Union[Unset, str] = UNSET + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + id = self.id + + name = self.name + + lb_url = self.lb_url + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "id": id, + "name": name, + } + ) + if lb_url is not UNSET: + field_dict["lb_url"] = lb_url + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + id = d.pop("id") + + name = d.pop("name") + + lb_url = d.pop("lb_url", UNSET) + + array_of_reports_item_sections_item_films_item_directors_item = cls( + id=id, + name=name, + lb_url=lb_url, + ) + + array_of_reports_item_sections_item_films_item_directors_item.additional_properties = d + return array_of_reports_item_sections_item_films_item_directors_item + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/letsrolld-api-client/letsrolld_api_client/models/array_of_reports_item_sections_item_films_item_offers_item.py b/letsrolld-api-client/letsrolld_api_client/models/array_of_reports_item_sections_item_films_item_offers_item.py new file mode 100644 index 0000000..50fb545 --- /dev/null +++ b/letsrolld-api-client/letsrolld_api_client/models/array_of_reports_item_sections_item_films_item_offers_item.py @@ -0,0 +1,72 @@ +from typing import Any, Dict, List, Type, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="ArrayOfReportsItemSectionsItemFilmsItemOffersItem") + + +@_attrs_define +class ArrayOfReportsItemSectionsItemFilmsItemOffersItem: + """ + Attributes: + name (str): + url (Union[None, str]): + """ + + name: str + url: Union[None, str] + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + name = self.name + + url: Union[None, str] + url = self.url + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + "url": url, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + name = d.pop("name") + + def _parse_url(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + url = _parse_url(d.pop("url")) + + array_of_reports_item_sections_item_films_item_offers_item = cls( + name=name, + url=url, + ) + + array_of_reports_item_sections_item_films_item_offers_item.additional_properties = d + return array_of_reports_item_sections_item_films_item_offers_item + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/letsrolld-api-client/letsrolld_api_client/models/report.py b/letsrolld-api-client/letsrolld_api_client/models/report.py new file mode 100644 index 0000000..c471bc3 --- /dev/null +++ b/letsrolld-api-client/letsrolld_api_client/models/report.py @@ -0,0 +1,93 @@ +from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.report_sections_item import ReportSectionsItem + + +T = TypeVar("T", bound="Report") + + +@_attrs_define +class Report: + """ + Attributes: + id (int): + name (str): + sections (Union[Unset, List['ReportSectionsItem']]): + """ + + id: int + name: str + sections: Union[Unset, List["ReportSectionsItem"]] = UNSET + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + id = self.id + + name = self.name + + sections: Union[Unset, List[Dict[str, Any]]] = UNSET + if not isinstance(self.sections, Unset): + sections = [] + for sections_item_data in self.sections: + sections_item = sections_item_data.to_dict() + sections.append(sections_item) + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "id": id, + "name": name, + } + ) + if sections is not UNSET: + field_dict["sections"] = sections + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.report_sections_item import ReportSectionsItem + + d = src_dict.copy() + id = d.pop("id") + + name = d.pop("name") + + sections = [] + _sections = d.pop("sections", UNSET) + for sections_item_data in _sections or []: + sections_item = ReportSectionsItem.from_dict(sections_item_data) + + sections.append(sections_item) + + report = cls( + id=id, + name=name, + sections=sections, + ) + + report.additional_properties = d + return report + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/letsrolld-api-client/letsrolld_api_client/models/report_sections_item.py b/letsrolld-api-client/letsrolld_api_client/models/report_sections_item.py new file mode 100644 index 0000000..8717bbe --- /dev/null +++ b/letsrolld-api-client/letsrolld_api_client/models/report_sections_item.py @@ -0,0 +1,80 @@ +from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.report_sections_item_films_item import ReportSectionsItemFilmsItem + + +T = TypeVar("T", bound="ReportSectionsItem") + + +@_attrs_define +class ReportSectionsItem: + """ + Attributes: + name (str): + films (List['ReportSectionsItemFilmsItem']): + """ + + name: str + films: List["ReportSectionsItemFilmsItem"] + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + name = self.name + + films = [] + for films_item_data in self.films: + films_item = films_item_data.to_dict() + films.append(films_item) + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + "films": films, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.report_sections_item_films_item import ReportSectionsItemFilmsItem + + d = src_dict.copy() + name = d.pop("name") + + films = [] + _films = d.pop("films") + for films_item_data in _films: + films_item = ReportSectionsItemFilmsItem.from_dict(films_item_data) + + films.append(films_item) + + report_sections_item = cls( + name=name, + films=films, + ) + + report_sections_item.additional_properties = d + return report_sections_item + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/letsrolld-api-client/letsrolld_api_client/models/report_sections_item_films_item.py b/letsrolld-api-client/letsrolld_api_client/models/report_sections_item_films_item.py new file mode 100644 index 0000000..7c49ff2 --- /dev/null +++ b/letsrolld-api-client/letsrolld_api_client/models/report_sections_item_films_item.py @@ -0,0 +1,254 @@ +from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.report_sections_item_films_item_countries_item import ReportSectionsItemFilmsItemCountriesItem + from ..models.report_sections_item_films_item_directors_item import ReportSectionsItemFilmsItemDirectorsItem + from ..models.report_sections_item_films_item_offers_item import ReportSectionsItemFilmsItemOffersItem + + +T = TypeVar("T", bound="ReportSectionsItemFilmsItem") + + +@_attrs_define +class ReportSectionsItemFilmsItem: + """ + Attributes: + title (str): + id (Union[Unset, int]): + description (Union[Unset, str]): + year (Union[None, Unset, int]): + rating (Union[Unset, str]): + runtime (Union[None, Unset, int]): + lb_url (Union[Unset, str]): + jw_url (Union[None, Unset, str]): + trailer_url (Union[None, Unset, str]): + genres (Union[Unset, List[str]]): + countries (Union[Unset, List['ReportSectionsItemFilmsItemCountriesItem']]): + offers (Union[Unset, List['ReportSectionsItemFilmsItemOffersItem']]): + directors (Union[Unset, List['ReportSectionsItemFilmsItemDirectorsItem']]): + """ + + title: str + id: Union[Unset, int] = UNSET + description: Union[Unset, str] = UNSET + year: Union[None, Unset, int] = UNSET + rating: Union[Unset, str] = UNSET + runtime: Union[None, Unset, int] = UNSET + lb_url: Union[Unset, str] = UNSET + jw_url: Union[None, Unset, str] = UNSET + trailer_url: Union[None, Unset, str] = UNSET + genres: Union[Unset, List[str]] = UNSET + countries: Union[Unset, List["ReportSectionsItemFilmsItemCountriesItem"]] = UNSET + offers: Union[Unset, List["ReportSectionsItemFilmsItemOffersItem"]] = UNSET + directors: Union[Unset, List["ReportSectionsItemFilmsItemDirectorsItem"]] = UNSET + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + title = self.title + + id = self.id + + description = self.description + + year: Union[None, Unset, int] + if isinstance(self.year, Unset): + year = UNSET + else: + year = self.year + + rating = self.rating + + runtime: Union[None, Unset, int] + if isinstance(self.runtime, Unset): + runtime = UNSET + else: + runtime = self.runtime + + lb_url = self.lb_url + + jw_url: Union[None, Unset, str] + if isinstance(self.jw_url, Unset): + jw_url = UNSET + else: + jw_url = self.jw_url + + trailer_url: Union[None, Unset, str] + if isinstance(self.trailer_url, Unset): + trailer_url = UNSET + else: + trailer_url = self.trailer_url + + genres: Union[Unset, List[str]] = UNSET + if not isinstance(self.genres, Unset): + genres = self.genres + + countries: Union[Unset, List[Dict[str, Any]]] = UNSET + if not isinstance(self.countries, Unset): + countries = [] + for countries_item_data in self.countries: + countries_item = countries_item_data.to_dict() + countries.append(countries_item) + + offers: Union[Unset, List[Dict[str, Any]]] = UNSET + if not isinstance(self.offers, Unset): + offers = [] + for offers_item_data in self.offers: + offers_item = offers_item_data.to_dict() + offers.append(offers_item) + + directors: Union[Unset, List[Dict[str, Any]]] = UNSET + if not isinstance(self.directors, Unset): + directors = [] + for directors_item_data in self.directors: + directors_item = directors_item_data.to_dict() + directors.append(directors_item) + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "title": title, + } + ) + if id is not UNSET: + field_dict["id"] = id + if description is not UNSET: + field_dict["description"] = description + if year is not UNSET: + field_dict["year"] = year + if rating is not UNSET: + field_dict["rating"] = rating + if runtime is not UNSET: + field_dict["runtime"] = runtime + if lb_url is not UNSET: + field_dict["lb_url"] = lb_url + if jw_url is not UNSET: + field_dict["jw_url"] = jw_url + if trailer_url is not UNSET: + field_dict["trailer_url"] = trailer_url + if genres is not UNSET: + field_dict["genres"] = genres + if countries is not UNSET: + field_dict["countries"] = countries + if offers is not UNSET: + field_dict["offers"] = offers + if directors is not UNSET: + field_dict["directors"] = directors + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.report_sections_item_films_item_countries_item import ReportSectionsItemFilmsItemCountriesItem + from ..models.report_sections_item_films_item_directors_item import ReportSectionsItemFilmsItemDirectorsItem + from ..models.report_sections_item_films_item_offers_item import ReportSectionsItemFilmsItemOffersItem + + d = src_dict.copy() + title = d.pop("title") + + id = d.pop("id", UNSET) + + description = d.pop("description", UNSET) + + def _parse_year(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + year = _parse_year(d.pop("year", UNSET)) + + rating = d.pop("rating", UNSET) + + def _parse_runtime(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + runtime = _parse_runtime(d.pop("runtime", UNSET)) + + lb_url = d.pop("lb_url", UNSET) + + def _parse_jw_url(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + jw_url = _parse_jw_url(d.pop("jw_url", UNSET)) + + def _parse_trailer_url(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + trailer_url = _parse_trailer_url(d.pop("trailer_url", UNSET)) + + genres = cast(List[str], d.pop("genres", UNSET)) + + countries = [] + _countries = d.pop("countries", UNSET) + for countries_item_data in _countries or []: + countries_item = ReportSectionsItemFilmsItemCountriesItem.from_dict(countries_item_data) + + countries.append(countries_item) + + offers = [] + _offers = d.pop("offers", UNSET) + for offers_item_data in _offers or []: + offers_item = ReportSectionsItemFilmsItemOffersItem.from_dict(offers_item_data) + + offers.append(offers_item) + + directors = [] + _directors = d.pop("directors", UNSET) + for directors_item_data in _directors or []: + directors_item = ReportSectionsItemFilmsItemDirectorsItem.from_dict(directors_item_data) + + directors.append(directors_item) + + report_sections_item_films_item = cls( + title=title, + id=id, + description=description, + year=year, + rating=rating, + runtime=runtime, + lb_url=lb_url, + jw_url=jw_url, + trailer_url=trailer_url, + genres=genres, + countries=countries, + offers=offers, + directors=directors, + ) + + report_sections_item_films_item.additional_properties = d + return report_sections_item_films_item + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/letsrolld-api-client/letsrolld_api_client/models/report_sections_item_films_item_countries_item.py b/letsrolld-api-client/letsrolld_api_client/models/report_sections_item_films_item_countries_item.py new file mode 100644 index 0000000..129e5f1 --- /dev/null +++ b/letsrolld-api-client/letsrolld_api_client/models/report_sections_item_films_item_countries_item.py @@ -0,0 +1,80 @@ +from typing import Any, Dict, List, Type, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="ReportSectionsItemFilmsItemCountriesItem") + + +@_attrs_define +class ReportSectionsItemFilmsItemCountriesItem: + """ + Attributes: + name (str): + flag (Union[None, Unset, str]): + """ + + name: str + flag: Union[None, Unset, str] = UNSET + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + name = self.name + + flag: Union[None, Unset, str] + if isinstance(self.flag, Unset): + flag = UNSET + else: + flag = self.flag + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + } + ) + if flag is not UNSET: + field_dict["flag"] = flag + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + name = d.pop("name") + + def _parse_flag(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + flag = _parse_flag(d.pop("flag", UNSET)) + + report_sections_item_films_item_countries_item = cls( + name=name, + flag=flag, + ) + + report_sections_item_films_item_countries_item.additional_properties = d + return report_sections_item_films_item_countries_item + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/letsrolld-api-client/letsrolld_api_client/models/report_sections_item_films_item_directors_item.py b/letsrolld-api-client/letsrolld_api_client/models/report_sections_item_films_item_directors_item.py new file mode 100644 index 0000000..695a53c --- /dev/null +++ b/letsrolld-api-client/letsrolld_api_client/models/report_sections_item_films_item_directors_item.py @@ -0,0 +1,77 @@ +from typing import Any, Dict, List, Type, TypeVar, Union + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="ReportSectionsItemFilmsItemDirectorsItem") + + +@_attrs_define +class ReportSectionsItemFilmsItemDirectorsItem: + """ + Attributes: + id (int): + name (str): + lb_url (Union[Unset, str]): + """ + + id: int + name: str + lb_url: Union[Unset, str] = UNSET + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + id = self.id + + name = self.name + + lb_url = self.lb_url + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "id": id, + "name": name, + } + ) + if lb_url is not UNSET: + field_dict["lb_url"] = lb_url + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + id = d.pop("id") + + name = d.pop("name") + + lb_url = d.pop("lb_url", UNSET) + + report_sections_item_films_item_directors_item = cls( + id=id, + name=name, + lb_url=lb_url, + ) + + report_sections_item_films_item_directors_item.additional_properties = d + return report_sections_item_films_item_directors_item + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/letsrolld-api-client/letsrolld_api_client/models/report_sections_item_films_item_offers_item.py b/letsrolld-api-client/letsrolld_api_client/models/report_sections_item_films_item_offers_item.py new file mode 100644 index 0000000..3101ee6 --- /dev/null +++ b/letsrolld-api-client/letsrolld_api_client/models/report_sections_item_films_item_offers_item.py @@ -0,0 +1,72 @@ +from typing import Any, Dict, List, Type, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="ReportSectionsItemFilmsItemOffersItem") + + +@_attrs_define +class ReportSectionsItemFilmsItemOffersItem: + """ + Attributes: + name (str): + url (Union[None, str]): + """ + + name: str + url: Union[None, str] + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + name = self.name + + url: Union[None, str] + url = self.url + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + "url": url, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + name = d.pop("name") + + def _parse_url(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + url = _parse_url(d.pop("url")) + + report_sections_item_films_item_offers_item = cls( + name=name, + url=url, + ) + + report_sections_item_films_item_offers_item.additional_properties = d + return report_sections_item_films_item_offers_item + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/src/letsrolld/config.py b/src/letsrolld/config.py index 7107b87..cbb5fb7 100644 --- a/src/letsrolld/config.py +++ b/src/letsrolld/config.py @@ -23,6 +23,16 @@ def __init__(self, name, **kwargs): setattr(self, k, v) self._set_defaults() + # TODO: remove properties after configs are converted to the new format + # Define some properties to translate into more reasonable names + @property + def exclude_genres(self): + return self.exclude_genre + + @property + def exclude_countries(self): + return self.exclude_country + def __setattr__(self, key, value): if key in ("min_rating", "max_rating"): if value is not None: @@ -30,6 +40,7 @@ def __setattr__(self, key, value): elif key in ("min_length", "max_length"): if value is not None: value = int(value) + # TODO: support text filter in api? elif key in ("text",): if value is not None: value = value.lower() diff --git a/src/letsrolld/webapi/app.py b/src/letsrolld/webapi/app.py index d94bbe2..81ebd0a 100644 --- a/src/letsrolld/webapi/app.py +++ b/src/letsrolld/webapi/app.py @@ -1,4 +1,5 @@ import json +import os from flask import Flask from flask_cors import CORS @@ -8,6 +9,7 @@ import pycountry from sqlalchemy.sql.expression import func +from letsrolld import config as lconfig from letsrolld import db from letsrolld.db import models from letsrolld.webapi import models as webapi_models @@ -87,6 +89,14 @@ def _get_film(session, f): ) +def _get_report(sections=None): + return webapi_models.Report( + id=0, + name="default", + sections=sections or [], + ) + + def _get_director(session, d): return webapi_models.Director( info=_get_director_info(d), @@ -211,6 +221,83 @@ def get(self, id): return _get_film(db_.session, f), 200 +def _get_report_config(id): + # TODO: store configs in db; convert id into actual name + sections = list(lconfig.Config.from_file(os.path.join("configs", "default.json"))) + return sections + + +def _execute_section_plan(db, config): + query = db.session.query(models.Film) + if config.services: + query = query.join(models.Film.offers).filter( + models.Offer.name.in_(config.services) + ) + + if config.min_rating: + query = query.filter(models.Film.rating >= config.min_rating) + if config.max_rating: + query = query.filter(models.Film.rating <= config.min_rating) + + if config.min_length: + query = query.filter(models.Film.runtime >= config.min_length) + if config.max_length: + query = query.filter(models.Film.runtime <= config.max_length) + + if config.genre: + # TODO: support multiple genres filter + query = query.join(models.Film.genres).filter(models.Genre.name == config.genre) + if config.exclude_genres: + query = query.join(models.Film.genres).filter( + ~models.Genre.name.in_(config.exclude_genres) + ) + + if config.exclude_countries: + query = query.join(models.Film.genres).filter( + ~models.Genre.name.in_(config.exclude_countries) + ) + + if config.min_year: + query = query.filter(models.Film.year >= config.min_year) + if config.max_year: + query = query.filter(models.Film.year <= config.max_year) + + query = query.order_by(func.random()).limit(config.max_movies) + return [_get_film(db.session, f) for f in query] + + +class ReportResource(Resource): + @swagger.reorder_with( + webapi_models.ArrayOfReports, + description="Returns available reports", + summary="List Reports", + ) + def get(self): + # TODO: actually list available reports + return [_get_report()] + + +class ReportItemResource(Resource): + @swagger.reorder_with( + webapi_models.Report, + description="Execute a report", + summary="Execute Report", + ) + def get(self, id): + # TODO: support multiple reports + if id != 0: + return {}, 404 + return _get_report( + sections=[ + webapi_models.ReportSection( + name=config.name, + films=_execute_section_plan(db_, config), + ) + for config in _get_report_config(id) + ] + ), 200 + + def _api(): api = Api(app, title="letsrolld API", license=_LICENSE, version="0.1") @@ -221,6 +308,11 @@ def _api(): api.add_resource(FilmResource, "/films") api.add_resource(FilmItemResource, "/films/") + # TODO: support different ids + # TODO: store report rules in db + api.add_resource(ReportResource, "/reports") + api.add_resource(ReportItemResource, "/reports/") + return api diff --git a/src/letsrolld/webapi/models.py b/src/letsrolld/webapi/models.py index 10e906a..86b28b1 100644 --- a/src/letsrolld/webapi/models.py +++ b/src/letsrolld/webapi/models.py @@ -89,6 +89,30 @@ class Director(Schema): required = ["info"] +class ReportSection(Schema): + properties = { + "name": { + "type": "string", + }, + "films": Film.array(), + } + required = ["name", "films"] + + +class Report(Schema): + properties = { + "id": { + "type": "integer", + "format": "int64", + }, + "name": { + "type": "string", + }, + "sections": ReportSection.array(), + } + required = ["id", "name"] + + class ArrayOfDirectors(Schema): type = "array" properties = Director.properties @@ -99,3 +123,9 @@ class ArrayOfFilms(Schema): type = "array" properties = Film.properties items = Film + + +class ArrayOfReports(Schema): + type = "array" + properties = Report.properties + items = Report diff --git a/src/letsrolld/webcli/cli.py b/src/letsrolld/webcli/cli.py index 6dff12a..4c8b6fd 100644 --- a/src/letsrolld/webcli/cli.py +++ b/src/letsrolld/webcli/cli.py @@ -6,7 +6,10 @@ # from letsrolld_api_client.api.default import get_directors_id from letsrolld_api_client.api.default import get_films + # from letsrolld_api_client.api.default import get_films_id +from letsrolld_api_client.api.default import get_reports +from letsrolld_api_client.api.default import get_reports_id DEFAULT_OFFERS = { @@ -44,6 +47,16 @@ def report_film(film): return template.render(film=film, offers=DEFAULT_OFFERS) +def list_report(report): + template = env.get_template("report.j2") + return template.render(report=report) + + +def render_report(report): + template = env.get_template("report-full.j2") + return template.render(report=report, film_renderer=report_film) + + @click.group() def cli(): pass @@ -70,15 +83,25 @@ def films(): pass +def _get_short_report_section(films): + film_entries = [] + for film in films: + film_entries.append(list_film(film)) + return "\n".join(film_entries) + + +def _get_long_report_section(films): + film_entries = [] + for film in films: + film_entries.append(report_film(film)) + return "\n".join(film_entries) + + @films.command(name="get") def films_get(): global client with client as client: - film_reports = [] - for film in get_films.sync(client=client): - film_reports.append(list_film(film)) - - print("\n".join(film_reports)) + print(_get_short_report_section(get_films.sync(client=client))) def _get_query_args(limit, genre, country, offer): @@ -107,13 +130,46 @@ def films_query( global client with client as client: args = _get_query_args(limit, genre, country, offer) - film_reports = [] films = get_films.sync(client=client, **args) if films: - for film in films: - film_reports.append(report_film(film)) + print(_get_long_report_section(films)) - print("\n".join(film_reports)) + +@cli.group() +def report(): + pass + + +@report.command(name="get") +def report_get(): + global client + with client as client: + reports = get_reports.sync(client=client) + if reports: + report_entries = [] + for report in reports: + report_entries.append(list_report(report)) + print("\n".join(report_entries)) + + +@report.command(name="render") +@click.option("--name", required=True) +def report_render( + name: str, +): + global client + with client as client: + reports = get_reports.sync(client=client) + if reports: + id_ = None + for report in reports: + if report.name == name: + id_ = report.id + break + if id_ is not None: + requested_report = get_reports_id.sync(client=client, id=id_) + if requested_report: + print(render_report(requested_report)) if __name__ == "__main__": diff --git a/src/letsrolld/webcli/templates/film-full.j2 b/src/letsrolld/webcli/templates/film-full.j2 index 889eeca..2049b57 100644 --- a/src/letsrolld/webcli/templates/film-full.j2 +++ b/src/letsrolld/webcli/templates/film-full.j2 @@ -5,7 +5,7 @@ ⌛:{{ film.runtime }}m ⭐:{{ film.rating }} 📎:{{ film.genres|join(',') }} {%- set ns = namespace(all_country_names=[]) -%} {%- for country in film.countries -%} - {%- set ns.all_country_names = ns.all_country_names + [country.flag + country.name] -%} + {%- set ns.all_country_names = ns.all_country_names + [(country.flag or '') + country.name] -%} {%- endfor %} Countries: {{ ns.all_country_names|join(', ') }} --- diff --git a/src/letsrolld/webcli/templates/report-full.j2 b/src/letsrolld/webcli/templates/report-full.j2 new file mode 100644 index 0000000..d8e59e5 --- /dev/null +++ b/src/letsrolld/webcli/templates/report-full.j2 @@ -0,0 +1,7 @@ +Report: {{ report.name }} +{% for section in report.sections %} +{{ section.name }}: +{% for film in section.films %} +{{ film_renderer(film) }} +{% endfor %} +{% endfor %} diff --git a/src/letsrolld/webcli/templates/report.j2 b/src/letsrolld/webcli/templates/report.j2 new file mode 100644 index 0000000..fbfc1d1 --- /dev/null +++ b/src/letsrolld/webcli/templates/report.j2 @@ -0,0 +1 @@ +{{ report.name }} diff --git a/swagger.json b/swagger.json index 15cff35..f6da026 100644 --- a/swagger.json +++ b/swagger.json @@ -771,6 +771,440 @@ "title" ], "type": "object" + }, + "ArrayOfReports": { + "type": "array", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "sections": { + "type": "array", + "items": { + "properties": { + "name": { + "type": "string" + }, + "films": { + "type": "array", + "items": { + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "year": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "rating": { + "type": "string" + }, + "runtime": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "lb_url": { + "type": "string", + "format": "url" + }, + "jw_url": { + "type": "string", + "format": "url", + "nullable": true + }, + "trailer_url": { + "type": "string", + "format": "url", + "nullable": true + }, + "genres": { + "type": "array", + "items": { + "type": "string" + } + }, + "countries": { + "type": "array", + "items": { + "properties": { + "name": { + "type": "string" + }, + "flag": { + "type": "string", + "nullable": true + } + }, + "required": [ + "name" + ], + "type": "object" + } + }, + "offers": { + "type": "array", + "items": { + "properties": { + "name": { + "type": "string" + }, + "url": { + "type": "string", + "format": "url", + "nullable": true + } + }, + "required": [ + "name", + "url" + ], + "type": "object" + } + }, + "directors": { + "type": "array", + "items": { + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "lb_url": { + "type": "string", + "format": "url" + } + }, + "required": [ + "id", + "name" + ], + "type": "object" + } + } + }, + "required": [ + "title" + ], + "type": "object" + } + } + }, + "required": [ + "name", + "films" + ], + "type": "object" + } + } + }, + "items": { + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "sections": { + "type": "array", + "items": { + "properties": { + "name": { + "type": "string" + }, + "films": { + "type": "array", + "items": { + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "year": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "rating": { + "type": "string" + }, + "runtime": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "lb_url": { + "type": "string", + "format": "url" + }, + "jw_url": { + "type": "string", + "format": "url", + "nullable": true + }, + "trailer_url": { + "type": "string", + "format": "url", + "nullable": true + }, + "genres": { + "type": "array", + "items": { + "type": "string" + } + }, + "countries": { + "type": "array", + "items": { + "properties": { + "name": { + "type": "string" + }, + "flag": { + "type": "string", + "nullable": true + } + }, + "required": [ + "name" + ], + "type": "object" + } + }, + "offers": { + "type": "array", + "items": { + "properties": { + "name": { + "type": "string" + }, + "url": { + "type": "string", + "format": "url", + "nullable": true + } + }, + "required": [ + "name", + "url" + ], + "type": "object" + } + }, + "directors": { + "type": "array", + "items": { + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "lb_url": { + "type": "string", + "format": "url" + } + }, + "required": [ + "id", + "name" + ], + "type": "object" + } + } + }, + "required": [ + "title" + ], + "type": "object" + } + } + }, + "required": [ + "name", + "films" + ], + "type": "object" + } + } + }, + "required": [ + "id", + "name" + ], + "type": "object" + } + }, + "Report": { + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "sections": { + "type": "array", + "items": { + "properties": { + "name": { + "type": "string" + }, + "films": { + "type": "array", + "items": { + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "year": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "rating": { + "type": "string" + }, + "runtime": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "lb_url": { + "type": "string", + "format": "url" + }, + "jw_url": { + "type": "string", + "format": "url", + "nullable": true + }, + "trailer_url": { + "type": "string", + "format": "url", + "nullable": true + }, + "genres": { + "type": "array", + "items": { + "type": "string" + } + }, + "countries": { + "type": "array", + "items": { + "properties": { + "name": { + "type": "string" + }, + "flag": { + "type": "string", + "nullable": true + } + }, + "required": [ + "name" + ], + "type": "object" + } + }, + "offers": { + "type": "array", + "items": { + "properties": { + "name": { + "type": "string" + }, + "url": { + "type": "string", + "format": "url", + "nullable": true + } + }, + "required": [ + "name", + "url" + ], + "type": "object" + } + }, + "directors": { + "type": "array", + "items": { + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "lb_url": { + "type": "string", + "format": "url" + } + }, + "required": [ + "id", + "name" + ], + "type": "object" + } + } + }, + "required": [ + "title" + ], + "type": "object" + } + } + }, + "required": [ + "name", + "films" + ], + "type": "object" + } + } + }, + "required": [ + "id", + "name" + ], + "type": "object" } } }, @@ -1073,6 +1507,144 @@ }, "summary": "Get Film" } + }, + "/reports": { + "get": { + "tags": [], + "parameters": [], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ArrayOfReports" + }, + "example": [ + { + "id": "integer", + "name": "string", + "sections": [ + { + "name": "string", + "films": [ + { + "id": "integer", + "title": "string", + "description": "string", + "year": "integer", + "rating": "string", + "runtime": "integer", + "lb_url": "string", + "jw_url": "string", + "trailer_url": "string", + "genres": [ + "string" + ], + "countries": [ + { + "name": "string", + "flag": "string" + } + ], + "offers": [ + { + "name": "string", + "url": "string" + } + ], + "directors": [ + { + "id": "integer", + "name": "string", + "lb_url": "string" + } + ] + } + ] + } + ] + } + ] + } + }, + "description": "Returns available reports" + } + }, + "summary": "List Reports" + } + }, + "/reports/{id}": { + "get": { + "tags": [], + "parameters": [ + { + "description": "id", + "in": "path", + "name": "id", + "required": true, + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Report" + }, + "example": { + "id": "integer", + "name": "string", + "sections": [ + { + "name": "string", + "films": [ + { + "id": "integer", + "title": "string", + "description": "string", + "year": "integer", + "rating": "string", + "runtime": "integer", + "lb_url": "string", + "jw_url": "string", + "trailer_url": "string", + "genres": [ + "string" + ], + "countries": [ + { + "name": "string", + "flag": "string" + } + ], + "offers": [ + { + "name": "string", + "url": "string" + } + ], + "directors": [ + { + "id": "integer", + "name": "string", + "lb_url": "string" + } + ] + } + ] + } + ] + } + } + }, + "description": "Execute a report" + } + }, + "summary": "Execute Report" + } } } } diff --git a/ts/.openapi-generator/FILES b/ts/.openapi-generator/FILES index d3e0d77..07f2409 100644 --- a/ts/.openapi-generator/FILES +++ b/ts/.openapi-generator/FILES @@ -6,6 +6,7 @@ api/defaultApi.ts git_push.sh model/arrayOfDirectors.ts model/arrayOfFilms.ts +model/arrayOfReports.ts model/director.ts model/directorFilmsInner.ts model/directorFilmsInnerCountriesInner.ts @@ -13,3 +14,5 @@ model/directorFilmsInnerOffersInner.ts model/directorInfo.ts model/film.ts model/models.ts +model/report.ts +model/reportSectionsInner.ts diff --git a/ts/api/defaultApi.ts b/ts/api/defaultApi.ts index 5a52ab8..26ab60c 100644 --- a/ts/api/defaultApi.ts +++ b/ts/api/defaultApi.ts @@ -17,6 +17,7 @@ import http from 'http'; /* tslint:disable:no-unused-locals */ import { Director } from '../model/director'; import { Film } from '../model/film'; +import { Report } from '../model/report'; import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models'; @@ -374,4 +375,135 @@ export class DefaultApi { }); }); } + /** + * + * @summary List Reports + */ + public async reportsGet (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array; }> { + const localVarPath = this.basePath + '/reports'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + (Object).assign(localVarHeaderParams, options.headers); + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'GET', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + let authenticationPromise = Promise.resolve(); + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: Array; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + body = ObjectSerializer.deserialize(body, "Array"); + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Execute Report + * @param id id + */ + public async reportsIdGet (id: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Report; }> { + const localVarPath = this.basePath + '/reports/{id}' + .replace('{' + 'id' + '}', encodeURIComponent(String(id))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling reportsIdGet.'); + } + + (Object).assign(localVarHeaderParams, options.headers); + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'GET', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + let authenticationPromise = Promise.resolve(); + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: Report; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + body = ObjectSerializer.deserialize(body, "Report"); + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } } diff --git a/ts/model/arrayOfReports.ts b/ts/model/arrayOfReports.ts new file mode 100644 index 0000000..3d3255f --- /dev/null +++ b/ts/model/arrayOfReports.ts @@ -0,0 +1,26 @@ +/** + * letsrolld API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { RequestFile } from './models'; + +export class ArrayOfReports extends Array { + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + ]; + + static getAttributeTypeMap() { + return super.getAttributeTypeMap().concat(ArrayOfReports.attributeTypeMap); + } +} + diff --git a/ts/model/models.ts b/ts/model/models.ts index ee582e9..ae36931 100644 --- a/ts/model/models.ts +++ b/ts/model/models.ts @@ -2,12 +2,15 @@ import localVarRequest from 'request'; export * from './arrayOfDirectors'; export * from './arrayOfFilms'; +export * from './arrayOfReports'; export * from './director'; export * from './directorFilmsInner'; export * from './directorFilmsInnerCountriesInner'; export * from './directorFilmsInnerOffersInner'; export * from './directorInfo'; export * from './film'; +export * from './report'; +export * from './reportSectionsInner'; import * as fs from 'fs'; @@ -24,12 +27,15 @@ export type RequestFile = string | Buffer | fs.ReadStream | RequestDetailedFile; import { ArrayOfDirectors } from './arrayOfDirectors'; import { ArrayOfFilms } from './arrayOfFilms'; +import { ArrayOfReports } from './arrayOfReports'; import { Director } from './director'; import { DirectorFilmsInner } from './directorFilmsInner'; import { DirectorFilmsInnerCountriesInner } from './directorFilmsInnerCountriesInner'; import { DirectorFilmsInnerOffersInner } from './directorFilmsInnerOffersInner'; import { DirectorInfo } from './directorInfo'; import { Film } from './film'; +import { Report } from './report'; +import { ReportSectionsInner } from './reportSectionsInner'; /* tslint:disable:no-unused-variable */ let primitives = [ @@ -49,12 +55,15 @@ let enumsMap: {[index: string]: any} = { let typeMap: {[index: string]: any} = { "ArrayOfDirectors": ArrayOfDirectors, "ArrayOfFilms": ArrayOfFilms, + "ArrayOfReports": ArrayOfReports, "Director": Director, "DirectorFilmsInner": DirectorFilmsInner, "DirectorFilmsInnerCountriesInner": DirectorFilmsInnerCountriesInner, "DirectorFilmsInnerOffersInner": DirectorFilmsInnerOffersInner, "DirectorInfo": DirectorInfo, "Film": Film, + "Report": Report, + "ReportSectionsInner": ReportSectionsInner, } // Check if a string starts with another string without using es6 features diff --git a/ts/model/report.ts b/ts/model/report.ts new file mode 100644 index 0000000..c360ff1 --- /dev/null +++ b/ts/model/report.ts @@ -0,0 +1,44 @@ +/** + * letsrolld API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { RequestFile } from './models'; +import { ReportSectionsInner } from './reportSectionsInner'; + +export class Report { + 'id': number; + 'name': string; + 'sections'?: Array; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number" + }, + { + "name": "name", + "baseName": "name", + "type": "string" + }, + { + "name": "sections", + "baseName": "sections", + "type": "Array" + } ]; + + static getAttributeTypeMap() { + return Report.attributeTypeMap; + } +} + diff --git a/ts/model/reportSectionsInner.ts b/ts/model/reportSectionsInner.ts new file mode 100644 index 0000000..5e0029f --- /dev/null +++ b/ts/model/reportSectionsInner.ts @@ -0,0 +1,38 @@ +/** + * letsrolld API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { RequestFile } from './models'; +import { DirectorFilmsInner } from './directorFilmsInner'; + +export class ReportSectionsInner { + 'name': string; + 'films': Array; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "name", + "baseName": "name", + "type": "string" + }, + { + "name": "films", + "baseName": "films", + "type": "Array" + } ]; + + static getAttributeTypeMap() { + return ReportSectionsInner.attributeTypeMap; + } +} +