Skip to content

Instantly share code, notes, and snippets.

@RomanVlasenko
Created March 28, 2019 15:10
Show Gist options
  • Save RomanVlasenko/f0abdb3fa53f9efadaf3a09682785e80 to your computer and use it in GitHub Desktop.
Save RomanVlasenko/f0abdb3fa53f9efadaf3a09682785e80 to your computer and use it in GitHub Desktop.
swagger: "2.0"
info:
title: "BE Assignment"
version: "1.0.0"
consumes:
- "application/json"
produces:
- "application/json"
schemes:
- "https"
paths:
"/transaction":
post:
description: "Submits a new transaction for the station"
parameters:
- in: body
name: transaction
schema:
$ref: "#/definitions/Transaction"
required: true
responses:
"200":
description: "Body of created transaction"
schema:
$ref: "#/definitions/Transaction"
"/transaction/{stopTransactionId}":
put:
description: "Stops transaction"
parameters:
- in: path
name: stopTransactionId
schema:
type: "string"
required: true
- in: body
name: transaction
schema:
$ref: "#/definitions/Transaction"
required: true
responses:
"200":
description: "Body of stopped transaction"
schema:
$ref: "#/definitions/Transaction"
"404":
description: "Transaction not found"
"/transaction/{deleteTransactionId}":
delete:
description: "Removes transaction"
parameters:
- in: path
name: deleteTransactionId
schema:
type: "string"
required: true
responses:
"204":
description: "Transaction was deleted successfully. Returns no body"
"404":
description: "Transaction not found"
"/transactions":
get:
description: "Retrieves statistics for all transaction"
responses:
"200":
description: "Statistics for all transactions"
schema:
$ref: "#/definitions/TransactionSummary"
"/transactions/stopped":
get:
description: "Retrieves statistics for stopped transaction"
responses:
"200":
description: "Count of stopped transactions"
schema:
$ref: "#/definitions/StoppedCount"
"/transactions/started":
get:
description: "Retrieves statistics for started transaction"
responses:
"200":
description: "Count of started transactions"
schema:
$ref: "#/definitions/StartedCount"
definitions:
TransactionSummary:
type: "object"
properties:
totalCount:
type: "integer"
startedCount:
type: "integer"
stoppedCount:
type: "integer"
StoppedCount:
type: "object"
properties:
stoppedCount:
type: "integer"
StartedCount:
type: "object"
properties:
startedCount:
type: "integer"
Transaction:
type: "object"
properties:
id:
type: "string"
stationId:
type: "string"
startedAt:
type: "string"
format: "date-time"
status:
type: "string"
enum:
- "in_progress"
- "finished"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment