mirror of
https://github.com/openstf/stf
synced 2025-10-04 18:29:17 +02:00
refactor reserve and release endpoints in HTTP POST and DELETE methods
This commit is contained in:
parent
dccacea43f
commit
bca180d284
6 changed files with 189 additions and 174 deletions
|
@ -24,7 +24,7 @@ tags:
|
|||
- name: device
|
||||
description: Device Operations
|
||||
paths:
|
||||
/me:
|
||||
/user:
|
||||
x-swagger-router-controller: user
|
||||
get:
|
||||
summary: User Profile
|
||||
|
@ -43,27 +43,70 @@ paths:
|
|||
$ref: "#/definitions/ErrorResponse"
|
||||
security:
|
||||
- accessTokenAuth: []
|
||||
# TODO: Change group endpoint with something more easy to understandable endpoint
|
||||
/group:
|
||||
/user/devices:
|
||||
x-swagger-router-controller: user
|
||||
get:
|
||||
summary: User Group
|
||||
description: The User Group endpoint returns information about user group of current authorized user.
|
||||
operationId: getCurrentUserGroup
|
||||
summary: List devices owned by current user
|
||||
description: The User Devices endpoint returns information about user group of current authorized user.
|
||||
operationId: getCurrentUserDevices
|
||||
tags:
|
||||
- user
|
||||
responses:
|
||||
"200":
|
||||
description: Current User's Group information
|
||||
description: Current User Devices information
|
||||
schema:
|
||||
$ref: "#/definitions/GroupResponse"
|
||||
$ref: "#/definitions/DeviceListResponse"
|
||||
default:
|
||||
description: Unexpected Error
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
security:
|
||||
- accessTokenAuth: []
|
||||
/accessTokens:
|
||||
post:
|
||||
summary: Add device to a user
|
||||
description: The User Devices endpoint will request stf server for a new device. It will return request accepted if device is usable.
|
||||
operationId: addDeviceToUser
|
||||
tags:
|
||||
- user
|
||||
parameters:
|
||||
- name: device
|
||||
in: body
|
||||
description: Device to add
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/DeviceAddPayload"
|
||||
responses:
|
||||
"202":
|
||||
description: Device Add Request Status
|
||||
default:
|
||||
description: Unexpected Error
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
security:
|
||||
- accessTokenAuth: []
|
||||
delete:
|
||||
summary: Release device from user
|
||||
description: The User Devices endpoint will request for device release from stf server.
|
||||
operationId: deleteDeviceFromUser
|
||||
tags:
|
||||
- user
|
||||
parameters:
|
||||
- name: device
|
||||
in: body
|
||||
description: Device to add
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/DeviceDeletePayload"
|
||||
responses:
|
||||
"202":
|
||||
description: Device Release Request Status
|
||||
default:
|
||||
description: Unexpected Error
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
security:
|
||||
- accessTokenAuth: []
|
||||
/user/accessTokens:
|
||||
x-swagger-router-controller: token
|
||||
get:
|
||||
summary: Access Tokens
|
||||
|
@ -115,57 +158,10 @@ paths:
|
|||
description: Device Serial
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: Device Information
|
||||
schema:
|
||||
$ref: "#/definitions/DeviceResponse"
|
||||
default:
|
||||
description: Unexpected Error
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
security:
|
||||
- accessTokenAuth: []
|
||||
/swagger.json:
|
||||
x-swagger-pipe: swagger_raw
|
||||
/devices/{serial}/reserve:
|
||||
x-swagger-router-controller: device
|
||||
put:
|
||||
summary: Reseve Device
|
||||
description: The device reserve enpoint will reserve a device if device it usable
|
||||
operationId: reserveDeviceBySerial
|
||||
tags:
|
||||
- device
|
||||
parameters:
|
||||
- name: serial
|
||||
in: path
|
||||
description: Device Serial
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: Device Information
|
||||
schema:
|
||||
$ref: "#/definitions/DeviceResponse"
|
||||
default:
|
||||
description: Unexpected Error
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
security:
|
||||
- accessTokenAuth: []
|
||||
/devices/{serial}/release:
|
||||
x-swagger-router-controller: device
|
||||
put:
|
||||
summary: Device Information
|
||||
description: The device reserve enpoint will release a device
|
||||
operationId: releaseDeviceBySerial
|
||||
tags:
|
||||
- device
|
||||
parameters:
|
||||
- name: serial
|
||||
in: path
|
||||
description: Device Serial
|
||||
required: true
|
||||
- name: fields
|
||||
in: query
|
||||
description: Fields query parameter takes a comma seperated list of fields. Only listed field will be return in response
|
||||
required: false
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
|
@ -187,14 +183,6 @@ definitions:
|
|||
properties:
|
||||
user:
|
||||
type: object
|
||||
GroupResponse:
|
||||
required:
|
||||
- devices
|
||||
properties:
|
||||
devices:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
AccessTokensResponse:
|
||||
required:
|
||||
- tokens
|
||||
|
@ -223,6 +211,25 @@ definitions:
|
|||
properties:
|
||||
message:
|
||||
type: string
|
||||
DeviceAddPayload:
|
||||
description: payload object for adding device to user
|
||||
required:
|
||||
- serial
|
||||
properties:
|
||||
serial:
|
||||
description: Device Serial
|
||||
type: string
|
||||
timeout:
|
||||
description: Device timeout in ms. If device is kept idle for this period, it will be automatically disconnected. Default is provider group timeout.
|
||||
type: integer
|
||||
DeviceDeletePayload:
|
||||
description: payload object for deleting device from user
|
||||
required:
|
||||
- serial
|
||||
properties:
|
||||
serial:
|
||||
description: Device Serial
|
||||
type: string
|
||||
|
||||
securityDefinitions:
|
||||
accessTokenAuth:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue