Skip to content

Commit

Permalink
feat(rfc): unity swagger.yml Users and Invites draft (#293)
Browse files Browse the repository at this point in the history
* feat(unity): add GET users to swagger def

* feat(unity-swagger): add DELETE users

* feat(unity-swagger): add POST invites

* feat(unity-swagger): add DELETE invite

* feat(unity-swagger): add resend invite
  • Loading branch information
121watts authored Nov 11, 2020
1 parent 72d97c5 commit 3943388
Show file tree
Hide file tree
Showing 3 changed files with 283 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ cypress.env.json
junit.xml
npm-error.log
src/client/generatedRoutes.ts
src/client/unityRoutes.ts
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
"tsc:cypress": "tsc -p ./cypress/tsconfig.json --noEmit --pretty --skipLibCheck",
"cy": "CYPRESS_baseUrl=http://localhost:9999 cypress open",
"cy:dev": "CYPRESS_baseUrl=http://kubernetes.docker.internal:8080 cypress open",
"generate": "oats https://raw.githubusercontent.com/influxdata/influxdb/master/http/swagger.yml > ./src/client/generatedRoutes.ts"
"generate": "oats https://raw.githubusercontent.com/influxdata/influxdb/master/http/swagger.yml > ./src/client/generatedRoutes.ts",
"unity": "oats ./src/client/unity.yml > ./src/client/unityRoutes.ts"
},
"author": "",
"devDependencies": {
Expand Down
280 changes: 280 additions & 0 deletions src/client/unity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,280 @@
openapi: "3.0.0"
info:
title: Unity API Service
version: 0.1.0
servers:
- url: /unity/v2 # to be determined
paths:
"/orgs/{orgID}/invites":
post:
operationId: PostOrgsIDInvites
tags:
- Invites
- Organizations
summary: Creates an invite to an organization
parameters:
- $ref: "#/components/parameters/TraceSpan"
- in: path
name: orgID
schema:
type: string
required: true
description: The organization ID.
requestBody:
description: Invite to be sent
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/Invite"
responses:
"201":
description: Invite sent
content:
application/json:
schema:
$ref: "#/components/schemas/Invite"
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"/orgs/{orgID}/invites/{inviteID}":
delete:
operationId: DeleteOrgsIDInviteID
tags:
- Invites
- Organizations
summary: Remove an invite to an organization
parameters:
- $ref: "#/components/parameters/TraceSpan"
- in: path
name: inviteID
schema:
type: string
required: true
description: The ID of the invite to remove.
- in: path
name: orgID
schema:
type: string
required: true
description: The organization ID.
responses:
"204":
description: Invite removed
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"/orgs/{orgID}/invites/{inviteID}/resend":
post:
operationId: DeleteOrgsIDInviteID
tags:
- Invites
- Organizations
summary: Re-sends an invite
parameters:
- $ref: "#/components/parameters/TraceSpan"
- in: path
name: inviteID
schema:
type: string
required: true
description: The ID of the invite to resend.
- in: path
name: orgID
schema:
type: string
required: true
description: The organization ID.
responses:
"200":
description: Invite resent
content:
application/json:
schema:
$ref: "#/components/schemas/Invite"
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"/orgs/{orgID}/users":
get:
operationId: GetUsers
tags:
- Users
parameters:
- $ref: "#/components/parameters/TraceSpan"
- in: path
name: orgID
description: Specifies the organization ID of the User.
required: true
schema:
type: string
responses:
"200":
description: A list of users
content:
application/json:
schema:
$ref: "#/components/schemas/Users"
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"/orgs/{orgID}/users/{userID}":
delete:
operationId: DeleteOrgsIDUserID
tags:
- Users
- Organizations
summary: Deletes a user
parameters:
- $ref: "#/components/parameters/TraceSpan"
- in: path
name: userID
schema:
type: string
required: true
description: The ID of the user to remove.
- in: path
name: orgID
schema:
type: string
required: true
description: The organization ID.
responses:
"204":
description: User removed
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
components:
parameters:
TraceSpan:
in: header
name: Zap-Trace-Span
description: OpenTracing span context
example:
trace_id: "1"
span_id: "1"
baggage:
key: value
required: false
schema:
type: string
schemas:
Error:
properties:
code:
description: Code is the machine-readable error code.
readOnly: true
type: string
# This set of enumerations must remain in sync with the constants defined in errors.go
enum:
- internal error
- not found
- conflict
- invalid
- unprocessable entity
- empty value
- unavailable
- forbidden
- too many requests
- unauthorized
- method not allowed
message:
readOnly: true
description: Message is a human-readable message.
type: string
required: [code, message]
Invite:
properties:
id:
description: the idpe id of the invite
readOnly: true
type: string
email:
type: string
role:
type: string
enum:
- member
- owner
expiresAt:
format: date-time
type: string
links:
type: object
readOnly: true
example:
self: "/unity/v2/invites/1"
properties:
self:
type: string
format: uri
required: [id, email, role]
Invites:
type: object
properties:
links:
type: object
properties:
self:
type: string
format: uri
invites:
type: array
items:
$ref: "#/components/schemas/Invite"
User:
properties:
id:
description: the idpe id of the user
readOnly: true
type: string
firstName:
type: string
lastName:
type: string
email:
type: string
role:
type: string
enum:
- member
- owner
links:
type: object
readOnly: true
example:
self: "/unity/v2/users/1"
properties:
self:
type: string
format: uri
required: [id, email, role]
Users:
type: object
properties:
links:
type: object
properties:
self:
type: string
format: uri
users:
type: array
items:
$ref: "#/components/schemas/User"

0 comments on commit 3943388

Please sign in to comment.