From a8d74e0b6fa3656df3e88b782ebf572d5a81eb61 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Mon, 25 Jan 2016 01:22:25 +0200 Subject: [PATCH 01/14] minor README fix --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 98367ea5..6d4f8cfa 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Swagger-generated API Reference Documentation ## Deployment -## tl;dr +#### tl;dr ```html @@ -85,7 +85,7 @@ Instead of adding `spec-url` attribute to the `` element you can initiali Redoc.init(specUrl, options) ``` -`options` is javascript object with camel-cased versions of options names as the keys. For example: +`options` is javascript object with camel-cased version of options names as the keys. For example: ```js Redoc.init('http://petstore.swagger.io/v2/swagger.json', { scrollYOffset: 50 From 6fb7bd0ba6880b9030025313d9eddc9a807287f4 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Tue, 26 Jan 2016 20:26:20 +0200 Subject: [PATCH 02/14] Fix sticky sidebar when scroll parent is not window --- lib/common/components/StickySidebar/sticky-sidebar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/common/components/StickySidebar/sticky-sidebar.js b/lib/common/components/StickySidebar/sticky-sidebar.js index c0f2cd1b..ad99a264 100644 --- a/lib/common/components/StickySidebar/sticky-sidebar.js +++ b/lib/common/components/StickySidebar/sticky-sidebar.js @@ -47,7 +47,7 @@ export default class StickySidebar { } get scrollY() { - return (this.scrollParent.pageYOffset !== null) ? this.scrollParent.pageYOffset : this.scrollParent.scrollTop; + return (this.scrollParent.pageYOffset != null) ? this.scrollParent.pageYOffset : this.scrollParent.scrollTop; } ngOnInit() { From 5007871b3e7093bd42661f82386bea9b1afe243a Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sun, 31 Jan 2016 19:36:27 +0200 Subject: [PATCH 03/14] Disable separateCSS --- build/tasks/build.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/build/tasks/build.js b/build/tasks/build.js index 18677e6e..2f14a46f 100644 --- a/build/tasks/build.js +++ b/build/tasks/build.js @@ -87,9 +87,6 @@ function concatDeps(deps, file) { function bundle(outputFile, minify, cb) { fs.existsSync('dist') || fs.mkdirSync('dist'); var builder = new Builder('./', 'system.config.js'); - builder.config({ - separateCSS: true - }); builder .buildStatic(path.join(paths.tmp, paths.sourceEntryPoint), From 75ce3e75a8644fcb981b79a5d6a64914cbb9baa9 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sun, 31 Jan 2016 19:37:10 +0200 Subject: [PATCH 04/14] Add prism.js dependency --- package.json | 1 + system.config.js | 25 ++++++------------------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 08931192..88106814 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "json-schema-instantiator": "npm:json-schema-instantiator@^0.3.0", "json-schema-ref-parser": "npm:json-schema-ref-parser@2.2.0", "marked": "npm:marked@^0.3.5", + "prismjs": "npm:prismjs@^1.3.0", "scrollparent": "npm:scrollparent@^0.1.0", "swagger-parser": "npm:swagger-parser@^3.4.0" }, diff --git a/system.config.js b/system.config.js index 29ba2e8b..59157f88 100644 --- a/system.config.js +++ b/system.config.js @@ -50,6 +50,7 @@ System.config({ "json-schema-instantiator": "npm:json-schema-instantiator@0.3.0", "json-schema-ref-parser": "npm:json-schema-ref-parser@2.2.0", "marked": "npm:marked@0.3.5", + "prismjs": "npm:prismjs@1.3.0", "scrollparent": "npm:scrollparent@0.1.0", "swagger-parser": "npm:swagger-parser@3.4.0", "systemjs/plugin-json": "github:systemjs/plugin-json@0.1.0", @@ -538,25 +539,6 @@ System.config({ "npm:json-pointer@0.3.0": { "foreach": "npm:foreach@2.0.5" }, - "npm:json-schema-ref-parser@1.4.1": { - "buffer": "github:jspm/nodelibs-buffer@0.1.0", - "call-me-maybe": "npm:call-me-maybe@1.0.1", - "debug": "npm:debug@2.2.0", - "es6-promise": "npm:es6-promise@3.0.2", - "events": "github:jspm/nodelibs-events@0.1.1", - "fs": "github:jspm/nodelibs-fs@0.1.2", - "http": "github:jspm/nodelibs-http@1.7.1", - "https": "github:jspm/nodelibs-https@0.1.0", - "js-yaml": "npm:js-yaml@3.5.2", - "ono": "npm:ono@2.0.1", - "process": "github:jspm/nodelibs-process@0.1.2", - "punycode": "github:jspm/nodelibs-punycode@0.1.0", - "querystring": "github:jspm/nodelibs-querystring@0.1.0", - "stream": "github:jspm/nodelibs-stream@0.1.0", - "string_decoder": "github:jspm/nodelibs-string_decoder@0.1.0", - "url": "github:jspm/nodelibs-url@0.1.0", - "util": "github:jspm/nodelibs-util@0.1.0" - }, "npm:json-schema-ref-parser@2.2.0": { "buffer": "github:jspm/nodelibs-buffer@0.1.0", "call-me-maybe": "npm:call-me-maybe@1.0.1", @@ -660,6 +642,11 @@ System.config({ "npm:pinkie@2.0.1": { "process": "github:jspm/nodelibs-process@0.1.2" }, + "npm:prismjs@1.3.0": { + "buffer": "github:jspm/nodelibs-buffer@0.1.0", + "fs": "github:jspm/nodelibs-fs@0.1.2", + "process": "github:jspm/nodelibs-process@0.1.2" + }, "npm:process-nextick-args@1.0.6": { "process": "github:jspm/nodelibs-process@0.1.2" }, From 5fd757076c5658e68fd3dc12154e560d4c0a3c06 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sun, 31 Jan 2016 19:37:35 +0200 Subject: [PATCH 05/14] Add prism.js pipe --- lib/utils/pipes.js | 52 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/lib/utils/pipes.js b/lib/utils/pipes.js index 664f70c7..65184212 100644 --- a/lib/utils/pipes.js +++ b/lib/utils/pipes.js @@ -5,6 +5,30 @@ import {isString, stringify, isBlank} from 'angular2/src/facade/lang'; import {BaseException} from 'angular2/src/facade/exceptions'; import {JsonPointer} from './JsonPointer'; import marked from 'marked'; +import Prism from 'prismjs'; +import 'prismjs/components/prism-actionscript.js'; +import 'prismjs/components/prism-c.js'; +import 'prismjs/components/prism-cpp.js'; +import 'prismjs/components/prism-csharp.js'; +import 'prismjs/components/prism-php.js'; +import 'prismjs/components/prism-coffeescript.js'; +import 'prismjs/components/prism-go.js'; +import 'prismjs/components/prism-haskell.js'; +import 'prismjs/components/prism-scala.js'; +import 'prismjs/components/prism-java.js'; +import 'prismjs/components/prism-lua.js'; +import 'prismjs/components/prism-matlab.js'; +import 'prismjs/components/prism-objectivec.js'; +import 'prismjs/components/prism-perl.js'; +import 'prismjs/components/prism-python.js'; +import 'prismjs/components/prism-r.js'; +import 'prismjs/components/prism-ruby.js'; + +import 'prismjs/components/prism-bash.js'; +import 'prismjs/components/prism-swift.js'; +import 'prismjs/components/prism-vim.js'; + +import 'prismjs/themes/prism-dark.css!css'; marked.setOptions({ renderer: new marked.Renderer(), @@ -65,3 +89,31 @@ export class MarkedPipe { return `${marked(value)}`; } } + +const langMap = { + 'c++': 'cpp', + 'c#': 'csharp', + 'objective-c': 'objectivec', + 'shell': 'bash', + 'viml': 'vim' +}; + +@Pipe({ name: 'prism' }) +export class PrismPipe { + transform(value, args) { + if (isBlank(args) || args.length === 0) { + throw new BaseException('Prism pipe requires one argument'); + } + if (isBlank(value)) return value; + if (!isString(value)) { + throw new InvalidPipeArgumentException(JsonPointerEscapePipe, value); + } + let lang = args[0].toString().trim().toLowerCase(); + if (langMap[lang]) lang = langMap[lang]; + + let grammar = Prism.languages[lang]; + //fallback to clike + if (!grammar) grammar = Prism.languages.clike; + return Prism.highlight(value, grammar); + } +} From 30fee46cfb3bc4f66842825d0dd739781732ccc3 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sun, 31 Jan 2016 19:37:51 +0200 Subject: [PATCH 06/14] Add RequestSamples component --- lib/components/Method/method.html | 4 +-- lib/components/Method/method.js | 3 +- .../RequestSamples/request-samples.html | 10 ++++++ .../RequestSamples/request-samples.js | 27 ++++++++++++++++ .../RequestSamples/request-samples.scss | 31 +++++++++++++++++++ 5 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 lib/components/RequestSamples/request-samples.html create mode 100644 lib/components/RequestSamples/request-samples.js create mode 100644 lib/components/RequestSamples/request-samples.scss diff --git a/lib/components/Method/method.html b/lib/components/Method/method.html index 697a213b..e677c448 100644 --- a/lib/components/Method/method.html +++ b/lib/components/Method/method.html @@ -18,8 +18,8 @@
-
Body sample
- + +
diff --git a/lib/components/Method/method.js b/lib/components/Method/method.js index 05674deb..13aa8178 100644 --- a/lib/components/Method/method.js +++ b/lib/components/Method/method.js @@ -6,12 +6,13 @@ import ParamsList from '../ParamsList/params-list'; import ResponsesList from '../ResponsesList/responses-list'; import ResponsesSamples from '../ResponsesSamples/responses-samples'; import SchemaSample from '../SchemaSample/schema-sample'; +import RequestSamples from '../RequestSamples/request-samples'; @RedocComponent({ selector: 'method', templateUrl: './lib/components/Method/method.html', styleUrls: ['./lib/components/Method/method.css'], - directives: [ParamsList, ResponsesList, ResponsesSamples, SchemaSample], + directives: [ParamsList, ResponsesList, ResponsesSamples, SchemaSample, RequestSamples], inputs: ['tag'] }) export default class Method extends BaseComponent { diff --git a/lib/components/RequestSamples/request-samples.html b/lib/components/RequestSamples/request-samples.html new file mode 100644 index 00000000..c1688d1a --- /dev/null +++ b/lib/components/RequestSamples/request-samples.html @@ -0,0 +1,10 @@ +
Request samples
+ + + + + + +

+  
+
diff --git a/lib/components/RequestSamples/request-samples.js b/lib/components/RequestSamples/request-samples.js new file mode 100644 index 00000000..6bebaa32 --- /dev/null +++ b/lib/components/RequestSamples/request-samples.js @@ -0,0 +1,27 @@ +'use strict'; + +import {RedocComponent, BaseComponent} from '../base'; +import JsonPointer from '../../utils/JsonPointer'; +import {Tabs, Tab} from '../../common/components/Tabs/tabs'; +import SchemaSample from '../SchemaSample/schema-sample'; +import {PrismPipe} from '../../utils/pipes'; + +@RedocComponent({ + selector: 'request-samples', + templateUrl: './lib/components/RequestSamples/request-samples.html', + styleUrls: ['./lib/components/RequestSamples/request-samples.css'], + directives: [SchemaSample, Tabs, Tab], + inputs: ['bodySchemaPtr'], + pipes: [PrismPipe] +}) +export default class RequestSamples extends BaseComponent { + constructor(schemaMgr) { + super(schemaMgr); + } + + prepareModel() { + this.data = {}; + this.data.bodySchemaPtr = JsonPointer.join(this.bodySchemaPtr, 'schema'); + this.data.samples = this.componentSchema['x-code-samples'] || []; + } +} diff --git a/lib/components/RequestSamples/request-samples.scss b/lib/components/RequestSamples/request-samples.scss new file mode 100644 index 00000000..62d60331 --- /dev/null +++ b/lib/components/RequestSamples/request-samples.scss @@ -0,0 +1,31 @@ +@import '../../common/styles/variables'; + +header { + font-size: 16px; + margin: 5px 0; + color: $sample-panel-headers-color; + text-transform: uppercase; + font-weight: normal; +} + +:host > tabs > ul li { + font-size: 13px; + margin: 2px 0; + padding: 2px 10px; + color: #8A9094; + line-height: 1.25; + color: $sample-panel-headers-color; + + &.active { + background-color: white; + color: #666; + } +} + +:host tabs ul { + padding-top: 10px; +} + +pre { + overflow-x: auto; +} From 671e41e0a158060fcba4018a80c7d798adc7c2c9 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Mon, 1 Feb 2016 14:14:59 +0200 Subject: [PATCH 07/14] convert sample schema to yaml --- demo/index.html | 2 +- demo/swagger.json | 892 ---------------------------------------------- demo/swagger.yml | 828 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 829 insertions(+), 893 deletions(-) delete mode 100644 demo/swagger.json create mode 100644 demo/swagger.yml diff --git a/demo/index.html b/demo/index.html index f7889511..580acf4b 100644 --- a/demo/index.html +++ b/demo/index.html @@ -14,7 +14,7 @@ - + diff --git a/demo/swagger.json b/demo/swagger.json deleted file mode 100644 index 2a126a55..00000000 --- a/demo/swagger.json +++ /dev/null @@ -1,892 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "description": "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.", - "version": "1.0.0", - "title": "Swagger Petstore", - "termsOfService": "http://swagger.io/terms/", - "contact": { - "email": "apiteam@swagger.io" - }, - "x-logo": { - "url": "https://rebilly.github.io/ReDoc/petstore-logo.png" - }, - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.html" - } - }, - "host": "petstore.swagger.io", - "basePath": "/v2", - "tags": [{ - "name": "Pagination", - "x-traitTag": true, - "description": "Sometimes you just can't get enough. For this reason, we've provided a convenient way to access more data in any request for sequential data. Simply call the url in the next_url parameter and we'll respond with the next set of data.\n```json\n{\n ...\n \"pagination\": {\n \"next_url\": \"https://api.instagram.com/v1/tags/puppy/media/recent?access_token=fb2e77d.47a0479900504cb3ab4a1f626d174d2d&max_id=13872296\",\n \"next_max_id\": \"13872296\"\n }\n}\n```\n On views where pagination is present, we also support the `count` parameter. Simply set this to the number of items you'd like to receive. Note that the default values should be fine for most applications - but if you decide to increase this number there is a maximum value defined on each endpoint.", - "externalDocs": { - "description": "Find out more", - "url": "http://swagger.io" - } - },{ - "name": "JSONP", - "x-traitTag": true, - "description": "If you're writing an AJAX application, and you'd like to wrap our response with a callback, all you have to do is specify a callback parameter with any API call:\n```\n https://api.instagram.com/v1/tags/coffee/media/recent?access_token=fb2e77d.47a0479900504cb3ab4a1f626d174d2d&callback=callbackFunction\n```\nWould respond with:\n```js\ncallbackFunction({\n ...\n});\n``` \n > Example of markdown blockquote", - "externalDocs": { - "description": "Find out more", - "url": "http://swagger.io" - } - },{ - "name": "pet", - "description": "Everything about your Pets", - "externalDocs": { - "description": "Find out more", - "url": "http://swagger.io" - } - }, { - "name": "store", - "description": "Access to Petstore orders" - }, { - "name": "user", - "description": "Operations about user", - "externalDocs": { - "description": "Find out more about our store", - "url": "http://swagger.io" - } - }], - "schemes": ["http"], - "paths": { - "/pet": { - "post": { - "tags": ["pet"], - "summary": "Add a new pet to the store", - "description": "", - "operationId": "addPet", - "consumes": ["application/json", "application/xml"], - "produces": ["application/xml", "application/json"], - "parameters": [{ - "in": "body", - "name": "body", - "description": "Pet object that needs to be added to the store", - "required": true, - "schema": { - "$ref": "#/definitions/Pet" - } - }], - "responses": { - "405": { - "description": "Invalid input" - } - }, - "security": [{ - "petstore_auth": ["write:pets", "read:pets"] - }] - }, - "put": { - "tags": ["pet"], - "summary": "Update an existing pet", - "description": "", - "operationId": "updatePet", - "consumes": ["application/json", "application/xml"], - "produces": ["application/xml", "application/json"], - "parameters": [{ - "in": "body", - "name": "body", - "description": "Pet object that needs to be added to the store", - "required": true, - "schema": { - "$ref": "#/definitions/Pet" - } - }], - "responses": { - "400": { - "description": "Invalid ID supplied" - }, - "404": { - "description": "Pet not found" - }, - "405": { - "description": "Validation exception" - } - }, - "security": [{ - "petstore_auth": ["write:pets", "read:pets"] - }] - } - }, - "/pet/findByStatus": { - "get": { - "tags": ["pet", "Pagination", "JSONP"], - "summary": "Finds Pets by status", - "description": "Multiple status values can be provided with comma seperated strings", - "operationId": "findPetsByStatus", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "name": "status", - "in": "query", - "description": "Status values that need to be considered for filter", - "required": true, - "type": "array", - "items": { - "type": "string", - "enum": ["available", "pending", "sold"], - "default": "available" - }, - "collectionFormat": "csv" - }], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Pet" - } - } - }, - "400": { - "description": "Invalid status value" - } - }, - "security": [{ - "petstore_auth": ["write:pets", "read:pets"] - }] - } - }, - "/pet/findByTags": { - "get": { - "tags": ["pet", "Pagination", "JSONP"], - "summary": "Finds Pets by tags", - "description": "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.", - "operationId": "findPetsByTags", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "name": "tags", - "in": "query", - "description": "Tags to filter by", - "required": true, - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "csv" - }], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Pet" - } - } - }, - "400": { - "description": "Invalid tag value" - } - }, - "security": [{ - "petstore_auth": ["write:pets", "read:pets"] - }] - } - }, - "/pet/{petId}": { - "get": { - "tags": ["pet", "JSONP"], - "summary": "Find pet by ID", - "description": "Returns a single pet", - "operationId": "getPetById", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "name": "petId", - "in": "path", - "description": "ID of pet to return", - "required": true, - "type": "integer", - "format": "int64" - }], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/Pet" - } - }, - "400": { - "description": "Invalid ID supplied" - }, - "404": { - "description": "Pet not found" - } - }, - "security": [{ - "api_key": [] - }] - }, - "post": { - "tags": ["pet"], - "summary": "Updates a pet in the store with form data", - "description": "", - "operationId": "updatePetWithForm", - "consumes": ["application/x-www-form-urlencoded"], - "produces": ["application/xml", "application/json"], - "parameters": [{ - "name": "petId", - "in": "path", - "description": "ID of pet that needs to be updated", - "required": true, - "type": "integer", - "format": "int64" - }, { - "name": "name", - "in": "formData", - "description": "Updated name of the pet", - "required": false, - "type": "string" - }, { - "name": "status", - "in": "formData", - "description": "Updated status of the pet", - "required": false, - "type": "string" - }], - "responses": { - "405": { - "description": "Invalid input" - } - }, - "security": [{ - "petstore_auth": ["write:pets", "read:pets"] - }] - }, - "delete": { - "tags": ["pet"], - "summary": "Deletes a pet", - "description": "", - "operationId": "deletePet", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "name": "api_key", - "in": "header", - "required": false, - "type": "string" - }, { - "name": "petId", - "in": "path", - "description": "Pet id to delete", - "required": true, - "type": "integer", - "format": "int64" - }], - "responses": { - "400": { - "description": "Invalid pet value" - } - }, - "security": [{ - "petstore_auth": ["write:pets", "read:pets"] - }] - } - }, - "/pet/{petId}/uploadImage": { - "post": { - "tags": ["pet"], - "summary": "uploads an image", - "description": "", - "operationId": "uploadFile", - "consumes": ["multipart/form-data"], - "produces": ["application/json"], - "parameters": [{ - "name": "petId", - "in": "path", - "description": "ID of pet to update", - "required": true, - "type": "integer", - "format": "int64" - }, { - "name": "additionalMetadata", - "in": "formData", - "description": "Additional data to pass to server", - "required": false, - "type": "string" - }, { - "name": "file", - "in": "formData", - "description": "file to upload", - "required": false, - "type": "file" - }], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/ApiResponse" - } - } - }, - "security": [{ - "petstore_auth": ["write:pets", "read:pets"] - }] - } - }, - "/store/inventory": { - "get": { - "tags": ["store", "JSONP"], - "summary": "Returns pet inventories by status", - "description": "Returns a map of status codes to quantities", - "operationId": "getInventory", - "produces": ["application/json"], - "parameters": [], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "type": "object", - "additionalProperties": { - "type": "integer", - "format": "int32" - } - } - } - }, - "security": [{ - "api_key": [] - }] - } - }, - "/store/order": { - "post": { - "tags": ["store"], - "summary": "Place an order for a pet", - "description": "", - "operationId": "placeOrder", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "in": "body", - "name": "body", - "description": "order placed for purchasing the pet", - "required": true, - "schema": { - "$ref": "#/definitions/Order" - } - }], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/Order" - } - }, - "400": { - "description": "Invalid Order" - } - } - } - }, - "/store/order/{orderId}": { - "get": { - "tags": ["store", "JSONP"], - "summary": "Find purchase order by ID", - "description": "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", - "operationId": "getOrderById", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "name": "orderId", - "in": "path", - "description": "ID of pet that needs to be fetched", - "required": true, - "type": "integer", - "maximum": 5.0, - "minimum": 1.0, - "format": "int64" - }], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/Order" - } - }, - "400": { - "description": "Invalid ID supplied" - }, - "404": { - "description": "Order not found" - } - } - }, - "delete": { - "tags": ["store"], - "summary": "Delete purchase order by ID", - "description": "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", - "operationId": "deleteOrder", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "name": "orderId", - "in": "path", - "description": "ID of the order that needs to be deleted", - "required": true, - "type": "string", - "minimum": 1.0 - }], - "responses": { - "400": { - "description": "Invalid ID supplied" - }, - "404": { - "description": "Order not found" - } - } - } - }, - "/user": { - "post": { - "tags": ["user"], - "summary": "Create user", - "description": "This can only be done by the logged in user.", - "operationId": "createUser", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "in": "body", - "name": "body", - "description": "Created user object", - "required": true, - "schema": { - "$ref": "#/definitions/User" - } - }], - "responses": { - "default": { - "description": "successful operation" - } - } - } - }, - "/user/createWithArray": { - "post": { - "tags": ["user"], - "summary": "Creates list of users with given input array", - "description": "", - "operationId": "createUsersWithArrayInput", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "in": "body", - "name": "body", - "description": "List of user object", - "required": true, - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/User" - } - } - }], - "responses": { - "default": { - "description": "successful operation" - } - } - } - }, - "/user/createWithList": { - "post": { - "tags": ["user"], - "summary": "Creates list of users with given input array", - "description": "", - "operationId": "createUsersWithListInput", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "in": "body", - "name": "body", - "description": "List of user object", - "required": true, - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/User" - } - } - }], - "responses": { - "default": { - "description": "successful operation" - } - } - } - }, - "/user/login": { - "get": { - "tags": ["user"], - "summary": "Logs user into the system", - "description": "", - "operationId": "loginUser", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "name": "username", - "in": "query", - "description": "The user name for login", - "required": true, - "type": "string" - }, { - "name": "password", - "in": "query", - "description": "The password for login in clear text", - "required": true, - "type": "string" - }], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "type": "string" - }, - "headers": { - "X-Rate-Limit": { - "type": "integer", - "format": "int32", - "description": "calls per hour allowed by the user" - }, - "X-Expires-After": { - "type": "string", - "format": "date-time", - "description": "date in UTC when toekn expires" - } - } - }, - "400": { - "description": "Invalid username/password supplied" - } - } - } - }, - "/user/logout": { - "get": { - "tags": ["user"], - "summary": "Logs out current logged in user session", - "description": "", - "operationId": "logoutUser", - "produces": ["application/xml", "application/json"], - "parameters": [], - "responses": { - "default": { - "description": "successful operation" - } - } - } - }, - "/user/{username}": { - "get": { - "tags": ["user", "JSONP"], - "summary": "Get user by user name", - "description": "", - "operationId": "getUserByName", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "name": "username", - "in": "path", - "description": "The name that needs to be fetched. Use user1 for testing. ", - "required": true, - "type": "string" - }], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/User" - } - }, - "400": { - "description": "Invalid username supplied" - }, - "404": { - "description": "User not found" - } - } - }, - "put": { - "tags": ["user"], - "summary": "Updated user", - "description": "This can only be done by the logged in user.", - "operationId": "updateUser", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "name": "username", - "in": "path", - "description": "name that need to be deleted", - "required": true, - "type": "string" - }, { - "in": "body", - "name": "body", - "description": "Updated user object", - "required": true, - "schema": { - "$ref": "#/definitions/User" - } - }], - "responses": { - "400": { - "description": "Invalid user supplied" - }, - "404": { - "description": "User not found" - } - } - }, - "delete": { - "tags": ["user"], - "summary": "Delete user", - "description": "This can only be done by the logged in user.", - "operationId": "deleteUser", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "name": "username", - "in": "path", - "description": "The name that needs to be deleted", - "required": true, - "type": "string" - }], - "responses": { - "400": { - "description": "Invalid username supplied" - }, - "404": { - "description": "User not found" - } - } - } - } - }, - "securityDefinitions": { - "petstore_auth": { - "type": "oauth2", - "authorizationUrl": "http://petstore.swagger.io/api/oauth/dialog", - "flow": "implicit", - "scopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - } - }, - "api_key": { - "type": "apiKey", - "name": "api_key", - "in": "header" - } - }, - "definitions": { - "Order": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "petId": { - "type": "integer", - "format": "int64" - }, - "quantity": { - "type": "integer", - "format": "int32" - }, - "shipDate": { - "type": "string", - "format": "date-time" - }, - "status": { - "type": "string", - "description": "Order Status", - "enum": ["placed", "approved", "delivered"] - }, - "complete": { - "type": "boolean", - "default": false - } - }, - "xml": { - "name": "Order" - } - }, - "User": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "username": { - "type": "string" - }, - "firstName": { - "type": "string" - }, - "lastName": { - "type": "string" - }, - "email": { - "type": "string" - }, - "password": { - "type": "string" - }, - "phone": { - "type": "string" - }, - "userStatus": { - "type": "integer", - "format": "int32", - "description": "User Status" - } - }, - "xml": { - "name": "User" - } - }, - "Category": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - } - }, - "xml": { - "name": "Category" - } - }, - "Tag": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - } - }, - "xml": { - "name": "Tag" - } - }, - "Pet": { - "type": "object", - "required": ["name", "photoUrls"], - "discriminator": "petType", - "properties": { - "petType": { - "type": "string" - }, - "id": { - "type": "integer", - "format": "int64" - }, - "category": { - "$ref": "#/definitions/Category" - }, - "name": { - "type": "string", - "example": "doggie" - }, - "photoUrls": { - "type": "array", - "xml": { - "name": "photoUrl", - "wrapped": true - }, - "items": { - "type": "string" - } - }, - "tags": { - "type": "array", - "xml": { - "name": "tag", - "wrapped": true - }, - "items": { - "$ref": "#/definitions/Tag" - } - }, - "status": { - "type": "string", - "description": "pet status in the store", - "enum": ["available", "pending", "sold"] - } - }, - "xml": { - "name": "Pet" - } - }, - "Cat": { - "description": "A representation of a cat", - "allOf": [ - { - "$ref": "#/definitions/Pet" - }, - { - "type": "object", - "properties": { - "huntingSkill": { - "type": "string", - "description": "The measured skill for hunting", - "default": "lazy", - "enum": [ - "clueless", - "lazy", - "adventurous", - "aggressive" - ] - } - }, - "required": [ - "huntingSkill" - ] - } - ] - }, - "Dog": { - "description": "A representation of a dog", - "allOf": [ - { - "$ref": "#/definitions/Pet" - }, - { - "type": "object", - "properties": { - "packSize": { - "type": "integer", - "format": "int32", - "description": "the size of the pack the dog is from", - "default": 0, - "minimum": 0 - } - }, - "required": [ - "packSize" - ] - } - ] - }, - "ApiResponse": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "type": { - "type": "string" - }, - "message": { - "type": "string" - } - } - } - }, - "externalDocs": { - "description": "Find out more about Swagger", - "url": "http://swagger.io" - } -} diff --git a/demo/swagger.yml b/demo/swagger.yml new file mode 100644 index 00000000..db34da1e --- /dev/null +++ b/demo/swagger.yml @@ -0,0 +1,828 @@ +--- + swagger: "2.0" + info: + description: "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters." + version: "1.0.0" + title: "Swagger Petstore" + termsOfService: "http://swagger.io/terms/" + contact: + email: "apiteam@swagger.io" + x-logo: + url: "https://rebilly.github.io/ReDoc/petstore-logo.png" + license: + name: "Apache 2.0" + url: "http://www.apache.org/licenses/LICENSE-2.0.html" + host: "petstore.swagger.io" + basePath: "/v2" + tags: + - + name: "Pagination" + x-traitTag: true + description: |- + Sometimes you just can't get enough. For this reason, we've provided a convenient way to access more data in + any request for sequential data. Simply call the url in the next_url parameter and we'll respond with the next + set of data. + + ```json + { + ... + "pagination": { + "next_url": "https://api.instagram.com/v1/tags/puppy/media/recent?access_token=fb2e77d.47a0479900504cb3ab4a1f626d174d2d&max_id=13872296", + "next_max_id": "13872296" + } + } + ``` + + On views where pagination is present, we also support the `count` parameter. + Simply set this to the number of items you'd like to receive. Note that the default values + should be fine for most applications - but if you decide to increase this number there is a maximum value + defined on each endpoint. + externalDocs: + description: "Find out more" + url: "http://swagger.io" + - + name: "JSONP" + x-traitTag: true + description: |- + If you're writing an AJAX application, and you'd like to wrap our response with a callback, + all you have to do is specify a callback parameter with any API call: + + ``` + https://api.instagram.com/v1/tags/coffee/media/recent?access_token=fb2e77d.47a0479900504cb3ab4a1f626d174d2d&callback=callbackFunction + ``` + Would respond with: + + ```js + callbackFunction({ + ... + }); + ``` + + > Example of markdown blockquote + externalDocs: + description: "Find out more" + url: "http://swagger.io" + - + name: "pet" + description: "Everything about your Pets" + externalDocs: + description: "Find out more" + url: "http://swagger.io" + - + name: "store" + description: "Access to Petstore orders" + - + name: "user" + description: "Operations about user" + externalDocs: + description: "Find out more about our store" + url: "http://swagger.io" + schemes: + - "http" + paths: + /pet: + post: + tags: + - "pet" + summary: "Add a new pet to the store" + description: "" + operationId: "addPet" + consumes: + - "application/json" + - "application/xml" + produces: + - "application/xml" + - "application/json" + parameters: + - + in: "body" + name: "body" + description: "Pet object that needs to be added to the store" + required: true + schema: + $ref: "#/definitions/Pet" + responses: + 405: + description: "Invalid input" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + put: + tags: + - "pet" + summary: "Update an existing pet" + description: "" + operationId: "updatePet" + consumes: + - "application/json" + - "application/xml" + produces: + - "application/xml" + - "application/json" + parameters: + - + in: "body" + name: "body" + description: "Pet object that needs to be added to the store" + required: true + schema: + $ref: "#/definitions/Pet" + responses: + 400: + description: "Invalid ID supplied" + 404: + description: "Pet not found" + 405: + description: "Validation exception" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + /pet/findByStatus: + get: + tags: + - "pet" + - "Pagination" + - "JSONP" + summary: "Finds Pets by status" + description: "Multiple status values can be provided with comma seperated strings" + operationId: "findPetsByStatus" + produces: + - "application/xml" + - "application/json" + parameters: + - + name: "status" + in: "query" + description: "Status values that need to be considered for filter" + required: true + type: "array" + items: + type: "string" + enum: + - "available" + - "pending" + - "sold" + default: "available" + collectionFormat: "csv" + responses: + 200: + description: "successful operation" + schema: + type: "array" + items: + $ref: "#/definitions/Pet" + 400: + description: "Invalid status value" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + /pet/findByTags: + get: + tags: + - "pet" + - "Pagination" + - "JSONP" + summary: "Finds Pets by tags" + description: "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing." + operationId: "findPetsByTags" + produces: + - "application/xml" + - "application/json" + parameters: + - + name: "tags" + in: "query" + description: "Tags to filter by" + required: true + type: "array" + items: + type: "string" + collectionFormat: "csv" + responses: + 200: + description: "successful operation" + schema: + type: "array" + items: + $ref: "#/definitions/Pet" + 400: + description: "Invalid tag value" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + /pet/{petId}: + get: + tags: + - "pet" + - "JSONP" + summary: "Find pet by ID" + description: "Returns a single pet" + operationId: "getPetById" + produces: + - "application/xml" + - "application/json" + parameters: + - + name: "petId" + in: "path" + description: "ID of pet to return" + required: true + type: "integer" + format: "int64" + responses: + 200: + description: "successful operation" + schema: + $ref: "#/definitions/Pet" + 400: + description: "Invalid ID supplied" + 404: + description: "Pet not found" + security: + - + api_key: [] + post: + tags: + - "pet" + summary: "Updates a pet in the store with form data" + description: "" + operationId: "updatePetWithForm" + consumes: + - "application/x-www-form-urlencoded" + produces: + - "application/xml" + - "application/json" + parameters: + - + name: "petId" + in: "path" + description: "ID of pet that needs to be updated" + required: true + type: "integer" + format: "int64" + - + name: "name" + in: "formData" + description: "Updated name of the pet" + required: false + type: "string" + - + name: "status" + in: "formData" + description: "Updated status of the pet" + required: false + type: "string" + responses: + 405: + description: "Invalid input" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + delete: + tags: + - "pet" + summary: "Deletes a pet" + description: "" + operationId: "deletePet" + produces: + - "application/xml" + - "application/json" + parameters: + - + name: "api_key" + in: "header" + required: false + type: "string" + - + name: "petId" + in: "path" + description: "Pet id to delete" + required: true + type: "integer" + format: "int64" + responses: + 400: + description: "Invalid pet value" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + /pet/{petId}/uploadImage: + post: + tags: + - "pet" + summary: "uploads an image" + description: "" + operationId: "uploadFile" + consumes: + - "multipart/form-data" + produces: + - "application/json" + parameters: + - + name: "petId" + in: "path" + description: "ID of pet to update" + required: true + type: "integer" + format: "int64" + - + name: "additionalMetadata" + in: "formData" + description: "Additional data to pass to server" + required: false + type: "string" + - + name: "file" + in: "formData" + description: "file to upload" + required: false + type: "file" + responses: + 200: + description: "successful operation" + schema: + $ref: "#/definitions/ApiResponse" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + /store/inventory: + get: + tags: + - "store" + - "JSONP" + summary: "Returns pet inventories by status" + description: "Returns a map of status codes to quantities" + operationId: "getInventory" + produces: + - "application/json" + parameters: [] + responses: + 200: + description: "successful operation" + schema: + type: "object" + additionalProperties: + type: "integer" + format: "int32" + security: + - + api_key: [] + /store/order: + post: + tags: + - "store" + summary: "Place an order for a pet" + description: "" + operationId: "placeOrder" + produces: + - "application/xml" + - "application/json" + parameters: + - + in: "body" + name: "body" + description: "order placed for purchasing the pet" + required: true + schema: + $ref: "#/definitions/Order" + responses: + 200: + description: "successful operation" + schema: + $ref: "#/definitions/Order" + 400: + description: "Invalid Order" + /store/order/{orderId}: + get: + tags: + - "store" + - "JSONP" + summary: "Find purchase order by ID" + description: "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions" + operationId: "getOrderById" + produces: + - "application/xml" + - "application/json" + parameters: + - + name: "orderId" + in: "path" + description: "ID of pet that needs to be fetched" + required: true + type: "integer" + maximum: 5 + minimum: 1 + format: "int64" + responses: + 200: + description: "successful operation" + schema: + $ref: "#/definitions/Order" + 400: + description: "Invalid ID supplied" + 404: + description: "Order not found" + delete: + tags: + - "store" + summary: "Delete purchase order by ID" + description: "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors" + operationId: "deleteOrder" + produces: + - "application/xml" + - "application/json" + parameters: + - + name: "orderId" + in: "path" + description: "ID of the order that needs to be deleted" + required: true + type: "string" + minimum: 1 + responses: + 400: + description: "Invalid ID supplied" + 404: + description: "Order not found" + /user: + post: + tags: + - "user" + summary: "Create user" + description: "This can only be done by the logged in user." + operationId: "createUser" + produces: + - "application/xml" + - "application/json" + parameters: + - + in: "body" + name: "body" + description: "Created user object" + required: true + schema: + $ref: "#/definitions/User" + responses: + default: + description: "successful operation" + /user/createWithArray: + post: + tags: + - "user" + summary: "Creates list of users with given input array" + description: "" + operationId: "createUsersWithArrayInput" + produces: + - "application/xml" + - "application/json" + parameters: + - + in: "body" + name: "body" + description: "List of user object" + required: true + schema: + type: "array" + items: + $ref: "#/definitions/User" + responses: + default: + description: "successful operation" + /user/createWithList: + post: + tags: + - "user" + summary: "Creates list of users with given input array" + description: "" + operationId: "createUsersWithListInput" + produces: + - "application/xml" + - "application/json" + parameters: + - + in: "body" + name: "body" + description: "List of user object" + required: true + schema: + type: "array" + items: + $ref: "#/definitions/User" + responses: + default: + description: "successful operation" + /user/login: + get: + tags: + - "user" + summary: "Logs user into the system" + description: "" + operationId: "loginUser" + produces: + - "application/xml" + - "application/json" + parameters: + - + name: "username" + in: "query" + description: "The user name for login" + required: true + type: "string" + - + name: "password" + in: "query" + description: "The password for login in clear text" + required: true + type: "string" + responses: + 200: + description: "successful operation" + schema: + type: "string" + headers: + X-Rate-Limit: + type: "integer" + format: "int32" + description: "calls per hour allowed by the user" + X-Expires-After: + type: "string" + format: "date-time" + description: "date in UTC when toekn expires" + 400: + description: "Invalid username/password supplied" + /user/logout: + get: + tags: + - "user" + summary: "Logs out current logged in user session" + description: "" + operationId: "logoutUser" + produces: + - "application/xml" + - "application/json" + parameters: [] + responses: + default: + description: "successful operation" + /user/{username}: + get: + tags: + - "user" + - "JSONP" + summary: "Get user by user name" + description: "" + operationId: "getUserByName" + produces: + - "application/xml" + - "application/json" + parameters: + - + name: "username" + in: "path" + description: "The name that needs to be fetched. Use user1 for testing. " + required: true + type: "string" + responses: + 200: + description: "successful operation" + schema: + $ref: "#/definitions/User" + 400: + description: "Invalid username supplied" + 404: + description: "User not found" + put: + tags: + - "user" + summary: "Updated user" + description: "This can only be done by the logged in user." + operationId: "updateUser" + produces: + - "application/xml" + - "application/json" + parameters: + - + name: "username" + in: "path" + description: "name that need to be deleted" + required: true + type: "string" + - + in: "body" + name: "body" + description: "Updated user object" + required: true + schema: + $ref: "#/definitions/User" + responses: + 400: + description: "Invalid user supplied" + 404: + description: "User not found" + delete: + tags: + - "user" + summary: "Delete user" + description: "This can only be done by the logged in user." + operationId: "deleteUser" + produces: + - "application/xml" + - "application/json" + parameters: + - + name: "username" + in: "path" + description: "The name that needs to be deleted" + required: true + type: "string" + responses: + 400: + description: "Invalid username supplied" + 404: + description: "User not found" + securityDefinitions: + petstore_auth: + type: "oauth2" + authorizationUrl: "http://petstore.swagger.io/api/oauth/dialog" + flow: "implicit" + scopes: + write:pets: "modify pets in your account" + read:pets: "read your pets" + api_key: + type: "apiKey" + name: "api_key" + in: "header" + definitions: + Order: + type: "object" + properties: + id: + type: "integer" + format: "int64" + petId: + type: "integer" + format: "int64" + quantity: + type: "integer" + format: "int32" + shipDate: + type: "string" + format: "date-time" + status: + type: "string" + description: "Order Status" + enum: + - "placed" + - "approved" + - "delivered" + complete: + type: "boolean" + default: false + xml: + name: "Order" + User: + type: "object" + properties: + id: + type: "integer" + format: "int64" + username: + type: "string" + firstName: + type: "string" + lastName: + type: "string" + email: + type: "string" + password: + type: "string" + phone: + type: "string" + userStatus: + type: "integer" + format: "int32" + description: "User Status" + xml: + name: "User" + Category: + type: "object" + properties: + id: + type: "integer" + format: "int64" + name: + type: "string" + xml: + name: "Category" + Tag: + type: "object" + properties: + id: + type: "integer" + format: "int64" + name: + type: "string" + xml: + name: "Tag" + Pet: + type: "object" + required: + - "name" + - "photoUrls" + discriminator: "petType" + properties: + petType: + type: "string" + id: + type: "integer" + format: "int64" + category: + $ref: "#/definitions/Category" + name: + type: "string" + example: "doggie" + photoUrls: + type: "array" + xml: + name: "photoUrl" + wrapped: true + items: + type: "string" + tags: + type: "array" + xml: + name: "tag" + wrapped: true + items: + $ref: "#/definitions/Tag" + status: + type: "string" + description: "pet status in the store" + enum: + - "available" + - "pending" + - "sold" + xml: + name: "Pet" + Cat: + description: "A representation of a cat" + allOf: + - + $ref: "#/definitions/Pet" + - + type: "object" + properties: + huntingSkill: + type: "string" + description: "The measured skill for hunting" + default: "lazy" + enum: + - "clueless" + - "lazy" + - "adventurous" + - "aggressive" + required: + - "huntingSkill" + Dog: + description: "A representation of a dog" + allOf: + - + $ref: "#/definitions/Pet" + - + type: "object" + properties: + packSize: + type: "integer" + format: "int32" + description: "the size of the pack the dog is from" + default: 0 + minimum: 0 + required: + - "packSize" + ApiResponse: + type: "object" + properties: + code: + type: "integer" + format: "int32" + type: + type: "string" + message: + type: "string" + externalDocs: + description: "Find out more about Swagger" + url: "http://swagger.io" From 8b301a086e6c87c9c971af690346c2b01f425173 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Mon, 1 Feb 2016 14:46:43 +0200 Subject: [PATCH 08/14] add code samples --- demo/swagger.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/demo/swagger.yml b/demo/swagger.yml index db34da1e..0a41c2ee 100644 --- a/demo/swagger.yml +++ b/demo/swagger.yml @@ -109,6 +109,39 @@ petstore_auth: - "write:pets" - "read:pets" + x-code-samples: + - + lang: PHP + source: |- + $form = new \PetStore\Entities\Pet(); + $form->setPetType("Dog"); + $form->setName("Rex"); + // set other fields + + try { + $pet = $client->pets()->create($form); + } catch (UnprocessableEntityException $e) { + var_dump($e->getErrors()); + } + - + lang: C# + source: |- + PetStore.v1.Pet pet = new PetStore.v1.Pet(); + pet.setApiKey("your api key"); + pet.petType = PetStore.v1.Pet.TYPE_DOG; + pet.name = "Rex"; + // set other fields + + PetStoreResponse response = pet.create(); + if (response.statusCode == HttpStatusCode.Created) + { + // Successfully created + } + else + { + // Something wrong -- check response for errors + Console.WriteLine(response.getRawResponse()); + } put: tags: - "pet" @@ -743,6 +776,7 @@ required: - "name" - "photoUrls" + - "petType" discriminator: "petType" properties: petType: From fb7c2d160f4e4e12a52e9110234af422bbe44f0d Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Mon, 1 Feb 2016 14:47:21 +0200 Subject: [PATCH 09/14] Update tests --- karma.conf.js | 2 +- lib/components/ApiLogo/api-logo.spec.js | 2 +- lib/components/Method/method.spec.js | 2 +- lib/components/Redoc/redoc.spec.js | 4 +- lib/components/SchemaSample/schema-sample.js | 5 - lib/components/SideMenu/side-menu.spec.js | 2 +- lib/utils/pipes.js | 3 +- tests/schemas/extended-petstore.json | 869 ------------------- tests/schemas/extended-petstore.yml | 862 ++++++++++++++++++ tests/unit/SchemaManager.spec.js | 12 +- 10 files changed, 875 insertions(+), 888 deletions(-) delete mode 100644 tests/schemas/extended-petstore.json create mode 100644 tests/schemas/extended-petstore.yml diff --git a/karma.conf.js b/karma.conf.js index 3fbf51b8..537dd917 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -55,7 +55,7 @@ module.exports = function (config) { jspm: { config: 'system.config.js', loadFiles: ['tests/unit/*.spec.js', 'tests/helpers.js', 'lib/**/*.js'], - serveFiles: ['tests/schemas/**/*.json', 'lib/**/*.html', '.tmp/lib/**/*.css'], + serveFiles: ['tests/schemas/**/*.json','tests/schemas/**/*.yml', 'lib/**/*.html', '.tmp/lib/**/*.css'], nocache: true }, diff --git a/lib/components/ApiLogo/api-logo.spec.js b/lib/components/ApiLogo/api-logo.spec.js index 0f438c58..e2ebb319 100644 --- a/lib/components/ApiLogo/api-logo.spec.js +++ b/lib/components/ApiLogo/api-logo.spec.js @@ -53,7 +53,7 @@ describe('Redoc components', () => { expect(imgElement).toBeNull(); // update schemaUrl to load other schema in the next test - schemaUrl = '/tests/schemas/extended-petstore.json'; + schemaUrl = '/tests/schemas/extended-petstore.yml'; }); it('should load values from spec and use transparent bgColor by default', () => { diff --git a/lib/components/Method/method.spec.js b/lib/components/Method/method.spec.js index c6c87df9..5385c9c8 100644 --- a/lib/components/Method/method.spec.js +++ b/lib/components/Method/method.spec.js @@ -23,7 +23,7 @@ describe('Redoc components', () => { ]); beforeEach(injectAsync([TestComponentBuilder, SchemaManager], (tcb, schemaMgr) => { builder = tcb; - return schemaMgr.load('/tests/schemas/extended-petstore.json').then(() => null, (err) => { throw err; }); + return schemaMgr.load('/tests/schemas/extended-petstore.yml').then(() => null, (err) => { throw err; }); })); beforeEach((done) => { builder.createAsync(TestApp).then(fixture => { diff --git a/lib/components/Redoc/redoc.spec.js b/lib/components/Redoc/redoc.spec.js index e332965b..d271bcd4 100644 --- a/lib/components/Redoc/redoc.spec.js +++ b/lib/components/Redoc/redoc.spec.js @@ -28,7 +28,7 @@ describe('Redoc components', () => { ]); beforeEach(injectAsync([TestComponentBuilder, SchemaManager], (tcb, schemaMgr) => { builder = tcb; - return schemaMgr.load('/tests/schemas/extended-petstore.json').then(() => null, (err) => { throw err; }); + return schemaMgr.load('/tests/schemas/extended-petstore.yml').then(() => null, (err) => { throw err; }); })); @@ -134,7 +134,7 @@ describe('Redoc components', () => { xit('should init redoc', (done) => { var node = document.createElement('redoc'); document.body.appendChild(node); - let res = Redoc.init('/tests/schemas/extended-petstore.json'); + let res = Redoc.init('/tests/schemas/extended-petstore.yml'); res.then(() => { done(); }, () => { done.fail('Error handler should not been called'); }); diff --git a/lib/components/SchemaSample/schema-sample.js b/lib/components/SchemaSample/schema-sample.js index 79382e53..43a014a7 100644 --- a/lib/components/SchemaSample/schema-sample.js +++ b/lib/components/SchemaSample/schema-sample.js @@ -22,11 +22,6 @@ export default class SchemaSample extends BaseComponent { init() { this.data = {}; - // sometimes for some reason this method is called without resolved pointer - // TODO: fix it and remove the following workaround - if (!this.componentSchema || !this.pointer) { - return; - } let base = {}; let sample; diff --git a/lib/components/SideMenu/side-menu.spec.js b/lib/components/SideMenu/side-menu.spec.js index 975f4b46..8b3da94f 100644 --- a/lib/components/SideMenu/side-menu.spec.js +++ b/lib/components/SideMenu/side-menu.spec.js @@ -36,7 +36,7 @@ describe('Redoc components', () => { ]); beforeEach(injectAsync([TestComponentBuilder, SchemaManager], (tcb, schemaMgr) => { builder = tcb; - return schemaMgr.load('/tests/schemas/extended-petstore.json').then(() => null, (err) => { throw err; }); + return schemaMgr.load('/tests/schemas/extended-petstore.yml').then(() => null, (err) => { throw err; }); })); afterEach(() => { diff --git a/lib/utils/pipes.js b/lib/utils/pipes.js index 65184212..df4bd4e2 100644 --- a/lib/utils/pipes.js +++ b/lib/utils/pipes.js @@ -14,7 +14,7 @@ import 'prismjs/components/prism-php.js'; import 'prismjs/components/prism-coffeescript.js'; import 'prismjs/components/prism-go.js'; import 'prismjs/components/prism-haskell.js'; -import 'prismjs/components/prism-scala.js'; +//import 'prismjs/components/prism-scala.js'; import 'prismjs/components/prism-java.js'; import 'prismjs/components/prism-lua.js'; import 'prismjs/components/prism-matlab.js'; @@ -23,7 +23,6 @@ import 'prismjs/components/prism-perl.js'; import 'prismjs/components/prism-python.js'; import 'prismjs/components/prism-r.js'; import 'prismjs/components/prism-ruby.js'; - import 'prismjs/components/prism-bash.js'; import 'prismjs/components/prism-swift.js'; import 'prismjs/components/prism-vim.js'; diff --git a/tests/schemas/extended-petstore.json b/tests/schemas/extended-petstore.json deleted file mode 100644 index d734204f..00000000 --- a/tests/schemas/extended-petstore.json +++ /dev/null @@ -1,869 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "description": "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.", - "version": "1.0.0", - "title": "Swagger Petstore", - "termsOfService": "http://swagger.io/terms/", - "contact": { - "email": "apiteam@swagger.io" - }, - "x-logo": { - "url": "https://rebilly.github.io/ReDoc/petstore-logo.png" - }, - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.html" - } - }, - "host": "petstore.swagger.io", - "basePath": "/v2/", - "tags": [{ - "name": "Pagination", - "x-traitTag": true, - "description": "Sometimes you just can't get enough. For this reason, we've provided a convenient way to access more data in any request for sequential data. Simply call the url in the next_url parameter and we'll respond with the next set of data.\n```json\n{\n ...\n \"pagination\": {\n \"next_url\": \"https://api.instagram.com/v1/tags/puppy/media/recent?access_token=fb2e77d.47a0479900504cb3ab4a1f626d174d2d&max_id=13872296\",\n \"next_max_id\": \"13872296\"\n }\n}\n```\n On views where pagination is present, we also support the `count` parameter. Simply set this to the number of items you'd like to receive. Note that the default values should be fine for most applications - but if you decide to increase this number there is a maximum value defined on each endpoint.", - "externalDocs": { - "description": "Find out more", - "url": "http://swagger.io" - } - },{ - "name": "JSONP", - "x-traitTag": true, - "description": "If you're writing an AJAX application, and you'd like to wrap our response with a callback, all you have to do is specify a callback parameter with any API call:\n```\n https://api.instagram.com/v1/tags/coffee/media/recent?access_token=fb2e77d.47a0479900504cb3ab4a1f626d174d2d&callback=callbackFunction\n```\nWould respond with:\n```js\ncallbackFunction({\n ...\n});\n```", - "externalDocs": { - "description": "Find out more", - "url": "http://swagger.io" - } - },{ - "name": "pet", - "description": "Everything about your Pets", - "externalDocs": { - "description": "Find out more", - "url": "http://swagger.io" - } - }, { - "name": "store", - "description": "Access to Petstore orders" - }, { - "name": "user", - "description": "Operations about user", - "externalDocs": { - "description": "Find out more about our store", - "url": "http://swagger.io" - } - }], - "schemes": ["http"], - "paths": { - "/pet": { - "post": { - "tags": ["pet"], - "summary": "Add a new pet to the store", - "description": "", - "operationId": "addPet", - "consumes": ["application/json", "application/xml"], - "produces": ["application/xml", "application/json"], - "parameters": [{ - "in": "body", - "name": "body", - "description": "Pet object that needs to be added to the store", - "required": true, - "schema": { - "$ref": "#/definitions/Pet" - } - }], - "responses": { - "405": { - "description": "Invalid input" - } - }, - "security": [{ - "petstore_auth": ["write:pets", "read:pets"] - }] - }, - "put": { - "tags": ["pet"], - "summary": "Update an existing pet", - "description": "", - "operationId": "updatePet", - "consumes": ["application/json", "application/xml"], - "produces": ["application/xml", "application/json"], - "parameters": [{ - "in": "body", - "name": "body", - "description": "Pet object that needs to be added to the store", - "required": true, - "schema": { - "$ref": "#/definitions/Pet" - } - }], - "responses": { - "400": { - "description": "Invalid ID supplied" - }, - "404": { - "description": "Pet not found" - }, - "405": { - "description": "Validation exception" - } - }, - "security": [{ - "petstore_auth": ["write:pets", "read:pets"] - }] - } - }, - "/pet/findByStatus": { - "get": { - "tags": ["pet", "Pagination", "JSONP"], - "summary": "Finds Pets by status", - "description": "Multiple status values can be provided with comma seperated strings", - "operationId": "findPetsByStatus", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "name": "status", - "in": "query", - "description": "Status values that need to be considered for filter", - "required": true, - "type": "array", - "items": { - "type": "string", - "enum": ["available", "pending", "sold"], - "default": "available" - }, - "collectionFormat": "csv" - }], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Pet" - } - } - }, - "400": { - "description": "Invalid status value" - } - }, - "security": [{ - "petstore_auth": ["write:pets", "read:pets"] - }] - } - }, - "/pet/findByTags": { - "get": { - "tags": ["pet", "Pagination", "JSONP"], - "summary": "Finds Pets by tags", - "description": "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.", - "operationId": "findPetsByTags", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "name": "tags", - "in": "query", - "description": "Tags to filter by", - "required": true, - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "csv" - }], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Pet" - } - } - }, - "400": { - "description": "Invalid tag value" - } - }, - "security": [{ - "petstore_auth": ["write:pets", "read:pets"] - }] - } - }, - "/pet/{petId}": { - "get": { - "tags": ["pet", "JSONP"], - "summary": "Find pet by ID", - "description": "Returns a single pet", - "operationId": "getPetById", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "name": "petId", - "in": "path", - "description": "ID of pet to return", - "required": true, - "type": "integer", - "format": "int64" - }], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/Pet" - } - }, - "400": { - "description": "Invalid ID supplied" - }, - "404": { - "description": "Pet not found" - } - }, - "security": [{ - "api_key": [] - }] - }, - "post": { - "tags": ["pet"], - "summary": "Updates a pet in the store with form data", - "description": "", - "operationId": "updatePetWithForm", - "consumes": ["application/x-www-form-urlencoded"], - "produces": ["application/xml", "application/json"], - "parameters": [{ - "name": "petId", - "in": "path", - "description": "ID of pet that needs to be updated", - "required": true, - "type": "integer", - "format": "int64" - }, { - "name": "name", - "in": "formData", - "description": "Updated name of the pet", - "required": false, - "type": "string" - }, { - "name": "status", - "in": "formData", - "description": "Updated status of the pet", - "required": false, - "type": "string" - }], - "responses": { - "405": { - "description": "Invalid input" - } - }, - "security": [{ - "petstore_auth": ["write:pets", "read:pets"] - }] - }, - "delete": { - "tags": ["pet"], - "summary": "Deletes a pet", - "description": "", - "operationId": "deletePet", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "name": "api_key", - "in": "header", - "required": false, - "type": "string" - }, { - "name": "petId", - "in": "path", - "description": "Pet id to delete", - "required": true, - "type": "integer", - "format": "int64" - }], - "responses": { - "400": { - "description": "Invalid pet value" - } - }, - "security": [{ - "petstore_auth": ["write:pets", "read:pets"] - }] - } - }, - "/pet/{petId}/uploadImage": { - "post": { - "tags": ["pet"], - "summary": "uploads an image", - "description": "", - "operationId": "uploadFile", - "consumes": ["multipart/form-data"], - "produces": ["application/json"], - "parameters": [{ - "name": "petId", - "in": "path", - "description": "ID of pet to update", - "required": true, - "type": "integer", - "format": "int64" - }, { - "name": "additionalMetadata", - "in": "formData", - "description": "Additional data to pass to server", - "required": false, - "type": "string" - }, { - "name": "file", - "in": "formData", - "description": "file to upload", - "required": false, - "type": "file" - }], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/ApiResponse" - } - } - }, - "security": [{ - "petstore_auth": ["write:pets", "read:pets"] - }] - } - }, - "/store/inventory": { - "get": { - "tags": ["store", "JSONP"], - "summary": "Returns pet inventories by status", - "description": "Returns a map of status codes to quantities", - "operationId": "getInventory", - "produces": ["application/json"], - "parameters": [], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "type": "object", - "additionalProperties": { - "type": "integer", - "format": "int32" - } - } - } - }, - "security": [{ - "api_key": [] - }] - } - }, - "/store/order": { - "post": { - "tags": ["store"], - "summary": "Place an order for a pet", - "description": "", - "operationId": "placeOrder", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "in": "body", - "name": "body", - "description": "order placed for purchasing the pet", - "required": true, - "schema": { - "$ref": "#/definitions/Order" - } - }], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/Order" - } - }, - "400": { - "description": "Invalid Order" - } - } - } - }, - "/store/order/{orderId}": { - "get": { - "tags": ["store", "JSONP"], - "summary": "Find purchase order by ID", - "description": "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", - "operationId": "getOrderById", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "name": "orderId", - "in": "path", - "description": "ID of pet that needs to be fetched", - "required": true, - "type": "integer", - "maximum": 5.0, - "minimum": 1.0, - "format": "int64" - }], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/Order" - } - }, - "400": { - "description": "Invalid ID supplied" - }, - "404": { - "description": "Order not found" - } - } - }, - "delete": { - "tags": ["store"], - "summary": "Delete purchase order by ID", - "description": "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", - "operationId": "deleteOrder", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "name": "orderId", - "in": "path", - "description": "ID of the order that needs to be deleted", - "required": true, - "type": "string", - "minimum": 1.0 - }], - "responses": { - "400": { - "description": "Invalid ID supplied" - }, - "404": { - "description": "Order not found" - } - } - } - }, - "/user": { - "post": { - "tags": ["user"], - "summary": "Create user", - "description": "This can only be done by the logged in user.", - "operationId": "createUser", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "in": "body", - "name": "body", - "description": "Created user object", - "required": true, - "schema": { - "$ref": "#/definitions/User" - } - }], - "responses": { - "default": { - "description": "successful operation" - } - } - } - }, - "/user/createWithArray": { - "post": { - "tags": ["user"], - "summary": "Creates list of users with given input array", - "description": "", - "operationId": "createUsersWithArrayInput", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "in": "body", - "name": "body", - "description": "List of user object", - "required": true, - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/User" - } - } - }], - "responses": { - "default": { - "description": "successful operation" - } - } - } - }, - "/user/createWithList": { - "post": { - "tags": ["user"], - "summary": "Creates list of users with given input array", - "description": "", - "operationId": "createUsersWithListInput", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "in": "body", - "name": "body", - "description": "List of user object", - "required": true, - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/User" - } - } - }], - "responses": { - "default": { - "description": "successful operation" - } - } - } - }, - "/user/login": { - "get": { - "tags": ["user"], - "summary": "Logs user into the system", - "description": "", - "operationId": "loginUser", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "name": "username", - "in": "query", - "description": "The user name for login", - "required": true, - "type": "string" - }, { - "name": "password", - "in": "query", - "description": "The password for login in clear text", - "required": true, - "type": "string" - }], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "type": "string" - }, - "headers": { - "X-Rate-Limit": { - "type": "integer", - "format": "int32", - "description": "calls per hour allowed by the user" - }, - "X-Expires-After": { - "type": "string", - "format": "date-time", - "description": "date in UTC when toekn expires" - } - } - }, - "400": { - "description": "Invalid username/password supplied" - } - } - } - }, - "/user/logout": { - "get": { - "tags": ["user"], - "summary": "Logs out current logged in user session", - "description": "", - "operationId": "logoutUser", - "produces": ["application/xml", "application/json"], - "parameters": [], - "responses": { - "default": { - "description": "successful operation" - } - } - } - }, - "/user/{username}": { - "get": { - "tags": ["user", "JSONP"], - "summary": "Get user by user name", - "description": "", - "operationId": "getUserByName", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "name": "username", - "in": "path", - "description": "The name that needs to be fetched. Use user1 for testing. ", - "required": true, - "type": "string" - }], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/User" - } - }, - "400": { - "description": "Invalid username supplied" - }, - "404": { - "description": "User not found" - } - } - }, - "put": { - "tags": ["user"], - "summary": "Updated user", - "description": "This can only be done by the logged in user.", - "operationId": "updateUser", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "name": "username", - "in": "path", - "description": "name that need to be deleted", - "required": true, - "type": "string" - }, { - "in": "body", - "name": "body", - "description": "Updated user object", - "required": true, - "schema": { - "$ref": "#/definitions/User" - } - }], - "responses": { - "400": { - "description": "Invalid user supplied" - }, - "404": { - "description": "User not found" - } - } - }, - "delete": { - "tags": ["user"], - "summary": "Delete user", - "description": "This can only be done by the logged in user.", - "operationId": "deleteUser", - "produces": ["application/xml", "application/json"], - "parameters": [{ - "name": "username", - "in": "path", - "description": "The name that needs to be deleted", - "required": true, - "type": "string" - }], - "responses": { - "400": { - "description": "Invalid username supplied" - }, - "404": { - "description": "User not found" - } - } - } - } - }, - "securityDefinitions": { - "petstore_auth": { - "type": "oauth2", - "authorizationUrl": "http://petstore.swagger.io/api/oauth/dialog", - "flow": "implicit", - "scopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - } - }, - "api_key": { - "type": "apiKey", - "name": "api_key", - "in": "header" - } - }, - "definitions": { - "Order": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "petId": { - "type": "integer", - "format": "int64" - }, - "quantity": { - "type": "integer", - "format": "int32" - }, - "shipDate": { - "type": "string", - "format": "date-time" - }, - "status": { - "type": "string", - "description": "Order Status", - "enum": ["placed", "approved", "delivered"] - }, - "complete": { - "type": "boolean", - "default": false - } - }, - "xml": { - "name": "Order" - } - }, - "User": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "username": { - "type": "string" - }, - "firstName": { - "type": "string" - }, - "lastName": { - "type": "string" - }, - "email": { - "type": "string" - }, - "password": { - "type": "string" - }, - "phone": { - "type": "string" - }, - "userStatus": { - "type": "integer", - "format": "int32", - "description": "User Status" - } - }, - "xml": { - "name": "User" - } - }, - "Category": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - } - }, - "xml": { - "name": "Category" - } - }, - "Tag": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - } - }, - "xml": { - "name": "Tag" - } - }, - "Pet": { - "type": "object", - "required": ["name", "photoUrls", "petType"], - "discriminator": "petType", - "properties": { - "petType": { - "type": "string" - }, - "id": { - "type": "integer", - "format": "int64" - }, - "category": { - "$ref": "#/definitions/Category" - }, - "name": { - "type": "string", - "example": "doggie" - }, - "photoUrls": { - "type": "array", - "xml": { - "name": "photoUrl", - "wrapped": true - }, - "items": { - "type": "string" - } - }, - "tags": { - "type": "array", - "xml": { - "name": "tag", - "wrapped": true - }, - "items": { - "$ref": "#/definitions/Tag" - } - }, - "status": { - "type": "string", - "description": "pet status in the store", - "enum": ["available", "pending", "sold"] - } - }, - "xml": { - "name": "Pet" - } - }, - "Cat": { - "description": "A representation of a cat", - "allOf": [ - { - "type": "object", - "properties": { - "huntingSkill": { - "type": "string", - "description": "The measured skill for hunting", - "default": "lazy", - "enum": [ - "clueless", - "lazy", - "adventurous", - "aggressive" - ] - } - }, - "required": [ - "huntingSkill" - ] - }, - { - "$ref": "#/definitions/Pet" - }, - ] - }, - "ApiResponse": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "type": { - "type": "string" - }, - "message": { - "type": "string" - } - } - } - }, - "externalDocs": { - "description": "Find out more about Swagger", - "url": "http://swagger.io" - } -} diff --git a/tests/schemas/extended-petstore.yml b/tests/schemas/extended-petstore.yml new file mode 100644 index 00000000..0a41c2ee --- /dev/null +++ b/tests/schemas/extended-petstore.yml @@ -0,0 +1,862 @@ +--- + swagger: "2.0" + info: + description: "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters." + version: "1.0.0" + title: "Swagger Petstore" + termsOfService: "http://swagger.io/terms/" + contact: + email: "apiteam@swagger.io" + x-logo: + url: "https://rebilly.github.io/ReDoc/petstore-logo.png" + license: + name: "Apache 2.0" + url: "http://www.apache.org/licenses/LICENSE-2.0.html" + host: "petstore.swagger.io" + basePath: "/v2" + tags: + - + name: "Pagination" + x-traitTag: true + description: |- + Sometimes you just can't get enough. For this reason, we've provided a convenient way to access more data in + any request for sequential data. Simply call the url in the next_url parameter and we'll respond with the next + set of data. + + ```json + { + ... + "pagination": { + "next_url": "https://api.instagram.com/v1/tags/puppy/media/recent?access_token=fb2e77d.47a0479900504cb3ab4a1f626d174d2d&max_id=13872296", + "next_max_id": "13872296" + } + } + ``` + + On views where pagination is present, we also support the `count` parameter. + Simply set this to the number of items you'd like to receive. Note that the default values + should be fine for most applications - but if you decide to increase this number there is a maximum value + defined on each endpoint. + externalDocs: + description: "Find out more" + url: "http://swagger.io" + - + name: "JSONP" + x-traitTag: true + description: |- + If you're writing an AJAX application, and you'd like to wrap our response with a callback, + all you have to do is specify a callback parameter with any API call: + + ``` + https://api.instagram.com/v1/tags/coffee/media/recent?access_token=fb2e77d.47a0479900504cb3ab4a1f626d174d2d&callback=callbackFunction + ``` + Would respond with: + + ```js + callbackFunction({ + ... + }); + ``` + + > Example of markdown blockquote + externalDocs: + description: "Find out more" + url: "http://swagger.io" + - + name: "pet" + description: "Everything about your Pets" + externalDocs: + description: "Find out more" + url: "http://swagger.io" + - + name: "store" + description: "Access to Petstore orders" + - + name: "user" + description: "Operations about user" + externalDocs: + description: "Find out more about our store" + url: "http://swagger.io" + schemes: + - "http" + paths: + /pet: + post: + tags: + - "pet" + summary: "Add a new pet to the store" + description: "" + operationId: "addPet" + consumes: + - "application/json" + - "application/xml" + produces: + - "application/xml" + - "application/json" + parameters: + - + in: "body" + name: "body" + description: "Pet object that needs to be added to the store" + required: true + schema: + $ref: "#/definitions/Pet" + responses: + 405: + description: "Invalid input" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + x-code-samples: + - + lang: PHP + source: |- + $form = new \PetStore\Entities\Pet(); + $form->setPetType("Dog"); + $form->setName("Rex"); + // set other fields + + try { + $pet = $client->pets()->create($form); + } catch (UnprocessableEntityException $e) { + var_dump($e->getErrors()); + } + - + lang: C# + source: |- + PetStore.v1.Pet pet = new PetStore.v1.Pet(); + pet.setApiKey("your api key"); + pet.petType = PetStore.v1.Pet.TYPE_DOG; + pet.name = "Rex"; + // set other fields + + PetStoreResponse response = pet.create(); + if (response.statusCode == HttpStatusCode.Created) + { + // Successfully created + } + else + { + // Something wrong -- check response for errors + Console.WriteLine(response.getRawResponse()); + } + put: + tags: + - "pet" + summary: "Update an existing pet" + description: "" + operationId: "updatePet" + consumes: + - "application/json" + - "application/xml" + produces: + - "application/xml" + - "application/json" + parameters: + - + in: "body" + name: "body" + description: "Pet object that needs to be added to the store" + required: true + schema: + $ref: "#/definitions/Pet" + responses: + 400: + description: "Invalid ID supplied" + 404: + description: "Pet not found" + 405: + description: "Validation exception" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + /pet/findByStatus: + get: + tags: + - "pet" + - "Pagination" + - "JSONP" + summary: "Finds Pets by status" + description: "Multiple status values can be provided with comma seperated strings" + operationId: "findPetsByStatus" + produces: + - "application/xml" + - "application/json" + parameters: + - + name: "status" + in: "query" + description: "Status values that need to be considered for filter" + required: true + type: "array" + items: + type: "string" + enum: + - "available" + - "pending" + - "sold" + default: "available" + collectionFormat: "csv" + responses: + 200: + description: "successful operation" + schema: + type: "array" + items: + $ref: "#/definitions/Pet" + 400: + description: "Invalid status value" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + /pet/findByTags: + get: + tags: + - "pet" + - "Pagination" + - "JSONP" + summary: "Finds Pets by tags" + description: "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing." + operationId: "findPetsByTags" + produces: + - "application/xml" + - "application/json" + parameters: + - + name: "tags" + in: "query" + description: "Tags to filter by" + required: true + type: "array" + items: + type: "string" + collectionFormat: "csv" + responses: + 200: + description: "successful operation" + schema: + type: "array" + items: + $ref: "#/definitions/Pet" + 400: + description: "Invalid tag value" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + /pet/{petId}: + get: + tags: + - "pet" + - "JSONP" + summary: "Find pet by ID" + description: "Returns a single pet" + operationId: "getPetById" + produces: + - "application/xml" + - "application/json" + parameters: + - + name: "petId" + in: "path" + description: "ID of pet to return" + required: true + type: "integer" + format: "int64" + responses: + 200: + description: "successful operation" + schema: + $ref: "#/definitions/Pet" + 400: + description: "Invalid ID supplied" + 404: + description: "Pet not found" + security: + - + api_key: [] + post: + tags: + - "pet" + summary: "Updates a pet in the store with form data" + description: "" + operationId: "updatePetWithForm" + consumes: + - "application/x-www-form-urlencoded" + produces: + - "application/xml" + - "application/json" + parameters: + - + name: "petId" + in: "path" + description: "ID of pet that needs to be updated" + required: true + type: "integer" + format: "int64" + - + name: "name" + in: "formData" + description: "Updated name of the pet" + required: false + type: "string" + - + name: "status" + in: "formData" + description: "Updated status of the pet" + required: false + type: "string" + responses: + 405: + description: "Invalid input" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + delete: + tags: + - "pet" + summary: "Deletes a pet" + description: "" + operationId: "deletePet" + produces: + - "application/xml" + - "application/json" + parameters: + - + name: "api_key" + in: "header" + required: false + type: "string" + - + name: "petId" + in: "path" + description: "Pet id to delete" + required: true + type: "integer" + format: "int64" + responses: + 400: + description: "Invalid pet value" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + /pet/{petId}/uploadImage: + post: + tags: + - "pet" + summary: "uploads an image" + description: "" + operationId: "uploadFile" + consumes: + - "multipart/form-data" + produces: + - "application/json" + parameters: + - + name: "petId" + in: "path" + description: "ID of pet to update" + required: true + type: "integer" + format: "int64" + - + name: "additionalMetadata" + in: "formData" + description: "Additional data to pass to server" + required: false + type: "string" + - + name: "file" + in: "formData" + description: "file to upload" + required: false + type: "file" + responses: + 200: + description: "successful operation" + schema: + $ref: "#/definitions/ApiResponse" + security: + - + petstore_auth: + - "write:pets" + - "read:pets" + /store/inventory: + get: + tags: + - "store" + - "JSONP" + summary: "Returns pet inventories by status" + description: "Returns a map of status codes to quantities" + operationId: "getInventory" + produces: + - "application/json" + parameters: [] + responses: + 200: + description: "successful operation" + schema: + type: "object" + additionalProperties: + type: "integer" + format: "int32" + security: + - + api_key: [] + /store/order: + post: + tags: + - "store" + summary: "Place an order for a pet" + description: "" + operationId: "placeOrder" + produces: + - "application/xml" + - "application/json" + parameters: + - + in: "body" + name: "body" + description: "order placed for purchasing the pet" + required: true + schema: + $ref: "#/definitions/Order" + responses: + 200: + description: "successful operation" + schema: + $ref: "#/definitions/Order" + 400: + description: "Invalid Order" + /store/order/{orderId}: + get: + tags: + - "store" + - "JSONP" + summary: "Find purchase order by ID" + description: "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions" + operationId: "getOrderById" + produces: + - "application/xml" + - "application/json" + parameters: + - + name: "orderId" + in: "path" + description: "ID of pet that needs to be fetched" + required: true + type: "integer" + maximum: 5 + minimum: 1 + format: "int64" + responses: + 200: + description: "successful operation" + schema: + $ref: "#/definitions/Order" + 400: + description: "Invalid ID supplied" + 404: + description: "Order not found" + delete: + tags: + - "store" + summary: "Delete purchase order by ID" + description: "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors" + operationId: "deleteOrder" + produces: + - "application/xml" + - "application/json" + parameters: + - + name: "orderId" + in: "path" + description: "ID of the order that needs to be deleted" + required: true + type: "string" + minimum: 1 + responses: + 400: + description: "Invalid ID supplied" + 404: + description: "Order not found" + /user: + post: + tags: + - "user" + summary: "Create user" + description: "This can only be done by the logged in user." + operationId: "createUser" + produces: + - "application/xml" + - "application/json" + parameters: + - + in: "body" + name: "body" + description: "Created user object" + required: true + schema: + $ref: "#/definitions/User" + responses: + default: + description: "successful operation" + /user/createWithArray: + post: + tags: + - "user" + summary: "Creates list of users with given input array" + description: "" + operationId: "createUsersWithArrayInput" + produces: + - "application/xml" + - "application/json" + parameters: + - + in: "body" + name: "body" + description: "List of user object" + required: true + schema: + type: "array" + items: + $ref: "#/definitions/User" + responses: + default: + description: "successful operation" + /user/createWithList: + post: + tags: + - "user" + summary: "Creates list of users with given input array" + description: "" + operationId: "createUsersWithListInput" + produces: + - "application/xml" + - "application/json" + parameters: + - + in: "body" + name: "body" + description: "List of user object" + required: true + schema: + type: "array" + items: + $ref: "#/definitions/User" + responses: + default: + description: "successful operation" + /user/login: + get: + tags: + - "user" + summary: "Logs user into the system" + description: "" + operationId: "loginUser" + produces: + - "application/xml" + - "application/json" + parameters: + - + name: "username" + in: "query" + description: "The user name for login" + required: true + type: "string" + - + name: "password" + in: "query" + description: "The password for login in clear text" + required: true + type: "string" + responses: + 200: + description: "successful operation" + schema: + type: "string" + headers: + X-Rate-Limit: + type: "integer" + format: "int32" + description: "calls per hour allowed by the user" + X-Expires-After: + type: "string" + format: "date-time" + description: "date in UTC when toekn expires" + 400: + description: "Invalid username/password supplied" + /user/logout: + get: + tags: + - "user" + summary: "Logs out current logged in user session" + description: "" + operationId: "logoutUser" + produces: + - "application/xml" + - "application/json" + parameters: [] + responses: + default: + description: "successful operation" + /user/{username}: + get: + tags: + - "user" + - "JSONP" + summary: "Get user by user name" + description: "" + operationId: "getUserByName" + produces: + - "application/xml" + - "application/json" + parameters: + - + name: "username" + in: "path" + description: "The name that needs to be fetched. Use user1 for testing. " + required: true + type: "string" + responses: + 200: + description: "successful operation" + schema: + $ref: "#/definitions/User" + 400: + description: "Invalid username supplied" + 404: + description: "User not found" + put: + tags: + - "user" + summary: "Updated user" + description: "This can only be done by the logged in user." + operationId: "updateUser" + produces: + - "application/xml" + - "application/json" + parameters: + - + name: "username" + in: "path" + description: "name that need to be deleted" + required: true + type: "string" + - + in: "body" + name: "body" + description: "Updated user object" + required: true + schema: + $ref: "#/definitions/User" + responses: + 400: + description: "Invalid user supplied" + 404: + description: "User not found" + delete: + tags: + - "user" + summary: "Delete user" + description: "This can only be done by the logged in user." + operationId: "deleteUser" + produces: + - "application/xml" + - "application/json" + parameters: + - + name: "username" + in: "path" + description: "The name that needs to be deleted" + required: true + type: "string" + responses: + 400: + description: "Invalid username supplied" + 404: + description: "User not found" + securityDefinitions: + petstore_auth: + type: "oauth2" + authorizationUrl: "http://petstore.swagger.io/api/oauth/dialog" + flow: "implicit" + scopes: + write:pets: "modify pets in your account" + read:pets: "read your pets" + api_key: + type: "apiKey" + name: "api_key" + in: "header" + definitions: + Order: + type: "object" + properties: + id: + type: "integer" + format: "int64" + petId: + type: "integer" + format: "int64" + quantity: + type: "integer" + format: "int32" + shipDate: + type: "string" + format: "date-time" + status: + type: "string" + description: "Order Status" + enum: + - "placed" + - "approved" + - "delivered" + complete: + type: "boolean" + default: false + xml: + name: "Order" + User: + type: "object" + properties: + id: + type: "integer" + format: "int64" + username: + type: "string" + firstName: + type: "string" + lastName: + type: "string" + email: + type: "string" + password: + type: "string" + phone: + type: "string" + userStatus: + type: "integer" + format: "int32" + description: "User Status" + xml: + name: "User" + Category: + type: "object" + properties: + id: + type: "integer" + format: "int64" + name: + type: "string" + xml: + name: "Category" + Tag: + type: "object" + properties: + id: + type: "integer" + format: "int64" + name: + type: "string" + xml: + name: "Tag" + Pet: + type: "object" + required: + - "name" + - "photoUrls" + - "petType" + discriminator: "petType" + properties: + petType: + type: "string" + id: + type: "integer" + format: "int64" + category: + $ref: "#/definitions/Category" + name: + type: "string" + example: "doggie" + photoUrls: + type: "array" + xml: + name: "photoUrl" + wrapped: true + items: + type: "string" + tags: + type: "array" + xml: + name: "tag" + wrapped: true + items: + $ref: "#/definitions/Tag" + status: + type: "string" + description: "pet status in the store" + enum: + - "available" + - "pending" + - "sold" + xml: + name: "Pet" + Cat: + description: "A representation of a cat" + allOf: + - + $ref: "#/definitions/Pet" + - + type: "object" + properties: + huntingSkill: + type: "string" + description: "The measured skill for hunting" + default: "lazy" + enum: + - "clueless" + - "lazy" + - "adventurous" + - "aggressive" + required: + - "huntingSkill" + Dog: + description: "A representation of a dog" + allOf: + - + $ref: "#/definitions/Pet" + - + type: "object" + properties: + packSize: + type: "integer" + format: "int32" + description: "the size of the pack the dog is from" + default: 0 + minimum: 0 + required: + - "packSize" + ApiResponse: + type: "object" + properties: + code: + type: "integer" + format: "int32" + type: + type: "string" + message: + type: "string" + externalDocs: + description: "Find out more about Swagger" + url: "http://swagger.io" diff --git a/tests/unit/SchemaManager.spec.js b/tests/unit/SchemaManager.spec.js index 3df2b985..0a2bfbf8 100644 --- a/tests/unit/SchemaManager.spec.js +++ b/tests/unit/SchemaManager.spec.js @@ -19,7 +19,7 @@ describe('Utils', () => { }); it('load should return a promise', ()=> { - schemaMgr.load('/tests/schemas/extended-petstore.json').should.be.instanceof(Promise); + schemaMgr.load('/tests/schemas/extended-petstore.yml').should.be.instanceof(Promise); }); it('load should reject promise for invalid url', (done)=> { @@ -31,7 +31,7 @@ describe('Utils', () => { }); it('load should resolve promise for valid url', (done)=> { - schemaMgr.load('/tests/schemas/extended-petstore.json').then(() => { + schemaMgr.load('/tests/schemas/extended-petstore.yml').then(() => { done(); }, () => { throw new Error('Error handler should not be called'); @@ -40,7 +40,7 @@ describe('Utils', () => { describe('Schema manager basic functionality', ()=> { beforeAll(function (done) { - schemaMgr.load('/tests/schemas/extended-petstore.json').then(() => { + schemaMgr.load('/tests/schemas/extended-petstore.yml').then(() => { done(); }, () => { throw new Error('Error handler should not be called'); @@ -227,7 +227,7 @@ describe('Utils', () => { describe('findDerivedDefinitions method', () => { beforeAll((done) => { - schemaMgr.load('/tests/schemas/extended-petstore.json').then(() => { + schemaMgr.load('/tests/schemas/extended-petstore.yml').then(() => { done(); }, () => { done(new Error('Error handler should not be called')); @@ -237,8 +237,8 @@ describe('Utils', () => { it('should find derived definitions for Pet', () => { let deriveDefs = schemaMgr.findDerivedDefinitions('#/definitions/Pet'); deriveDefs.should.be.instanceof(Array); - deriveDefs.should.not.be.empty; - deriveDefs.should.be.deepEqual([{name: 'Cat', $ref: '#/definitions/Cat'}]); + deriveDefs.should.not.be.empty(); + deriveDefs.should.be.deepEqual([{name: 'Cat', $ref: '#/definitions/Cat'}, {name: 'Dog', $ref: '#/definitions/Dog'}]); }); it('should return emtpy array for definitions that dont have discriminator', () => { From d839ee86357bee5bc4dad2e9f23608ac641831f5 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Mon, 1 Feb 2016 14:48:51 +0200 Subject: [PATCH 10/14] minor demo fix --- demo/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/index.html b/demo/index.html index 580acf4b..1d480d20 100644 --- a/demo/index.html +++ b/demo/index.html @@ -9,7 +9,7 @@ From acd3b9bfdc3e22c417ce75b60b679534109f4ec1 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Mon, 1 Feb 2016 14:50:20 +0200 Subject: [PATCH 11/14] Remove schema from demo folder --- demo/rebilly.json | 5916 --------------------------------------------- 1 file changed, 5916 deletions(-) delete mode 100644 demo/rebilly.json diff --git a/demo/rebilly.json b/demo/rebilly.json deleted file mode 100644 index fc3a8509..00000000 --- a/demo/rebilly.json +++ /dev/null @@ -1,5916 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "version": "2.1", - "title": "Rebilly REST API", - "contact": { - "name": "Rebilly API Support", - "url": "https://www.rebilly.com/contact/", - "email": "integrations@rebilly.com" - }, - "license": { - "name": "Rebilly", - "url": "https://www.rebilly.com/api/license/" - }, - "termsOfService": "https://www.rebilly.com/terms/" - }, - "host": "api.rebilly.com", - "basePath": "/v2.1", - "schemes": [ - "https" - ], - "produces": [ - "application/json" - ], - "consumes": [ - "application/json" - ], - "tags": [ - { - "name": "Introduction", - "description": "The Rebilly API is built on HTTP. Our API is RESTful. It has predictable\nresource URLs. It returns HTTP response codes to indicate errors. It also\naccepts and returns JSON int he HTTP body. You can use your favorite\nHTTP/REST library for your programming language to use Rebilly's API, or \nyou can use one of our SDKs (currently available in PHP and C#).\n" - }, - { - "name": "Authentication", - "description": "When you sign up for an account, you are given your first API key. \nYou can generate additional API keys, and delete API keys (as you may \nneed to rotate your keys in the future). You authenticate to the \nRebilly API by providing your secret key in the request header. \nRebilly authenticates each request by searching for the presence \nof an HTTP header: REB-APIKEY. JWT authentication may be coming soon. \nRebilly also has a client-side authentication scheme that uses an\napiUser and HMAC-SHA1 signature (only for the Tokens resource), so\nthat you may safely create tokens from the client-side without compromising\nyour secret keys. Never share your secret keys. Keep them guarded and secure.\nThe client-side authentication scheme uses one HTTP header named REB-AUTH.\n" - }, - { - "name": "Customer", - "description": "Customers are your customers, sometimes known as accounts, clients,\nmembers, patrons, or players in other systems.\n" - }, - { - "name": "Contact", - "description": "Contacts belong to Customers. A Customer can have many contacts.\nSome contacts are associated to Invoices, Payment Cards, Subscriptions\nand Transactions.\n" - }, - { - "name": "Blacklist", - "description": "Your blacklists contains values of customerIds, email addresses,\nipAddresses, bank identification numbers, countries or payment cards that\nyou do NOT want to do business with. They are a good tool for managing\nrisk. A blacklist entry that expires after a period of time we call a\ngreylist.\n" - }, - { - "name": "Layout", - "description": "Layouts are used to hold collections of plans. A layout can be used to\npower a pricing page. You can make multiple layouts, and use rules to\ntarget them to different audiences.\n" - }, - { - "name": "Organization", - "description": "Organizations include the name and address of the entities related to your\naccount. An account may be multi-national, and support multiple\norganizations. Note: Organizations are share between \"Live\" and \"Sandbox\"\n" - }, - { - "name": "Payment", - "description": "Collect money from your customers with payments.\n" - }, - { - "name": "Product", - "description": "Your product includes digital goods, services, and physical goods. \n" - }, - { - "name": "Taxes", - "description": "You can map a product to a tax category. The tax category is used by \ntax providers to calculate taxes for invoices.\n" - }, - { - "name": "Website", - "description": "Website is your website accepting payments\n" - } - ], - "securityDefinitions": { - "ApiKey": { - "description": "When you sign up for an account, you are given your first API key.\nTo do so please follow this link: https://www.rebilly.com/site/signup/\nAlso you can generate additional API keys, and delete API keys (as you may\nneed to rotate your keys in the future).\n", - "name": "REB-APIKEY", - "type": "apiKey", - "in": "header" - } - }, - "security": [ - { - "ApiKey": [] - } - ], - "responses": { - "AccessForbidden": { - "description": "Access forbidden, invalid API-KEY was used", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "NotFound": { - "description": "Resource was not found", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "Conflict": { - "description": "Conflict", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "InvalidDataError": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/Error" - } - } - }, - "parameters": { - "resourceId": { - "name": "id", - "in": "path", - "description": "The resource identifier string", - "type": "string", - "required": true - }, - "collectionLimit": { - "name": "limit", - "in": "query", - "description": "The collection items limit", - "type": "integer", - "minimum": 0, - "maximum": 1000 - }, - "collectionOffset": { - "name": "offset", - "in": "query", - "description": "The collection items offset", - "type": "integer", - "minimum": 0 - } - }, - "paths": { - "/authentication-options": { - "get": { - "tags": [ - "Customer Authentication" - ], - "summary": "Read current authentication options", - "description": "Read current authentication options\n", - "responses": { - "200": { - "description": "Current authentication options was retrieved successfully", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/AuthenticationOptions" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - } - } - }, - "put": { - "tags": [ - "Customer Authentication" - ], - "summary": "Change authentication options", - "description": "Change options\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Authentication Options resource", - "required": true, - "schema": { - "$ref": "#/definitions/AuthenticationOptions" - } - } - ], - "responses": { - "200": { - "description": "Authentication Options were updated", - "schema": { - "$ref": "#/definitions/AuthenticationOptions" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/authentication-tokens/{token}": { - "parameters": [ - { - "name": "token", - "in": "path", - "description": "The token identifier string", - "type": "string", - "required": true - } - ], - "get": { - "tags": [ - "Customer Authentication" - ], - "summary": "Verify", - "description": "Verify an authentication token\n", - "responses": { - "200": { - "description": "Authentication Token was verified", - "schema": { - "$ref": "#/definitions/AuthenticationToken" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - }, - "delete": { - "tags": [ - "Customer Authentication" - ], - "summary": "Logout a user", - "description": "Logout a user\n", - "responses": { - "204": { - "description": "User was logged out" - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - } - }, - "/authentication-tokens": { - "get": { - "tags": [ - "Customer Authentication" - ], - "summary": "Retrieve a list of auth tokens", - "description": "Retrieve a list of auth tokens\n", - "parameters": [ - { - "$ref": "#/parameters/collectionLimit" - }, - { - "$ref": "#/parameters/collectionOffset" - } - ], - "responses": { - "200": { - "description": "A list of auth tokens was retrieved successfully", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/AuthenticationToken" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - } - } - }, - "post": { - "tags": [ - "Customer Authentication" - ], - "summary": "Login", - "description": "Login a user (customer)\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "AuthenticationToken resource", - "required": true, - "schema": { - "$ref": "#/definitions/AuthenticationToken" - } - } - ], - "responses": { - "201": { - "description": "Login successful", - "schema": { - "$ref": "#/definitions/AuthenticationToken" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/blacklists/{id}": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "get": { - "tags": [ - "Blacklist" - ], - "summary": "Retrieve a blacklist", - "description": "Retrieve a blacklist with specified identifier string\n", - "responses": { - "200": { - "description": "Blacklist was retrieved successfully", - "schema": { - "$ref": "#/definitions/Blacklist" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - }, - "put": { - "tags": [ - "Blacklist" - ], - "summary": "Create a blacklist with predefined ID", - "description": "Create a blacklist with predefined identifier string\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Blacklist resource", - "required": true, - "schema": { - "$ref": "#/definitions/Blacklist" - } - } - ], - "responses": { - "201": { - "description": "Blacklist was created", - "schema": { - "$ref": "#/definitions/Blacklist" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "409": { - "description": "Blacklist exist and cannot be updated", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "422": { - "$ref": "#/responses/InvalidDataError" - } - } - }, - "delete": { - "tags": [ - "Blacklist" - ], - "summary": "Delete a blacklist", - "description": "Delete a blacklist with predefined identifier string\n", - "responses": { - "204": { - "description": "Blacklist was deleted" - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - } - }, - "/blacklists": { - "get": { - "tags": [ - "Blacklists" - ], - "summary": "Retrieve a list of blacklists", - "description": "Retrieve a list of blacklists\n", - "parameters": [ - { - "$ref": "#/parameters/collectionLimit" - }, - { - "$ref": "#/parameters/collectionOffset" - } - ], - "responses": { - "200": { - "description": "A list of Blacklists was retrieved successfully", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Blacklist" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - } - } - }, - "post": { - "tags": [ - "Blacklists" - ], - "summary": "Create a blacklist", - "description": "Create a blacklist\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Blacklist resource", - "required": true, - "schema": { - "$ref": "#/definitions/Blacklist" - } - } - ], - "responses": { - "201": { - "description": "Blacklist was created", - "schema": { - "$ref": "#/definitions/Blacklist" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "$ref": "#/responses/InvalidDataError" - } - } - } - }, - "/contacts/{id}": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "get": { - "tags": [ - "Contact" - ], - "summary": "Retrieve a contact", - "description": "Retrieve a contact with specified identifier string\n", - "responses": { - "200": { - "description": "Contact was retrieved successfully", - "schema": { - "$ref": "#/definitions/Contact" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - }, - "put": { - "tags": [ - "Contact" - ], - "summary": "Create or update a contact with predefined ID", - "description": "Create or update a contact with predefined identifier string\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Contact resource", - "required": true, - "schema": { - "$ref": "#/definitions/Contact" - } - } - ], - "responses": { - "201": { - "description": "Contact was created", - "schema": { - "$ref": "#/definitions/Contact" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - }, - "409": { - "description": "Contact exists and cannot be updated" - }, - "422": { - "$ref": "#/responses/InvalidDataError" - } - } - } - }, - "/contacts": { - "get": { - "tags": [ - "Contact" - ], - "summary": "Retrieve a list of contacts", - "description": "Retrieve a list of contacts\n", - "parameters": [ - { - "$ref": "#/parameters/collectionLimit" - }, - { - "$ref": "#/parameters/collectionOffset" - } - ], - "responses": { - "200": { - "description": "A list of Contacts was retrieved successfully", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Contact" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - } - } - }, - "post": { - "tags": [ - "Contact" - ], - "summary": "Create a contact", - "description": "Create a contact\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Contact resource", - "required": true, - "schema": { - "$ref": "#/definitions/Contact" - } - } - ], - "responses": { - "201": { - "description": "Contact was created", - "schema": { - "$ref": "#/definitions/Contact" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "$ref": "#/responses/InvalidDataError" - } - } - } - }, - "/credentials/{id}": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "get": { - "tags": [ - "Customer Authentication" - ], - "summary": "Retrieve a credential", - "description": "Retrieve a credential with specified identifier string\n", - "responses": { - "200": { - "description": "Credential was retrieved successfully", - "schema": { - "$ref": "#/definitions/Credential" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - }, - "put": { - "tags": [ - "Customer Authentication" - ], - "summary": "Create or update a credential with predefined ID", - "description": "Create or update a credential with predefined identifier string\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Credential resource", - "required": true, - "schema": { - "$ref": "#/definitions/Credential" - } - } - ], - "responses": { - "200": { - "description": "Credential was updated", - "schema": { - "$ref": "#/definitions/Credential" - } - }, - "201": { - "description": "Credential was created", - "schema": { - "$ref": "#/definitions/Credential" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - }, - "delete": { - "tags": [ - "Customer Authentication" - ], - "summary": "Delete a credential", - "description": "Delete a credential with predefined identifier string\n", - "responses": { - "204": { - "description": "Credential was deleted" - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - } - }, - "/credentials": { - "get": { - "tags": [ - "Customer Authentication" - ], - "summary": "Retrieve a list of credentials", - "description": "Retrieve a list of credentials\n", - "parameters": [ - { - "$ref": "#/parameters/collectionLimit" - }, - { - "$ref": "#/parameters/collectionOffset" - } - ], - "responses": { - "200": { - "description": "A list of Credentials was retrieved successfully", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Credential" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - } - } - }, - "post": { - "tags": [ - "Customer Authentication" - ], - "summary": "Create a credential", - "description": "Create a credential\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Credential resource", - "required": true, - "schema": { - "$ref": "#/definitions/Credential" - } - } - ], - "responses": { - "201": { - "description": "Credential was created", - "schema": { - "$ref": "#/definitions/Credential" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/custom-fields/{resource}/{name}": { - "parameters": [ - { - "name": "resource", - "in": "path", - "description": "The resource type string", - "type": "string", - "required": true, - "enum": [ - "customers", - "payment-cards", - "subscriptions", - "payments", - "websites", - "contacts" - ] - }, - { - "name": "name", - "in": "path", - "description": "The custom field's identifier string", - "type": "string", - "required": true - } - ], - "get": { - "tags": [ - "Custom Fields" - ], - "summary": "Retrieve a Custom Field", - "description": "Retrieve a schema of the given Custom Field for the given resource type\n", - "responses": { - "200": { - "description": "A schema of the Custom Field was retrieved successfully", - "schema": { - "$ref": "#/definitions/CustomField" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - }, - "put": { - "tags": [ - "Custom Fields" - ], - "summary": "Create or alter a Custom Field", - "description": "Create or alter a schema of the given Custom Field for the given resource type.\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Custom Fields schema of the given resource type", - "required": true, - "schema": { - "$ref": "#/definitions/CustomField" - } - } - ], - "responses": { - "200": { - "description": "The Custom Field was updated", - "schema": { - "$ref": "#/definitions/CustomField" - } - }, - "201": { - "description": "The Custom Fields was created", - "schema": { - "$ref": "#/definitions/CustomField" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "409": { - "description": "The schema is in use: remove all the associated data in order to remove or alter the schema", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - }, - "delete": { - "tags": [ - "Custom Fields" - ], - "summary": "Delete a custom field", - "description": "Delete a custom field by its name\n", - "responses": { - "204": { - "description": "Custom field has been deleted" - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - }, - "409": { - "description": "The field is in use: remove all the associated data first", - "schema": { - "$ref": "#/definitions/Error" - } - } - } - } - }, - "/custom-fields/{resource}": { - "parameters": [ - { - "name": "resource", - "in": "path", - "description": "The resource type string", - "type": "string", - "required": true, - "enum": [ - "customers", - "payment-cards", - "subscriptions", - "payments", - "websites", - "contacts" - ] - } - ], - "get": { - "tags": [ - "Custom Fields" - ], - "summary": "Retrieve Custom Fields", - "description": "Retrieve a schema of Custom Fields for the given resource type\n", - "responses": { - "200": { - "description": "A schema of Custom Fields was retrieved successfully", - "schema": { - "description": "The list of custom fields", - "type": "array", - "items": { - "$ref": "#/definitions/CustomField" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - } - } - } - }, - "/customers/{id}": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "get": { - "tags": [ - "Customer" - ], - "summary": "Retrieve a customer", - "description": "Retrieve a customer with specified identifier string\n", - "responses": { - "200": { - "description": "Customer was retrieved successfully", - "schema": { - "$ref": "#/definitions/Customer" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - }, - "put": { - "tags": [ - "Customer" - ], - "summary": "Create a customer with predefined ID", - "description": "Create a customer with predefined identifier string\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Customer resource", - "required": true, - "schema": { - "$ref": "#/definitions/Customer" - } - } - ], - "responses": { - "200": { - "description": "Customer was updated", - "schema": { - "$ref": "#/definitions/Customer" - } - }, - "201": { - "description": "Customer was created", - "schema": { - "$ref": "#/definitions/Customer" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "$ref": "#/responses/InvalidDataError" - } - } - } - }, - "/customers": { - "get": { - "tags": [ - "Customer" - ], - "summary": "Retrieve a list of customers", - "description": "Retrieve a list of customers\n", - "parameters": [ - { - "$ref": "#/parameters/collectionLimit" - }, - { - "$ref": "#/parameters/collectionOffset" - } - ], - "responses": { - "200": { - "description": "A list of Customers was retrieved successfully", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Customer" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - } - } - }, - "post": { - "tags": [ - "Customer" - ], - "summary": "Create a customer", - "description": "Create a customer\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Customer resource", - "required": true, - "schema": { - "$ref": "#/definitions/Customer" - } - } - ], - "responses": { - "201": { - "description": "Customer was created", - "schema": { - "$ref": "#/definitions/Customer" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "$ref": "#/responses/InvalidDataError" - } - } - } - }, - "/email-credentials/{id}": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "get": { - "tags": [ - "EmailCredential" - ], - "summary": "Retrieve email credential", - "description": "Retrieve email credential with specified identifier string\n", - "responses": { - "200": { - "description": "Email credential was retrieved successfully", - "schema": { - "$ref": "#/definitions/EmailCredential" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - }, - "put": { - "tags": [ - "EmailCredential" - ], - "summary": "Create or update email credential with predefined ID", - "description": "Create or update email credential with predefined identifier string\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "EmailCredential resource", - "required": true, - "schema": { - "$ref": "#/definitions/EmailCredential" - } - } - ], - "responses": { - "200": { - "description": "Email credential was updated", - "schema": { - "$ref": "#/definitions/EmailCredential" - } - }, - "201": { - "description": "Email credential was created", - "schema": { - "$ref": "#/definitions/EmailCredential" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - }, - "delete": { - "tags": [ - "EmailCredential" - ], - "summary": "Delete an email credential", - "description": "Delete an email credential with predefined identifier string\n", - "responses": { - "204": { - "description": "Email credential was deleted" - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - } - }, - "/email-credentials": { - "get": { - "tags": [ - "EmailCredential" - ], - "summary": "Retrieve a list of email credentials", - "description": "Retrieve a list of email credentials\n", - "parameters": [ - { - "$ref": "#/parameters/collectionLimit" - }, - { - "$ref": "#/parameters/collectionOffset" - } - ], - "responses": { - "200": { - "description": "A list of email credentials was retrieved successfully", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/EmailCredential" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - } - } - }, - "post": { - "tags": [ - "EmailCredential" - ], - "summary": "Create email credential", - "description": "Create email credential", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "EmailCredential resource", - "required": true, - "schema": { - "$ref": "#/definitions/EmailCredential" - } - } - ], - "responses": { - "201": { - "description": "Email credential was created", - "schema": { - "$ref": "#/definitions/EmailCredential" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/gateway-accounts/{id}": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "get": { - "tags": [ - "Gateway Account" - ], - "summary": "Retrieve a Gateway Account", - "description": "Retrieve a Gateway Account with specified identifier string\n", - "responses": { - "200": { - "description": "Gateway Account was retrieved successfully", - "schema": { - "$ref": "#/definitions/GatewayAccount" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - }, - "put": { - "tags": [ - "Gateway Account" - ], - "summary": "Create or update a Gateway Account with predefined ID", - "description": "Create or update a GatewayAccount with predefined identifier string\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Gateway Account resource", - "required": true, - "schema": { - "$ref": "#/definitions/GatewayAccount" - } - } - ], - "responses": { - "200": { - "description": "Gateway Account was updated", - "schema": { - "$ref": "#/definitions/GatewayAccount" - } - }, - "201": { - "description": "Gateway Account was created", - "schema": { - "$ref": "#/definitions/GatewayAccount" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - }, - "delete": { - "tags": [ - "Gateway Account" - ], - "summary": "Delete a Gateway Account", - "description": "Delete a Gateway Account with predefined identifier string\n", - "responses": { - "204": { - "description": "Gateway Account was deleted" - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - } - }, - "/gateway-accounts": { - "get": { - "tags": [ - "Gateway Account" - ], - "summary": "Retrieve a list of gateway accounts", - "description": "Retrieve a list of gateway accounts\n", - "parameters": [ - { - "$ref": "#/parameters/collectionLimit" - }, - { - "$ref": "#/parameters/collectionOffset" - } - ], - "responses": { - "200": { - "description": "A list of Gateway Accounts was retrieved successfully", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/GatewayAccount" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - } - } - }, - "post": { - "tags": [ - "Gateway Account" - ], - "summary": "Create a Gateway Account", - "description": "Create a Gateway Account\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Gateway Account resource", - "required": true, - "schema": { - "$ref": "#/definitions/GatewayAccount" - } - } - ], - "responses": { - "201": { - "description": "Gateway Account was created", - "schema": { - "$ref": "#/definitions/GatewayAccount" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/invoices/{id}/abandon": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "post": { - "tags": [ - "Invoice" - ], - "summary": "Abandon an invoice", - "description": "Abandon an invoice with specified identifier string\n", - "responses": { - "201": { - "description": "Invoice was abandoned successfully", - "schema": { - "$ref": "#/definitions/Invoice" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - } - }, - "/invoices/{id}/issue": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "post": { - "tags": [ - "Invoice" - ], - "summary": "Issue an invoice", - "description": "Issue an invoice with specified identifier string\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "InvoiceItem resource", - "required": true, - "schema": { - "$ref": "#/definitions/InvoiceIssue" - } - } - ], - "responses": { - "201": { - "description": "Invoice was abandoned successfully", - "schema": { - "$ref": "#/definitions/Invoice" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - } - }, - "/invoices/{id}/items": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "get": { - "tags": [ - "Invoice" - ], - "summary": "Retrieve invoice items", - "description": "Retrieve an invoice items with specified invoice identifier string\n", - "parameters": [ - { - "$ref": "#/parameters/collectionLimit" - }, - { - "$ref": "#/parameters/collectionOffset" - } - ], - "responses": { - "200": { - "description": "Invoice items were retrieved successfully", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/InvoiceItem" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - }, - "post": { - "tags": [ - "Invoice" - ], - "summary": "Create an invoice item", - "description": "Create an invoice item\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "InvoiceItem resource", - "required": true, - "schema": { - "$ref": "#/definitions/InvoiceItem" - } - } - ], - "responses": { - "201": { - "description": "InvoiceItem was created", - "schema": { - "$ref": "#/definitions/InvoiceItem" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/invoices/{id}/void": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "post": { - "tags": [ - "Invoice" - ], - "summary": "Void an invoice", - "description": "Void an invoice with specified identifier string\n", - "responses": { - "201": { - "description": "Invoice was voided successfully", - "schema": { - "$ref": "#/definitions/Invoice" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - } - }, - "/invoices/{id}": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "get": { - "tags": [ - "Invoice" - ], - "summary": "Retrieve an invoice", - "description": "Retrieve an invoice with specified identifier string\n", - "responses": { - "200": { - "description": "Invoice was retrieved successfully", - "schema": { - "$ref": "#/definitions/Invoice" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - }, - "put": { - "tags": [ - "Invoice" - ], - "summary": "Create or update an invoice with predefined ID", - "description": "Create or update an invoice with predefined identifier string\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Invoice resource", - "required": true, - "schema": { - "$ref": "#/definitions/Invoice" - } - } - ], - "responses": { - "200": { - "description": "Invoice was updated", - "schema": { - "$ref": "#/definitions/Invoice" - } - }, - "201": { - "description": "Invoice was created", - "schema": { - "$ref": "#/definitions/Invoice" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/invoices": { - "get": { - "tags": [ - "Invoice" - ], - "summary": "Retrieve a list of invoices", - "description": "Retrieve a list of invoices\n", - "parameters": [ - { - "$ref": "#/parameters/collectionLimit" - }, - { - "$ref": "#/parameters/collectionOffset" - } - ], - "responses": { - "200": { - "description": "A list of invoices was retrieved successfully", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Invoice" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - } - } - }, - "post": { - "tags": [ - "Invoice" - ], - "summary": "Create an invoice", - "description": "Create an invoice\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Invoice resource", - "required": true, - "schema": { - "$ref": "#/definitions/Invoice" - } - } - ], - "responses": { - "201": { - "description": "Invoice was created", - "schema": { - "$ref": "#/definitions/Invoice" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/layouts/{id}": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "get": { - "tags": [ - "Layout" - ], - "summary": "Retrieve a layout", - "description": "Retrieve a layout with specified identifier string\n", - "responses": { - "200": { - "description": "Layout was retrieved successfully", - "schema": { - "$ref": "#/definitions/Layout" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - }, - "put": { - "tags": [ - "Layout" - ], - "summary": "Create or update a layout with predefined ID", - "description": "Create or update a layout with predefined identifier string\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Layout resource", - "required": true, - "schema": { - "$ref": "#/definitions/Layout" - } - } - ], - "responses": { - "200": { - "description": "Layout was updated", - "schema": { - "$ref": "#/definitions/Layout" - } - }, - "201": { - "description": "Layout was created", - "schema": { - "$ref": "#/definitions/Layout" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - }, - "422": { - "$ref": "#/responses/InvalidDataError" - } - } - } - }, - "/layouts": { - "get": { - "tags": [ - "Layout" - ], - "summary": "Retrieve a layout list", - "description": "Retrieve a layout list\n", - "parameters": [ - { - "$ref": "#/parameters/collectionLimit" - }, - { - "$ref": "#/parameters/collectionOffset" - } - ], - "responses": { - "200": { - "description": "Layout list was retrieved successfully", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Layout" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - } - } - }, - "post": { - "tags": [ - "Layout" - ], - "summary": "Create a layout", - "description": "Create a layout\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Layout resource", - "required": true, - "schema": { - "$ref": "#/definitions/Layout" - } - } - ], - "responses": { - "201": { - "description": "Layout was created", - "schema": { - "$ref": "#/definitions/Layout" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "$ref": "#/responses/InvalidDataError" - } - } - } - }, - "/lead-sources/{id}": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "get": { - "tags": [ - "Lead Source" - ], - "summary": "Retrieve a LeadSource", - "description": "Retrieve a LeadSource with specified identifier string\n", - "responses": { - "200": { - "description": "LeadSource was retrieved successfully", - "schema": { - "$ref": "#/definitions/LeadSource" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - }, - "put": { - "tags": [ - "Lead Source" - ], - "summary": "Create a LeadSource with predefined ID", - "description": "Create a LeadSource with predefined identifier string\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "LeadSource resource", - "required": true, - "schema": { - "$ref": "#/definitions/LeadSource" - } - } - ], - "responses": { - "200": { - "description": "LeadSource was updated", - "schema": { - "$ref": "#/definitions/LeadSource" - } - }, - "201": { - "description": "LeadSource was created", - "schema": { - "$ref": "#/definitions/LeadSource" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/lead-sources": { - "get": { - "tags": [ - "Lead Source" - ], - "summary": "Retrieve a list of LeadSources", - "description": "Retrieve a list of LeadSources\n", - "parameters": [ - { - "$ref": "#/parameters/collectionLimit" - }, - { - "$ref": "#/parameters/collectionOffset" - } - ], - "responses": { - "200": { - "description": "A list of LeadSources was retrieved successfully", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/LeadSource" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - } - } - }, - "post": { - "tags": [ - "Lead Source" - ], - "summary": "Create a LeadSource", - "description": "Create a LeadSource\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "LeadSource resource", - "required": true, - "schema": { - "$ref": "#/definitions/LeadSource" - } - } - ], - "responses": { - "201": { - "description": "LeadSource was created", - "schema": { - "$ref": "#/definitions/LeadSource" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/login": { - "post": { - "tags": [ - "Session", - "Login" - ], - "summary": "Create a session with email and password", - "description": "Create a session with email and password\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Login resource", - "required": true, - "schema": { - "$ref": "#/definitions/Login" - } - } - ], - "responses": { - "201": { - "description": "Session was created", - "schema": { - "$ref": "#/definitions/Session" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/notes/{id}": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "get": { - "tags": [ - "Note" - ], - "summary": "Retrieve a note", - "description": "Retrieve a note with specified identifier string\n", - "responses": { - "200": { - "description": "Note was retrieved successfully", - "schema": { - "$ref": "#/definitions/Note" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - }, - "put": { - "tags": [ - "Note" - ], - "summary": "Create or update a note with predefined ID", - "description": "Create or update a note with predefined identifier string\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Note resource", - "required": true, - "schema": { - "$ref": "#/definitions/Note" - } - } - ], - "responses": { - "200": { - "description": "Note was updated", - "schema": { - "$ref": "#/definitions/Note" - } - }, - "201": { - "description": "Note was created", - "schema": { - "$ref": "#/definitions/Note" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/notes": { - "get": { - "tags": [ - "Note" - ], - "summary": "Retrieve a list of notes", - "description": "Retrieve a list of notes\n", - "parameters": [ - { - "$ref": "#/parameters/collectionLimit" - }, - { - "$ref": "#/parameters/collectionOffset" - } - ], - "responses": { - "200": { - "description": "A list of Notes was retrieved successfully", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Note" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - } - } - }, - "post": { - "tags": [ - "Note" - ], - "summary": "Create a note", - "description": "Create a note\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Note resource", - "required": true, - "schema": { - "$ref": "#/definitions/Note" - } - } - ], - "responses": { - "201": { - "description": "Note was created", - "schema": { - "$ref": "#/definitions/Note" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/organizations/{id}": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "get": { - "tags": [ - "Organization" - ], - "summary": "Retrieve a organization", - "description": "Retrieve a organization with specified identifier string\n", - "responses": { - "200": { - "description": "Organization was retrieved successfully", - "schema": { - "$ref": "#/definitions/Organization" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - }, - "put": { - "tags": [ - "Organization" - ], - "summary": "Create or update a organization with predefined ID", - "description": "Create or update a organization with predefined identifier string\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Organization resource", - "required": true, - "schema": { - "$ref": "#/definitions/Organization" - } - } - ], - "responses": { - "200": { - "description": "Organization was updated", - "schema": { - "$ref": "#/definitions/Organization" - } - }, - "201": { - "description": "Organization was created", - "schema": { - "$ref": "#/definitions/Organization" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "$ref": "#/responses/InvalidDataError" - } - } - }, - "delete": { - "tags": [ - "Organization" - ], - "summary": "Delete a organization", - "description": "Delete a organization with predefined identifier string\n", - "responses": { - "204": { - "description": "Organization was deleted" - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - }, - "409": { - "description": "Organization has related resources and cannot be deleted", - "schema": { - "$ref": "#/definitions/Error" - } - } - } - } - }, - "/organizations": { - "get": { - "tags": [ - "Organization" - ], - "summary": "Retrieve a list of organizations", - "description": "Retrieve a list of organizations\n", - "parameters": [ - { - "$ref": "#/parameters/collectionLimit" - }, - { - "$ref": "#/parameters/collectionOffset" - } - ], - "responses": { - "200": { - "description": "A list of organizations was retrieved successfully", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Organization" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - } - } - }, - "post": { - "tags": [ - "Organization" - ], - "summary": "Create a organization", - "description": "Create a organization\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Organization resource", - "required": true, - "schema": { - "$ref": "#/definitions/Organization" - } - } - ], - "responses": { - "201": { - "description": "Organization was created", - "schema": { - "$ref": "#/definitions/Organization" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "$ref": "#/responses/InvalidDataError" - } - } - } - }, - "/password-tokens/{id}": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "get": { - "tags": [ - "Customer Authentication" - ], - "summary": "Retrieve a Reset Password Token", - "description": "Retrieve a Reset Password Token with specified identifier string\n", - "responses": { - "200": { - "description": "ResetPasswordToken was retrieved successfully", - "schema": { - "$ref": "#/definitions/ResetPasswordToken" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - }, - "delete": { - "tags": [ - "Customer Authentication" - ], - "summary": "Delete a Reset Password Token", - "description": "Delete a Reset Password Token with predefined identifier string\n", - "responses": { - "204": { - "description": "ResetPasswordToken was deleted" - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - }, - "409": { - "description": "ResetPasswordToken has related resources and cannot be deleted" - } - } - } - }, - "/password-tokens": { - "get": { - "tags": [ - "Customer Authentication" - ], - "summary": "Retrieve a list of tokens", - "description": "Retrieve a list of tokens\n", - "parameters": [ - { - "$ref": "#/parameters/collectionLimit" - }, - { - "$ref": "#/parameters/collectionOffset" - } - ], - "responses": { - "200": { - "description": "A list of Reset Password Tokens was retrieved successfully", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/ResetPasswordToken" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - } - } - }, - "post": { - "tags": [ - "Customer Authentication" - ], - "summary": "Create a Reset Password Token", - "description": "Create a Reset Password Token\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "ResetPasswordToken resource", - "required": true, - "schema": { - "$ref": "#/definitions/ResetPasswordToken" - } - } - ], - "responses": { - "201": { - "description": "Reset Password Token was created", - "schema": { - "$ref": "#/definitions/ResetPasswordToken" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/payment-cards/{id}/authorization": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "post": { - "tags": [ - "PaymentCard", - "Public" - ], - "summary": "Authorize a Payment Card", - "description": "Authorize a Payment Card\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "PaymentCard resource", - "required": true, - "schema": { - "type": "object", - "required": [ - "websiteId", - "currency" - ], - "properties": { - "websiteId": { - "description": "The Website ID", - "type": "string" - }, - "currency": { - "description": "Currency (three letter code)", - "type": "string" - }, - "gatewayAccountId": { - "description": "The Gateway account ID", - "type": "string" - }, - "amount": { - "description": "Amount", - "type": "number", - "format": "double" - } - } - } - } - ], - "responses": { - "201": { - "description": "Authorization successful", - "schema": { - "$ref": "#/definitions/PaymentCard" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/payment-cards/{id}/deactivation": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "post": { - "tags": [ - "Payment Card" - ], - "summary": "Deactivate a Payment Card", - "description": "Deactivate a Payment Card\n", - "responses": { - "201": { - "description": "Authorization successful", - "schema": { - "$ref": "#/definitions/PaymentCard" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/payment-cards/{id}": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "get": { - "tags": [ - "Payment Card" - ], - "summary": "Retrieve a Payment Card", - "description": "Retrieve a Payment Card with specified identifier string\n", - "responses": { - "200": { - "description": "PaymentCard was retrieved successfully", - "schema": { - "$ref": "#/definitions/PaymentCard" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - } - }, - "/payment-cards": { - "get": { - "tags": [ - "Payment Card" - ], - "summary": "Retrieve a list of Payment Cards", - "description": "Retrieve a list of Payments Cards\n", - "parameters": [ - { - "$ref": "#/parameters/collectionLimit" - }, - { - "$ref": "#/parameters/collectionOffset" - } - ], - "responses": { - "200": { - "description": "A list of Payment Card was retrieved successfully", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/PaymentCard" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - } - } - }, - "post": { - "tags": [ - "Payment Card" - ], - "summary": "Create a Payment Card", - "description": "Create a Payment Card\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "PaymentCard resource", - "required": true, - "schema": { - "$ref": "#/definitions/PaymentCard" - } - } - ], - "responses": { - "201": { - "description": "Payment Card was created", - "schema": { - "$ref": "#/definitions/PaymentCard" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/payments/{id}": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "get": { - "tags": [ - "Payment" - ], - "summary": "Retrieve a payment", - "description": "Retrieve a payment with specified identifier string\n", - "responses": { - "200": { - "description": "Payment was retrieved successfully", - "schema": { - "$ref": "#/definitions/PaymentResponse" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - }, - "put": { - "tags": [ - "Payment" - ], - "summary": "Create a payment with predefined ID", - "description": "Make a payment with predefined identifier string\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Payment resource", - "required": true, - "schema": { - "$ref": "#/definitions/Payment" - } - } - ], - "responses": { - "201": { - "description": "Payment was processed", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/PaymentResponse" - } - } - }, - "202": { - "description": "Payment was accepted", - "schema": { - "$ref": "#/definitions/PaymentResponse" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/payments": { - "get": { - "tags": [ - "Payment" - ], - "summary": "Retrieve a payment list", - "description": "Retrieve a payment list\n", - "parameters": [ - { - "$ref": "#/parameters/collectionLimit" - }, - { - "$ref": "#/parameters/collectionOffset" - } - ], - "responses": { - "200": { - "description": "Payment list was retrieved successfully", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/PaymentResponse" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - }, - "post": { - "tags": [ - "Payment" - ], - "summary": "Create a payment", - "description": "Create a payment\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Payment resource", - "required": true, - "schema": { - "$ref": "#/definitions/Payment" - } - } - ], - "responses": { - "201": { - "description": "Payment was processed", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/PaymentResponse" - } - } - }, - "202": { - "description": "Payment was accepted", - "schema": { - "$ref": "#/definitions/PaymentResponse" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "409": { - "$ref": "#/responses/Conflict" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/plans/{id}": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "get": { - "tags": [ - "Plan" - ], - "summary": "Retrieve a plan", - "description": "Retrieve a plan with specified identifier string\n", - "responses": { - "200": { - "description": "Plan was retrieved successfully", - "schema": { - "$ref": "#/definitions/Plan" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - }, - "put": { - "tags": [ - "Plan" - ], - "summary": "Create or update a Plan with predefined ID", - "description": "Create or update a Plan with predefined identifier string\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Plan resource", - "required": true, - "schema": { - "$ref": "#/definitions/Plan" - } - } - ], - "responses": { - "200": { - "description": "Plan was updated", - "schema": { - "$ref": "#/definitions/Plan" - } - }, - "201": { - "description": "Plan was created", - "schema": { - "$ref": "#/definitions/Plan" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - }, - "delete": { - "tags": [ - "Plan" - ], - "summary": "Delete a Plan", - "description": "Delete a Plan with predefined identifier string\n", - "responses": { - "204": { - "description": "Plan was deleted" - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - } - }, - "/plans": { - "get": { - "tags": [ - "Plan" - ], - "summary": "Retrieve a list of plans", - "description": "Retrieve a list of plans\n", - "parameters": [ - { - "$ref": "#/parameters/collectionLimit" - }, - { - "$ref": "#/parameters/collectionOffset" - } - ], - "responses": { - "200": { - "description": "A list of Plans was retrieved successfully", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Plan" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - } - } - }, - "post": { - "tags": [ - "Plan" - ], - "summary": "Create a plan", - "description": "Create a plan\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Plan resource", - "required": true, - "schema": { - "$ref": "#/definitions/Plan" - } - } - ], - "responses": { - "201": { - "description": "Plan was created", - "schema": { - "$ref": "#/definitions/Plan" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/products/{id}": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "get": { - "tags": [ - "Product" - ], - "summary": "Retrieve a product", - "description": "Retrieve a product with specified identifier string\n", - "responses": { - "200": { - "description": "Product was retrieved successfully", - "schema": { - "$ref": "#/definitions/Product" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - }, - "put": { - "tags": [ - "Product" - ], - "summary": "Create a product with predefined ID", - "description": "Create a product with predefined identifier string\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Product resource", - "required": true, - "schema": { - "$ref": "#/definitions/Product" - } - } - ], - "responses": { - "200": { - "description": "Product was updated", - "schema": { - "$ref": "#/definitions/Product" - } - }, - "201": { - "description": "Product was created", - "schema": { - "$ref": "#/definitions/Product" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "$ref": "#/responses/InvalidDataError" - } - } - } - }, - "/products": { - "get": { - "tags": [ - "Product" - ], - "summary": "Retrieve a list of products", - "description": "Retrieve a list of products\n", - "parameters": [ - { - "$ref": "#/parameters/collectionLimit" - }, - { - "$ref": "#/parameters/collectionOffset" - } - ], - "responses": { - "200": { - "description": "A list of products was retrieved successfully", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Product" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - } - } - }, - "post": { - "tags": [ - "Product" - ], - "summary": "Create a Product", - "description": "Create a Product\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Product resource", - "required": true, - "schema": { - "$ref": "#/definitions/Product" - } - } - ], - "responses": { - "201": { - "description": "Product was created", - "schema": { - "$ref": "#/definitions/Product" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "$ref": "#/responses/InvalidDataError" - } - } - } - }, - "/queue/payments/{id}/cancel": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "post": { - "tags": [ - "Payment" - ], - "summary": "Cancel a scheduled payment", - "description": "Cancel a scheduled payment with specified identifier string\n", - "responses": { - "201": { - "description": "Successful cancel the payment", - "schema": { - "$ref": "#/definitions/PaymentResponse" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - } - }, - "/queue/payments/{id}": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "get": { - "tags": [ - "Payment" - ], - "summary": "Retrieve a scheduled payment", - "description": "Retrieve a payment with specified identifier string\n", - "responses": { - "200": { - "description": "Successful retrieve the payment that still waiting to be processed", - "schema": { - "$ref": "#/definitions/PaymentResponse" - } - }, - "303": { - "description": "Payment was successfully processed and moved out from queue", - "schema": { - "$ref": "#/definitions/PaymentResponse" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - } - }, - "/queue/payments": { - "get": { - "tags": [ - "Payment" - ], - "parameters": [ - { - "$ref": "#/parameters/collectionLimit" - }, - { - "$ref": "#/parameters/collectionOffset" - } - ], - "summary": "Retrieve a scheduled payment list", - "description": "Retrieve a scheduled payment list\n", - "responses": { - "200": { - "description": "Successful retrieve the payments list that still waiting to be processed", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/PaymentResponse" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - } - } - } - }, - "/sessions/{id}": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "get": { - "tags": [ - "Session" - ], - "summary": "Retrieve a Session", - "description": "Retrieve a Session with specified identifier string\n", - "responses": { - "200": { - "description": "Session was retrieved successfully", - "schema": { - "$ref": "#/definitions/Session" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - }, - "put": { - "tags": [ - "Session" - ], - "summary": "Create or update a Session with predefined ID", - "description": "Create or update a Session with predefined identifier string\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Session resource", - "required": true, - "schema": { - "$ref": "#/definitions/Session" - } - } - ], - "responses": { - "200": { - "description": "Session was updated", - "schema": { - "$ref": "#/definitions/Session" - } - }, - "201": { - "description": "Session was created", - "schema": { - "$ref": "#/definitions/Session" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - }, - "delete": { - "tags": [ - "Session" - ], - "summary": "Delete a Session", - "description": "Delete a Session with predefined identifier string\n", - "responses": { - "204": { - "description": "Session was deleted" - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - }, - "409": { - "description": "Session has related resources and cannot be deleted" - } - } - } - }, - "/sessions": { - "get": { - "tags": [ - "Session" - ], - "summary": "Retrieve a list of sessions", - "description": "Retrieve a list of sessions\n", - "parameters": [ - { - "$ref": "#/parameters/collectionLimit" - }, - { - "$ref": "#/parameters/collectionOffset" - } - ], - "responses": { - "200": { - "description": "A list of Sessions was retrieved successfully", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Session" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - } - } - }, - "post": { - "tags": [ - "Session" - ], - "summary": "Create a session", - "description": "Create a session\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Sessions resource", - "required": true, - "schema": { - "$ref": "#/definitions/Session" - } - } - ], - "responses": { - "201": { - "description": "Session was created", - "schema": { - "$ref": "#/definitions/Session" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/subscriptions/{id}/cancel": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "post": { - "tags": [ - "Subscription" - ], - "summary": "Cancel a subscription", - "description": "Cancel a subscription\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Only policy", - "required": true, - "schema": { - "$ref": "#/definitions/SubscriptionCancel" - } - } - ], - "responses": { - "201": { - "description": "Subscription was switched", - "schema": { - "$ref": "#/definitions/Subscription" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/subscriptions/{id}/switch": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "post": { - "tags": [ - "Subscription" - ], - "summary": "Switch a subscription", - "description": "Switch a subscription\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "SubscriptionSwitch resource", - "required": true, - "schema": { - "$ref": "#/definitions/SubscriptionSwitch" - } - } - ], - "responses": { - "201": { - "description": "Subscription was switched", - "schema": { - "$ref": "#/definitions/Subscription" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/subscriptions/{id}": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "get": { - "tags": [ - "Subscription" - ], - "summary": "Retrieve a subscription", - "description": "Retrieve a subscription with specified identifier string\n", - "responses": { - "200": { - "description": "Subscription was retrieved successfully", - "schema": { - "$ref": "#/definitions/Subscription" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - }, - "put": { - "tags": [ - "Subscription" - ], - "summary": "Create or update a subscription with predefined ID", - "description": "Create or update a subscription with predefined identifier string\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Subscription resource", - "required": true, - "schema": { - "$ref": "#/definitions/Subscription" - } - } - ], - "responses": { - "200": { - "description": "Subscription was updated", - "schema": { - "$ref": "#/definitions/Subscription" - } - }, - "201": { - "description": "Subscription was created", - "schema": { - "$ref": "#/definitions/Subscription" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/subscriptions": { - "get": { - "tags": [ - "Subscription" - ], - "summary": "Retrieve a list of subscriptions", - "description": "Retrieve a list of subscriptions\n", - "parameters": [ - { - "$ref": "#/parameters/collectionLimit" - }, - { - "$ref": "#/parameters/collectionOffset" - } - ], - "responses": { - "200": { - "description": "A list of subscriptions was retrieved successfully", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Subscription" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - } - } - }, - "post": { - "tags": [ - "Subscription" - ], - "summary": "Create a subscription", - "description": "Create a subscription\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Subscription resource", - "required": true, - "schema": { - "$ref": "#/definitions/Subscription" - } - } - ], - "responses": { - "201": { - "description": "Subscription was created", - "schema": { - "$ref": "#/definitions/Subscription" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/tax-categories": { - "get": { - "tags": [ - "Taxes" - ], - "summary": "Retrieve a list of tax categories", - "description": "Retrieve a list of tax categories\n", - "responses": { - "200": { - "description": "A list of tax categories was retrieved successfully", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/TaxCategory" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - } - } - } - }, - "/tokens/{token}/expiration": { - "parameters": [ - { - "name": "token", - "in": "path", - "description": "The token identifier string", - "type": "string", - "required": true - } - ], - "post": { - "tags": [ - "Payment Card Token" - ], - "summary": "Expire a token", - "description": "Expire a token\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "PaymentCardToken resource", - "required": true, - "schema": { - "$ref": "#/definitions/PaymentCardToken" - } - } - ], - "responses": { - "201": { - "description": "Token expiration successful", - "schema": { - "$ref": "#/definitions/PaymentCardToken" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/tokens/{token}": { - "parameters": [ - { - "name": "token", - "in": "path", - "description": "The token identifier string", - "type": "string", - "required": true - } - ], - "get": { - "tags": [ - "Payment Card Token" - ], - "summary": "Retrieve a token", - "description": "Retrieve a token with specified identifier string\n", - "responses": { - "200": { - "description": "Token was retrieved successfully", - "schema": { - "$ref": "#/definitions/PaymentCardToken" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - } - }, - "/tokens": { - "get": { - "tags": [ - "Payment Card Token" - ], - "summary": "Retrieve a list of tokens", - "description": "Retrieve a list of tokens\n", - "parameters": [ - { - "$ref": "#/parameters/collectionLimit" - }, - { - "$ref": "#/parameters/collectionOffset" - } - ], - "responses": { - "200": { - "description": "A list of tokens was retrieved successfully", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/PaymentCardToken" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - } - } - }, - "post": { - "tags": [ - "Payment Card Token" - ], - "summary": "Create a token", - "description": "Create a token\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "PaymentCardToken resource", - "required": true, - "schema": { - "$ref": "#/definitions/PaymentCardToken" - } - } - ], - "responses": { - "201": { - "description": "Token was created", - "schema": { - "$ref": "#/definitions/PaymentCardToken" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - }, - "/transactions/{id}/refund": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "post": { - "tags": [ - "Transaction" - ], - "summary": "Refund a Transaction", - "description": "Refund a Transaction with specified identifier string\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Transaction resource", - "required": true, - "schema": { - "$ref": "#/definitions/TransactionRefund" - } - } - ], - "responses": { - "201": { - "description": "Transaction was refunded successfully", - "schema": { - "$ref": "#/definitions/Transaction" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - } - }, - "/transactions/{id}": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "get": { - "tags": [ - "Transaction" - ], - "summary": "Retrieve a Transaction", - "description": "Retrieve a Transaction with specified identifier string\n", - "responses": { - "200": { - "description": "Transaction was retrieved successfully", - "schema": { - "$ref": "#/definitions/Transaction" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - } - }, - "/transactions": { - "get": { - "tags": [ - "Transaction" - ], - "summary": "Retrieve a list of transactions", - "description": "Retrieve a list of transactions\n", - "parameters": [ - { - "$ref": "#/parameters/collectionLimit" - }, - { - "$ref": "#/parameters/collectionOffset" - } - ], - "responses": { - "200": { - "description": "A list of transactions was retrieved successfully", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Transaction" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - } - } - } - }, - "/websites/{id}": { - "parameters": [ - { - "$ref": "#/parameters/resourceId" - } - ], - "get": { - "tags": [ - "Website" - ], - "summary": "Retrieve a website", - "description": "Retrieve a website with specified identifier string\n", - "responses": { - "200": { - "description": "Website was retrieved successfully", - "schema": { - "$ref": "#/definitions/Website" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - } - } - }, - "put": { - "tags": [ - "Website" - ], - "summary": "Create or update a website with predefined ID", - "description": "Create or update a website with predefined identifier string\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Website resource", - "required": true, - "schema": { - "$ref": "#/definitions/Website" - } - } - ], - "responses": { - "200": { - "description": "Website was updated", - "schema": { - "$ref": "#/definitions/Website" - } - }, - "201": { - "description": "Website was created", - "schema": { - "$ref": "#/definitions/Website" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - }, - "delete": { - "tags": [ - "Website" - ], - "summary": "Delete a website", - "description": "Delete a website with predefined identifier string\n", - "responses": { - "204": { - "description": "Website was deleted" - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "404": { - "$ref": "#/responses/NotFound" - }, - "409": { - "description": "Website has related resources and cannot be deleted" - } - } - } - }, - "/websites": { - "get": { - "tags": [ - "Website" - ], - "summary": "Retrieve a list of websites", - "description": "Retrieve a list of websites\n", - "parameters": [ - { - "$ref": "#/parameters/collectionLimit" - }, - { - "$ref": "#/parameters/collectionOffset" - } - ], - "responses": { - "200": { - "description": "A list of Websites was retrieved successfully", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Website" - } - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - } - } - }, - "post": { - "tags": [ - "Website" - ], - "summary": "Create a website", - "description": "Create a website\n", - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Website resource", - "required": true, - "schema": { - "$ref": "#/definitions/Website" - } - } - ], - "responses": { - "201": { - "description": "Website was created", - "schema": { - "$ref": "#/definitions/Website" - } - }, - "401": { - "$ref": "#/responses/AccessForbidden" - }, - "422": { - "description": "Invalid data was sent", - "schema": { - "$ref": "#/definitions/InvalidError" - } - } - } - } - } - }, - "definitions": { - "AuthenticationOptions": { - "type": "object", - "properties": { - "passwordPattern": { - "description": "Allowed password pattern", - "type": "string" - }, - "credentialTtl": { - "description": "The default lifetime of the credential in seconds", - "type": "integer" - }, - "authTokenTtl": { - "description": "The default lifetime of the auth-token in seconds", - "type": "integer" - }, - "resetTokenTtl": { - "description": "The default lifetime of the reset-token in seconds", - "type": "integer" - } - } - }, - "AuthenticationToken": { - "type": "object", - "required": [ - "username", - "password" - ], - "properties": { - "token": { - "description": "The token identifier string", - "type": "string", - "readOnly": true - }, - "username": { - "description": "The token's username", - "type": "string" - }, - "password": { - "description": "The token's password (write-only)", - "type": "string", - "format": "password" - }, - "credentialId": { - "description": "The credential's ID", - "type": "string", - "readOnly": true - }, - "customerId": { - "description": "The token's customer ID", - "type": "string", - "readOnly": true - }, - "expiredTime": { - "description": "Token's expired time", - "type": "string", - "format": "date-time" - }, - "_links": { - "description": "The links related to token", - "type": "array", - "readOnly": true, - "items": { - "$ref": "#/definitions/Link" - } - } - } - }, - "Blacklist": { - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "id": { - "description": "The blacklist identifier string", - "type": "string", - "readOnly": true - }, - "type": { - "description": "The blacklist type", - "type": "string", - "enum": [ - "paymentCardId", - "customerId", - "email", - "ipAddress", - "country" - ] - }, - "value": { - "description": "The blacklist value", - "type": "string" - }, - "ttl": { - "description": "The blacklist time to live", - "type": "integer", - "minimum": 30 - }, - "expireTime": { - "description": "The blacklist expire time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "createdTime": { - "description": "The blacklist created time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "updatedTime": { - "description": "The blacklist updated time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "_links": { - "description": "The links related to blacklist", - "type": "array", - "readOnly": true, - "items": { - "$ref": "#/definitions/Link" - } - } - } - }, - "Contact": { - "type": "object", - "properties": { - "id": { - "description": "The contact identifier string", - "type": "string", - "readOnly": true - }, - "customerId": { - "description": "The contact ID", - "type": "string" - }, - "firstName": { - "description": "The contact first name", - "type": "string" - }, - "lastName": { - "description": "The contact last name", - "type": "string" - }, - "organization": { - "description": "The contact organization", - "type": "string" - }, - "address": { - "description": "The contact street address", - "type": "string", - "maxLength": 60 - }, - "address2": { - "description": "The contact street address (second line)", - "type": "string", - "maxLength": 60 - }, - "city": { - "description": "The contact city", - "type": "string", - "maxLength": 45 - }, - "region": { - "description": "The contact region (state)", - "type": "string", - "maxLength": 45 - }, - "country": { - "description": "The contact country ISO Alpha-2 code", - "type": "string", - "pattern": "^[A-Z]{2}$" - }, - "postalCode": { - "description": "The contact postal code", - "type": "string", - "maxLength": 10 - }, - "phoneNumber": { - "description": "The contact phone number", - "type": "string" - }, - "createdTime": { - "description": "The contact created time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "updatedTime": { - "description": "The contact updated time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "_links": { - "description": "The links related to contact", - "type": "array", - "readOnly": true, - "items": { - "$ref": "#/definitions/Link" - } - }, - "customFields": { - "$ref": "#/definitions/ResourceCustomFields" - } - } - }, - "Credential": { - "type": "object", - "required": [ - "username", - "password", - "customerId" - ], - "properties": { - "id": { - "description": "The credential identifier string", - "type": "string", - "readOnly": true - }, - "username": { - "description": "Credential's username", - "type": "string" - }, - "password": { - "description": "The credential's password", - "type": "string", - "format": "password" - }, - "customerId": { - "description": "The credential's customer ID", - "type": "string" - }, - "expiredTime": { - "description": "The credential's expired time", - "type": "string", - "format": "date-time" - }, - "_links": { - "description": "The links related to credential", - "type": "array", - "readOnly": true, - "items": { - "$ref": "#/definitions/Link" - } - } - } - }, - "Customer": { - "type": "object", - "properties": { - "id": { - "description": "The customer identifier string", - "type": "string", - "readOnly": true - }, - "email": { - "description": "The customer email", - "type": "string", - "format": "email", - "maxLength": 100 - }, - "firstName": { - "description": "The customer first name", - "type": "string" - }, - "lastName": { - "description": "The customer last name", - "type": "string" - }, - "ipAddress": { - "description": "The customer IP", - "type": "string", - "format": "ipv4" - }, - "defaultCard": { - "description": "The customer default card ID", - "type": "string" - }, - "createdTime": { - "description": "The customer created time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "updatedTime": { - "description": "The customer updated time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "_links": { - "description": "The links related to customer", - "type": "array", - "readOnly": true, - "items": { - "$ref": "#/definitions/Link" - } - }, - "customFields": { - "$ref": "#/definitions/ResourceCustomFields" - } - } - }, - "CustomField": { - "description": "A separate Custom Field schema", - "type": "object", - "required": [ - "name", - "type" - ], - "properties": { - "name": { - "description": "The name of the custom field", - "type": "string" - }, - "type": { - "description": "Type value | Description\n------------- | -------------\narray | An array of strings up to 255 characters, maximum size is 1000 elements\nboolean | true or false\ndate | String of format \"full-date\" (YYYY-MM-DD) from RFC-3339 (full-date)\ndatetime | String of format \"date-time\" (YYYY-MM-DDTHH:MM:SSZ) from RFC-3339 (date-time)\ninteger | Cardinal value of -2^31..2^31-1\nnumber | Float value. It can take cardinal values also which are interpreted as float\nstring | Regular string up to 255 characters\nmonetary | A map of 3-letters currency code and amount, e.g. {\"currency\": \"EUR\", \"amount\": 25.30}\n", - "type": "string", - "enum": [ - "array", - "boolean", - "datetime", - "integer", - "number", - "string", - "monetary" - ] - }, - "description": { - "description": "The custom field description", - "type": "string" - }, - "additionalSchema": { - "description": "Additional parameters which can be added according to type:\nParameter Name | Types | Description\n-------------- | ------------- | -------------\nallowedValues | string, array | List of allowed values\n" - } - } - }, - "DeclineInstructions": { - "type": "object", - "description": "Dunning instructions object for payment declines", - "properties": { - "dunningId": { - "description": "The dunning identifier string", - "type": "string" - }, - "dunningIndex": { - "readOnly": true, - "description": "The position in the sequence of dunning", - "type": "integer" - } - } - }, - "EmailCredential": { - "type": "object", - "required": [ - "senderName", - "senderEmail", - "host", - "port", - "username", - "password" - ], - "properties": { - "id": { - "description": "Credential's identifier string", - "type": "string", - "readOnly": true - }, - "senderName": { - "description": "Credential's sender name", - "type": "string" - }, - "senderEmail": { - "description": "Credential's sender email address", - "type": "string", - "format": "email" - }, - "host": { - "description": "Credential's host", - "type": "string" - }, - "port": { - "description": "Credential's port", - "type": "integer", - "minimum": 0, - "maximum": 65535 - }, - "username": { - "description": "Credential's username", - "type": "string" - }, - "password": { - "description": "Credential's password", - "type": "string", - "format": "password" - }, - "authenticationMethod": { - "description": "Credential's authentication method", - "type": "string", - "enum": [ - "none", - "plain", - "login", - "cram-md5" - ] - }, - "encryprionMethod": { - "description": "Credential's encryption method", - "type": "string", - "enum": [ - "none", - "tls", - "ssl" - ] - }, - "createdTime": { - "description": "Credential's created time", - "type": "string", - "format": "date-time" - }, - "updatedTime": { - "description": "Credential's updated time", - "type": "string", - "format": "date-time" - }, - "_links": { - "description": "The links related to credential", - "type": "array", - "readOnly": true, - "items": { - "$ref": "#/definitions/Link" - } - } - } - }, - "Error": { - "type": "object", - "properties": { - "status": { - "type": "integer", - "minimum": 100, - "maximum": 600 - }, - "error": { - "type": "string" - } - } - }, - "GatewayAccount": { - "type": "object", - "required": [ - "gatewayName", - "merchantCategoryCode", - "websites", - "acquirerName", - "acceptedCurrencies", - "organizationId" - ], - "properties": { - "id": { - "description": "The gateway identifier string", - "type": "string", - "readOnly": true - }, - "gatewayName": { - "description": "The gateway name", - "type": "string" - }, - "gatewayConfig": { - "type": "object", - "description": "Gateway config. Fields depends on gatewayName" - }, - "merchantCategoryCode": { - "description": "The gateway's merchant category code", - "type": "integer", - "minimum": 742, - "maximum": 9950 - }, - "descriptor": { - "description": "The gateway's desciptor", - "type": "string" - }, - "city": { - "description": "The gateway's city field", - "type": "string" - }, - "organizationId": { - "description": "Organization ID", - "type": "string" - }, - "websites": { - "description": "Websites IDs", - "type": "array", - "items": { - "type": "string", - "description": "Website ID" - } - }, - "acquirerName": { - "description": "Acquirer name", - "type": "string" - }, - "monthlyLimit": { - "description": "Monthly Limit", - "type": "integer", - "format": "double", - "minimum": 0 - }, - "threeDSecure": { - "description": "True, if Gateway Account allows 3DSecure", - "type": "boolean" - }, - "threeDSecureType": { - "description": "Type of 3DSecure", - "type": "string", - "enum": [ - null, - "integrated", - "external" - ] - }, - "dynamicDescriptor": { - "description": "True, if Gateway Account allows dynamic descriptor", - "type": "boolean" - }, - "acceptedCurrencies": { - "description": "Accepted currencies (array of the currency three letter code)", - "type": "array", - "items": { - "type": "string" - } - }, - "paymentMethods": { - "description": "Accepted payments methods", - "type": "array", - "items": { - "type": "string", - "enum": [ - "Visa", - "Mastercard", - "American_Express", - "Discover", - "Maestro", - "Solo", - "Electron", - "JCB", - "Voyager", - "Diners_Club", - "Switch", - "Laser" - ] - } - }, - "downtimeStart": { - "description": "Gateway downtime start", - "type": "string", - "format": "date-time" - }, - "downtimeEnd": { - "description": "Gateway downtime end", - "type": "string", - "format": "date-time" - }, - "createdTime": { - "description": "Gateway Account created time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "updatedTime": { - "description": "Gateway Account updated time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "_links": { - "description": "The links related to gateway account", - "type": "array", - "readOnly": true, - "items": { - "$ref": "#/definitions/Link" - } - } - } - }, - "InvalidError": { - "allOf": [ - { - "$ref": "#/definitions/Error" - }, - { - "type": "object", - "properties": { - "details": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - ] - }, - "Invoice": { - "type": "object", - "required": [ - "customerId", - "websiteId", - "currency" - ], - "properties": { - "id": { - "description": "The invoice identifier string", - "type": "string", - "readOnly": true - }, - "customerId": { - "description": "The customer's ID", - "type": "string" - }, - "websiteId": { - "description": "The website's ID", - "type": "string" - }, - "currency": { - "description": "The currency three letter code", - "type": "string" - }, - "billingContactId": { - "description": "Invoice's billing contact ID", - "type": "string", - "format": "email" - }, - "deliveryContactId": { - "description": "Invoice's delivery contact ID", - "type": "string" - }, - "items": { - "type": "array", - "description": "Invoice items array", - "readOnly": true, - "items": { - "type": "string" - } - }, - "abandonedTime": { - "description": "Invoice abandoned time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "voidedTime": { - "description": "Invoice voided time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "closedTime": { - "description": "Invoice closed time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "dueTime": { - "description": "Invoice due time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "issuedTime": { - "description": "Invoice issued time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "createdTime": { - "description": "Invoice created time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "_links": { - "description": "The links related to invoice", - "type": "array", - "readOnly": true, - "items": { - "$ref": "#/definitions/Link" - } - } - } - }, - "InvoiceIssue": { - "type": "object", - "properties": { - "issueTime": { - "type": "string", - "format": "date-time" - } - } - }, - "InvoiceItem": { - "type": "object", - "required": [ - "type", - "unitPrice" - ], - "properties": { - "id": { - "description": "The website identifier string", - "type": "string", - "readOnly": true - }, - "type": { - "description": "Invoice item's type", - "type": "string", - "enum": [ - "debit", - "credit" - ] - }, - "unitPrice": { - "description": "Invoice item's price", - "type": "number", - "format": "double" - }, - "quantity": { - "description": "Invoice item's quantity", - "type": "integer" - }, - "description": { - "description": "Invoice item's description", - "type": "string" - }, - "periodStartTime": { - "description": "Start time", - "type": "string", - "format": "date-time" - }, - "periodEndTime": { - "description": "End time", - "type": "string", - "format": "date-time" - }, - "_links": { - "description": "The links related to invoice item", - "type": "array", - "readOnly": true, - "items": { - "$ref": "#/definitions/Link" - } - } - } - }, - "Layout": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "id": { - "description": "The layout identifier string", - "type": "string", - "readOnly": true - }, - "name": { - "description": "The name of the layout string", - "type": "string" - }, - "items": { - "description": "The array of layout items (planId and starred)", - "type": "array", - "items": { - "$ref": "#/definitions/LayoutItem" - } - }, - "createdBy": { - "description": "The process that created this layout", - "type": "string", - "readOnly": true - }, - "updatedBy": { - "description": "The process that updated this layout", - "type": "string", - "readOnly": true - }, - "createdTime": { - "description": "Layout created time", - "type": "string", - "readOnly": true - }, - "updatedTime": { - "description": "Layout updated time", - "type": "string", - "readOnly": true - }, - "customFields": { - "description": "Any custom object that must be stored with layout", - "type": "object" - }, - "_links": { - "description": "The links related to this layout", - "type": "array", - "readOnly": true, - "items": { - "$ref": "#/definitions/Link" - } - } - } - }, - "LayoutItem": { - "type": "object", - "properties": { - "planId": { - "description": "The plan identifier string", - "type": "string" - }, - "starred": { - "description": "Boolean if the plan should be starred (special callout presentation)", - "type": "boolean" - }, - "order": { - "description": "Item's order in Layout", - "type": "integer", - "readOnly": true - } - } - }, - "LeadSource": { - "type": "object", - "required": [ - "customerId" - ], - "properties": { - "id": { - "description": "The lead source identifier string", - "type": "string", - "readOnly": true - }, - "customerId": { - "description": "Customer ID", - "type": "string" - }, - "medium": { - "description": "Lead Source's medium (eg search, display)", - "type": "string" - }, - "source": { - "description": "Lead Source's source (eg google, yahoo)", - "type": "string" - }, - "campaign": { - "description": "Lead Source's campaign (eg go-big-123)", - "type": "string" - }, - "term": { - "description": "Lead Source's term (eg salt shakers)", - "type": "string" - }, - "content": { - "description": "Lead Source's content (eg smiley faces)", - "type": "string" - }, - "affiliate": { - "description": "Lead Source's affiliate (eg 123, Bob Smith)", - "type": "string" - }, - "subAffiliate": { - "description": "Lead Source's sub-affiliate also called a sub-id or click id in some circles (eg 123456)", - "type": "string" - }, - "salesAgent": { - "description": "Lead Source's sales agent (eg James Bond)", - "type": "string" - }, - "clickId": { - "description": "Lead Source's click id (may come from an ad server)", - "type": "string" - }, - "path": { - "description": "Lead Source's path uri (eg www.example.com/some/landing/path)", - "type": "string" - }, - "ipAddress": { - "description": "Customer's IP Address", - "type": "string" - }, - "currency": { - "description": "Currency (three letter ISO 4217 alpha code) (eg USD, EUR)", - "type": "string" - }, - "amount": { - "description": "The amount that the lead cost", - "type": "number", - "format": "double" - }, - "createdTime": { - "description": "LeadSource created time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "updatedTime": { - "description": "LeadSource updated time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "_links": { - "description": "The links related to LeadSource", - "type": "array", - "readOnly": true, - "items": { - "$ref": "#/definitions/Link" - } - } - } - }, - "Link": { - "type": "object", - "properties": { - "rel": { - "description": "The link type", - "type": "string", - "enum": [ - "self" - ] - }, - "href": { - "description": "The link URL", - "type": "string" - } - } - }, - "Login": { - "type": "object", - "required": [ - "email", - "password" - ], - "properties": { - "email": { - "description": "Email", - "type": "string" - }, - "password": { - "description": "Password", - "type": "string", - "format": "password" - }, - "expiredTime": { - "description": "Session expired time. Defaults to one hour", - "type": "string", - "format": "date-time" - } - } - }, - "Note": { - "type": "object", - "required": [ - "content", - "relatedType", - "relatedId" - ], - "properties": { - "id": { - "description": "The note identifier string", - "type": "string", - "readOnly": true - }, - "createdBy": { - "description": "The note's creator", - "type": "string", - "readOnly": true - }, - "content": { - "description": "The note's name", - "type": "string" - }, - "archived": { - "description": "Is the note archived (excluded from List method)", - "type": "boolean" - }, - "relatedType": { - "description": "The note's related resource type (customer, paymentCard, paymentGateway, subscription, transaction)", - "type": "string" - }, - "relatedId": { - "description": "The note's related resource ID", - "type": "string" - }, - "createdTime": { - "description": "Note created time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "updatedTime": { - "description": "Note updated time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "archivedTime": { - "description": "Note archived time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "_links": { - "description": "The links related to note", - "type": "array", - "readOnly": true, - "items": { - "$ref": "#/definitions/Link" - } - } - } - }, - "Organization": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "id": { - "description": "The organization identifier string", - "type": "string", - "readOnly": true - }, - "createdTime": { - "description": "The organization created time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "updatedTime": { - "description": "The organization updated time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "name": { - "description": "The organization name", - "type": "string", - "maxLength": 60 - }, - "address": { - "description": "The organization street address", - "type": "string", - "maxLength": 60 - }, - "address2": { - "description": "The organization street address", - "type": "string", - "maxLength": 60 - }, - "city": { - "description": "The organization city", - "type": "string", - "maxLength": 45 - }, - "region": { - "description": "The organization region (state)", - "type": "string", - "maxLength": 45 - }, - "country": { - "description": "The organization country ISO Alpha-2 code", - "type": "string", - "pattern": "^[A-Z]{2}$" - }, - "postalCode": { - "description": "The organization postal code", - "type": "string", - "maxLength": 10 - }, - "_links": { - "description": "The links related to organization", - "type": "array", - "readOnly": true, - "items": { - "$ref": "#/definitions/Link" - } - } - } - }, - "Payment": { - "type": "object", - "required": [ - "websiteId", - "customerId", - "currency", - "amount", - "method", - "paymentInstrument" - ], - "properties": { - "websiteId": { - "description": "The website identifier string", - "type": "string" - }, - "customerId": { - "description": "The customer identifier string", - "type": "string" - }, - "currency": { - "description": "The payment currency ISO Alpha code", - "type": "string" - }, - "amount": { - "description": "The payment amount", - "type": "integer", - "format": "double" - }, - "scheduledTime": { - "description": "The time the payment is scheduled for collection", - "type": "string", - "format": "date-time" - }, - "invoiceIds": { - "description": "The array of invoice identifiers", - "type": "array", - "items": { - "type": "string" - } - }, - "method": { - "description": "The payment method", - "type": "string", - "enum": [ - "payment_card", - "paypal", - "cash" - ] - }, - "description": { - "description": "The payment description", - "type": "string", - "maxLength": 255 - }, - "paymentInstrument": { - "$ref": "#/definitions/PaymentInstrument" - }, - "customFields": { - "$ref": "#/definitions/ResourceCustomFields" - }, - "declineInstructions": { - "$ref": "#/definitions/DeclineInstructions" - } - } - }, - "PaymentCard": { - "type": "object", - "properties": { - "id": { - "description": "The card identifier string", - "type": "string", - "readOnly": true - }, - "customerId": { - "description": "The Customer's ID. Required if card is creating not from Token", - "type": "string" - }, - "pan": { - "description": "The card PAN (Primary Account Number). Required if card is creating not from Token", - "type": "string" - }, - "expYear": { - "description": "Card's expiry year. Required if card is creating not from Token", - "type": "integer" - }, - "expMonth": { - "description": "Card's expiry month. Required if card is creating not from Token", - "type": "integer" - }, - "cvv": { - "description": "Card's cvv (card verification value). Required if card is creating not from Token", - "type": "string" - }, - "billingContactId": { - "description": "The Billing Contact ID. Required if card is creating not from Token", - "type": "string" - }, - "token": { - "description": "PaymentCardToken. Use without any other fields", - "type": "string" - }, - "status": { - "description": "Payment Card status", - "type": "string", - "readOnly": true, - "enum": [ - "active", - "expired", - "inactive", - "deactivated", - "pending" - ] - }, - "createdTime": { - "description": "Card created time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "updatedTime": { - "description": "Card updated time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "_links": { - "description": "The links related to card", - "type": "array", - "readOnly": true, - "items": { - "$ref": "#/definitions/Link" - } - }, - "customFields": { - "$ref": "#/definitions/ResourceCustomFields" - } - } - }, - "PaymentCardToken": { - "type": "object", - "required": [ - "pan", - "expMonth", - "expYear", - "firstName", - "lastName" - ], - "properties": { - "id": { - "description": "The token identifier string", - "type": "string", - "readOnly": true - }, - "pan": { - "description": "The card PAN (Primary Account Number)", - "type": "string" - }, - "expMonth": { - "description": "Card's expiry month", - "type": "integer" - }, - "expYear": { - "description": "Card's expiry year", - "type": "integer" - }, - "firstName": { - "description": "First name on payment card", - "type": "string" - }, - "lastName": { - "description": "Last name on payment card", - "type": "string" - }, - "cvv": { - "description": "The CVV/CVC of the payment card", - "type": "string" - }, - "address": { - "description": "Customer's billing address 1", - "type": "string" - }, - "address2": { - "description": "Customer's billing address 2", - "type": "string" - }, - "city": { - "description": "Billing address city", - "type": "string" - }, - "region": { - "description": "Billing region", - "type": "string" - }, - "country": { - "description": "Billing country - Two letter code", - "type": "string" - }, - "phoneNumber": { - "description": "Phone number", - "type": "string" - }, - "postalCode": { - "description": "Billing postal code", - "type": "string" - }, - "fingerprint": { - "description": "Device fingerprint hash", - "type": "string" - }, - "_links": { - "description": "The links related to token", - "type": "array", - "readOnly": true, - "items": { - "$ref": "#/definitions/Link" - } - } - } - }, - "PaymentInstrument": { - "type": "object", - "description": "Payment instrument object", - "properties": { - "paymentCardId": { - "description": "The payment card identifier string, required when paying by payment card", - "type": "string" - }, - "gatewayAccountId": { - "description": "The payment gateway identifier string", - "type": "string" - } - } - }, - "PaymentResponse": { - "allOf": [ - { - "$ref": "#/definitions/Payment" - }, - { - "type": "object", - "properties": { - "id": { - "description": "The payment identifier string", - "type": "string" - }, - "createdBy": { - "description": "The process that created this payment", - "type": "string" - }, - "updatedBy": { - "description": "The process that updated this payment", - "type": "string" - }, - "state": { - "description": "Payment state", - "type": "string" - }, - "createdTime": { - "description": "Payment created time", - "type": "string" - }, - "updatedTime": { - "description": "Payment updated time", - "type": "string" - }, - "_links": { - "description": "The links related to payment", - "type": "array", - "items": { - "$ref": "#/definitions/Link" - } - } - } - } - ] - }, - "Plan": { - "type": "object", - "required": [ - "name", - "currency" - ], - "properties": { - "id": { - "description": "The website identifier string", - "type": "string", - "readOnly": true - }, - "name": { - "description": "The plan name", - "type": "string" - }, - "currency": { - "description": "Currency (three letter ISO 4217 code)", - "type": "string" - }, - "currencySign": { - "description": "Currency sign", - "type": "string" - }, - "isActive": { - "description": "If the plan is not active, customers cannot subscribe to the plan (default to true)", - "type": "boolean" - }, - "description": { - "description": "The plan description", - "type": "string" - }, - "richDescription": { - "description": "The plan rich description - supports HTML", - "type": "string" - }, - "recurringAmount": { - "description": "The amount that recurs according to the schedule", - "type": "number", - "format": "double" - }, - "recurringPeriodUnit": { - "description": "The unit of time", - "type": "string", - "enum": [ - "day", - "week", - "month", - "year" - ] - }, - "recurringPeriodLength": { - "description": "The length of time (used with the recurringPeriodUnit)", - "type": "integer" - }, - "trialAmount": { - "description": "The amount of a trial - 0 is a valid value (for free)", - "type": "number", - "format": "double" - }, - "trialPeriodUnit": { - "description": "The unit of time", - "type": "string", - "enum": [ - "day", - "week", - "month", - "year" - ] - }, - "trialPeriodLength": { - "description": "The length of time (used with the trialPeriodUnit)", - "type": "integer" - }, - "setupAmount": { - "description": "The amount of a trial - 0 is a valid value (for free)", - "type": "number", - "format": "double" - }, - "expireTime": { - "description": "Time when the plan is not longer valid", - "type": "string", - "format": "date-time" - }, - "contractTermUnit": { - "description": "The unit of time", - "type": "string", - "enum": [ - "day", - "week", - "month", - "year" - ] - }, - "contractTermLength": { - "description": "The length that corresponds with the contractTermUnit", - "type": "integer" - }, - "recurringPeriodLimit": { - "description": "The number of times a subscription will rebill until the contract is over", - "type": "integer" - }, - "minQuantity": { - "description": "Minimum quantity per order, defaults to 1", - "type": "integer" - }, - "maxQuantity": { - "description": "Maximum quantity per order (NULL if no maximum)", - "type": "integer" - }, - "createdTime": { - "description": "Plan created time", - "type": "string", - "format": "date-time" - }, - "updatedTime": { - "description": "Plan updated time", - "type": "string", - "format": "date-time" - }, - "_links": { - "description": "The links related to plan", - "type": "array", - "readOnly": true, - "items": { - "$ref": "#/definitions/Link" - } - } - } - }, - "Product": { - "type": "object", - "description": "Your product includes digital goods, services, and physical goods. \nProducts appear on invoice line items. If you set a tax category identifier,\ntaxes will be calculated upon invoice generation.\n", - "example": "{\n \"id\": \"stringid\",\n \"name\": \"Widget\",\n \"description\": \"Fantastic widget\",\n \"taxCategoryId\": null,\n \"customFields\": [],\n \"createdTime\": \"2015-08-27 13:45:12\",\n \"updatedTime\": \"2015-08-27 13:45:12\",\n \"_links\": [\n {\n \"self\": \"https://api.rebilly.com/v2.1/products/stringid\"\n }\n ]\n}\n", - "properties": { - "id": { - "description": "The product identifier string", - "type": "string", - "readOnly": true, - "maxLength": 50 - }, - "name": { - "description": "The product name", - "type": "string", - "maxLength": 255 - }, - "description": { - "description": "The product description", - "type": "string", - "maxLength": 512 - }, - "taxCategoryId": { - "description": "The product's tax category identifier string", - "type": "string", - "enum": [ - "99999", - "20010", - "40030", - "51020", - "51010", - "31000", - "30070" - ] - }, - "customFields": { - "description": "Any custom object that may be stored with product (see custom fields)", - "type": "string" - }, - "createdTime": { - "description": "The product created time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "updatedTime": { - "description": "The product updated time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "_links": { - "description": "The links related to product", - "type": "array", - "readOnly": true, - "items": { - "$ref": "#/definitions/Link" - } - } - } - }, - "ResetPasswordToken": { - "type": "object", - "required": [ - "username", - "password" - ], - "properties": { - "token": { - "description": "The token's identifier string", - "type": "string", - "readOnly": true - }, - "username": { - "description": "The token's username", - "type": "string" - }, - "password": { - "description": "Token's password (only for POST)", - "type": "string", - "format": "password" - }, - "credential": { - "description": "Token's credential ID", - "type": "string" - }, - "expiredTime": { - "description": "Password expired time", - "type": "string", - "format": "date-time" - }, - "_links": { - "description": "The links related to token", - "type": "array", - "readOnly": true, - "items": { - "$ref": "#/definitions/Link" - } - } - } - }, - "ResourceCustomFields": { - "description": "\"Custom Fields list as a map `{\"custom field name\": \"custom field value\", ...}\"`.\nThe format must follow the saved format (see Custom Fields section for the formats).\n", - "type": "object" - }, - "Session": { - "type": "object", - "required": [ - "permissions" - ], - "properties": { - "id": { - "description": "The session identifier string", - "type": "string", - "readOnly": true - }, - "token": { - "description": "The session's token used for authentication", - "type": "string" - }, - "permissions": { - "type": "object", - "description": "The session's permissions. It's an array with following format: [ { resourceName: '' methods: ['GET', 'POST', 'PUT', 'HEAD', 'DELETE'], id: [] }, { resourceName: '' methods: ['GET', 'POST', 'PUT', 'HEAD', 'DELETE'], id: [] } ]\nIt can contain wildcard (*) for any field: [ { resourceName: '*' id: '*', methods: '*' } ] " - }, - "createdTime": { - "description": "Session created time", - "type": "string", - "format": "date-time" - }, - "updatedTime": { - "description": "Session updated time", - "type": "string", - "format": "date-time" - }, - "expiredTime": { - "description": "Session expired time. Defaults to one hour", - "type": "string", - "format": "date-time" - }, - "_links": { - "description": "The links related to session", - "type": "array", - "readOnly": true, - "items": { - "$ref": "#/definitions/Link" - } - } - } - }, - "Subscription": { - "type": "object", - "required": [ - "customerId", - "planId", - "websiteId" - ], - "properties": { - "id": { - "description": "The Subscription identifier string", - "type": "string", - "readOnly": true - }, - "customerId": { - "description": "Unique id for each customer", - "type": "string" - }, - "planId": { - "description": "Unique id for each plan", - "type": "string" - }, - "websiteId": { - "description": "Unique id for each website", - "type": "string" - }, - "initialInvoiceId": { - "description": "Unique id for the initial invoice", - "type": "string" - }, - "deliveryContactId": { - "description": "Unique id for each delivery contact", - "type": "string" - }, - "billingContactId": { - "description": "Unique id for each billing contact", - "type": "string" - }, - "status": { - "description": "Subscription status", - "type": "string", - "readOnly": true - }, - "quantity": { - "description": "Quantity for each subscription. Default value to 1", - "type": "integer" - }, - "startTime": { - "description": "Subscription start time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "activationTime": { - "description": "Subscription activation time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "endTime": { - "description": "Subscription end time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "renewalTime": { - "description": "Subscription renewal time", - "type": "string", - "format": "date-time" - }, - "cancelledTime": { - "description": "Subscription cancelled time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "createdTime": { - "description": "Subscription created time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "updatedTime": { - "description": "Subscription updated time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "_links": { - "description": "The links related to subscription", - "type": "array", - "readOnly": true, - "items": { - "$ref": "#/definitions/Link" - } - }, - "customFields": { - "$ref": "#/definitions/ResourceCustomFields" - } - } - }, - "SubscriptionCancel": { - "type": "object", - "required": [ - "policy" - ], - "properties": { - "policy": { - "description": "Cancel policy", - "type": "string", - "enum": [ - "AT_NEXT_RENEWAL", - "NOW_WITH_PRORATA_REFUND", - "NOW_WITH_PRORATA_CREDIT", - "NOW_WITHOUT_REFUND", - "NOW_WITH_FULL_REFUND" - ] - } - } - }, - "SubscriptionSwitch": { - "type": "object", - "required": [ - "planId", - "policy" - ], - "properties": { - "planId": { - "description": "The plan identifier string", - "type": "string" - }, - "policy": { - "description": "Switch policy", - "type": "string", - "enum": [ - "AT_NEXT_RENEWAL", - "NOW_WITH_PRORATA_REFUND", - "NOW_WITH_PRORATA_CREDIT", - "NOW_WITHOUT_REFUND" - ] - }, - "websiteId": { - "description": "The website's ID", - "type": "string" - }, - "quantity": { - "description": "Quantity for each subscription. Default value to 1", - "type": "integer" - } - } - }, - "TaxCategory": { - "type": "object", - "properties": { - "id": { - "description": "The tax category identifier string", - "type": "string", - "readOnly": true, - "maxLength": 50, - "enum": [ - "99999", - "20010", - "40030", - "51020", - "51010", - "31000", - "30070" - ] - }, - "description": { - "description": "The tax category description", - "type": "string", - "maxLength": 512 - }, - "taxProvider": { - "description": "The tax category maps to a provider", - "type": "string", - "enum": [ - "TaxJar" - ] - }, - "_links": { - "description": "The links related to tax category", - "type": "array", - "readOnly": true, - "items": { - "$ref": "#/definitions/Link" - } - } - } - }, - "Transaction": { - "type": "object", - "properties": { - "id": { - "description": "The transaction identifier string", - "type": "string", - "readOnly": true - }, - "type": { - "description": "Transaction type", - "type": "string", - "readOnly": true, - "enum": [ - "authorize", - "capture", - "credit", - "refund", - "sale", - "void" - ] - }, - "result": { - "description": "Transaction result", - "type": "string", - "readOnly": true, - "enum": [ - "approved", - "conn_error", - "declined", - "never_sent", - "pending", - "pending_processor", - "timeout", - "unknown" - ] - }, - "amount": { - "description": "The transactions's amount", - "type": "number", - "format": "double", - "readOnly": true - }, - "currency": { - "description": "The transactions's currency", - "type": "string", - "readOnly": true - }, - "parentTransactionId": { - "description": "The transactions's parent ID", - "type": "string", - "readOnly": true - }, - "rebillNumber": { - "description": "The transactions's rebill number", - "type": "integer", - "readOnly": true - }, - "gatewayAccountId": { - "description": "The transactions's Gateway Account ID", - "type": "string", - "readOnly": true - }, - "gatewayResponse": { - "description": "The transactions's processor response", - "type": "string", - "readOnly": true - }, - "websiteId": { - "description": "Website's ID", - "type": "string", - "readOnly": true - }, - "customerId": { - "description": "Customer's ID", - "type": "string", - "readOnly": true - }, - "paymentCardId": { - "description": "Payment Card's ID", - "type": "string", - "readOnly": true - }, - "createdTime": { - "description": "Transaction created time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "updatedTime": { - "description": "Transaction updated time", - "type": "string", - "format": "date-time", - "readOnly": true - }, - "_links": { - "description": "The links related to transaction", - "type": "array", - "readOnly": true, - "items": { - "$ref": "#/definitions/Link" - } - } - } - }, - "TransactionRefund": { - "type": "object", - "required": [ - "amount" - ], - "properties": { - "amount": { - "description": "Refund amount", - "type": "number", - "format": "double" - } - } - }, - "Website": { - "type": "object", - "required": [ - "name", - "url", - "servicePhone", - "serviceEmail" - ], - "properties": { - "id": { - "description": "The website identifier string", - "type": "string", - "readOnly": true - }, - "name": { - "description": "The website's name", - "type": "string" - }, - "url": { - "description": "The website's domain address", - "type": "string" - }, - "servicePhone": { - "description": "The website's customer service phone number", - "type": "string" - }, - "serviceEmail": { - "description": "The website's customer service email address", - "type": "string", - "format": "email" - }, - "checkoutPageUri": { - "description": "Your own custom URI for this Checkout Page", - "type": "string" - }, - "webHookUrl": { - "description": "Webhook Url (only for POST/PUT)", - "type": "string" - }, - "webHookUsername": { - "description": "Webhook HTTP Authentication Username (only for POST/PUT)", - "type": "string" - }, - "webHookPassword": { - "description": "Webhook HTTP Authentication Password (only for POST/PUT)", - "type": "string" - }, - "createdTime": { - "description": "Website created time", - "type": "string", - "format": "date-time" - }, - "updatedTime": { - "description": "Website updated time", - "type": "string", - "format": "date-time" - }, - "_links": { - "description": "The links related to website", - "type": "array", - "readOnly": true, - "items": { - "$ref": "#/definitions/Link" - } - }, - "customFields": { - "$ref": "#/definitions/ResourceCustomFields" - } - } - } - } -} From 860eb30c4879c487f047f126f4d8f01c54748fb1 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Mon, 1 Feb 2016 14:54:58 +0200 Subject: [PATCH 12/14] Code sample ui fix --- lib/components/RequestSamples/request-samples.html | 2 +- lib/components/RequestSamples/request-samples.scss | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/components/RequestSamples/request-samples.html b/lib/components/RequestSamples/request-samples.html index c1688d1a..2f71bdd2 100644 --- a/lib/components/RequestSamples/request-samples.html +++ b/lib/components/RequestSamples/request-samples.html @@ -1,7 +1,7 @@
Request samples
- + diff --git a/lib/components/RequestSamples/request-samples.scss b/lib/components/RequestSamples/request-samples.scss index 62d60331..4270dc84 100644 --- a/lib/components/RequestSamples/request-samples.scss +++ b/lib/components/RequestSamples/request-samples.scss @@ -11,7 +11,7 @@ header { :host > tabs > ul li { font-size: 13px; margin: 2px 0; - padding: 2px 10px; + padding: 2px 5px; color: #8A9094; line-height: 1.25; color: $sample-panel-headers-color; @@ -28,4 +28,7 @@ header { pre { overflow-x: auto; + word-break: break-all; + word-wrap: break-word; + white-space: pre-wrap; } From ad7629a6400655ea3f2ba7b1719e6c087c2be274 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Mon, 1 Feb 2016 19:23:13 +0200 Subject: [PATCH 13/14] Add vendor extensions docs --- README.md | 7 +++ docs/redoc-vendor-extensions.md | 105 ++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 docs/redoc-vendor-extensions.md diff --git a/README.md b/README.md index 6d4f8cfa..5c1b103c 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,13 @@ For npm: ## Configuration +#### Swagger vendor extensions +ReDoc makes use of the following [vendor extensions](http://swagger.io/specification/#vendorExtensions): +* [`x-logo`](docs/redoc-vendor-extensions.md#x-logo) - is used to specify API logo +* [`x-traitTag`](docs/redoc-vendor-extensions.md#x-traitTag) - useful for handling out common things like Pagination, Rate-Limits, etc +* [`x-code-samples`](docs/redoc-vendor-extensions.md#x-code-samples) - specify operation code samples + +#### Options * `spec-url` - relative or absolute url to your spec file * `scroll-y-offset` - If set, specifies a vertical scroll-offset. This is often useful when there are fixed positioned elements at the top of the page, such as navbars, headers etc. `scroll-y-offset` can be specified in various ways: diff --git a/docs/redoc-vendor-extensions.md b/docs/redoc-vendor-extensions.md new file mode 100644 index 00000000..e6dcac25 --- /dev/null +++ b/docs/redoc-vendor-extensions.md @@ -0,0 +1,105 @@ +# ReDoc vendor extensions +ReDoc makes use of the following [vendor extensions](http://swagger.io/specification/#vendorExtensions) + +### [Info Object](http://swagger.io/specification/#infoObject) vendor extensions + +#### x-logo +| Field Name | Type | Description +| :------------- | :------: | +| x-logo | [Logo Object](#logoObject) | The information about API logo + +##### Usage in Redoc +`x-logo` is used to specify API logo. The corresponding image are displayed just above side-menu. + +#### Logo Object +The information about API logo +##### Fixed fields +| Field Name | Type | Description +| :---------- | :------: | +| url | string | The URL pointing to the spec logo. MUST be in the format of a URL +| backgroundColor | string | background color to be used. MUST be in [CSS color syntax](https://developer.mozilla.org/en/docs/Web/CSS/color) + + +##### x-logo example +```yaml +{ + "info": { + "version": "1.0.0", + "title": "Swagger Petstore", + "x-logo": { + "url": "https://rebilly.github.io/ReDoc/petstore-logo.png", + "backgroundColor": "white" + } + } +} +``` +```yaml +{ + info: + version: "1.0.0" + title: "Swagger Petstore" + x-logo: + url: "https://rebilly.github.io/ReDoc/petstore-logo.png" + backgroundColor: "white" +} +``` + + + +### [Tag object](http://swagger.io/specification/#tagObject) vendor extensions + +#### x-traitTag +| Field Name | Type | Description +| :------------- | :------: | +| x-traitTag | boolean | In Swagger two operations can have multiply tags. This property distinguish between tags that are used to group operations (default) from tags that are used to mark operation with certain trait (`true` value) + +##### Usage in Redoc +Tags that have `x-traitTag` set to `true` are listed in side-menu but don't have any subitems (operations). Tag `description` is rendered as well. +This is useful for handling out common things like Pagination, Rate-Limits, etc. + +##### x-traitTag example +```json +{ + "name": "Pagination", + "description": "Pagination description (can use markdown syntax)", + "x-traitTag": true +} +``` +```yaml +name: Pagination +description: Pagination description (can use markdown syntax) +x-traitTag: true +``` + +### [Operation Object](http://swagger.io/specification/#operationObject) vendor extensions + +#### x-code-samples +| Field Name | Type | Description +| :------------- | :------: | +| x-code-samples | [[Code Sample Object](#codeSampleObject)] | A list of code samples associated with operation + +##### Usage in ReDoc +x-code-samples are rendered on the right panel of ReDoc + +#### Code Sample Object +Operation code sample +##### Fixed fields +| Field Name | Type | Description +| :---------- | :------: | :----------- +| lang | string | Code sample language. Value should be one of the following [list](https://github.com/github/linguist/blob/master/lib/linguist/popular.yml) +| source | string | Code sample source code + + +##### Code Sample Object example +```yaml +{ + "lang": "JavaScript", + "source": "console.log('Hello World');" +} +``` +```yaml +{ + lang: JavaScript + source: console.log('Hello World'); +} +``` From 8b79c0c0b36adbf20ec3a1005912ad1aa179ea7f Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Mon, 1 Feb 2016 19:23:44 +0200 Subject: [PATCH 14/14] v0.5.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 88106814..458fb67b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "redoc", "description": "Swagger-generated API Reference Documentation", - "version": "0.4.0", + "version": "0.5.0", "repository": { "type": "git", "url": "git://github.com/Rebilly/ReDoc"