swagger: "2.0" info: description: "This is a sample server go-swap-server. You can find out more about information at [https://github.com/me-io/go-swap](https://github.com/me-io/go-swap)" version: "1.0.0" title: "Go-Swap-Server" contact: email: "meabed@me.io" license: name: "MIT" url: "https://github.com/me-io/go-swap/blob/master/LICENSE.md" tags: - name: "Currency" description: "Swap & Convert between Currencies" externalDocs: description: "Find out more" url: "https://github.com/me-io/go-swap" schemes: - "https" - "http" paths: /convert: post: tags: - "Currency" summary: "Request Currency Conversion Rate & Value Multiple Exchanger - POST" description: "" operationId: "ConvertCurrencyPost" consumes: - "application/json" produces: - "application/json" parameters: - in: "body" name: "body" description: "Currency Conversion Request" required: true schema: $ref: "#/definitions/ConvertPostRequest" responses: 200: description: "successful operation" schema: $ref: "#/definitions/ConvertResponse" 405: description: "Invalid input" 400: description: "Invalid input" 404: description: "Invalid input" get: tags: - "Currency" summary: "Request Currency Conversion Rate & Value Single Exchanger - GET" description: "" operationId: "ConvertCurrencyGet" produces: - "application/json" parameters: - in: "query" name: "from" type: "string" required: true default: "USD" - in: "query" name: "to" type: "string" required: true default: "EGP" - in: "query" name: "amount" type: "number" required: true default: "10.45" - in: "query" name: "exchanger" type: "string" required: true default: "google" - in: "query" name: "apiKey" type: "string" required: false - in: "query" name: "cacheTime" type: "string" required: false default: "120s" responses: 200: description: "successful operation" schema: $ref: "#/definitions/ConvertResponse" 405: description: "Invalid input" 400: description: "Invalid input" 404: description: "Invalid input" definitions: ConvertPostRequest: example: amount: 2.5 from: "USD" to: "AED" decimalPoints: 4 cacheTime: "120s" exchanger: - name: "yahoo" - name: "google" - name: "themoneyconverter" userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0" type: "object" required: - "amount" - "from" - "to" - "exchanger" properties: amount: type: "number" format: "float" example: 1.54 from: type: "string" example: "USD" to: type: "string" example: "AED" decimalPoints: type: "integer" example: 4 exchanger: type: "array" minItems: 1 maxItems: 10 items: type: "object" required: - "name" properties: name: type: "string" example: "google" apiKey: type: "string" example: "demo_api_key_2018" apiVersion: type: "string" example: "1.0.3" userAgent: type: "string" example: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0" cacheTime: type: "string" example: "60s" ConvertResponse: type: "object" properties: from: type: "string" example: "USD" to: type: "string" example: "AED" originalAmount: type: "number" format: "float" example: 1.54 exchangeValue: type: "number" format: "float" example: 17.91 convertedAmount: type: "number" format: "float" example: 27.5814 convertedText: type: "string" example: "1 USD is worth 3.675 AED" exchangerName: type: "string" example: "google" rateDateTime: type: "string" example: "2018-09-25T12:17:17Z" rateFromCache: type: "boolean" example: false externalDocs: description: "Find out more about Go-Swap-Server" url: "https://github.com/me-io/go-swap"