diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..c73df9d --- /dev/null +++ b/.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/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..e97d08e --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +version: 2 +updates: + - package-ecosystem: npm + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 diff --git a/.github/workflows/builder.yml b/.github/workflows/builder.yml new file mode 100644 index 0000000..b4eecf6 --- /dev/null +++ b/.github/workflows/builder.yml @@ -0,0 +1,60 @@ +name: builder + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + sdk: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Generate SDK + uses: openapi-generators/openapitools-generator-action@v1 + with: + generator: javascript + openapi-url: https://raw.githubusercontent.com/bavix/gripmock-openapi/master/api.yaml + command-args: -o . --package-name gripmock-sdk-js -c config.yaml + + - name: "Check if build has changed" + if: success() + id: has-changes + run: | + echo "stdout<> $GITHUB_OUTPUT + echo "$(git diff --stat)" >> $GITHUB_OUTPUT + echo 'EOF' >> $GITHUB_OUTPUT + + - name: "git add --all" + run: git add --all + + - name: Import GPG key + if: ${{ steps.has-changes.outputs.stdout }} + uses: crazy-max/ghaction-import-gpg@v6 + with: + gpg_private_key: ${{ secrets.GPG_BOT }} + passphrase: ${{ secrets.GPG_PASSPHRASE }} + fingerprint: ${{ secrets.GPG_FINGERPRINT }} + git_config_global: true + git_user_signingkey: true + git_commit_gpgsign: true + git_committer_name: Github bot + git_committer_email: bot@babichev.net + + - name: "Commit files" + if: ${{ steps.has-changes.outputs.stdout }} + env: + GH_TOKEN: ${{ secrets.BOT_TOKEN }} + run: | + gh pr checkout ${{ github.event.pull_request.number }} + git commit -S -m "sdk generated" -a + + - name: "Push changes" + if: ${{ steps.has-changes.outputs.stdout }} + env: + GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} + run: git push -u origin HEAD diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml new file mode 100644 index 0000000..11c615e --- /dev/null +++ b/.github/workflows/changelog.yml @@ -0,0 +1,14 @@ +name: update changelog + +on: + release: + types: [released] + +permissions: {} + +jobs: + changelog: + permissions: + contents: write + secrets: inherit + uses: bavix/.github/.github/workflows/changelog.yml@0.2.3 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..4d3b90b --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,23 @@ +name: Publish package to GitHub Packages +on: + release: + types: [published] +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + # Setup .npmrc file to publish to GitHub Packages + - uses: actions/setup-node@v3 + with: + node-version: '21.x' + registry-url: 'https://npm.pkg.github.com' + # Defaults to the user or organization that owns the workflow file + scope: '@bavix' + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index c6bba59..6a7d6d8 100644 --- a/.gitignore +++ b/.gitignore @@ -127,4 +127,4 @@ dist .yarn/unplugged .yarn/build-state.yml .yarn/install-state.gz -.pnp.* +.pnp.* \ No newline at end of file diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/.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/.openapi-generator/FILES b/.openapi-generator/FILES new file mode 100644 index 0000000..db9fda6 --- /dev/null +++ b/.openapi-generator/FILES @@ -0,0 +1,43 @@ +.babelrc +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +docs/AddStub200Response.md +docs/AddStubRequest.md +docs/HealthcheckApi.md +docs/MessageOK.md +docs/SearchRequest.md +docs/SearchResponse.md +docs/Stub.md +docs/StubHeaders.md +docs/StubInput.md +docs/StubOutput.md +docs/StubsApi.md +git_push.sh +mocha.opts +package.json +src/ApiClient.js +src/api/HealthcheckApi.js +src/api/StubsApi.js +src/index.js +src/model/AddStub200Response.js +src/model/AddStubRequest.js +src/model/MessageOK.js +src/model/SearchRequest.js +src/model/SearchResponse.js +src/model/Stub.js +src/model/StubHeaders.js +src/model/StubInput.js +src/model/StubOutput.js +test/api/HealthcheckApi.spec.js +test/api/StubsApi.spec.js +test/model/AddStub200Response.spec.js +test/model/AddStubRequest.spec.js +test/model/MessageOK.spec.js +test/model/SearchRequest.spec.js +test/model/SearchResponse.spec.js +test/model/Stub.spec.js +test/model/StubHeaders.spec.js +test/model/StubInput.spec.js +test/model/StubOutput.spec.js diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION new file mode 100644 index 0000000..c9e125b --- /dev/null +++ b/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.4.0-SNAPSHOT diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..0968f7a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +cache: npm +node_js: + - "6" + - "6.1" diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..bbe0c5c --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +gen-client: + # https://github.com/OpenAPITools/openapi-generator + openapi-generator generate -i https://raw.githubusercontent.com/bavix/gripmock-openapi/master/api.yaml -g javascript -o ./generated/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..c434bd4 --- /dev/null +++ b/README.md @@ -0,0 +1,150 @@ +# gripmock-sdk-js + +GripmockSdkJs - JavaScript client for gripmock-sdk-js +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: 2.4.0 +- Package version: 2.4.0 +- 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 gripmock-sdk-js --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 gripmock-sdk-js 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 GripmockSdkJs = require('gripmock-sdk-js'); + + +var api = new GripmockSdkJs.HealthcheckApi() +var callback = function(error, data, response) { + if (error) { + console.error(error); + } else { + console.log('API called successfully. Returned data: ' + data); + } +}; +api.liveness(callback); + +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://raw.githubusercontent.com/api* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*GripmockSdkJs.HealthcheckApi* | [**liveness**](docs/HealthcheckApi.md#liveness) | **GET** /health/liveness | Liveness check +*GripmockSdkJs.HealthcheckApi* | [**readiness**](docs/HealthcheckApi.md#readiness) | **GET** /health/readiness | Readiness check +*GripmockSdkJs.StubsApi* | [**addStub**](docs/StubsApi.md#addStub) | **POST** /stubs | Add a new stub to the store +*GripmockSdkJs.StubsApi* | [**batchStubsDelete**](docs/StubsApi.md#batchStubsDelete) | **POST** /stubs/batchDelete | Deletes a pack by IDs +*GripmockSdkJs.StubsApi* | [**deleteStubByID**](docs/StubsApi.md#deleteStubByID) | **DELETE** /stubs/{uuid} | Deletes stub by ID +*GripmockSdkJs.StubsApi* | [**listStubs**](docs/StubsApi.md#listStubs) | **GET** /stubs | Getting a list of stubs +*GripmockSdkJs.StubsApi* | [**listUnusedStubs**](docs/StubsApi.md#listUnusedStubs) | **GET** /stubs/unused | Getting a list of unused stubs +*GripmockSdkJs.StubsApi* | [**listUsedStubs**](docs/StubsApi.md#listUsedStubs) | **GET** /stubs/used | Getting a list of used stubs +*GripmockSdkJs.StubsApi* | [**purgeStubs**](docs/StubsApi.md#purgeStubs) | **DELETE** /stubs | Remove all stubs +*GripmockSdkJs.StubsApi* | [**searchStubs**](docs/StubsApi.md#searchStubs) | **POST** /stubs/search | Stub storage search + + +## Documentation for Models + + - [GripmockSdkJs.AddStub200Response](docs/AddStub200Response.md) + - [GripmockSdkJs.AddStubRequest](docs/AddStubRequest.md) + - [GripmockSdkJs.MessageOK](docs/MessageOK.md) + - [GripmockSdkJs.SearchRequest](docs/SearchRequest.md) + - [GripmockSdkJs.SearchResponse](docs/SearchResponse.md) + - [GripmockSdkJs.Stub](docs/Stub.md) + - [GripmockSdkJs.StubHeaders](docs/StubHeaders.md) + - [GripmockSdkJs.StubInput](docs/StubInput.md) + - [GripmockSdkJs.StubOutput](docs/StubOutput.md) + + +## Documentation for Authorization + +Endpoints do not require authorization. + diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000..e821c13 --- /dev/null +++ b/config.yaml @@ -0,0 +1,4 @@ +additionalProperties: + projectName: gripmock-sdk-js + projectVersion: 2.4.0 + licenseName: MIT \ No newline at end of file diff --git a/docs/AddStub200Response.md b/docs/AddStub200Response.md new file mode 100644 index 0000000..19b073d --- /dev/null +++ b/docs/AddStub200Response.md @@ -0,0 +1,8 @@ +# GripmockSdkJs.AddStub200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + diff --git a/docs/AddStubRequest.md b/docs/AddStubRequest.md new file mode 100644 index 0000000..21fd863 --- /dev/null +++ b/docs/AddStubRequest.md @@ -0,0 +1,14 @@ +# GripmockSdkJs.AddStubRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**service** | **String** | | +**method** | **String** | | +**headers** | [**StubHeaders**](StubHeaders.md) | | [optional] +**input** | [**StubInput**](StubInput.md) | | +**output** | [**StubOutput**](StubOutput.md) | | + + diff --git a/docs/HealthcheckApi.md b/docs/HealthcheckApi.md new file mode 100644 index 0000000..778ac1f --- /dev/null +++ b/docs/HealthcheckApi.md @@ -0,0 +1,92 @@ +# GripmockSdkJs.HealthcheckApi + +All URIs are relative to *https://raw.githubusercontent.com/api* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**liveness**](HealthcheckApi.md#liveness) | **GET** /health/liveness | Liveness check +[**readiness**](HealthcheckApi.md#readiness) | **GET** /health/readiness | Readiness check + + + +## liveness + +> MessageOK liveness() + +Liveness check + +The test says that the service is alive and yet + +### Example + +```javascript +import GripmockSdkJs from 'gripmock-sdk-js'; + +let apiInstance = new GripmockSdkJs.HealthcheckApi(); +apiInstance.liveness((error, data, response) => { + if (error) { + console.error(error); + } else { + console.log('API called successfully. Returned data: ' + data); + } +}); +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**MessageOK**](MessageOK.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## readiness + +> MessageOK readiness() + +Readiness check + +The test indicates readiness to receive traffic + +### Example + +```javascript +import GripmockSdkJs from 'gripmock-sdk-js'; + +let apiInstance = new GripmockSdkJs.HealthcheckApi(); +apiInstance.readiness((error, data, response) => { + if (error) { + console.error(error); + } else { + console.log('API called successfully. Returned data: ' + data); + } +}); +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**MessageOK**](MessageOK.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/docs/MessageOK.md b/docs/MessageOK.md new file mode 100644 index 0000000..a150903 --- /dev/null +++ b/docs/MessageOK.md @@ -0,0 +1,10 @@ +# GripmockSdkJs.MessageOK + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **String** | | +**time** | **Date** | | + + diff --git a/docs/SearchRequest.md b/docs/SearchRequest.md new file mode 100644 index 0000000..15056f7 --- /dev/null +++ b/docs/SearchRequest.md @@ -0,0 +1,13 @@ +# GripmockSdkJs.SearchRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**service** | **String** | | +**method** | **String** | | +**headers** | **{String: String}** | | [optional] +**data** | **{String: Object}** | | + + diff --git a/docs/SearchResponse.md b/docs/SearchResponse.md new file mode 100644 index 0000000..06b71b4 --- /dev/null +++ b/docs/SearchResponse.md @@ -0,0 +1,12 @@ +# GripmockSdkJs.SearchResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**headers** | **{String: String}** | | [optional] +**data** | **{String: Object}** | | +**error** | **String** | | +**code** | **Number** | | [optional] + + diff --git a/docs/Stub.md b/docs/Stub.md new file mode 100644 index 0000000..d3a5143 --- /dev/null +++ b/docs/Stub.md @@ -0,0 +1,14 @@ +# GripmockSdkJs.Stub + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**service** | **String** | | +**method** | **String** | | +**headers** | [**StubHeaders**](StubHeaders.md) | | [optional] +**input** | [**StubInput**](StubInput.md) | | +**output** | [**StubOutput**](StubOutput.md) | | + + diff --git a/docs/StubHeaders.md b/docs/StubHeaders.md new file mode 100644 index 0000000..14a48ca --- /dev/null +++ b/docs/StubHeaders.md @@ -0,0 +1,11 @@ +# GripmockSdkJs.StubHeaders + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**equals** | **{String: String}** | | [optional] +**contains** | **{String: String}** | | [optional] +**matches** | **{String: String}** | | [optional] + + diff --git a/docs/StubInput.md b/docs/StubInput.md new file mode 100644 index 0000000..082e038 --- /dev/null +++ b/docs/StubInput.md @@ -0,0 +1,12 @@ +# GripmockSdkJs.StubInput + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ignoreArrayOrder** | **Boolean** | | [optional] [default to false] +**equals** | **{String: Object}** | | [optional] +**contains** | **{String: Object}** | | [optional] +**matches** | **{String: Object}** | | [optional] + + diff --git a/docs/StubOutput.md b/docs/StubOutput.md new file mode 100644 index 0000000..cbcc133 --- /dev/null +++ b/docs/StubOutput.md @@ -0,0 +1,12 @@ +# GripmockSdkJs.StubOutput + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | **{String: Object}** | | +**headers** | **{String: String}** | | [optional] +**error** | **String** | | +**code** | **Number** | | [optional] + + diff --git a/docs/StubsApi.md b/docs/StubsApi.md new file mode 100644 index 0000000..eaf5039 --- /dev/null +++ b/docs/StubsApi.md @@ -0,0 +1,360 @@ +# GripmockSdkJs.StubsApi + +All URIs are relative to *https://raw.githubusercontent.com/api* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addStub**](StubsApi.md#addStub) | **POST** /stubs | Add a new stub to the store +[**batchStubsDelete**](StubsApi.md#batchStubsDelete) | **POST** /stubs/batchDelete | Deletes a pack by IDs +[**deleteStubByID**](StubsApi.md#deleteStubByID) | **DELETE** /stubs/{uuid} | Deletes stub by ID +[**listStubs**](StubsApi.md#listStubs) | **GET** /stubs | Getting a list of stubs +[**listUnusedStubs**](StubsApi.md#listUnusedStubs) | **GET** /stubs/unused | Getting a list of unused stubs +[**listUsedStubs**](StubsApi.md#listUsedStubs) | **GET** /stubs/used | Getting a list of used stubs +[**purgeStubs**](StubsApi.md#purgeStubs) | **DELETE** /stubs | Remove all stubs +[**searchStubs**](StubsApi.md#searchStubs) | **POST** /stubs/search | Stub storage search + + + +## addStub + +> AddStub200Response addStub(addStubRequest) + +Add a new stub to the store + +Add a new stub to the store + +### Example + +```javascript +import GripmockSdkJs from 'gripmock-sdk-js'; + +let apiInstance = new GripmockSdkJs.StubsApi(); +let addStubRequest = new GripmockSdkJs.AddStubRequest(); // AddStubRequest | Create a new pet in the store +apiInstance.addStub(addStubRequest, (error, data, response) => { + if (error) { + console.error(error); + } else { + console.log('API called successfully. Returned data: ' + data); + } +}); +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **addStubRequest** | [**AddStubRequest**](AddStubRequest.md)| Create a new pet in the store | + +### Return type + +[**AddStub200Response**](AddStub200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## batchStubsDelete + +> batchStubsDelete(requestBody) + +Deletes a pack by IDs + +Takes IDs as input and deletes them + +### Example + +```javascript +import GripmockSdkJs from 'gripmock-sdk-js'; + +let apiInstance = new GripmockSdkJs.StubsApi(); +let requestBody = ["51c50050-ec27-4dae-a583-a32ca71a1dd5"]; // [String] | Create a new pet in the store +apiInstance.batchStubsDelete(requestBody, (error, data, response) => { + if (error) { + console.error(error); + } else { + console.log('API called successfully.'); + } +}); +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | [**[String]**](String.md)| Create a new pet in the store | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## deleteStubByID + +> deleteStubByID(uuid) + +Deletes stub by ID + +The method removes the stub by ID + +### Example + +```javascript +import GripmockSdkJs from 'gripmock-sdk-js'; + +let apiInstance = new GripmockSdkJs.StubsApi(); +let uuid = "uuid_example"; // String | ID of stub +apiInstance.deleteStubByID(uuid, (error, data, response) => { + if (error) { + console.error(error); + } else { + console.log('API called successfully.'); + } +}); +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **uuid** | **String**| ID of stub | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## listStubs + +> [Stub] listStubs() + +Getting a list of stubs + +The list of stubs is required to view all added stubs + +### Example + +```javascript +import GripmockSdkJs from 'gripmock-sdk-js'; + +let apiInstance = new GripmockSdkJs.StubsApi(); +apiInstance.listStubs((error, data, response) => { + if (error) { + console.error(error); + } else { + console.log('API called successfully. Returned data: ' + data); + } +}); +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**[Stub]**](Stub.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## listUnusedStubs + +> [Stub] listUnusedStubs() + +Getting a list of unused stubs + +The list is needed to quickly find unused stubs + +### Example + +```javascript +import GripmockSdkJs from 'gripmock-sdk-js'; + +let apiInstance = new GripmockSdkJs.StubsApi(); +apiInstance.listUnusedStubs((error, data, response) => { + if (error) { + console.error(error); + } else { + console.log('API called successfully. Returned data: ' + data); + } +}); +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**[Stub]**](Stub.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## listUsedStubs + +> [Stub] listUsedStubs() + +Getting a list of used stubs + +The list is needed to quickly find used stubs + +### Example + +```javascript +import GripmockSdkJs from 'gripmock-sdk-js'; + +let apiInstance = new GripmockSdkJs.StubsApi(); +apiInstance.listUsedStubs((error, data, response) => { + if (error) { + console.error(error); + } else { + console.log('API called successfully. Returned data: ' + data); + } +}); +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**[Stub]**](Stub.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## purgeStubs + +> purgeStubs() + +Remove all stubs + +Completely clears the stub storage + +### Example + +```javascript +import GripmockSdkJs from 'gripmock-sdk-js'; + +let apiInstance = new GripmockSdkJs.StubsApi(); +apiInstance.purgeStubs((error, data, response) => { + if (error) { + console.error(error); + } else { + console.log('API called successfully.'); + } +}); +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## searchStubs + +> SearchResponse searchStubs(searchRequest) + +Stub storage search + +Performs a search for a stub by the given conditions + +### Example + +```javascript +import GripmockSdkJs from 'gripmock-sdk-js'; + +let apiInstance = new GripmockSdkJs.StubsApi(); +let searchRequest = new GripmockSdkJs.SearchRequest(); // SearchRequest | Description of filtering +apiInstance.searchStubs(searchRequest, (error, data, response) => { + if (error) { + console.error(error); + } else { + console.log('API called successfully. Returned data: ' + data); + } +}); +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **searchRequest** | [**SearchRequest**](SearchRequest.md)| Description of filtering | + +### Return type + +[**SearchResponse**](SearchResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + diff --git a/git_push.sh b/git_push.sh new file mode 100644 index 0000000..f53a75d --- /dev/null +++ b/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/mocha.opts b/mocha.opts new file mode 100644 index 0000000..9070118 --- /dev/null +++ b/mocha.opts @@ -0,0 +1 @@ +--timeout 10000 diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..61563b4 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "gripmock-sdk-js", + "version": "2.4.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "gripmock-sdk-js", + "version": "2.4.0", + "license": "MIT" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..2fb9376 --- /dev/null +++ b/package.json @@ -0,0 +1,46 @@ +{ + "name": "gripmock-sdk-js", + "version": "2.4.0", + "description": "JS API client generated by OpenAPI Generator", + "license": "MIT", + "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/src/ApiClient.js b/src/ApiClient.js new file mode 100644 index 0000000..44c007e --- /dev/null +++ b/src/ApiClient.js @@ -0,0 +1,691 @@ +/** + * GripMock API Schema + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.4.0 + * + * + * 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 2.4.0 +*/ + +/** +* Manages low level client-server communications, parameter marshalling, etc. There should not be any need for an +* application to use this class directly - the *Api and model classes provide the public API for the service. The +* contents of this file should be regarded as internal but are documented for completeness. +* @alias module:ApiClient +* @class +*/ +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 = 'https://raw.githubusercontent.com/api') { + /** + * The base URL against which to resolve every API call's (relative) path. + * @type {String} + * @default https://raw.githubusercontent.com/api + */ + 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/2.4.0/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': "https://raw.githubusercontent.com/api", + '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/src/api/HealthcheckApi.js b/src/api/HealthcheckApi.js new file mode 100644 index 0000000..bb5452c --- /dev/null +++ b/src/api/HealthcheckApi.js @@ -0,0 +1,112 @@ +/** + * GripMock API Schema + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.4.0 + * + * + * 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 MessageOK from '../model/MessageOK'; + +/** +* Healthcheck service. +* @module api/HealthcheckApi +* @version 2.4.0 +*/ +export default class HealthcheckApi { + + /** + * Constructs a new HealthcheckApi. + * @alias module:api/HealthcheckApi + * @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 liveness operation. + * @callback module:api/HealthcheckApi~livenessCallback + * @param {String} error Error message, if any. + * @param {module:model/MessageOK} data The data returned by the service call. + * @param {String} response The complete HTTP response. + */ + + /** + * Liveness check + * The test says that the service is alive and yet + * @param {module:api/HealthcheckApi~livenessCallback} callback The callback function, accepting three arguments: error, data, response + * data is of type: {@link module:model/MessageOK} + */ + liveness(callback) { + let postBody = null; + + let pathParams = { + }; + let queryParams = { + }; + let headerParams = { + }; + let formParams = { + }; + + let authNames = []; + let contentTypes = []; + let accepts = ['application/json']; + let returnType = MessageOK; + return this.apiClient.callApi( + '/health/liveness', 'GET', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, null, callback + ); + } + + /** + * Callback function to receive the result of the readiness operation. + * @callback module:api/HealthcheckApi~readinessCallback + * @param {String} error Error message, if any. + * @param {module:model/MessageOK} data The data returned by the service call. + * @param {String} response The complete HTTP response. + */ + + /** + * Readiness check + * The test indicates readiness to receive traffic + * @param {module:api/HealthcheckApi~readinessCallback} callback The callback function, accepting three arguments: error, data, response + * data is of type: {@link module:model/MessageOK} + */ + readiness(callback) { + let postBody = null; + + let pathParams = { + }; + let queryParams = { + }; + let headerParams = { + }; + let formParams = { + }; + + let authNames = []; + let contentTypes = []; + let accepts = ['application/json']; + let returnType = MessageOK; + return this.apiClient.callApi( + '/health/readiness', 'GET', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, null, callback + ); + } + + +} diff --git a/src/api/StubsApi.js b/src/api/StubsApi.js new file mode 100644 index 0000000..ca9e8a9 --- /dev/null +++ b/src/api/StubsApi.js @@ -0,0 +1,356 @@ +/** + * GripMock API Schema + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.4.0 + * + * + * 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 AddStub200Response from '../model/AddStub200Response'; +import AddStubRequest from '../model/AddStubRequest'; +import SearchRequest from '../model/SearchRequest'; +import SearchResponse from '../model/SearchResponse'; +import Stub from '../model/Stub'; + +/** +* Stubs service. +* @module api/StubsApi +* @version 2.4.0 +*/ +export default class StubsApi { + + /** + * Constructs a new StubsApi. + * @alias module:api/StubsApi + * @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 addStub operation. + * @callback module:api/StubsApi~addStubCallback + * @param {String} error Error message, if any. + * @param {module:model/AddStub200Response} data The data returned by the service call. + * @param {String} response The complete HTTP response. + */ + + /** + * Add a new stub to the store + * Add a new stub to the store + * @param {module:model/AddStubRequest} addStubRequest Create a new pet in the store + * @param {module:api/StubsApi~addStubCallback} callback The callback function, accepting three arguments: error, data, response + * data is of type: {@link module:model/AddStub200Response} + */ + addStub(addStubRequest, callback) { + let postBody = addStubRequest; + // verify the required parameter 'addStubRequest' is set + if (addStubRequest === undefined || addStubRequest === null) { + throw new Error("Missing the required parameter 'addStubRequest' when calling addStub"); + } + + let pathParams = { + }; + let queryParams = { + }; + let headerParams = { + }; + let formParams = { + }; + + let authNames = []; + let contentTypes = ['application/json']; + let accepts = ['application/json']; + let returnType = AddStub200Response; + return this.apiClient.callApi( + '/stubs', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, null, callback + ); + } + + /** + * Callback function to receive the result of the batchStubsDelete operation. + * @callback module:api/StubsApi~batchStubsDeleteCallback + * @param {String} error Error message, if any. + * @param data This operation does not return a value. + * @param {String} response The complete HTTP response. + */ + + /** + * Deletes a pack by IDs + * Takes IDs as input and deletes them + * @param {Array.} requestBody Create a new pet in the store + * @param {module:api/StubsApi~batchStubsDeleteCallback} callback The callback function, accepting three arguments: error, data, response + */ + batchStubsDelete(requestBody, callback) { + let postBody = requestBody; + // verify the required parameter 'requestBody' is set + if (requestBody === undefined || requestBody === null) { + throw new Error("Missing the required parameter 'requestBody' when calling batchStubsDelete"); + } + + let pathParams = { + }; + let queryParams = { + }; + let headerParams = { + }; + let formParams = { + }; + + let authNames = []; + let contentTypes = ['application/json']; + let accepts = []; + let returnType = null; + return this.apiClient.callApi( + '/stubs/batchDelete', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, null, callback + ); + } + + /** + * Callback function to receive the result of the deleteStubByID operation. + * @callback module:api/StubsApi~deleteStubByIDCallback + * @param {String} error Error message, if any. + * @param data This operation does not return a value. + * @param {String} response The complete HTTP response. + */ + + /** + * Deletes stub by ID + * The method removes the stub by ID + * @param {String} uuid ID of stub + * @param {module:api/StubsApi~deleteStubByIDCallback} callback The callback function, accepting three arguments: error, data, response + */ + deleteStubByID(uuid, callback) { + let postBody = null; + // verify the required parameter 'uuid' is set + if (uuid === undefined || uuid === null) { + throw new Error("Missing the required parameter 'uuid' when calling deleteStubByID"); + } + + let pathParams = { + 'uuid': uuid + }; + let queryParams = { + }; + let headerParams = { + }; + let formParams = { + }; + + let authNames = []; + let contentTypes = []; + let accepts = []; + let returnType = null; + return this.apiClient.callApi( + '/stubs/{uuid}', 'DELETE', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, null, callback + ); + } + + /** + * Callback function to receive the result of the listStubs operation. + * @callback module:api/StubsApi~listStubsCallback + * @param {String} error Error message, if any. + * @param {Array.} data The data returned by the service call. + * @param {String} response The complete HTTP response. + */ + + /** + * Getting a list of stubs + * The list of stubs is required to view all added stubs + * @param {module:api/StubsApi~listStubsCallback} callback The callback function, accepting three arguments: error, data, response + * data is of type: {@link Array.} + */ + listStubs(callback) { + let postBody = null; + + let pathParams = { + }; + let queryParams = { + }; + let headerParams = { + }; + let formParams = { + }; + + let authNames = []; + let contentTypes = []; + let accepts = ['application/json']; + let returnType = [Stub]; + return this.apiClient.callApi( + '/stubs', 'GET', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, null, callback + ); + } + + /** + * Callback function to receive the result of the listUnusedStubs operation. + * @callback module:api/StubsApi~listUnusedStubsCallback + * @param {String} error Error message, if any. + * @param {Array.} data The data returned by the service call. + * @param {String} response The complete HTTP response. + */ + + /** + * Getting a list of unused stubs + * The list is needed to quickly find unused stubs + * @param {module:api/StubsApi~listUnusedStubsCallback} callback The callback function, accepting three arguments: error, data, response + * data is of type: {@link Array.} + */ + listUnusedStubs(callback) { + let postBody = null; + + let pathParams = { + }; + let queryParams = { + }; + let headerParams = { + }; + let formParams = { + }; + + let authNames = []; + let contentTypes = []; + let accepts = ['application/json']; + let returnType = [Stub]; + return this.apiClient.callApi( + '/stubs/unused', 'GET', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, null, callback + ); + } + + /** + * Callback function to receive the result of the listUsedStubs operation. + * @callback module:api/StubsApi~listUsedStubsCallback + * @param {String} error Error message, if any. + * @param {Array.} data The data returned by the service call. + * @param {String} response The complete HTTP response. + */ + + /** + * Getting a list of used stubs + * The list is needed to quickly find used stubs + * @param {module:api/StubsApi~listUsedStubsCallback} callback The callback function, accepting three arguments: error, data, response + * data is of type: {@link Array.} + */ + listUsedStubs(callback) { + let postBody = null; + + let pathParams = { + }; + let queryParams = { + }; + let headerParams = { + }; + let formParams = { + }; + + let authNames = []; + let contentTypes = []; + let accepts = ['application/json']; + let returnType = [Stub]; + return this.apiClient.callApi( + '/stubs/used', 'GET', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, null, callback + ); + } + + /** + * Callback function to receive the result of the purgeStubs operation. + * @callback module:api/StubsApi~purgeStubsCallback + * @param {String} error Error message, if any. + * @param data This operation does not return a value. + * @param {String} response The complete HTTP response. + */ + + /** + * Remove all stubs + * Completely clears the stub storage + * @param {module:api/StubsApi~purgeStubsCallback} callback The callback function, accepting three arguments: error, data, response + */ + purgeStubs(callback) { + let postBody = null; + + let pathParams = { + }; + let queryParams = { + }; + let headerParams = { + }; + let formParams = { + }; + + let authNames = []; + let contentTypes = []; + let accepts = []; + let returnType = null; + return this.apiClient.callApi( + '/stubs', 'DELETE', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, null, callback + ); + } + + /** + * Callback function to receive the result of the searchStubs operation. + * @callback module:api/StubsApi~searchStubsCallback + * @param {String} error Error message, if any. + * @param {module:model/SearchResponse} data The data returned by the service call. + * @param {String} response The complete HTTP response. + */ + + /** + * Stub storage search + * Performs a search for a stub by the given conditions + * @param {module:model/SearchRequest} searchRequest Description of filtering + * @param {module:api/StubsApi~searchStubsCallback} callback The callback function, accepting three arguments: error, data, response + * data is of type: {@link module:model/SearchResponse} + */ + searchStubs(searchRequest, callback) { + let postBody = searchRequest; + // verify the required parameter 'searchRequest' is set + if (searchRequest === undefined || searchRequest === null) { + throw new Error("Missing the required parameter 'searchRequest' when calling searchStubs"); + } + + let pathParams = { + }; + let queryParams = { + }; + let headerParams = { + }; + let formParams = { + }; + + let authNames = []; + let contentTypes = ['application/json']; + let accepts = ['application/json']; + let returnType = SearchResponse; + return this.apiClient.callApi( + '/stubs/search', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, null, callback + ); + } + + +} diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..7d66b08 --- /dev/null +++ b/src/index.js @@ -0,0 +1,132 @@ +/** + * GripMock API Schema + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.4.0 + * + * + * 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 AddStub200Response from './model/AddStub200Response'; +import AddStubRequest from './model/AddStubRequest'; +import MessageOK from './model/MessageOK'; +import SearchRequest from './model/SearchRequest'; +import SearchResponse from './model/SearchResponse'; +import Stub from './model/Stub'; +import StubHeaders from './model/StubHeaders'; +import StubInput from './model/StubInput'; +import StubOutput from './model/StubOutput'; +import HealthcheckApi from './api/HealthcheckApi'; +import StubsApi from './api/StubsApi'; + + +/** +* 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 GripmockSdkJs = require('index'); // See note below*.
+* var xxxSvc = new GripmockSdkJs.XxxApi(); // Allocate the API class we're going to use.
+* var yyyModel = new GripmockSdkJs.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 GripmockSdkJs.XxxApi(); // Allocate the API class we're going to use.
+* var yyy = new GripmockSdkJs.Yyy(); // Construct a model instance.
+* yyyModel.someProperty = 'someValue';
+* ...
+* var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.
+* ...
+* 
+*

+* @module index +* @version 2.4.0 +*/ +export { + /** + * The ApiClient constructor. + * @property {module:ApiClient} + */ + ApiClient, + + /** + * The AddStub200Response model constructor. + * @property {module:model/AddStub200Response} + */ + AddStub200Response, + + /** + * The AddStubRequest model constructor. + * @property {module:model/AddStubRequest} + */ + AddStubRequest, + + /** + * The MessageOK model constructor. + * @property {module:model/MessageOK} + */ + MessageOK, + + /** + * The SearchRequest model constructor. + * @property {module:model/SearchRequest} + */ + SearchRequest, + + /** + * The SearchResponse model constructor. + * @property {module:model/SearchResponse} + */ + SearchResponse, + + /** + * The Stub model constructor. + * @property {module:model/Stub} + */ + Stub, + + /** + * The StubHeaders model constructor. + * @property {module:model/StubHeaders} + */ + StubHeaders, + + /** + * The StubInput model constructor. + * @property {module:model/StubInput} + */ + StubInput, + + /** + * The StubOutput model constructor. + * @property {module:model/StubOutput} + */ + StubOutput, + + /** + * The HealthcheckApi service constructor. + * @property {module:api/HealthcheckApi} + */ + HealthcheckApi, + + /** + * The StubsApi service constructor. + * @property {module:api/StubsApi} + */ + StubsApi +}; diff --git a/src/model/AddStub200Response.js b/src/model/AddStub200Response.js new file mode 100644 index 0000000..9c3b2f2 --- /dev/null +++ b/src/model/AddStub200Response.js @@ -0,0 +1,112 @@ +/** + * GripMock API Schema + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.4.0 + * + * + * 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 AddStub200Response model module. + * @module model/AddStub200Response + * @version 2.4.0 + */ +class AddStub200Response { + /** + * Constructs a new AddStub200Response. + * @alias module:model/AddStub200Response + * @param {(module:model/[String])} instance The actual instance to initialize AddStub200Response. + */ + constructor(instance = null) { + if (instance === null) { + this.actualInstance = null; + return; + } + var match = 0; + var errorMessages = []; + try { + // validate array data type + if (!Array.isArray(instance)) { + throw new Error("Invalid data type. Expecting array. Input: " + instance); + } + // validate array of string + for (const item of instance) { + if (!(typeof item === 'number' && item % 1 === 0)) { + throw new Error("Invalid array items. Must be string. Input: " + instance); + } + } + this.actualInstance = instance; + match++; + } catch(err) { + // json data failed to deserialize into [String] + errorMessages.push("Failed to construct [String]: " + err) + } + + if (match > 1) { + throw new Error("Multiple matches found constructing `AddStub200Response` with oneOf schemas [String]. Input: " + JSON.stringify(instance)); + } else if (match === 0) { + this.actualInstance = null; // clear the actual instance in case there are multiple matches + throw new Error("No match found constructing `AddStub200Response` with oneOf schemas [String]. Details: " + + errorMessages.join(", ")); + } else { // only 1 match + // the input is valid + } + } + + /** + * Constructs a AddStub200Response 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/AddStub200Response} obj Optional instance to populate. + * @return {module:model/AddStub200Response} The populated AddStub200Response instance. + */ + static constructFromObject(data, obj) { + return new AddStub200Response(data); + } + + /** + * Gets the actual instance, which can be [String]. + * @return {(module:model/[String])} The actual instance. + */ + getActualInstance() { + return this.actualInstance; + } + + /** + * Sets the actual instance, which can be [String]. + * @param {(module:model/[String])} obj The actual instance. + */ + setActualInstance(obj) { + this.actualInstance = AddStub200Response.constructFromObject(obj).getActualInstance(); + } + + /** + * Returns the JSON representation of the actual instance. + * @return {string} + */ + toJSON = function(){ + return this.getActualInstance(); + } + + /** + * Create an instance of AddStub200Response from a JSON string. + * @param {string} json_string JSON string. + * @return {module:model/AddStub200Response} An instance of AddStub200Response. + */ + static fromJSON = function(json_string){ + return AddStub200Response.constructFromObject(JSON.parse(json_string)); + } +} + + +AddStub200Response.OneOf = ["[String]"]; + +export default AddStub200Response; + diff --git a/src/model/AddStubRequest.js b/src/model/AddStubRequest.js new file mode 100644 index 0000000..40fbdc3 --- /dev/null +++ b/src/model/AddStubRequest.js @@ -0,0 +1,160 @@ +/** + * GripMock API Schema + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.4.0 + * + * + * 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 Stub from './Stub'; +import StubHeaders from './StubHeaders'; +import StubInput from './StubInput'; +import StubOutput from './StubOutput'; + +/** + * The AddStubRequest model module. + * @module model/AddStubRequest + * @version 2.4.0 + */ +class AddStubRequest { + /** + * Constructs a new AddStubRequest. + * @alias module:model/AddStubRequest + * @param {(module:model/Stub|module:model/[Stub])} instance The actual instance to initialize AddStubRequest. + */ + constructor(instance = null) { + if (instance === null) { + this.actualInstance = null; + return; + } + var match = 0; + var errorMessages = []; + try { + if (typeof instance === "[Stub]") { + this.actualInstance = instance; + } else { + // plain JS object + // validate the object + [Stub].validateJSON(instance); // throw an exception if no match + // create [Stub] from JS object + this.actualInstance = [Stub].constructFromObject(instance); + } + match++; + } catch(err) { + // json data failed to deserialize into [Stub] + errorMessages.push("Failed to construct [Stub]: " + err) + } + + try { + if (typeof instance === "Stub") { + this.actualInstance = instance; + } else { + // plain JS object + // validate the object + Stub.validateJSON(instance); // throw an exception if no match + // create Stub from JS object + this.actualInstance = Stub.constructFromObject(instance); + } + match++; + } catch(err) { + // json data failed to deserialize into Stub + errorMessages.push("Failed to construct Stub: " + err) + } + + if (match > 1) { + throw new Error("Multiple matches found constructing `AddStubRequest` with oneOf schemas Stub, [Stub]. Input: " + JSON.stringify(instance)); + } else if (match === 0) { + this.actualInstance = null; // clear the actual instance in case there are multiple matches + throw new Error("No match found constructing `AddStubRequest` with oneOf schemas Stub, [Stub]. Details: " + + errorMessages.join(", ")); + } else { // only 1 match + // the input is valid + } + } + + /** + * Constructs a AddStubRequest 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/AddStubRequest} obj Optional instance to populate. + * @return {module:model/AddStubRequest} The populated AddStubRequest instance. + */ + static constructFromObject(data, obj) { + return new AddStubRequest(data); + } + + /** + * Gets the actual instance, which can be Stub, [Stub]. + * @return {(module:model/Stub|module:model/[Stub])} The actual instance. + */ + getActualInstance() { + return this.actualInstance; + } + + /** + * Sets the actual instance, which can be Stub, [Stub]. + * @param {(module:model/Stub|module:model/[Stub])} obj The actual instance. + */ + setActualInstance(obj) { + this.actualInstance = AddStubRequest.constructFromObject(obj).getActualInstance(); + } + + /** + * Returns the JSON representation of the actual instance. + * @return {string} + */ + toJSON = function(){ + return this.getActualInstance(); + } + + /** + * Create an instance of AddStubRequest from a JSON string. + * @param {string} json_string JSON string. + * @return {module:model/AddStubRequest} An instance of AddStubRequest. + */ + static fromJSON = function(json_string){ + return AddStubRequest.constructFromObject(JSON.parse(json_string)); + } +} + +/** + * @member {String} id + */ +AddStubRequest.prototype['id'] = undefined; + +/** + * @member {String} service + */ +AddStubRequest.prototype['service'] = undefined; + +/** + * @member {String} method + */ +AddStubRequest.prototype['method'] = undefined; + +/** + * @member {module:model/StubHeaders} headers + */ +AddStubRequest.prototype['headers'] = undefined; + +/** + * @member {module:model/StubInput} input + */ +AddStubRequest.prototype['input'] = undefined; + +/** + * @member {module:model/StubOutput} output + */ +AddStubRequest.prototype['output'] = undefined; + + +AddStubRequest.OneOf = ["Stub", "[Stub]"]; + +export default AddStubRequest; + diff --git a/src/model/MessageOK.js b/src/model/MessageOK.js new file mode 100644 index 0000000..72ac02e --- /dev/null +++ b/src/model/MessageOK.js @@ -0,0 +1,105 @@ +/** + * GripMock API Schema + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.4.0 + * + * + * 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 MessageOK model module. + * @module model/MessageOK + * @version 2.4.0 + */ +class MessageOK { + /** + * Constructs a new MessageOK. + * @alias module:model/MessageOK + * @param message {String} + * @param time {Date} + */ + constructor(message, time) { + + MessageOK.initialize(this, message, time); + } + + /** + * 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, message, time) { + obj['message'] = message; + obj['time'] = time; + } + + /** + * Constructs a MessageOK 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/MessageOK} obj Optional instance to populate. + * @return {module:model/MessageOK} The populated MessageOK instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new MessageOK(); + + if (data.hasOwnProperty('message')) { + obj['message'] = ApiClient.convertToType(data['message'], 'String'); + } + if (data.hasOwnProperty('time')) { + obj['time'] = ApiClient.convertToType(data['time'], 'Date'); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to MessageOK. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to MessageOK. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of MessageOK.RequiredProperties) { + if (!data.hasOwnProperty(property)) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['message'] && !(typeof data['message'] === 'string' || data['message'] instanceof String)) { + throw new Error("Expected the field `message` to be a primitive type in the JSON string but got " + data['message']); + } + + return true; + } + + +} + +MessageOK.RequiredProperties = ["message", "time"]; + +/** + * @member {String} message + */ +MessageOK.prototype['message'] = undefined; + +/** + * @member {Date} time + */ +MessageOK.prototype['time'] = undefined; + + + + + + +export default MessageOK; + diff --git a/src/model/SearchRequest.js b/src/model/SearchRequest.js new file mode 100644 index 0000000..d5d974d --- /dev/null +++ b/src/model/SearchRequest.js @@ -0,0 +1,139 @@ +/** + * GripMock API Schema + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.4.0 + * + * + * 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 SearchRequest model module. + * @module model/SearchRequest + * @version 2.4.0 + */ +class SearchRequest { + /** + * Constructs a new SearchRequest. + * @alias module:model/SearchRequest + * @param service {String} + * @param method {String} + * @param data {Object.} + */ + constructor(service, method, data) { + + SearchRequest.initialize(this, service, method, data); + } + + /** + * 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, service, method, data) { + obj['service'] = service; + obj['method'] = method; + obj['data'] = data; + } + + /** + * Constructs a SearchRequest 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/SearchRequest} obj Optional instance to populate. + * @return {module:model/SearchRequest} The populated SearchRequest instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new SearchRequest(); + + if (data.hasOwnProperty('id')) { + obj['id'] = ApiClient.convertToType(data['id'], 'String'); + } + if (data.hasOwnProperty('service')) { + obj['service'] = ApiClient.convertToType(data['service'], 'String'); + } + if (data.hasOwnProperty('method')) { + obj['method'] = ApiClient.convertToType(data['method'], 'String'); + } + if (data.hasOwnProperty('headers')) { + obj['headers'] = ApiClient.convertToType(data['headers'], {'String': 'String'}); + } + if (data.hasOwnProperty('data')) { + obj['data'] = ApiClient.convertToType(data['data'], {'String': Object}); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to SearchRequest. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to SearchRequest. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of SearchRequest.RequiredProperties) { + if (!data.hasOwnProperty(property)) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['id'] && !(typeof data['id'] === 'string' || data['id'] instanceof String)) { + throw new Error("Expected the field `id` to be a primitive type in the JSON string but got " + data['id']); + } + // ensure the json data is a string + if (data['service'] && !(typeof data['service'] === 'string' || data['service'] instanceof String)) { + throw new Error("Expected the field `service` to be a primitive type in the JSON string but got " + data['service']); + } + // ensure the json data is a string + if (data['method'] && !(typeof data['method'] === 'string' || data['method'] instanceof String)) { + throw new Error("Expected the field `method` to be a primitive type in the JSON string but got " + data['method']); + } + + return true; + } + + +} + +SearchRequest.RequiredProperties = ["service", "method", "data"]; + +/** + * @member {String} id + */ +SearchRequest.prototype['id'] = undefined; + +/** + * @member {String} service + */ +SearchRequest.prototype['service'] = undefined; + +/** + * @member {String} method + */ +SearchRequest.prototype['method'] = undefined; + +/** + * @member {Object.} headers + */ +SearchRequest.prototype['headers'] = undefined; + +/** + * @member {Object.} data + */ +SearchRequest.prototype['data'] = undefined; + + + + + + +export default SearchRequest; + diff --git a/src/model/SearchResponse.js b/src/model/SearchResponse.js new file mode 100644 index 0000000..4f93c63 --- /dev/null +++ b/src/model/SearchResponse.js @@ -0,0 +1,121 @@ +/** + * GripMock API Schema + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.4.0 + * + * + * 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 SearchResponse model module. + * @module model/SearchResponse + * @version 2.4.0 + */ +class SearchResponse { + /** + * Constructs a new SearchResponse. + * @alias module:model/SearchResponse + * @param data {Object.} + * @param error {String} + */ + constructor(data, error) { + + SearchResponse.initialize(this, data, error); + } + + /** + * 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, data, error) { + obj['data'] = data; + obj['error'] = error; + } + + /** + * Constructs a SearchResponse 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/SearchResponse} obj Optional instance to populate. + * @return {module:model/SearchResponse} The populated SearchResponse instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new SearchResponse(); + + if (data.hasOwnProperty('headers')) { + obj['headers'] = ApiClient.convertToType(data['headers'], {'String': 'String'}); + } + if (data.hasOwnProperty('data')) { + obj['data'] = ApiClient.convertToType(data['data'], {'String': Object}); + } + if (data.hasOwnProperty('error')) { + obj['error'] = ApiClient.convertToType(data['error'], 'String'); + } + if (data.hasOwnProperty('code')) { + obj['code'] = ApiClient.convertToType(data['code'], 'Number'); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to SearchResponse. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to SearchResponse. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of SearchResponse.RequiredProperties) { + if (!data.hasOwnProperty(property)) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['error'] && !(typeof data['error'] === 'string' || data['error'] instanceof String)) { + throw new Error("Expected the field `error` to be a primitive type in the JSON string but got " + data['error']); + } + + return true; + } + + +} + +SearchResponse.RequiredProperties = ["data", "error"]; + +/** + * @member {Object.} headers + */ +SearchResponse.prototype['headers'] = undefined; + +/** + * @member {Object.} data + */ +SearchResponse.prototype['data'] = undefined; + +/** + * @member {String} error + */ +SearchResponse.prototype['error'] = undefined; + +/** + * @member {Number} code + */ +SearchResponse.prototype['code'] = undefined; + + + + + + +export default SearchResponse; + diff --git a/src/model/Stub.js b/src/model/Stub.js new file mode 100644 index 0000000..6d62473 --- /dev/null +++ b/src/model/Stub.js @@ -0,0 +1,164 @@ +/** + * GripMock API Schema + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.4.0 + * + * + * 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 StubHeaders from './StubHeaders'; +import StubInput from './StubInput'; +import StubOutput from './StubOutput'; + +/** + * The Stub model module. + * @module model/Stub + * @version 2.4.0 + */ +class Stub { + /** + * Constructs a new Stub. + * @alias module:model/Stub + * @param service {String} + * @param method {String} + * @param input {module:model/StubInput} + * @param output {module:model/StubOutput} + */ + constructor(service, method, input, output) { + + Stub.initialize(this, service, method, input, output); + } + + /** + * 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, service, method, input, output) { + obj['service'] = service; + obj['method'] = method; + obj['input'] = input; + obj['output'] = output; + } + + /** + * Constructs a Stub 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/Stub} obj Optional instance to populate. + * @return {module:model/Stub} The populated Stub instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Stub(); + + if (data.hasOwnProperty('id')) { + obj['id'] = ApiClient.convertToType(data['id'], 'String'); + } + if (data.hasOwnProperty('service')) { + obj['service'] = ApiClient.convertToType(data['service'], 'String'); + } + if (data.hasOwnProperty('method')) { + obj['method'] = ApiClient.convertToType(data['method'], 'String'); + } + if (data.hasOwnProperty('headers')) { + obj['headers'] = StubHeaders.constructFromObject(data['headers']); + } + if (data.hasOwnProperty('input')) { + obj['input'] = StubInput.constructFromObject(data['input']); + } + if (data.hasOwnProperty('output')) { + obj['output'] = StubOutput.constructFromObject(data['output']); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to Stub. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to Stub. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of Stub.RequiredProperties) { + if (!data.hasOwnProperty(property)) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['id'] && !(typeof data['id'] === 'string' || data['id'] instanceof String)) { + throw new Error("Expected the field `id` to be a primitive type in the JSON string but got " + data['id']); + } + // ensure the json data is a string + if (data['service'] && !(typeof data['service'] === 'string' || data['service'] instanceof String)) { + throw new Error("Expected the field `service` to be a primitive type in the JSON string but got " + data['service']); + } + // ensure the json data is a string + if (data['method'] && !(typeof data['method'] === 'string' || data['method'] instanceof String)) { + throw new Error("Expected the field `method` to be a primitive type in the JSON string but got " + data['method']); + } + // validate the optional field `headers` + if (data['headers']) { // data not null + StubHeaders.validateJSON(data['headers']); + } + // validate the optional field `input` + if (data['input']) { // data not null + StubInput.validateJSON(data['input']); + } + // validate the optional field `output` + if (data['output']) { // data not null + StubOutput.validateJSON(data['output']); + } + + return true; + } + + +} + +Stub.RequiredProperties = ["service", "method", "input", "output"]; + +/** + * @member {String} id + */ +Stub.prototype['id'] = undefined; + +/** + * @member {String} service + */ +Stub.prototype['service'] = undefined; + +/** + * @member {String} method + */ +Stub.prototype['method'] = undefined; + +/** + * @member {module:model/StubHeaders} headers + */ +Stub.prototype['headers'] = undefined; + +/** + * @member {module:model/StubInput} input + */ +Stub.prototype['input'] = undefined; + +/** + * @member {module:model/StubOutput} output + */ +Stub.prototype['output'] = undefined; + + + + + + +export default Stub; + diff --git a/src/model/StubHeaders.js b/src/model/StubHeaders.js new file mode 100644 index 0000000..14636ab --- /dev/null +++ b/src/model/StubHeaders.js @@ -0,0 +1,99 @@ +/** + * GripMock API Schema + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.4.0 + * + * + * 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 StubHeaders model module. + * @module model/StubHeaders + * @version 2.4.0 + */ +class StubHeaders { + /** + * Constructs a new StubHeaders. + * @alias module:model/StubHeaders + */ + constructor() { + + StubHeaders.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 StubHeaders 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/StubHeaders} obj Optional instance to populate. + * @return {module:model/StubHeaders} The populated StubHeaders instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new StubHeaders(); + + if (data.hasOwnProperty('equals')) { + obj['equals'] = ApiClient.convertToType(data['equals'], {'String': 'String'}); + } + if (data.hasOwnProperty('contains')) { + obj['contains'] = ApiClient.convertToType(data['contains'], {'String': 'String'}); + } + if (data.hasOwnProperty('matches')) { + obj['matches'] = ApiClient.convertToType(data['matches'], {'String': 'String'}); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to StubHeaders. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to StubHeaders. + */ + static validateJSON(data) { + + return true; + } + + +} + + + +/** + * @member {Object.} equals + */ +StubHeaders.prototype['equals'] = undefined; + +/** + * @member {Object.} contains + */ +StubHeaders.prototype['contains'] = undefined; + +/** + * @member {Object.} matches + */ +StubHeaders.prototype['matches'] = undefined; + + + + + + +export default StubHeaders; + diff --git a/src/model/StubInput.js b/src/model/StubInput.js new file mode 100644 index 0000000..fa5086d --- /dev/null +++ b/src/model/StubInput.js @@ -0,0 +1,108 @@ +/** + * GripMock API Schema + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.4.0 + * + * + * 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 StubInput model module. + * @module model/StubInput + * @version 2.4.0 + */ +class StubInput { + /** + * Constructs a new StubInput. + * @alias module:model/StubInput + */ + constructor() { + + StubInput.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 StubInput 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/StubInput} obj Optional instance to populate. + * @return {module:model/StubInput} The populated StubInput instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new StubInput(); + + if (data.hasOwnProperty('ignoreArrayOrder')) { + obj['ignoreArrayOrder'] = ApiClient.convertToType(data['ignoreArrayOrder'], 'Boolean'); + } + if (data.hasOwnProperty('equals')) { + obj['equals'] = ApiClient.convertToType(data['equals'], {'String': Object}); + } + if (data.hasOwnProperty('contains')) { + obj['contains'] = ApiClient.convertToType(data['contains'], {'String': Object}); + } + if (data.hasOwnProperty('matches')) { + obj['matches'] = ApiClient.convertToType(data['matches'], {'String': Object}); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to StubInput. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to StubInput. + */ + static validateJSON(data) { + + return true; + } + + +} + + + +/** + * @member {Boolean} ignoreArrayOrder + * @default false + */ +StubInput.prototype['ignoreArrayOrder'] = false; + +/** + * @member {Object.} equals + */ +StubInput.prototype['equals'] = undefined; + +/** + * @member {Object.} contains + */ +StubInput.prototype['contains'] = undefined; + +/** + * @member {Object.} matches + */ +StubInput.prototype['matches'] = undefined; + + + + + + +export default StubInput; + diff --git a/src/model/StubOutput.js b/src/model/StubOutput.js new file mode 100644 index 0000000..7333da7 --- /dev/null +++ b/src/model/StubOutput.js @@ -0,0 +1,121 @@ +/** + * GripMock API Schema + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.4.0 + * + * + * 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 StubOutput model module. + * @module model/StubOutput + * @version 2.4.0 + */ +class StubOutput { + /** + * Constructs a new StubOutput. + * @alias module:model/StubOutput + * @param data {Object.} + * @param error {String} + */ + constructor(data, error) { + + StubOutput.initialize(this, data, error); + } + + /** + * 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, data, error) { + obj['data'] = data; + obj['error'] = error; + } + + /** + * Constructs a StubOutput 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/StubOutput} obj Optional instance to populate. + * @return {module:model/StubOutput} The populated StubOutput instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new StubOutput(); + + if (data.hasOwnProperty('data')) { + obj['data'] = ApiClient.convertToType(data['data'], {'String': Object}); + } + if (data.hasOwnProperty('headers')) { + obj['headers'] = ApiClient.convertToType(data['headers'], {'String': 'String'}); + } + if (data.hasOwnProperty('error')) { + obj['error'] = ApiClient.convertToType(data['error'], 'String'); + } + if (data.hasOwnProperty('code')) { + obj['code'] = ApiClient.convertToType(data['code'], 'Number'); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to StubOutput. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to StubOutput. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of StubOutput.RequiredProperties) { + if (!data.hasOwnProperty(property)) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['error'] && !(typeof data['error'] === 'string' || data['error'] instanceof String)) { + throw new Error("Expected the field `error` to be a primitive type in the JSON string but got " + data['error']); + } + + return true; + } + + +} + +StubOutput.RequiredProperties = ["data", "error"]; + +/** + * @member {Object.} data + */ +StubOutput.prototype['data'] = undefined; + +/** + * @member {Object.} headers + */ +StubOutput.prototype['headers'] = undefined; + +/** + * @member {String} error + */ +StubOutput.prototype['error'] = undefined; + +/** + * @member {Number} code + */ +StubOutput.prototype['code'] = undefined; + + + + + + +export default StubOutput; + diff --git a/test/api/HealthcheckApi.spec.js b/test/api/HealthcheckApi.spec.js new file mode 100644 index 0000000..23a802a --- /dev/null +++ b/test/api/HealthcheckApi.spec.js @@ -0,0 +1,73 @@ +/** + * GripMock API Schema + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.4.0 + * + * + * 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.GripmockSdkJs); + } +}(this, function(expect, GripmockSdkJs) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new GripmockSdkJs.HealthcheckApi(); + }); + + 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('HealthcheckApi', function() { + describe('liveness', function() { + it('should call liveness successfully', function(done) { + //uncomment below and update the code to test liveness + //instance.liveness(function(error) { + // if (error) throw error; + //expect().to.be(); + //}); + done(); + }); + }); + describe('readiness', function() { + it('should call readiness successfully', function(done) { + //uncomment below and update the code to test readiness + //instance.readiness(function(error) { + // if (error) throw error; + //expect().to.be(); + //}); + done(); + }); + }); + }); + +})); diff --git a/test/api/StubsApi.spec.js b/test/api/StubsApi.spec.js new file mode 100644 index 0000000..01448ba --- /dev/null +++ b/test/api/StubsApi.spec.js @@ -0,0 +1,133 @@ +/** + * GripMock API Schema + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.4.0 + * + * + * 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.GripmockSdkJs); + } +}(this, function(expect, GripmockSdkJs) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new GripmockSdkJs.StubsApi(); + }); + + 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('StubsApi', function() { + describe('addStub', function() { + it('should call addStub successfully', function(done) { + //uncomment below and update the code to test addStub + //instance.addStub(function(error) { + // if (error) throw error; + //expect().to.be(); + //}); + done(); + }); + }); + describe('batchStubsDelete', function() { + it('should call batchStubsDelete successfully', function(done) { + //uncomment below and update the code to test batchStubsDelete + //instance.batchStubsDelete(function(error) { + // if (error) throw error; + //expect().to.be(); + //}); + done(); + }); + }); + describe('deleteStubByID', function() { + it('should call deleteStubByID successfully', function(done) { + //uncomment below and update the code to test deleteStubByID + //instance.deleteStubByID(function(error) { + // if (error) throw error; + //expect().to.be(); + //}); + done(); + }); + }); + describe('listStubs', function() { + it('should call listStubs successfully', function(done) { + //uncomment below and update the code to test listStubs + //instance.listStubs(function(error) { + // if (error) throw error; + //expect().to.be(); + //}); + done(); + }); + }); + describe('listUnusedStubs', function() { + it('should call listUnusedStubs successfully', function(done) { + //uncomment below and update the code to test listUnusedStubs + //instance.listUnusedStubs(function(error) { + // if (error) throw error; + //expect().to.be(); + //}); + done(); + }); + }); + describe('listUsedStubs', function() { + it('should call listUsedStubs successfully', function(done) { + //uncomment below and update the code to test listUsedStubs + //instance.listUsedStubs(function(error) { + // if (error) throw error; + //expect().to.be(); + //}); + done(); + }); + }); + describe('purgeStubs', function() { + it('should call purgeStubs successfully', function(done) { + //uncomment below and update the code to test purgeStubs + //instance.purgeStubs(function(error) { + // if (error) throw error; + //expect().to.be(); + //}); + done(); + }); + }); + describe('searchStubs', function() { + it('should call searchStubs successfully', function(done) { + //uncomment below and update the code to test searchStubs + //instance.searchStubs(function(error) { + // if (error) throw error; + //expect().to.be(); + //}); + done(); + }); + }); + }); + +})); diff --git a/test/model/AddStub200Response.spec.js b/test/model/AddStub200Response.spec.js new file mode 100644 index 0000000..5623e84 --- /dev/null +++ b/test/model/AddStub200Response.spec.js @@ -0,0 +1,59 @@ +/** + * GripMock API Schema + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.4.0 + * + * + * 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.GripmockSdkJs); + } +}(this, function(expect, GripmockSdkJs) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new GripmockSdkJs.AddStub200Response(); + }); + + 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('AddStub200Response', function() { + it('should create an instance of AddStub200Response', function() { + // uncomment below and update the code to test AddStub200Response + //var instance = new GripmockSdkJs.AddStub200Response(); + //expect(instance).to.be.a(GripmockSdkJs.AddStub200Response); + }); + + }); + +})); diff --git a/test/model/AddStubRequest.spec.js b/test/model/AddStubRequest.spec.js new file mode 100644 index 0000000..17b7219 --- /dev/null +++ b/test/model/AddStubRequest.spec.js @@ -0,0 +1,95 @@ +/** + * GripMock API Schema + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.4.0 + * + * + * 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.GripmockSdkJs); + } +}(this, function(expect, GripmockSdkJs) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new GripmockSdkJs.AddStubRequest(); + }); + + 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('AddStubRequest', function() { + it('should create an instance of AddStubRequest', function() { + // uncomment below and update the code to test AddStubRequest + //var instance = new GripmockSdkJs.AddStubRequest(); + //expect(instance).to.be.a(GripmockSdkJs.AddStubRequest); + }); + + it('should have the property id (base name: "id")', function() { + // uncomment below and update the code to test the property id + //var instance = new GripmockSdkJs.AddStubRequest(); + //expect(instance).to.be(); + }); + + it('should have the property service (base name: "service")', function() { + // uncomment below and update the code to test the property service + //var instance = new GripmockSdkJs.AddStubRequest(); + //expect(instance).to.be(); + }); + + it('should have the property method (base name: "method")', function() { + // uncomment below and update the code to test the property method + //var instance = new GripmockSdkJs.AddStubRequest(); + //expect(instance).to.be(); + }); + + it('should have the property headers (base name: "headers")', function() { + // uncomment below and update the code to test the property headers + //var instance = new GripmockSdkJs.AddStubRequest(); + //expect(instance).to.be(); + }); + + it('should have the property input (base name: "input")', function() { + // uncomment below and update the code to test the property input + //var instance = new GripmockSdkJs.AddStubRequest(); + //expect(instance).to.be(); + }); + + it('should have the property output (base name: "output")', function() { + // uncomment below and update the code to test the property output + //var instance = new GripmockSdkJs.AddStubRequest(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/test/model/MessageOK.spec.js b/test/model/MessageOK.spec.js new file mode 100644 index 0000000..b07d9a0 --- /dev/null +++ b/test/model/MessageOK.spec.js @@ -0,0 +1,71 @@ +/** + * GripMock API Schema + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.4.0 + * + * + * 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.GripmockSdkJs); + } +}(this, function(expect, GripmockSdkJs) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new GripmockSdkJs.MessageOK(); + }); + + 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('MessageOK', function() { + it('should create an instance of MessageOK', function() { + // uncomment below and update the code to test MessageOK + //var instance = new GripmockSdkJs.MessageOK(); + //expect(instance).to.be.a(GripmockSdkJs.MessageOK); + }); + + it('should have the property message (base name: "message")', function() { + // uncomment below and update the code to test the property message + //var instance = new GripmockSdkJs.MessageOK(); + //expect(instance).to.be(); + }); + + it('should have the property time (base name: "time")', function() { + // uncomment below and update the code to test the property time + //var instance = new GripmockSdkJs.MessageOK(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/test/model/SearchRequest.spec.js b/test/model/SearchRequest.spec.js new file mode 100644 index 0000000..870cb9c --- /dev/null +++ b/test/model/SearchRequest.spec.js @@ -0,0 +1,89 @@ +/** + * GripMock API Schema + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.4.0 + * + * + * 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.GripmockSdkJs); + } +}(this, function(expect, GripmockSdkJs) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new GripmockSdkJs.SearchRequest(); + }); + + 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('SearchRequest', function() { + it('should create an instance of SearchRequest', function() { + // uncomment below and update the code to test SearchRequest + //var instance = new GripmockSdkJs.SearchRequest(); + //expect(instance).to.be.a(GripmockSdkJs.SearchRequest); + }); + + it('should have the property id (base name: "id")', function() { + // uncomment below and update the code to test the property id + //var instance = new GripmockSdkJs.SearchRequest(); + //expect(instance).to.be(); + }); + + it('should have the property service (base name: "service")', function() { + // uncomment below and update the code to test the property service + //var instance = new GripmockSdkJs.SearchRequest(); + //expect(instance).to.be(); + }); + + it('should have the property method (base name: "method")', function() { + // uncomment below and update the code to test the property method + //var instance = new GripmockSdkJs.SearchRequest(); + //expect(instance).to.be(); + }); + + it('should have the property headers (base name: "headers")', function() { + // uncomment below and update the code to test the property headers + //var instance = new GripmockSdkJs.SearchRequest(); + //expect(instance).to.be(); + }); + + it('should have the property data (base name: "data")', function() { + // uncomment below and update the code to test the property data + //var instance = new GripmockSdkJs.SearchRequest(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/test/model/SearchResponse.spec.js b/test/model/SearchResponse.spec.js new file mode 100644 index 0000000..c61b462 --- /dev/null +++ b/test/model/SearchResponse.spec.js @@ -0,0 +1,83 @@ +/** + * GripMock API Schema + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.4.0 + * + * + * 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.GripmockSdkJs); + } +}(this, function(expect, GripmockSdkJs) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new GripmockSdkJs.SearchResponse(); + }); + + 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('SearchResponse', function() { + it('should create an instance of SearchResponse', function() { + // uncomment below and update the code to test SearchResponse + //var instance = new GripmockSdkJs.SearchResponse(); + //expect(instance).to.be.a(GripmockSdkJs.SearchResponse); + }); + + it('should have the property headers (base name: "headers")', function() { + // uncomment below and update the code to test the property headers + //var instance = new GripmockSdkJs.SearchResponse(); + //expect(instance).to.be(); + }); + + it('should have the property data (base name: "data")', function() { + // uncomment below and update the code to test the property data + //var instance = new GripmockSdkJs.SearchResponse(); + //expect(instance).to.be(); + }); + + it('should have the property error (base name: "error")', function() { + // uncomment below and update the code to test the property error + //var instance = new GripmockSdkJs.SearchResponse(); + //expect(instance).to.be(); + }); + + it('should have the property code (base name: "code")', function() { + // uncomment below and update the code to test the property code + //var instance = new GripmockSdkJs.SearchResponse(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/test/model/Stub.spec.js b/test/model/Stub.spec.js new file mode 100644 index 0000000..b9d33f0 --- /dev/null +++ b/test/model/Stub.spec.js @@ -0,0 +1,95 @@ +/** + * GripMock API Schema + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.4.0 + * + * + * 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.GripmockSdkJs); + } +}(this, function(expect, GripmockSdkJs) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new GripmockSdkJs.Stub(); + }); + + 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('Stub', function() { + it('should create an instance of Stub', function() { + // uncomment below and update the code to test Stub + //var instance = new GripmockSdkJs.Stub(); + //expect(instance).to.be.a(GripmockSdkJs.Stub); + }); + + it('should have the property id (base name: "id")', function() { + // uncomment below and update the code to test the property id + //var instance = new GripmockSdkJs.Stub(); + //expect(instance).to.be(); + }); + + it('should have the property service (base name: "service")', function() { + // uncomment below and update the code to test the property service + //var instance = new GripmockSdkJs.Stub(); + //expect(instance).to.be(); + }); + + it('should have the property method (base name: "method")', function() { + // uncomment below and update the code to test the property method + //var instance = new GripmockSdkJs.Stub(); + //expect(instance).to.be(); + }); + + it('should have the property headers (base name: "headers")', function() { + // uncomment below and update the code to test the property headers + //var instance = new GripmockSdkJs.Stub(); + //expect(instance).to.be(); + }); + + it('should have the property input (base name: "input")', function() { + // uncomment below and update the code to test the property input + //var instance = new GripmockSdkJs.Stub(); + //expect(instance).to.be(); + }); + + it('should have the property output (base name: "output")', function() { + // uncomment below and update the code to test the property output + //var instance = new GripmockSdkJs.Stub(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/test/model/StubHeaders.spec.js b/test/model/StubHeaders.spec.js new file mode 100644 index 0000000..2be7702 --- /dev/null +++ b/test/model/StubHeaders.spec.js @@ -0,0 +1,77 @@ +/** + * GripMock API Schema + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.4.0 + * + * + * 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.GripmockSdkJs); + } +}(this, function(expect, GripmockSdkJs) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new GripmockSdkJs.StubHeaders(); + }); + + 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('StubHeaders', function() { + it('should create an instance of StubHeaders', function() { + // uncomment below and update the code to test StubHeaders + //var instance = new GripmockSdkJs.StubHeaders(); + //expect(instance).to.be.a(GripmockSdkJs.StubHeaders); + }); + + it('should have the property equals (base name: "equals")', function() { + // uncomment below and update the code to test the property equals + //var instance = new GripmockSdkJs.StubHeaders(); + //expect(instance).to.be(); + }); + + it('should have the property contains (base name: "contains")', function() { + // uncomment below and update the code to test the property contains + //var instance = new GripmockSdkJs.StubHeaders(); + //expect(instance).to.be(); + }); + + it('should have the property matches (base name: "matches")', function() { + // uncomment below and update the code to test the property matches + //var instance = new GripmockSdkJs.StubHeaders(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/test/model/StubInput.spec.js b/test/model/StubInput.spec.js new file mode 100644 index 0000000..cf23f25 --- /dev/null +++ b/test/model/StubInput.spec.js @@ -0,0 +1,83 @@ +/** + * GripMock API Schema + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.4.0 + * + * + * 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.GripmockSdkJs); + } +}(this, function(expect, GripmockSdkJs) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new GripmockSdkJs.StubInput(); + }); + + 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('StubInput', function() { + it('should create an instance of StubInput', function() { + // uncomment below and update the code to test StubInput + //var instance = new GripmockSdkJs.StubInput(); + //expect(instance).to.be.a(GripmockSdkJs.StubInput); + }); + + it('should have the property ignoreArrayOrder (base name: "ignoreArrayOrder")', function() { + // uncomment below and update the code to test the property ignoreArrayOrder + //var instance = new GripmockSdkJs.StubInput(); + //expect(instance).to.be(); + }); + + it('should have the property equals (base name: "equals")', function() { + // uncomment below and update the code to test the property equals + //var instance = new GripmockSdkJs.StubInput(); + //expect(instance).to.be(); + }); + + it('should have the property contains (base name: "contains")', function() { + // uncomment below and update the code to test the property contains + //var instance = new GripmockSdkJs.StubInput(); + //expect(instance).to.be(); + }); + + it('should have the property matches (base name: "matches")', function() { + // uncomment below and update the code to test the property matches + //var instance = new GripmockSdkJs.StubInput(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/test/model/StubOutput.spec.js b/test/model/StubOutput.spec.js new file mode 100644 index 0000000..8f84e9d --- /dev/null +++ b/test/model/StubOutput.spec.js @@ -0,0 +1,83 @@ +/** + * GripMock API Schema + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.4.0 + * + * + * 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.GripmockSdkJs); + } +}(this, function(expect, GripmockSdkJs) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new GripmockSdkJs.StubOutput(); + }); + + 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('StubOutput', function() { + it('should create an instance of StubOutput', function() { + // uncomment below and update the code to test StubOutput + //var instance = new GripmockSdkJs.StubOutput(); + //expect(instance).to.be.a(GripmockSdkJs.StubOutput); + }); + + it('should have the property data (base name: "data")', function() { + // uncomment below and update the code to test the property data + //var instance = new GripmockSdkJs.StubOutput(); + //expect(instance).to.be(); + }); + + it('should have the property headers (base name: "headers")', function() { + // uncomment below and update the code to test the property headers + //var instance = new GripmockSdkJs.StubOutput(); + //expect(instance).to.be(); + }); + + it('should have the property error (base name: "error")', function() { + // uncomment below and update the code to test the property error + //var instance = new GripmockSdkJs.StubOutput(); + //expect(instance).to.be(); + }); + + it('should have the property code (base name: "code")', function() { + // uncomment below and update the code to test the property code + //var instance = new GripmockSdkJs.StubOutput(); + //expect(instance).to.be(); + }); + + }); + +}));