diff --git a/.github/workflows/swagger-validate.yml b/.github/workflows/swagger-validate.yml deleted file mode 100644 index e1ec83b..0000000 --- a/.github/workflows/swagger-validate.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Swagger Validate -on: [pull_request] -jobs: - swagger-validate: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Install nodejs - uses: actions/setup-node@v4 - with: - node-version: '22' - - name: Install java - uses: actions/setup-java@v4 - with: - java-version: '11' - distribution: 'temurin' - - name: Install openapi-generator-cli - run: | - npm install @openapitools/openapi-generator-cli -g - - name: Validate swagger.json - run: | - openapi-generator-cli validate -i swagger.json diff --git a/.github/workflows/swagger.yml b/.github/workflows/swagger.yml index cbab95b..44ccb2c 100644 --- a/.github/workflows/swagger.yml +++ b/.github/workflows/swagger.yml @@ -5,14 +5,49 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.11.x' - - name: Install dependencies + + - name: Install nodejs + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Install java + uses: actions/setup-java@v4 + with: + java-version: '11' + distribution: 'temurin' + + - name: Install make + run: | + sudo apt-get update + sudo apt-get install make + + - name: Install pdm run: | python -m pip install --upgrade pip - pip install . + pip install pdm + + - name: Install the package + run: | + pdm install + - name: Re-generate swagger.json run: | - diff -u swagger.json <(swagger) + diff -u swagger.json <(pdm run swagger) + + - name: Install openapi-generator-cli + run: | + npm install @openapitools/openapi-generator-cli -g + + - name: Validate swagger.json + run: | + openapi-generator-cli validate -i swagger.json + + - name: Re-generate client bindings + run: | + make swagger-all diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 36d931d..6151c5d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,4 +17,8 @@ repos: args: [ --fix ] # Run the formatter. - id: ruff-format -exclude: 'letsrolld-api-client/.*' +exclude: | + (?x)^( + letsrolld-api-client/.*| + js/.* + )$ diff --git a/Makefile b/Makefile index e199d28..f0ab2d7 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ DIRECTORS_FILE?=directors.csv RUN_LOG?=run.log RUN_LOG_CMD?=ts | tee -a $(RUN_LOG) -.PHONY: install lint mypy test populate run-update-directors run-update-films run-update-offers run-cleanup run-all run-db-upgrade webapp ui swagger swagger_py get-dirs get-films +.PHONY: install lint mypy test populate run-update-directors run-update-films run-update-offers run-cleanup run-all run-db-upgrade webapp ui swagger swagger-py swagger-js swagger-all get-dirs get-films install: pdm install -vd @@ -44,12 +44,20 @@ webapp: swagger: #curl http://localhost:8000/api/doc/swagger.json -o swagger.json - pdm run swagger > swagger.json + pdm run swagger > swagger.json.tmp + mv swagger.json.tmp swagger.json openapi-generator-cli validate -i swagger.json -swagger_py: swagger +swagger-py: swagger + rm -rf letsrolld-api-client pdm run openapi-python-client generate --path swagger.json +swagger-js: swagger + rm -rf js + openapi-generator-cli generate -i swagger.json -g javascript -o js + +swagger-all: swagger-py swagger-js + ui: cd ui && http-server --port 8081 -c-1 -o diff --git a/js/.babelrc b/js/.babelrc new file mode 100644 index 0000000..c73df9d --- /dev/null +++ b/js/.babelrc @@ -0,0 +1,33 @@ +{ + "presets": [ + "@babel/preset-env" + ], + "plugins": [ + "@babel/plugin-syntax-dynamic-import", + "@babel/plugin-syntax-import-meta", + "@babel/plugin-proposal-class-properties", + "@babel/plugin-proposal-json-strings", + [ + "@babel/plugin-proposal-decorators", + { + "legacy": true + } + ], + "@babel/plugin-proposal-function-sent", + "@babel/plugin-proposal-export-namespace-from", + "@babel/plugin-proposal-numeric-separator", + "@babel/plugin-proposal-throw-expressions", + "@babel/plugin-proposal-export-default-from", + "@babel/plugin-proposal-logical-assignment-operators", + "@babel/plugin-proposal-optional-chaining", + [ + "@babel/plugin-proposal-pipeline-operator", + { + "proposal": "minimal" + } + ], + "@babel/plugin-proposal-nullish-coalescing-operator", + "@babel/plugin-proposal-do-expressions", + "@babel/plugin-proposal-function-bind" + ] +} diff --git a/js/.gitignore b/js/.gitignore new file mode 100644 index 0000000..6a7d6d8 --- /dev/null +++ b/js/.gitignore @@ -0,0 +1,130 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional stylelint cache +.stylelintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# vuepress v2.x temp and cache directory +.temp +.cache + +# Docusaurus cache and generated files +.docusaurus + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* \ No newline at end of file diff --git a/js/.openapi-generator-ignore b/js/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/js/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/js/.openapi-generator/FILES b/js/.openapi-generator/FILES new file mode 100644 index 0000000..e89eb3e --- /dev/null +++ b/js/.openapi-generator/FILES @@ -0,0 +1,37 @@ +.babelrc +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +docs/ArrayOfDirectors.md +docs/ArrayOfFilms.md +docs/DefaultApi.md +docs/Director.md +docs/DirectorFilmsInner.md +docs/DirectorFilmsInnerCountriesInner.md +docs/DirectorFilmsInnerOffersInner.md +docs/DirectorInfo.md +docs/Film.md +git_push.sh +mocha.opts +package.json +src/ApiClient.js +src/api/DefaultApi.js +src/index.js +src/model/ArrayOfDirectors.js +src/model/ArrayOfFilms.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 +test/api/DefaultApi.spec.js +test/model/ArrayOfDirectors.spec.js +test/model/ArrayOfFilms.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 diff --git a/js/.openapi-generator/VERSION b/js/.openapi-generator/VERSION new file mode 100644 index 0000000..73a86b1 --- /dev/null +++ b/js/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.0.1 \ No newline at end of file diff --git a/js/.travis.yml b/js/.travis.yml new file mode 100644 index 0000000..0968f7a --- /dev/null +++ b/js/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +cache: npm +node_js: + - "6" + - "6.1" diff --git a/js/README.md b/js/README.md new file mode 100644 index 0000000..c311d64 --- /dev/null +++ b/js/README.md @@ -0,0 +1,146 @@ +# letsrolld_api + +LetsrolldApi - JavaScript client for letsrolld_api +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) +This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 0.1 +- Package version: 0.1 +- Build package: org.openapitools.codegen.languages.JavascriptClientCodegen + +## Installation + +### For [Node.js](https://nodejs.org/) + +#### npm + +To publish the library as a [npm](https://www.npmjs.com/), please follow the procedure in ["Publishing npm packages"](https://docs.npmjs.com/getting-started/publishing-npm-packages). + +Then install it via: + +```shell +npm install letsrolld_api --save +``` + +Finally, you need to build the module: + +```shell +npm run build +``` + +##### Local development + +To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing `package.json` (and this README). Let's call this `JAVASCRIPT_CLIENT_DIR`. Then run: + +```shell +npm install +``` + +Next, [link](https://docs.npmjs.com/cli/link) it globally in npm with the following, also from `JAVASCRIPT_CLIENT_DIR`: + +```shell +npm link +``` + +To use the link you just defined in your project, switch to the directory you want to use your letsrolld_api from, and run: + +```shell +npm link /path/to/ +``` + +Finally, you need to build the module: + +```shell +npm run build +``` + +#### git + +If the library is hosted at a git repository, e.g.https://github.com/GIT_USER_ID/GIT_REPO_ID +then install it via: + +```shell + npm install GIT_USER_ID/GIT_REPO_ID --save +``` + +### For browser + +The library also works in the browser environment via npm and [browserify](http://browserify.org/). After following +the above steps with Node.js and installing browserify with `npm install -g browserify`, +perform the following (assuming *main.js* is your entry file): + +```shell +browserify main.js > bundle.js +``` + +Then include *bundle.js* in the HTML pages. + +### Webpack Configuration + +Using Webpack you may encounter the following error: "Module not found: Error: +Cannot resolve module", most certainly you should disable AMD loader. Add/merge +the following section to your webpack config: + +```javascript +module: { + rules: [ + { + parser: { + amd: false + } + } + ] +} +``` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following JS code: + +```javascript +var LetsrolldApi = require('letsrolld_api'); + + +var api = new LetsrolldApi.DefaultApi() +var opts = { + 'limit': 10 // {Number} Number of directors to return +}; +var callback = function(error, data, response) { + if (error) { + console.error(error); + } else { + console.log('API called successfully. Returned data: ' + data); + } +}; +api.directorsGet(opts, callback); + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*LetsrolldApi.DefaultApi* | [**directorsGet**](docs/DefaultApi.md#directorsGet) | **GET** /directors | Get Directors +*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 + + +## Documentation for Models + + - [LetsrolldApi.ArrayOfDirectors](docs/ArrayOfDirectors.md) + - [LetsrolldApi.ArrayOfFilms](docs/ArrayOfFilms.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) + + +## Documentation for Authorization + +Endpoints do not require authorization. + diff --git a/js/docs/ArrayOfDirectors.md b/js/docs/ArrayOfDirectors.md new file mode 100644 index 0000000..facd063 --- /dev/null +++ b/js/docs/ArrayOfDirectors.md @@ -0,0 +1,8 @@ +# LetsrolldApi.ArrayOfDirectors + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + diff --git a/js/docs/ArrayOfFilms.md b/js/docs/ArrayOfFilms.md new file mode 100644 index 0000000..20eec56 --- /dev/null +++ b/js/docs/ArrayOfFilms.md @@ -0,0 +1,8 @@ +# LetsrolldApi.ArrayOfFilms + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + diff --git a/js/docs/DefaultApi.md b/js/docs/DefaultApi.md new file mode 100644 index 0000000..d4fde9d --- /dev/null +++ b/js/docs/DefaultApi.md @@ -0,0 +1,194 @@ +# LetsrolldApi.DefaultApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**directorsGet**](DefaultApi.md#directorsGet) | **GET** /directors | Get Directors +[**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 + + + +## directorsGet + +> [Object] directorsGet(opts) + +Get Directors + +### Example + +```javascript +import LetsrolldApi from 'letsrolld_api'; + +let apiInstance = new LetsrolldApi.DefaultApi(); +let opts = { + 'limit': 10 // Number | Number of directors to return +}; +apiInstance.directorsGet(opts, (error, data, response) => { + if (error) { + console.error(error); + } else { + console.log('API called successfully. Returned data: ' + data); + } +}); +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **Number**| Number of directors to return | [optional] [default to 10] + +### Return type + +**[Object]** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## directorsIdGet + +> Director directorsIdGet(id) + +Get Director + +### Example + +```javascript +import LetsrolldApi from 'letsrolld_api'; + +let apiInstance = new LetsrolldApi.DefaultApi(); +let id = 56; // Number | id +apiInstance.directorsIdGet(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 + +[**Director**](Director.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## filmsGet + +> [Object] filmsGet(opts) + +Get Films + +### Example + +```javascript +import LetsrolldApi from 'letsrolld_api'; + +let apiInstance = new LetsrolldApi.DefaultApi(); +let opts = { + 'limit': 10, // Number | Number of films to return + 'genre': "genre_example", // String | Genre to filter by + 'country': "country_example", // String | Country to filter by + 'offer': "offer_example" // String | Offer to filter by +}; +apiInstance.filmsGet(opts, (error, data, response) => { + if (error) { + console.error(error); + } else { + console.log('API called successfully. Returned data: ' + data); + } +}); +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **Number**| Number of films to return | [optional] [default to 10] + **genre** | **String**| Genre to filter by | [optional] + **country** | **String**| Country to filter by | [optional] + **offer** | **String**| Offer to filter by | [optional] + +### Return type + +**[Object]** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## filmsIdGet + +> Film filmsIdGet(id) + +Get Film + +### Example + +```javascript +import LetsrolldApi from 'letsrolld_api'; + +let apiInstance = new LetsrolldApi.DefaultApi(); +let id = 56; // Number | id +apiInstance.filmsIdGet(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 + +[**Film**](Film.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/js/docs/Director.md b/js/docs/Director.md new file mode 100644 index 0000000..cc752d6 --- /dev/null +++ b/js/docs/Director.md @@ -0,0 +1,10 @@ +# LetsrolldApi.Director + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**info** | [**DirectorInfo**](DirectorInfo.md) | | +**films** | [**[DirectorFilmsInner]**](DirectorFilmsInner.md) | | [optional] + + diff --git a/js/docs/DirectorFilmsInner.md b/js/docs/DirectorFilmsInner.md new file mode 100644 index 0000000..57c58a8 --- /dev/null +++ b/js/docs/DirectorFilmsInner.md @@ -0,0 +1,21 @@ +# LetsrolldApi.DirectorFilmsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Number** | | [optional] +**title** | **String** | | +**description** | **String** | | [optional] +**year** | **Number** | | [optional] +**rating** | **String** | | [optional] +**runtime** | **Number** | | [optional] +**lbUrl** | **String** | | [optional] +**jwUrl** | **String** | | [optional] +**trailerUrl** | **String** | | [optional] +**genres** | **[String]** | | [optional] +**countries** | [**[DirectorFilmsInnerCountriesInner]**](DirectorFilmsInnerCountriesInner.md) | | [optional] +**offers** | [**[DirectorFilmsInnerOffersInner]**](DirectorFilmsInnerOffersInner.md) | | [optional] +**directors** | [**[DirectorInfo]**](DirectorInfo.md) | | [optional] + + diff --git a/js/docs/DirectorFilmsInnerCountriesInner.md b/js/docs/DirectorFilmsInnerCountriesInner.md new file mode 100644 index 0000000..165eda8 --- /dev/null +++ b/js/docs/DirectorFilmsInnerCountriesInner.md @@ -0,0 +1,10 @@ +# LetsrolldApi.DirectorFilmsInnerCountriesInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | +**flag** | **String** | | [optional] + + diff --git a/js/docs/DirectorFilmsInnerOffersInner.md b/js/docs/DirectorFilmsInnerOffersInner.md new file mode 100644 index 0000000..0edcdd9 --- /dev/null +++ b/js/docs/DirectorFilmsInnerOffersInner.md @@ -0,0 +1,10 @@ +# LetsrolldApi.DirectorFilmsInnerOffersInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | +**url** | **String** | | + + diff --git a/js/docs/DirectorInfo.md b/js/docs/DirectorInfo.md new file mode 100644 index 0000000..3b43e41 --- /dev/null +++ b/js/docs/DirectorInfo.md @@ -0,0 +1,11 @@ +# LetsrolldApi.DirectorInfo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Number** | | +**name** | **String** | | +**lbUrl** | **String** | | [optional] + + diff --git a/js/docs/Film.md b/js/docs/Film.md new file mode 100644 index 0000000..74334ac --- /dev/null +++ b/js/docs/Film.md @@ -0,0 +1,21 @@ +# LetsrolldApi.Film + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Number** | | [optional] +**title** | **String** | | +**description** | **String** | | [optional] +**year** | **Number** | | [optional] +**rating** | **String** | | [optional] +**runtime** | **Number** | | [optional] +**lbUrl** | **String** | | [optional] +**jwUrl** | **String** | | [optional] +**trailerUrl** | **String** | | [optional] +**genres** | **[String]** | | [optional] +**countries** | [**[DirectorFilmsInnerCountriesInner]**](DirectorFilmsInnerCountriesInner.md) | | [optional] +**offers** | [**[DirectorFilmsInnerOffersInner]**](DirectorFilmsInnerOffersInner.md) | | [optional] +**directors** | [**[DirectorInfo]**](DirectorInfo.md) | | [optional] + + diff --git a/js/git_push.sh b/js/git_push.sh new file mode 100644 index 0000000..f53a75d --- /dev/null +++ b/js/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/js/mocha.opts b/js/mocha.opts new file mode 100644 index 0000000..9070118 --- /dev/null +++ b/js/mocha.opts @@ -0,0 +1 @@ +--timeout 10000 diff --git a/js/package.json b/js/package.json new file mode 100644 index 0000000..efff836 --- /dev/null +++ b/js/package.json @@ -0,0 +1,46 @@ +{ + "name": "letsrolld_api", + "version": "0.1", + "description": "JS API client generated by OpenAPI Generator", + "license": "GPL-3.0", + "main": "dist/index.js", + "scripts": { + "build": "babel src -d dist", + "prepare": "npm run build", + "test": "mocha --require @babel/register --recursive" + }, + "browser": { + "fs": false + }, + "dependencies": { + "@babel/cli": "^7.0.0", + "superagent": "^5.3.0" + }, + "devDependencies": { + "@babel/core": "^7.0.0", + "@babel/plugin-proposal-class-properties": "^7.0.0", + "@babel/plugin-proposal-decorators": "^7.0.0", + "@babel/plugin-proposal-do-expressions": "^7.0.0", + "@babel/plugin-proposal-export-default-from": "^7.0.0", + "@babel/plugin-proposal-export-namespace-from": "^7.0.0", + "@babel/plugin-proposal-function-bind": "^7.0.0", + "@babel/plugin-proposal-function-sent": "^7.0.0", + "@babel/plugin-proposal-json-strings": "^7.0.0", + "@babel/plugin-proposal-logical-assignment-operators": "^7.0.0", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0", + "@babel/plugin-proposal-numeric-separator": "^7.0.0", + "@babel/plugin-proposal-optional-chaining": "^7.0.0", + "@babel/plugin-proposal-pipeline-operator": "^7.0.0", + "@babel/plugin-proposal-throw-expressions": "^7.0.0", + "@babel/plugin-syntax-dynamic-import": "^7.0.0", + "@babel/plugin-syntax-import-meta": "^7.0.0", + "@babel/preset-env": "^7.0.0", + "@babel/register": "^7.0.0", + "expect.js": "^0.3.1", + "mocha": "^8.0.1", + "sinon": "^7.2.0" + }, + "files": [ + "dist" + ] +} diff --git a/js/src/ApiClient.js b/js/src/ApiClient.js new file mode 100644 index 0000000..c6c3f33 --- /dev/null +++ b/js/src/ApiClient.js @@ -0,0 +1,691 @@ +/** + * 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 superagent from "superagent"; +import querystring from "querystring"; + +/** +* @module ApiClient +* @version 0.1 +*/ + +/** +* Manages low level client-server communications, parameter marshalling, etc. There should not be any need for an +* application to use this class directly - the *Api and model classes provide the public API for the service. The +* contents of this file should be regarded as internal but are documented for completeness. +* @alias module:ApiClient +* @class +*/ +class ApiClient { + /** + * The base URL against which to resolve every API call's (relative) path. + * Overrides the default value set in spec file if present + * @param {String} basePath + */ + constructor(basePath = 'http://localhost') { + /** + * The base URL against which to resolve every API call's (relative) path. + * @type {String} + * @default http://localhost + */ + this.basePath = basePath.replace(/\/+$/, ''); + + /** + * The authentication methods to be included for all API calls. + * @type {Array.} + */ + this.authentications = { + } + + /** + * The default HTTP headers to be included for all API calls. + * @type {Array.} + * @default {} + */ + this.defaultHeaders = { + 'User-Agent': 'OpenAPI-Generator/0.1/Javascript' + }; + + /** + * The default HTTP timeout for all API calls. + * @type {Number} + * @default 60000 + */ + this.timeout = 60000; + + /** + * If set to false an additional timestamp parameter is added to all API GET calls to + * prevent browser caching + * @type {Boolean} + * @default true + */ + this.cache = true; + + /** + * If set to true, the client will save the cookies from each server + * response, and return them in the next request. + * @default false + */ + this.enableCookies = false; + + /* + * Used to save and return cookies in a node.js (non-browser) setting, + * if this.enableCookies is set to true. + */ + if (typeof window === 'undefined') { + this.agent = new superagent.agent(); + } + + /* + * Allow user to override superagent agent + */ + this.requestAgent = null; + + /* + * Allow user to add superagent plugins + */ + this.plugins = null; + + } + + /** + * Returns a string representation for an actual parameter. + * @param param The actual parameter. + * @returns {String} The string representation of param. + */ + paramToString(param) { + if (param == undefined || param == null) { + return ''; + } + if (param instanceof Date) { + return param.toJSON(); + } + if (ApiClient.canBeJsonified(param)) { + return JSON.stringify(param); + } + + return param.toString(); + } + + /** + * Returns a boolean indicating if the parameter could be JSON.stringified + * @param param The actual parameter + * @returns {Boolean} Flag indicating if param can be JSON.stringified + */ + static canBeJsonified(str) { + if (typeof str !== 'string' && typeof str !== 'object') return false; + try { + const type = str.toString(); + return type === '[object Object]' + || type === '[object Array]'; + } catch (err) { + return false; + } + }; + + /** + * Builds full URL by appending the given path to the base URL and replacing path parameter place-holders with parameter values. + * NOTE: query parameters are not handled here. + * @param {String} path The path to append to the base URL. + * @param {Object} pathParams The parameter values to append. + * @param {String} apiBasePath Base path defined in the path, operation level to override the default one + * @returns {String} The encoded path with parameter values substituted. + */ + buildUrl(path, pathParams, apiBasePath) { + if (!path.match(/^\//)) { + path = '/' + path; + } + + var url = this.basePath + path; + + // use API (operation, path) base path if defined + if (apiBasePath !== null && apiBasePath !== undefined) { + url = apiBasePath + path; + } + + url = url.replace(/\{([\w-\.]+)\}/g, (fullMatch, key) => { + var value; + if (pathParams.hasOwnProperty(key)) { + value = this.paramToString(pathParams[key]); + } else { + value = fullMatch; + } + + return encodeURIComponent(value); + }); + + return url; + } + + /** + * Checks whether the given content type represents JSON.
+ * JSON content type examples:
+ *
    + *
  • application/json
  • + *
  • application/json; charset=UTF8
  • + *
  • APPLICATION/JSON
  • + *
+ * @param {String} contentType The MIME content type to check. + * @returns {Boolean} true if contentType represents JSON, otherwise false. + */ + isJsonMime(contentType) { + return Boolean(contentType != null && contentType.match(/^application\/json(;.*)?$/i)); + } + + /** + * Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first. + * @param {Array.} contentTypes + * @returns {String} The chosen content type, preferring JSON. + */ + jsonPreferredMime(contentTypes) { + for (var i = 0; i < contentTypes.length; i++) { + if (this.isJsonMime(contentTypes[i])) { + return contentTypes[i]; + } + } + + return contentTypes[0]; + } + + /** + * Checks whether the given parameter value represents file-like content. + * @param param The parameter to check. + * @returns {Boolean} true if param represents a file. + */ + isFileParam(param) { + // fs.ReadStream in Node.js and Electron (but not in runtime like browserify) + if (typeof require === 'function') { + let fs; + try { + fs = require('fs'); + } catch (err) {} + if (fs && fs.ReadStream && param instanceof fs.ReadStream) { + return true; + } + } + + // Buffer in Node.js + if (typeof Buffer === 'function' && param instanceof Buffer) { + return true; + } + + // Blob in browser + if (typeof Blob === 'function' && param instanceof Blob) { + return true; + } + + // File in browser (it seems File object is also instance of Blob, but keep this for safe) + if (typeof File === 'function' && param instanceof File) { + return true; + } + + return false; + } + + /** + * Normalizes parameter values: + *
    + *
  • remove nils
  • + *
  • keep files and arrays
  • + *
  • format to string with `paramToString` for other cases
  • + *
+ * @param {Object.} params The parameters as object properties. + * @returns {Object.} normalized parameters. + */ + normalizeParams(params) { + var newParams = {}; + for (var key in params) { + if (params.hasOwnProperty(key) && params[key] != undefined && params[key] != null) { + var value = params[key]; + if (this.isFileParam(value) || Array.isArray(value)) { + newParams[key] = value; + } else { + newParams[key] = this.paramToString(value); + } + } + } + + return newParams; + } + + /** + * Builds a string representation of an array-type actual parameter, according to the given collection format. + * @param {Array} param An array parameter. + * @param {module:ApiClient.CollectionFormatEnum} collectionFormat The array element separator strategy. + * @returns {String|Array} A string representation of the supplied collection, using the specified delimiter. Returns + * param as is if collectionFormat is multi. + */ + buildCollectionParam(param, collectionFormat) { + if (param == null) { + return null; + } + switch (collectionFormat) { + case 'csv': + return param.map(this.paramToString, this).join(','); + case 'ssv': + return param.map(this.paramToString, this).join(' '); + case 'tsv': + return param.map(this.paramToString, this).join('\t'); + case 'pipes': + return param.map(this.paramToString, this).join('|'); + case 'multi': + //return the array directly as SuperAgent will handle it as expected + return param.map(this.paramToString, this); + case 'passthrough': + return param; + default: + throw new Error('Unknown collection format: ' + collectionFormat); + } + } + + /** + * Applies authentication headers to the request. + * @param {Object} request The request object created by a superagent() call. + * @param {Array.} authNames An array of authentication method names. + */ + applyAuthToRequest(request, authNames) { + authNames.forEach((authName) => { + var auth = this.authentications[authName]; + switch (auth.type) { + case 'basic': + if (auth.username || auth.password) { + request.auth(auth.username || '', auth.password || ''); + } + + break; + case 'bearer': + if (auth.accessToken) { + var localVarBearerToken = typeof auth.accessToken === 'function' + ? auth.accessToken() + : auth.accessToken + request.set({'Authorization': 'Bearer ' + localVarBearerToken}); + } + + break; + case 'apiKey': + if (auth.apiKey) { + var data = {}; + if (auth.apiKeyPrefix) { + data[auth.name] = auth.apiKeyPrefix + ' ' + auth.apiKey; + } else { + data[auth.name] = auth.apiKey; + } + + if (auth['in'] === 'header') { + request.set(data); + } else { + request.query(data); + } + } + + break; + case 'oauth2': + if (auth.accessToken) { + request.set({'Authorization': 'Bearer ' + auth.accessToken}); + } + + break; + default: + throw new Error('Unknown authentication type: ' + auth.type); + } + }); + } + + /** + * Deserializes an HTTP response body into a value of the specified type. + * @param {Object} response A SuperAgent response object. + * @param {(String|Array.|Object.|Function)} returnType The type to return. Pass a string for simple types + * or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To + * return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type: + * all properties on data will be converted to this type. + * @returns A value of the specified type. + */ + deserialize(response, returnType) { + if (response == null || returnType == null || response.status == 204) { + return null; + } + + // Rely on SuperAgent for parsing response body. + // See http://visionmedia.github.io/superagent/#parsing-response-bodies + var data = response.body; + if (data == null || (typeof data === 'object' && typeof data.length === 'undefined' && !Object.keys(data).length)) { + // SuperAgent does not always produce a body; use the unparsed response as a fallback + data = response.text; + } + + return ApiClient.convertToType(data, returnType); + } + + /** + * Callback function to receive the result of the operation. + * @callback module:ApiClient~callApiCallback + * @param {String} error Error message, if any. + * @param data The data returned by the service call. + * @param {String} response The complete HTTP response. + */ + + /** + * Invokes the REST service using the supplied settings and parameters. + * @param {String} path The base URL to invoke. + * @param {String} httpMethod The HTTP method to use. + * @param {Object.} pathParams A map of path parameters and their values. + * @param {Object.} queryParams A map of query parameters and their values. + * @param {Object.} headerParams A map of header parameters and their values. + * @param {Object.} formParams A map of form parameters and their values. + * @param {Object} bodyParam The value to pass as the request body. + * @param {Array.} authNames An array of authentication type names. + * @param {Array.} contentTypes An array of request MIME types. + * @param {Array.} accepts An array of acceptable response MIME types. + * @param {(String|Array|ObjectFunction)} returnType The required type to return; can be a string for simple types or the + * constructor for a complex type. + * @param {String} apiBasePath base path defined in the operation/path level to override the default one + * @param {module:ApiClient~callApiCallback} callback The callback function. + * @returns {Object} The SuperAgent request object. + */ + callApi(path, httpMethod, pathParams, + queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts, + returnType, apiBasePath, callback) { + + var url = this.buildUrl(path, pathParams, apiBasePath); + var request = superagent(httpMethod, url); + + if (this.plugins !== null) { + for (var index in this.plugins) { + if (this.plugins.hasOwnProperty(index)) { + request.use(this.plugins[index]) + } + } + } + + // apply authentications + this.applyAuthToRequest(request, authNames); + + // set query parameters + if (httpMethod.toUpperCase() === 'GET' && this.cache === false) { + queryParams['_'] = new Date().getTime(); + } + + request.query(this.normalizeParams(queryParams)); + + // set header parameters + request.set(this.defaultHeaders).set(this.normalizeParams(headerParams)); + + // set requestAgent if it is set by user + if (this.requestAgent) { + request.agent(this.requestAgent); + } + + // set request timeout + request.timeout(this.timeout); + + var contentType = this.jsonPreferredMime(contentTypes); + if (contentType) { + // Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746) + if(contentType != 'multipart/form-data') { + request.type(contentType); + } + } + + if (contentType === 'application/x-www-form-urlencoded') { + request.send(querystring.stringify(this.normalizeParams(formParams))); + } else if (contentType == 'multipart/form-data') { + var _formParams = this.normalizeParams(formParams); + for (var key in _formParams) { + if (_formParams.hasOwnProperty(key)) { + let _formParamsValue = _formParams[key]; + if (this.isFileParam(_formParamsValue)) { + // file field + request.attach(key, _formParamsValue); + } else if (Array.isArray(_formParamsValue) && _formParamsValue.length + && this.isFileParam(_formParamsValue[0])) { + // multiple files + _formParamsValue.forEach(file => request.attach(key, file)); + } else { + request.field(key, _formParamsValue); + } + } + } + } else if (bodyParam !== null && bodyParam !== undefined) { + if (!request.header['Content-Type']) { + request.type('application/json'); + } + request.send(bodyParam); + } + + var accept = this.jsonPreferredMime(accepts); + if (accept) { + request.accept(accept); + } + + if (returnType === 'Blob') { + request.responseType('blob'); + } else if (returnType === 'String') { + request.responseType('text'); + } + + // Attach previously saved cookies, if enabled + if (this.enableCookies){ + if (typeof window === 'undefined') { + this.agent._attachCookies(request); + } + else { + request.withCredentials(); + } + } + + request.end((error, response) => { + if (callback) { + var data = null; + if (!error) { + try { + data = this.deserialize(response, returnType); + if (this.enableCookies && typeof window === 'undefined'){ + this.agent._saveCookies(response); + } + } catch (err) { + error = err; + } + } + + callback(error, data, response); + } + }); + + return request; + } + + /** + * Parses an ISO-8601 string representation or epoch representation of a date value. + * @param {String} str The date value as a string. + * @returns {Date} The parsed date object. + */ + static parseDate(str) { + if (isNaN(str)) { + return new Date(str.replace(/(\d)(T)(\d)/i, '$1 $3')); + } + return new Date(+str); + } + + /** + * Converts a value to the specified type. + * @param {(String|Object)} data The data to convert, as a string or object. + * @param {(String|Array.|Object.|Function)} type The type to return. Pass a string for simple types + * or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To + * return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type: + * all properties on data will be converted to this type. + * @returns An instance of the specified type or null or undefined if data is null or undefined. + */ + static convertToType(data, type) { + if (data === null || data === undefined) + return data + + switch (type) { + case 'Boolean': + return Boolean(data); + case 'Integer': + return parseInt(data, 10); + case 'Number': + return parseFloat(data); + case 'String': + return String(data); + case 'Date': + return ApiClient.parseDate(String(data)); + case 'Blob': + return data; + default: + if (type === Object) { + // generic object, return directly + return data; + } else if (typeof type.constructFromObject === 'function') { + // for model type like User and enum class + return type.constructFromObject(data); + } else if (Array.isArray(type)) { + // for array type like: ['String'] + var itemType = type[0]; + + return data.map((item) => { + return ApiClient.convertToType(item, itemType); + }); + } else if (typeof type === 'object') { + // for plain object type like: {'String': 'Integer'} + var keyType, valueType; + for (var k in type) { + if (type.hasOwnProperty(k)) { + keyType = k; + valueType = type[k]; + break; + } + } + + var result = {}; + for (var k in data) { + if (data.hasOwnProperty(k)) { + var key = ApiClient.convertToType(k, keyType); + var value = ApiClient.convertToType(data[k], valueType); + result[key] = value; + } + } + + return result; + } else { + // for unknown type, return the data directly + return data; + } + } + } + + /** + * Gets an array of host settings + * @returns An array of host settings + */ + hostSettings() { + return [ + { + 'url': "", + 'description': "No description provided", + } + ]; + } + + getBasePathFromSettings(index, variables={}) { + var servers = this.hostSettings(); + + // check array index out of bound + if (index < 0 || index >= servers.length) { + throw new Error("Invalid index " + index + " when selecting the host settings. Must be less than " + servers.length); + } + + var server = servers[index]; + var url = server['url']; + + // go through variable and assign a value + for (var variable_name in server['variables']) { + if (variable_name in variables) { + let variable = server['variables'][variable_name]; + if ( !('enum_values' in variable) || variable['enum_values'].includes(variables[variable_name]) ) { + url = url.replace("{" + variable_name + "}", variables[variable_name]); + } else { + throw new Error("The variable `" + variable_name + "` in the host URL has invalid value " + variables[variable_name] + ". Must be " + server['variables'][variable_name]['enum_values'] + "."); + } + } else { + // use default value + url = url.replace("{" + variable_name + "}", server['variables'][variable_name]['default_value']) + } + } + return url; + } + + /** + * Constructs a new map or array model from REST data. + * @param data {Object|Array} The REST data. + * @param obj {Object|Array} The target object or array. + */ + static constructFromObject(data, obj, itemType) { + if (Array.isArray(data)) { + for (var i = 0; i < data.length; i++) { + if (data.hasOwnProperty(i)) + obj[i] = ApiClient.convertToType(data[i], itemType); + } + } else { + for (var k in data) { + if (data.hasOwnProperty(k)) + obj[k] = ApiClient.convertToType(data[k], itemType); + } + } + }; +} + +/** + * Enumeration of collection format separator strategies. + * @enum {String} + * @readonly + */ +ApiClient.CollectionFormatEnum = { + /** + * Comma-separated values. Value: csv + * @const + */ + CSV: ',', + + /** + * Space-separated values. Value: ssv + * @const + */ + SSV: ' ', + + /** + * Tab-separated values. Value: tsv + * @const + */ + TSV: '\t', + + /** + * Pipe(|)-separated values. Value: pipes + * @const + */ + PIPES: '|', + + /** + * Native array. Value: multi + * @const + */ + MULTI: 'multi' +}; + +/** +* The default API client implementation. +* @type {module:ApiClient} +*/ +ApiClient.instance = new ApiClient(); +export default ApiClient; diff --git a/js/src/api/DefaultApi.js b/js/src/api/DefaultApi.js new file mode 100644 index 0000000..2706e79 --- /dev/null +++ b/js/src/api/DefaultApi.js @@ -0,0 +1,209 @@ +/** + * 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 Director from '../model/Director'; +import Film from '../model/Film'; + +/** +* Default service. +* @module api/DefaultApi +* @version 0.1 +*/ +export default class DefaultApi { + + /** + * Constructs a new DefaultApi. + * @alias module:api/DefaultApi + * @class + * @param {module:ApiClient} [apiClient] Optional API client implementation to use, + * default to {@link module:ApiClient#instance} if unspecified. + */ + constructor(apiClient) { + this.apiClient = apiClient || ApiClient.instance; + } + + + /** + * Callback function to receive the result of the directorsGet operation. + * @callback module:api/DefaultApi~directorsGetCallback + * @param {String} error Error message, if any. + * @param {Array.} data The data returned by the service call. + * @param {String} response The complete HTTP response. + */ + + /** + * Get Directors + * @param {Object} opts Optional parameters + * @param {Number} [limit = 10)] Number of directors to return + * @param {module:api/DefaultApi~directorsGetCallback} callback The callback function, accepting three arguments: error, data, response + * data is of type: {@link Array.} + */ + directorsGet(opts, callback) { + opts = opts || {}; + let postBody = null; + + let pathParams = { + }; + let queryParams = { + 'limit': opts['limit'] + }; + let headerParams = { + }; + let formParams = { + }; + + let authNames = []; + let contentTypes = []; + let accepts = ['application/json']; + let returnType = [Object]; + return this.apiClient.callApi( + '/directors', 'GET', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, null, callback + ); + } + + /** + * Callback function to receive the result of the directorsIdGet operation. + * @callback module:api/DefaultApi~directorsIdGetCallback + * @param {String} error Error message, if any. + * @param {module:model/Director} data The data returned by the service call. + * @param {String} response The complete HTTP response. + */ + + /** + * Get Director + * @param {Number} id id + * @param {module:api/DefaultApi~directorsIdGetCallback} callback The callback function, accepting three arguments: error, data, response + * data is of type: {@link module:model/Director} + */ + directorsIdGet(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 directorsIdGet"); + } + + let pathParams = { + 'id': id + }; + let queryParams = { + }; + let headerParams = { + }; + let formParams = { + }; + + let authNames = []; + let contentTypes = []; + let accepts = ['application/json']; + let returnType = Director; + return this.apiClient.callApi( + '/directors/{id}', 'GET', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, null, callback + ); + } + + /** + * Callback function to receive the result of the filmsGet operation. + * @callback module:api/DefaultApi~filmsGetCallback + * @param {String} error Error message, if any. + * @param {Array.} data The data returned by the service call. + * @param {String} response The complete HTTP response. + */ + + /** + * Get Films + * @param {Object} opts Optional parameters + * @param {Number} [limit = 10)] Number of films to return + * @param {String} [genre] Genre to filter by + * @param {String} [country] Country to filter by + * @param {String} [offer] Offer to filter by + * @param {module:api/DefaultApi~filmsGetCallback} callback The callback function, accepting three arguments: error, data, response + * data is of type: {@link Array.} + */ + filmsGet(opts, callback) { + opts = opts || {}; + let postBody = null; + + let pathParams = { + }; + let queryParams = { + 'limit': opts['limit'], + 'genre': opts['genre'], + 'country': opts['country'], + 'offer': opts['offer'] + }; + let headerParams = { + }; + let formParams = { + }; + + let authNames = []; + let contentTypes = []; + let accepts = ['application/json']; + let returnType = [Object]; + return this.apiClient.callApi( + '/films', 'GET', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, null, callback + ); + } + + /** + * Callback function to receive the result of the filmsIdGet operation. + * @callback module:api/DefaultApi~filmsIdGetCallback + * @param {String} error Error message, if any. + * @param {module:model/Film} data The data returned by the service call. + * @param {String} response The complete HTTP response. + */ + + /** + * Get Film + * @param {Number} id id + * @param {module:api/DefaultApi~filmsIdGetCallback} callback The callback function, accepting three arguments: error, data, response + * data is of type: {@link module:model/Film} + */ + filmsIdGet(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 filmsIdGet"); + } + + let pathParams = { + 'id': id + }; + let queryParams = { + }; + let headerParams = { + }; + let formParams = { + }; + + let authNames = []; + let contentTypes = []; + let accepts = ['application/json']; + let returnType = Film; + return this.apiClient.callApi( + '/films/{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 new file mode 100644 index 0000000..94c35eb --- /dev/null +++ b/js/src/index.js @@ -0,0 +1,118 @@ +/** + * 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 ArrayOfDirectors from './model/ArrayOfDirectors'; +import ArrayOfFilms from './model/ArrayOfFilms'; +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 DefaultApi from './api/DefaultApi'; + + +/** +* JS API client generated by OpenAPI Generator.
+* The index module provides access to constructors for all the classes which comprise the public API. +*

+* An AMD (recommended!) or CommonJS application will generally do something equivalent to the following: +*

+* var LetsrolldApi = require('index'); // See note below*.
+* var xxxSvc = new LetsrolldApi.XxxApi(); // Allocate the API class we're going to use.
+* var yyyModel = new LetsrolldApi.Yyy(); // Construct a model instance.
+* yyyModel.someProperty = 'someValue';
+* ...
+* var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.
+* ...
+* 
+* *NOTE: For a top-level AMD script, use require(['index'], function(){...}) +* and put the application logic within the callback function. +*

+*

+* A non-AMD browser application (discouraged) might do something like this: +*

+* var xxxSvc = new LetsrolldApi.XxxApi(); // Allocate the API class we're going to use.
+* var yyy = new LetsrolldApi.Yyy(); // Construct a model instance.
+* yyyModel.someProperty = 'someValue';
+* ...
+* var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.
+* ...
+* 
+*

+* @module index +* @version 0.1 +*/ +export { + /** + * The ApiClient constructor. + * @property {module:ApiClient} + */ + ApiClient, + + /** + * The ArrayOfDirectors model constructor. + * @property {module:model/ArrayOfDirectors} + */ + ArrayOfDirectors, + + /** + * The ArrayOfFilms model constructor. + * @property {module:model/ArrayOfFilms} + */ + ArrayOfFilms, + + /** + * The Director model constructor. + * @property {module:model/Director} + */ + Director, + + /** + * The DirectorFilmsInner model constructor. + * @property {module:model/DirectorFilmsInner} + */ + DirectorFilmsInner, + + /** + * The DirectorFilmsInnerCountriesInner model constructor. + * @property {module:model/DirectorFilmsInnerCountriesInner} + */ + DirectorFilmsInnerCountriesInner, + + /** + * The DirectorFilmsInnerOffersInner model constructor. + * @property {module:model/DirectorFilmsInnerOffersInner} + */ + DirectorFilmsInnerOffersInner, + + /** + * The DirectorInfo model constructor. + * @property {module:model/DirectorInfo} + */ + DirectorInfo, + + /** + * The Film model constructor. + * @property {module:model/Film} + */ + Film, + + /** + * The DefaultApi service constructor. + * @property {module:api/DefaultApi} + */ + DefaultApi +}; diff --git a/js/src/model/ArrayOfDirectors.js b/js/src/model/ArrayOfDirectors.js new file mode 100644 index 0000000..cb1c85b --- /dev/null +++ b/js/src/model/ArrayOfDirectors.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 ArrayOfDirectors model module. + * @module model/ArrayOfDirectors + * @version 0.1 + */ +class ArrayOfDirectors extends Array { + /** + * Constructs a new ArrayOfDirectors. + * @alias module:model/ArrayOfDirectors + * @extends Array + */ + constructor() { + super(); + + + ArrayOfDirectors.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 ArrayOfDirectors 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/ArrayOfDirectors} obj Optional instance to populate. + * @return {module:model/ArrayOfDirectors} The populated ArrayOfDirectors instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ArrayOfDirectors(); + + ApiClient.constructFromObject(data, obj, 'Object'); + + + } + return obj; + } + + /** + * Validates the JSON data with respect to ArrayOfDirectors. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArrayOfDirectors. + */ + static validateJSON(data) { + + return true; + } + + +} + + + + + + + + +export default ArrayOfDirectors; + diff --git a/js/src/model/ArrayOfFilms.js b/js/src/model/ArrayOfFilms.js new file mode 100644 index 0000000..4003f85 --- /dev/null +++ b/js/src/model/ArrayOfFilms.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 ArrayOfFilms model module. + * @module model/ArrayOfFilms + * @version 0.1 + */ +class ArrayOfFilms extends Array { + /** + * Constructs a new ArrayOfFilms. + * @alias module:model/ArrayOfFilms + * @extends Array + */ + constructor() { + super(); + + + ArrayOfFilms.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 ArrayOfFilms 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/ArrayOfFilms} obj Optional instance to populate. + * @return {module:model/ArrayOfFilms} The populated ArrayOfFilms instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ArrayOfFilms(); + + ApiClient.constructFromObject(data, obj, 'Object'); + + + } + return obj; + } + + /** + * Validates the JSON data with respect to ArrayOfFilms. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ArrayOfFilms. + */ + static validateJSON(data) { + + return true; + } + + +} + + + + + + + + +export default ArrayOfFilms; + diff --git a/js/src/model/Director.js b/js/src/model/Director.js new file mode 100644 index 0000000..c7857a7 --- /dev/null +++ b/js/src/model/Director.js @@ -0,0 +1,115 @@ +/** + * 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'; +import DirectorInfo from './DirectorInfo'; + +/** + * The Director model module. + * @module model/Director + * @version 0.1 + */ +class Director { + /** + * Constructs a new Director. + * @alias module:model/Director + * @param info {module:model/DirectorInfo} + */ + constructor(info) { + + Director.initialize(this, info); + } + + /** + * 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, info) { + obj['info'] = info; + } + + /** + * Constructs a Director 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/Director} obj Optional instance to populate. + * @return {module:model/Director} The populated Director instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Director(); + + if (data.hasOwnProperty('info')) { + obj['info'] = DirectorInfo.constructFromObject(data['info']); + } + if (data.hasOwnProperty('films')) { + obj['films'] = ApiClient.convertToType(data['films'], [DirectorFilmsInner]); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to Director. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to Director. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of Director.RequiredProperties) { + if (!data[property]) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // validate the optional field `info` + if (data['info']) { // data not null + DirectorInfo.validateJSON(data['info']); + } + 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; + } + + +} + +Director.RequiredProperties = ["info"]; + +/** + * @member {module:model/DirectorInfo} info + */ +Director.prototype['info'] = undefined; + +/** + * @member {Array.} films + */ +Director.prototype['films'] = undefined; + + + + + + +export default Director; + diff --git a/js/src/model/DirectorFilmsInner.js b/js/src/model/DirectorFilmsInner.js new file mode 100644 index 0000000..dca5063 --- /dev/null +++ b/js/src/model/DirectorFilmsInner.js @@ -0,0 +1,248 @@ +/** + * 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 DirectorFilmsInnerCountriesInner from './DirectorFilmsInnerCountriesInner'; +import DirectorFilmsInnerOffersInner from './DirectorFilmsInnerOffersInner'; +import DirectorInfo from './DirectorInfo'; + +/** + * The DirectorFilmsInner model module. + * @module model/DirectorFilmsInner + * @version 0.1 + */ +class DirectorFilmsInner { + /** + * Constructs a new DirectorFilmsInner. + * @alias module:model/DirectorFilmsInner + * @param title {String} + */ + constructor(title) { + + DirectorFilmsInner.initialize(this, title); + } + + /** + * 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, title) { + obj['title'] = title; + } + + /** + * Constructs a DirectorFilmsInner 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/DirectorFilmsInner} obj Optional instance to populate. + * @return {module:model/DirectorFilmsInner} The populated DirectorFilmsInner instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new DirectorFilmsInner(); + + if (data.hasOwnProperty('id')) { + obj['id'] = ApiClient.convertToType(data['id'], 'Number'); + } + if (data.hasOwnProperty('title')) { + obj['title'] = ApiClient.convertToType(data['title'], 'String'); + } + if (data.hasOwnProperty('description')) { + obj['description'] = ApiClient.convertToType(data['description'], 'String'); + } + if (data.hasOwnProperty('year')) { + obj['year'] = ApiClient.convertToType(data['year'], 'Number'); + } + if (data.hasOwnProperty('rating')) { + obj['rating'] = ApiClient.convertToType(data['rating'], 'String'); + } + if (data.hasOwnProperty('runtime')) { + obj['runtime'] = ApiClient.convertToType(data['runtime'], 'Number'); + } + if (data.hasOwnProperty('lb_url')) { + obj['lb_url'] = ApiClient.convertToType(data['lb_url'], 'String'); + } + if (data.hasOwnProperty('jw_url')) { + obj['jw_url'] = ApiClient.convertToType(data['jw_url'], 'String'); + } + if (data.hasOwnProperty('trailer_url')) { + obj['trailer_url'] = ApiClient.convertToType(data['trailer_url'], 'String'); + } + if (data.hasOwnProperty('genres')) { + obj['genres'] = ApiClient.convertToType(data['genres'], ['String']); + } + if (data.hasOwnProperty('countries')) { + obj['countries'] = ApiClient.convertToType(data['countries'], [DirectorFilmsInnerCountriesInner]); + } + if (data.hasOwnProperty('offers')) { + obj['offers'] = ApiClient.convertToType(data['offers'], [DirectorFilmsInnerOffersInner]); + } + if (data.hasOwnProperty('directors')) { + obj['directors'] = ApiClient.convertToType(data['directors'], [DirectorInfo]); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to DirectorFilmsInner. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to DirectorFilmsInner. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of DirectorFilmsInner.RequiredProperties) { + if (!data[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['title'] && !(typeof data['title'] === 'string' || data['title'] instanceof String)) { + throw new Error("Expected the field `title` to be a primitive type in the JSON string but got " + data['title']); + } + // ensure the json data is a string + if (data['description'] && !(typeof data['description'] === 'string' || data['description'] instanceof String)) { + throw new Error("Expected the field `description` to be a primitive type in the JSON string but got " + data['description']); + } + // ensure the json data is a string + if (data['rating'] && !(typeof data['rating'] === 'string' || data['rating'] instanceof String)) { + throw new Error("Expected the field `rating` to be a primitive type in the JSON string but got " + data['rating']); + } + // ensure the json data is a string + if (data['lb_url'] && !(typeof data['lb_url'] === 'string' || data['lb_url'] instanceof String)) { + throw new Error("Expected the field `lb_url` to be a primitive type in the JSON string but got " + data['lb_url']); + } + // ensure the json data is a string + if (data['jw_url'] && !(typeof data['jw_url'] === 'string' || data['jw_url'] instanceof String)) { + throw new Error("Expected the field `jw_url` to be a primitive type in the JSON string but got " + data['jw_url']); + } + // ensure the json data is a string + if (data['trailer_url'] && !(typeof data['trailer_url'] === 'string' || data['trailer_url'] instanceof String)) { + throw new Error("Expected the field `trailer_url` to be a primitive type in the JSON string but got " + data['trailer_url']); + } + // ensure the json data is an array + if (!Array.isArray(data['genres'])) { + throw new Error("Expected the field `genres` to be an array in the JSON data but got " + data['genres']); + } + if (data['countries']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['countries'])) { + throw new Error("Expected the field `countries` to be an array in the JSON data but got " + data['countries']); + } + // validate the optional field `countries` (array) + for (const item of data['countries']) { + DirectorFilmsInnerCountriesInner.validateJSON(item); + }; + } + if (data['offers']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['offers'])) { + throw new Error("Expected the field `offers` to be an array in the JSON data but got " + data['offers']); + } + // validate the optional field `offers` (array) + for (const item of data['offers']) { + DirectorFilmsInnerOffersInner.validateJSON(item); + }; + } + if (data['directors']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['directors'])) { + throw new Error("Expected the field `directors` to be an array in the JSON data but got " + data['directors']); + } + // validate the optional field `directors` (array) + for (const item of data['directors']) { + DirectorInfo.validateJSON(item); + }; + } + + return true; + } + + +} + +DirectorFilmsInner.RequiredProperties = ["title"]; + +/** + * @member {Number} id + */ +DirectorFilmsInner.prototype['id'] = undefined; + +/** + * @member {String} title + */ +DirectorFilmsInner.prototype['title'] = undefined; + +/** + * @member {String} description + */ +DirectorFilmsInner.prototype['description'] = undefined; + +/** + * @member {Number} year + */ +DirectorFilmsInner.prototype['year'] = undefined; + +/** + * @member {String} rating + */ +DirectorFilmsInner.prototype['rating'] = undefined; + +/** + * @member {Number} runtime + */ +DirectorFilmsInner.prototype['runtime'] = undefined; + +/** + * @member {String} lb_url + */ +DirectorFilmsInner.prototype['lb_url'] = undefined; + +/** + * @member {String} jw_url + */ +DirectorFilmsInner.prototype['jw_url'] = undefined; + +/** + * @member {String} trailer_url + */ +DirectorFilmsInner.prototype['trailer_url'] = undefined; + +/** + * @member {Array.} genres + */ +DirectorFilmsInner.prototype['genres'] = undefined; + +/** + * @member {Array.} countries + */ +DirectorFilmsInner.prototype['countries'] = undefined; + +/** + * @member {Array.} offers + */ +DirectorFilmsInner.prototype['offers'] = undefined; + +/** + * @member {Array.} directors + */ +DirectorFilmsInner.prototype['directors'] = undefined; + + + + + + +export default DirectorFilmsInner; + diff --git a/js/src/model/DirectorFilmsInnerCountriesInner.js b/js/src/model/DirectorFilmsInnerCountriesInner.js new file mode 100644 index 0000000..7a7205a --- /dev/null +++ b/js/src/model/DirectorFilmsInnerCountriesInner.js @@ -0,0 +1,107 @@ +/** + * 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 DirectorFilmsInnerCountriesInner model module. + * @module model/DirectorFilmsInnerCountriesInner + * @version 0.1 + */ +class DirectorFilmsInnerCountriesInner { + /** + * Constructs a new DirectorFilmsInnerCountriesInner. + * @alias module:model/DirectorFilmsInnerCountriesInner + * @param name {String} + */ + constructor(name) { + + DirectorFilmsInnerCountriesInner.initialize(this, 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, name) { + obj['name'] = name; + } + + /** + * Constructs a DirectorFilmsInnerCountriesInner 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/DirectorFilmsInnerCountriesInner} obj Optional instance to populate. + * @return {module:model/DirectorFilmsInnerCountriesInner} The populated DirectorFilmsInnerCountriesInner instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new DirectorFilmsInnerCountriesInner(); + + if (data.hasOwnProperty('name')) { + obj['name'] = ApiClient.convertToType(data['name'], 'String'); + } + if (data.hasOwnProperty('flag')) { + obj['flag'] = ApiClient.convertToType(data['flag'], 'String'); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to DirectorFilmsInnerCountriesInner. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to DirectorFilmsInnerCountriesInner. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of DirectorFilmsInnerCountriesInner.RequiredProperties) { + if (!data[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']); + } + // ensure the json data is a string + if (data['flag'] && !(typeof data['flag'] === 'string' || data['flag'] instanceof String)) { + throw new Error("Expected the field `flag` to be a primitive type in the JSON string but got " + data['flag']); + } + + return true; + } + + +} + +DirectorFilmsInnerCountriesInner.RequiredProperties = ["name"]; + +/** + * @member {String} name + */ +DirectorFilmsInnerCountriesInner.prototype['name'] = undefined; + +/** + * @member {String} flag + */ +DirectorFilmsInnerCountriesInner.prototype['flag'] = undefined; + + + + + + +export default DirectorFilmsInnerCountriesInner; + diff --git a/js/src/model/DirectorFilmsInnerOffersInner.js b/js/src/model/DirectorFilmsInnerOffersInner.js new file mode 100644 index 0000000..d53741f --- /dev/null +++ b/js/src/model/DirectorFilmsInnerOffersInner.js @@ -0,0 +1,109 @@ +/** + * 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 DirectorFilmsInnerOffersInner model module. + * @module model/DirectorFilmsInnerOffersInner + * @version 0.1 + */ +class DirectorFilmsInnerOffersInner { + /** + * Constructs a new DirectorFilmsInnerOffersInner. + * @alias module:model/DirectorFilmsInnerOffersInner + * @param name {String} + * @param url {String} + */ + constructor(name, url) { + + DirectorFilmsInnerOffersInner.initialize(this, name, url); + } + + /** + * 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, url) { + obj['name'] = name; + obj['url'] = url; + } + + /** + * Constructs a DirectorFilmsInnerOffersInner 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/DirectorFilmsInnerOffersInner} obj Optional instance to populate. + * @return {module:model/DirectorFilmsInnerOffersInner} The populated DirectorFilmsInnerOffersInner instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new DirectorFilmsInnerOffersInner(); + + if (data.hasOwnProperty('name')) { + obj['name'] = ApiClient.convertToType(data['name'], 'String'); + } + if (data.hasOwnProperty('url')) { + obj['url'] = ApiClient.convertToType(data['url'], 'String'); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to DirectorFilmsInnerOffersInner. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to DirectorFilmsInnerOffersInner. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of DirectorFilmsInnerOffersInner.RequiredProperties) { + if (!data[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']); + } + // ensure the json data is a string + if (data['url'] && !(typeof data['url'] === 'string' || data['url'] instanceof String)) { + throw new Error("Expected the field `url` to be a primitive type in the JSON string but got " + data['url']); + } + + return true; + } + + +} + +DirectorFilmsInnerOffersInner.RequiredProperties = ["name", "url"]; + +/** + * @member {String} name + */ +DirectorFilmsInnerOffersInner.prototype['name'] = undefined; + +/** + * @member {String} url + */ +DirectorFilmsInnerOffersInner.prototype['url'] = undefined; + + + + + + +export default DirectorFilmsInnerOffersInner; + diff --git a/js/src/model/DirectorInfo.js b/js/src/model/DirectorInfo.js new file mode 100644 index 0000000..d907fbc --- /dev/null +++ b/js/src/model/DirectorInfo.js @@ -0,0 +1,117 @@ +/** + * 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 DirectorInfo model module. + * @module model/DirectorInfo + * @version 0.1 + */ +class DirectorInfo { + /** + * Constructs a new DirectorInfo. + * @alias module:model/DirectorInfo + * @param id {Number} + * @param name {String} + */ + constructor(id, name) { + + DirectorInfo.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 DirectorInfo 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/DirectorInfo} obj Optional instance to populate. + * @return {module:model/DirectorInfo} The populated DirectorInfo instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new DirectorInfo(); + + 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('lb_url')) { + obj['lb_url'] = ApiClient.convertToType(data['lb_url'], 'String'); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to DirectorInfo. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to DirectorInfo. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of DirectorInfo.RequiredProperties) { + if (!data[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']); + } + // ensure the json data is a string + if (data['lb_url'] && !(typeof data['lb_url'] === 'string' || data['lb_url'] instanceof String)) { + throw new Error("Expected the field `lb_url` to be a primitive type in the JSON string but got " + data['lb_url']); + } + + return true; + } + + +} + +DirectorInfo.RequiredProperties = ["id", "name"]; + +/** + * @member {Number} id + */ +DirectorInfo.prototype['id'] = undefined; + +/** + * @member {String} name + */ +DirectorInfo.prototype['name'] = undefined; + +/** + * @member {String} lb_url + */ +DirectorInfo.prototype['lb_url'] = undefined; + + + + + + +export default DirectorInfo; + diff --git a/js/src/model/Film.js b/js/src/model/Film.js new file mode 100644 index 0000000..037b19b --- /dev/null +++ b/js/src/model/Film.js @@ -0,0 +1,248 @@ +/** + * 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 DirectorFilmsInnerCountriesInner from './DirectorFilmsInnerCountriesInner'; +import DirectorFilmsInnerOffersInner from './DirectorFilmsInnerOffersInner'; +import DirectorInfo from './DirectorInfo'; + +/** + * The Film model module. + * @module model/Film + * @version 0.1 + */ +class Film { + /** + * Constructs a new Film. + * @alias module:model/Film + * @param title {String} + */ + constructor(title) { + + Film.initialize(this, title); + } + + /** + * 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, title) { + obj['title'] = title; + } + + /** + * Constructs a Film 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/Film} obj Optional instance to populate. + * @return {module:model/Film} The populated Film instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Film(); + + if (data.hasOwnProperty('id')) { + obj['id'] = ApiClient.convertToType(data['id'], 'Number'); + } + if (data.hasOwnProperty('title')) { + obj['title'] = ApiClient.convertToType(data['title'], 'String'); + } + if (data.hasOwnProperty('description')) { + obj['description'] = ApiClient.convertToType(data['description'], 'String'); + } + if (data.hasOwnProperty('year')) { + obj['year'] = ApiClient.convertToType(data['year'], 'Number'); + } + if (data.hasOwnProperty('rating')) { + obj['rating'] = ApiClient.convertToType(data['rating'], 'String'); + } + if (data.hasOwnProperty('runtime')) { + obj['runtime'] = ApiClient.convertToType(data['runtime'], 'Number'); + } + if (data.hasOwnProperty('lb_url')) { + obj['lb_url'] = ApiClient.convertToType(data['lb_url'], 'String'); + } + if (data.hasOwnProperty('jw_url')) { + obj['jw_url'] = ApiClient.convertToType(data['jw_url'], 'String'); + } + if (data.hasOwnProperty('trailer_url')) { + obj['trailer_url'] = ApiClient.convertToType(data['trailer_url'], 'String'); + } + if (data.hasOwnProperty('genres')) { + obj['genres'] = ApiClient.convertToType(data['genres'], ['String']); + } + if (data.hasOwnProperty('countries')) { + obj['countries'] = ApiClient.convertToType(data['countries'], [DirectorFilmsInnerCountriesInner]); + } + if (data.hasOwnProperty('offers')) { + obj['offers'] = ApiClient.convertToType(data['offers'], [DirectorFilmsInnerOffersInner]); + } + if (data.hasOwnProperty('directors')) { + obj['directors'] = ApiClient.convertToType(data['directors'], [DirectorInfo]); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to Film. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to Film. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of Film.RequiredProperties) { + if (!data[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['title'] && !(typeof data['title'] === 'string' || data['title'] instanceof String)) { + throw new Error("Expected the field `title` to be a primitive type in the JSON string but got " + data['title']); + } + // ensure the json data is a string + if (data['description'] && !(typeof data['description'] === 'string' || data['description'] instanceof String)) { + throw new Error("Expected the field `description` to be a primitive type in the JSON string but got " + data['description']); + } + // ensure the json data is a string + if (data['rating'] && !(typeof data['rating'] === 'string' || data['rating'] instanceof String)) { + throw new Error("Expected the field `rating` to be a primitive type in the JSON string but got " + data['rating']); + } + // ensure the json data is a string + if (data['lb_url'] && !(typeof data['lb_url'] === 'string' || data['lb_url'] instanceof String)) { + throw new Error("Expected the field `lb_url` to be a primitive type in the JSON string but got " + data['lb_url']); + } + // ensure the json data is a string + if (data['jw_url'] && !(typeof data['jw_url'] === 'string' || data['jw_url'] instanceof String)) { + throw new Error("Expected the field `jw_url` to be a primitive type in the JSON string but got " + data['jw_url']); + } + // ensure the json data is a string + if (data['trailer_url'] && !(typeof data['trailer_url'] === 'string' || data['trailer_url'] instanceof String)) { + throw new Error("Expected the field `trailer_url` to be a primitive type in the JSON string but got " + data['trailer_url']); + } + // ensure the json data is an array + if (!Array.isArray(data['genres'])) { + throw new Error("Expected the field `genres` to be an array in the JSON data but got " + data['genres']); + } + if (data['countries']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['countries'])) { + throw new Error("Expected the field `countries` to be an array in the JSON data but got " + data['countries']); + } + // validate the optional field `countries` (array) + for (const item of data['countries']) { + DirectorFilmsInnerCountriesInner.validateJSON(item); + }; + } + if (data['offers']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['offers'])) { + throw new Error("Expected the field `offers` to be an array in the JSON data but got " + data['offers']); + } + // validate the optional field `offers` (array) + for (const item of data['offers']) { + DirectorFilmsInnerOffersInner.validateJSON(item); + }; + } + if (data['directors']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['directors'])) { + throw new Error("Expected the field `directors` to be an array in the JSON data but got " + data['directors']); + } + // validate the optional field `directors` (array) + for (const item of data['directors']) { + DirectorInfo.validateJSON(item); + }; + } + + return true; + } + + +} + +Film.RequiredProperties = ["title"]; + +/** + * @member {Number} id + */ +Film.prototype['id'] = undefined; + +/** + * @member {String} title + */ +Film.prototype['title'] = undefined; + +/** + * @member {String} description + */ +Film.prototype['description'] = undefined; + +/** + * @member {Number} year + */ +Film.prototype['year'] = undefined; + +/** + * @member {String} rating + */ +Film.prototype['rating'] = undefined; + +/** + * @member {Number} runtime + */ +Film.prototype['runtime'] = undefined; + +/** + * @member {String} lb_url + */ +Film.prototype['lb_url'] = undefined; + +/** + * @member {String} jw_url + */ +Film.prototype['jw_url'] = undefined; + +/** + * @member {String} trailer_url + */ +Film.prototype['trailer_url'] = undefined; + +/** + * @member {Array.} genres + */ +Film.prototype['genres'] = undefined; + +/** + * @member {Array.} countries + */ +Film.prototype['countries'] = undefined; + +/** + * @member {Array.} offers + */ +Film.prototype['offers'] = undefined; + +/** + * @member {Array.} directors + */ +Film.prototype['directors'] = undefined; + + + + + + +export default Film; + diff --git a/js/test/api/DefaultApi.spec.js b/js/test/api/DefaultApi.spec.js new file mode 100644 index 0000000..9193569 --- /dev/null +++ b/js/test/api/DefaultApi.spec.js @@ -0,0 +1,93 @@ +/** + * 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.DefaultApi(); + }); + + 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('DefaultApi', function() { + describe('directorsGet', function() { + it('should call directorsGet successfully', function(done) { + //uncomment below and update the code to test directorsGet + //instance.directorsGet(function(error) { + // if (error) throw error; + //expect().to.be(); + //}); + done(); + }); + }); + describe('directorsIdGet', function() { + it('should call directorsIdGet successfully', function(done) { + //uncomment below and update the code to test directorsIdGet + //instance.directorsIdGet(function(error) { + // if (error) throw error; + //expect().to.be(); + //}); + done(); + }); + }); + describe('filmsGet', function() { + it('should call filmsGet successfully', function(done) { + //uncomment below and update the code to test filmsGet + //instance.filmsGet(function(error) { + // if (error) throw error; + //expect().to.be(); + //}); + done(); + }); + }); + describe('filmsIdGet', function() { + it('should call filmsIdGet successfully', function(done) { + //uncomment below and update the code to test filmsIdGet + //instance.filmsIdGet(function(error) { + // if (error) throw error; + //expect().to.be(); + //}); + done(); + }); + }); + }); + +})); diff --git a/js/test/model/ArrayOfDirectors.spec.js b/js/test/model/ArrayOfDirectors.spec.js new file mode 100644 index 0000000..dee3e70 --- /dev/null +++ b/js/test/model/ArrayOfDirectors.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.ArrayOfDirectors(); + }); + + 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('ArrayOfDirectors', function() { + it('should create an instance of ArrayOfDirectors', function() { + // uncomment below and update the code to test ArrayOfDirectors + //var instance = new LetsrolldApi.ArrayOfDirectors(); + //expect(instance).to.be.a(LetsrolldApi.ArrayOfDirectors); + }); + + }); + +})); diff --git a/js/test/model/ArrayOfFilms.spec.js b/js/test/model/ArrayOfFilms.spec.js new file mode 100644 index 0000000..99da77b --- /dev/null +++ b/js/test/model/ArrayOfFilms.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.ArrayOfFilms(); + }); + + 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('ArrayOfFilms', function() { + it('should create an instance of ArrayOfFilms', function() { + // uncomment below and update the code to test ArrayOfFilms + //var instance = new LetsrolldApi.ArrayOfFilms(); + //expect(instance).to.be.a(LetsrolldApi.ArrayOfFilms); + }); + + }); + +})); diff --git a/js/test/model/Director.spec.js b/js/test/model/Director.spec.js new file mode 100644 index 0000000..6a45860 --- /dev/null +++ b/js/test/model/Director.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.Director(); + }); + + 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('Director', function() { + it('should create an instance of Director', function() { + // uncomment below and update the code to test Director + //var instance = new LetsrolldApi.Director(); + //expect(instance).to.be.a(LetsrolldApi.Director); + }); + + it('should have the property info (base name: "info")', function() { + // uncomment below and update the code to test the property info + //var instance = new LetsrolldApi.Director(); + //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.Director(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/js/test/model/DirectorFilmsInner.spec.js b/js/test/model/DirectorFilmsInner.spec.js new file mode 100644 index 0000000..a3e4eae --- /dev/null +++ b/js/test/model/DirectorFilmsInner.spec.js @@ -0,0 +1,137 @@ +/** + * 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.DirectorFilmsInner(); + }); + + 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('DirectorFilmsInner', function() { + it('should create an instance of DirectorFilmsInner', function() { + // uncomment below and update the code to test DirectorFilmsInner + //var instance = new LetsrolldApi.DirectorFilmsInner(); + //expect(instance).to.be.a(LetsrolldApi.DirectorFilmsInner); + }); + + 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.DirectorFilmsInner(); + //expect(instance).to.be(); + }); + + it('should have the property title (base name: "title")', function() { + // uncomment below and update the code to test the property title + //var instance = new LetsrolldApi.DirectorFilmsInner(); + //expect(instance).to.be(); + }); + + it('should have the property description (base name: "description")', function() { + // uncomment below and update the code to test the property description + //var instance = new LetsrolldApi.DirectorFilmsInner(); + //expect(instance).to.be(); + }); + + it('should have the property year (base name: "year")', function() { + // uncomment below and update the code to test the property year + //var instance = new LetsrolldApi.DirectorFilmsInner(); + //expect(instance).to.be(); + }); + + it('should have the property rating (base name: "rating")', function() { + // uncomment below and update the code to test the property rating + //var instance = new LetsrolldApi.DirectorFilmsInner(); + //expect(instance).to.be(); + }); + + it('should have the property runtime (base name: "runtime")', function() { + // uncomment below and update the code to test the property runtime + //var instance = new LetsrolldApi.DirectorFilmsInner(); + //expect(instance).to.be(); + }); + + it('should have the property lbUrl (base name: "lb_url")', function() { + // uncomment below and update the code to test the property lbUrl + //var instance = new LetsrolldApi.DirectorFilmsInner(); + //expect(instance).to.be(); + }); + + it('should have the property jwUrl (base name: "jw_url")', function() { + // uncomment below and update the code to test the property jwUrl + //var instance = new LetsrolldApi.DirectorFilmsInner(); + //expect(instance).to.be(); + }); + + it('should have the property trailerUrl (base name: "trailer_url")', function() { + // uncomment below and update the code to test the property trailerUrl + //var instance = new LetsrolldApi.DirectorFilmsInner(); + //expect(instance).to.be(); + }); + + it('should have the property genres (base name: "genres")', function() { + // uncomment below and update the code to test the property genres + //var instance = new LetsrolldApi.DirectorFilmsInner(); + //expect(instance).to.be(); + }); + + it('should have the property countries (base name: "countries")', function() { + // uncomment below and update the code to test the property countries + //var instance = new LetsrolldApi.DirectorFilmsInner(); + //expect(instance).to.be(); + }); + + it('should have the property offers (base name: "offers")', function() { + // uncomment below and update the code to test the property offers + //var instance = new LetsrolldApi.DirectorFilmsInner(); + //expect(instance).to.be(); + }); + + it('should have the property directors (base name: "directors")', function() { + // uncomment below and update the code to test the property directors + //var instance = new LetsrolldApi.DirectorFilmsInner(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/js/test/model/DirectorFilmsInnerCountriesInner.spec.js b/js/test/model/DirectorFilmsInnerCountriesInner.spec.js new file mode 100644 index 0000000..5bba490 --- /dev/null +++ b/js/test/model/DirectorFilmsInnerCountriesInner.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.DirectorFilmsInnerCountriesInner(); + }); + + 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('DirectorFilmsInnerCountriesInner', function() { + it('should create an instance of DirectorFilmsInnerCountriesInner', function() { + // uncomment below and update the code to test DirectorFilmsInnerCountriesInner + //var instance = new LetsrolldApi.DirectorFilmsInnerCountriesInner(); + //expect(instance).to.be.a(LetsrolldApi.DirectorFilmsInnerCountriesInner); + }); + + 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.DirectorFilmsInnerCountriesInner(); + //expect(instance).to.be(); + }); + + it('should have the property flag (base name: "flag")', function() { + // uncomment below and update the code to test the property flag + //var instance = new LetsrolldApi.DirectorFilmsInnerCountriesInner(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/js/test/model/DirectorFilmsInnerOffersInner.spec.js b/js/test/model/DirectorFilmsInnerOffersInner.spec.js new file mode 100644 index 0000000..372d10c --- /dev/null +++ b/js/test/model/DirectorFilmsInnerOffersInner.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.DirectorFilmsInnerOffersInner(); + }); + + 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('DirectorFilmsInnerOffersInner', function() { + it('should create an instance of DirectorFilmsInnerOffersInner', function() { + // uncomment below and update the code to test DirectorFilmsInnerOffersInner + //var instance = new LetsrolldApi.DirectorFilmsInnerOffersInner(); + //expect(instance).to.be.a(LetsrolldApi.DirectorFilmsInnerOffersInner); + }); + + 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.DirectorFilmsInnerOffersInner(); + //expect(instance).to.be(); + }); + + it('should have the property url (base name: "url")', function() { + // uncomment below and update the code to test the property url + //var instance = new LetsrolldApi.DirectorFilmsInnerOffersInner(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/js/test/model/DirectorInfo.spec.js b/js/test/model/DirectorInfo.spec.js new file mode 100644 index 0000000..bbc43ab --- /dev/null +++ b/js/test/model/DirectorInfo.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.DirectorInfo(); + }); + + 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('DirectorInfo', function() { + it('should create an instance of DirectorInfo', function() { + // uncomment below and update the code to test DirectorInfo + //var instance = new LetsrolldApi.DirectorInfo(); + //expect(instance).to.be.a(LetsrolldApi.DirectorInfo); + }); + + 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.DirectorInfo(); + //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.DirectorInfo(); + //expect(instance).to.be(); + }); + + it('should have the property lbUrl (base name: "lb_url")', function() { + // uncomment below and update the code to test the property lbUrl + //var instance = new LetsrolldApi.DirectorInfo(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/js/test/model/Film.spec.js b/js/test/model/Film.spec.js new file mode 100644 index 0000000..c7077d1 --- /dev/null +++ b/js/test/model/Film.spec.js @@ -0,0 +1,137 @@ +/** + * 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.Film(); + }); + + 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('Film', function() { + it('should create an instance of Film', function() { + // uncomment below and update the code to test Film + //var instance = new LetsrolldApi.Film(); + //expect(instance).to.be.a(LetsrolldApi.Film); + }); + + 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.Film(); + //expect(instance).to.be(); + }); + + it('should have the property title (base name: "title")', function() { + // uncomment below and update the code to test the property title + //var instance = new LetsrolldApi.Film(); + //expect(instance).to.be(); + }); + + it('should have the property description (base name: "description")', function() { + // uncomment below and update the code to test the property description + //var instance = new LetsrolldApi.Film(); + //expect(instance).to.be(); + }); + + it('should have the property year (base name: "year")', function() { + // uncomment below and update the code to test the property year + //var instance = new LetsrolldApi.Film(); + //expect(instance).to.be(); + }); + + it('should have the property rating (base name: "rating")', function() { + // uncomment below and update the code to test the property rating + //var instance = new LetsrolldApi.Film(); + //expect(instance).to.be(); + }); + + it('should have the property runtime (base name: "runtime")', function() { + // uncomment below and update the code to test the property runtime + //var instance = new LetsrolldApi.Film(); + //expect(instance).to.be(); + }); + + it('should have the property lbUrl (base name: "lb_url")', function() { + // uncomment below and update the code to test the property lbUrl + //var instance = new LetsrolldApi.Film(); + //expect(instance).to.be(); + }); + + it('should have the property jwUrl (base name: "jw_url")', function() { + // uncomment below and update the code to test the property jwUrl + //var instance = new LetsrolldApi.Film(); + //expect(instance).to.be(); + }); + + it('should have the property trailerUrl (base name: "trailer_url")', function() { + // uncomment below and update the code to test the property trailerUrl + //var instance = new LetsrolldApi.Film(); + //expect(instance).to.be(); + }); + + it('should have the property genres (base name: "genres")', function() { + // uncomment below and update the code to test the property genres + //var instance = new LetsrolldApi.Film(); + //expect(instance).to.be(); + }); + + it('should have the property countries (base name: "countries")', function() { + // uncomment below and update the code to test the property countries + //var instance = new LetsrolldApi.Film(); + //expect(instance).to.be(); + }); + + it('should have the property offers (base name: "offers")', function() { + // uncomment below and update the code to test the property offers + //var instance = new LetsrolldApi.Film(); + //expect(instance).to.be(); + }); + + it('should have the property directors (base name: "directors")', function() { + // uncomment below and update the code to test the property directors + //var instance = new LetsrolldApi.Film(); + //expect(instance).to.be(); + }); + + }); + +}));