Skip to content

Instantly share code, notes, and snippets.

@nherbaut
Created May 25, 2020 21:50
Show Gist options
  • Select an option

  • Save nherbaut/fa3d2d28ce11dfabbcc1bd5bc7d9637f to your computer and use it in GitHub Desktop.

Select an option

Save nherbaut/fa3d2d28ce11dfabbcc1bd5bc7d9637f to your computer and use it in GitHub Desktop.
openapi: 3.0.2
info:
title: Davatiz API
version: "0.1.0"
servers:
- url: https://virtserver.swaggerhub.com/discoverability/dataviz-api/0.1.0
- url: 'https://conso-api.vod-prime.space/v1'
components:
schemas:
Predicate:
type: string
enum:
- '<='
- '='
- '>='
- '!='
Subject:
type: string
enum:
- content_type
- production_country
- originals
- festivals
User:
type: object
properties:
user_id:
type: string
session_ids:
type: array
items:
type: string
minLength: 1
BooleanCondition:
type: object
required:
- name
Criteria:
description: "a triple expressing a selection criteria for content attributes"
allOf: # Combines the BasicErrorModel and the inline model
- $ref: '#/components/schemas/BooleanCondition'
- type: object
properties:
name:
type: string
default: "criteria"
subject:
$ref: '#/components/schemas/Subject'
predicate:
$ref: '#/components/schemas/Predicate'
object:
type: string
Thumbnail:
type: object
description: "a suggestion for a content made by the content provider located at the given coordinates on the screen"
properties:
content_id:
type: string
row:
type: integer
col:
type: integer
ContentMatchCriteria:
type: object
description: "tells if the content match a certain criteria"
properties:
content_id:
type: string
match:
type: boolean
CheckCriteriaRequest:
type: object
properties:
content_ids:
type: array
items:
type: string
example: "content_id"
query:
$ref: "#/components/schemas/BooleanCondition"
example:
items: ["content_id1","content_id2"]
query:
name: "TRUE"
operand:
subject: "content_type"
predicate: "="
object: "FILM"
LogicalUnaryOperator:
allOf:
- $ref: '#/components/schemas/BooleanCondition'
- type: object
properties:
name:
type: string
enum: ["TRUE","FALSE"]
operand:
$ref: "#/components/schemas/BooleanCondition"
LogicalBinaryOperator:
allOf:
- $ref: '#/components/schemas/BooleanCondition'
- type: object
properties:
name:
type: string
enum: ["AND","OR"]
operand1:
$ref: "#/components/schemas/BooleanCondition"
operand2:
$ref: "#/components/schemas/BooleanCondition"
CheckCriteriaResponses:
type: array
items:
$ref: '#/components/schemas/ContentMatchCriteria'
UserResponses:
type: array
items:
$ref: '#/components/schemas/User'
ThumbnailsResponses:
type: array
items:
$ref: '#/components/schemas/Thumbnail'
responses:
CheckCriteriaResponses:
description: "provides a boolean flag for each content_id passed in parameter when considering the Criteria"
content:
application/json:
schema:
$ref: '#/components/schemas/CheckCriteriaResponses'
UserResponses:
description: 'Contains the list of users and their associated streaming sessions'
content:
application/json:
schema:
$ref: '#/components/schemas/UserResponses'
ThumbnailsResponses:
description: 'contains a list of contents and their location in the page'
content:
application/json:
schema:
$ref: '#/components/schemas/ThumbnailsResponses'
example:
- content_id: "80192098"
row: 2
col: 1
- content_id: "70237215"
row: 4
col: 3
paths:
/check_criteria:
post:
requestBody:
description: "allow criteria checking for a list of content"
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CheckCriteriaRequest"
example:
items: ["content_id1","content_id2"]
query:
name: "AND"
operand1:
subject: "content_type"
predicate: "="
object: "FILM"
operand2:
subject: "production_country"
predicate: "="
object: "FR"
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: "#/components/responses/CheckCriteriaResponses"
example:
items:
- content_id: "content_id1"
match: true
- content_id : "content_id2"
match: false
/users:
get:
operationId: get_users
responses:
'200':
$ref: '#/components/responses/UserResponses'
example:
- user_id: user_id_1
session_ids:
- session_id1
- session_id2
'/thumbnails/{user_id}/{session_id}':
get:
operationId: get_thumbnails
description: 'provides a list of users and their associated streaming sessions'
parameters:
- in: path
name: user_id
schema:
type: string
required: true
description: user anonymised id
- in: path
name: session_id
schema:
type: string
required: true
description: session for a particular user
responses:
'200':
$ref: '#/components/responses/ThumbnailsResponses'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment