{
    "openapi": "3.0.1",
    "info": {
      "title": "Gamelearn API",
      "description": "Gamelearn API\n\n# Use cases\n\n## Get token\n\nIn order to get a valid token to use our API, you should send your credential to the authorization url.\n\n### Command line\n\n```\ncurl -X POST --user id:secret 'https://gamelearn.auth.eu-west-1.amazoncognito.com/oauth2/token?grant_type=client_credentials' -H 'Content-Type: application/x-www-form-urlencoded'\n```\n\n### JS\n\n```\nfetch('https://gamelearn.auth.eu-west-1.amazoncognito.com/oauth2/token?grant_type=client_credentials', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/x-www-form-urlencoded',\n    'Authorization': 'Basic ' + btoa(`${id}:${secret}`)\n  }\n}).then((response) => {\n  return response.json();\n}).then({ access_token: token }) => {\n  return token\n});\n```\n\n# Authentication\n\n<!-- ReDoc-Inject: <security-definitions> -->",
      "contact": {
        "email": "developer@game-learn.com"
      },
      "version": "0.2.0"
    },
    "externalDocs": {
      "description": "Find out more about Gamelearn API",
      "url": "http://developer.gamelearn.io"
    },
    "servers": [
      {
        "url": "https://evr151p8w1.execute-api.eu-west-1.amazonaws.com/integration"
      }
    ],
    "components": {
      "parameters": {
        "groupId": {
          "name": "groupId",
          "description": "Group id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "example": "507f1f77bcf86cd799439011"
        }
      },
      "securitySchemes": {
        "ClientsAPIScopes": {
          "type": "oauth2",
          "flows": {
            "implicit": {
              "authorizationUrl": "https://gamelearn.auth.eu-west-1.amazoncognito.com/oauth2/token?grant_type=client_credentials",
              "scopes": {
                "groups:read": "Read groups",
                "licenses:read": "Read licenses"
              }
            }
          }
        }
      }
    },
    "paths": {
      "/groups": {
        "description": "Groups info",
        "get": {
          "summary": "Get groups",
          "description": "Get groups with pagination",
          "security": [
            {
              "ClientsAPIScopes": [
                "groups:read"
              ]
            }
          ],
          "parameters": [
            {
              "name": "limit",
              "description": "number of groups",
              "in": "query",
              "required": false,
              "schema": {
                "type": "string"
              }
            },
            {
              "name": "page",
              "description": "number of page",
              "in": "query",
              "required": false,
              "schema": {
                "type": "string"
              }
            }
          ],
          "responses": {
            "200": {
              "description": "Groups matching pagination options",
              "content": {
                "application/json": {
                  "schema": {
                    "type": "object",
                    "description": "Groups and pagination info",
                    "properties": {
                      "items": {
                        "type": "object",
                        "description": "Group info",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Group id",
                            "example": "507f1f77bcf86cd799439011"
                          },
                          "name": {
                            "type": "string",
                            "description": "Group name",
                            "example": "Awesome group"
                          },
                          "startDate": {
                            "type": "string",
                            "description": "Start date",
                            "example": "2020-01-01T00:00:00.000Z"
                          },
                          "endDate": {
                            "type": "string",
                            "description": "End date",
                            "example": "2020-12-31T23:59:59.999Z"
                          },
                          "numberOfLicenses": {
                            "type": "number",
                            "description": "Number of licenses",
                            "example": 10
                          },
                          "tags": {
                            "type": "array",
                            "description": "Group tags",
                            "items": {
                              "type": "string",
                              "example": "tag"
                            }
                          }
                        }
                      },
                      "limit": {
                        "type": "number",
                        "description": "Number of groups",
                        "example": 10
                      },
                      "total": {
                        "type": "number",
                        "description": "Total number of groups",
                        "example": 99
                      },
                      "page": {
                        "type": "number",
                        "description": "Page number",
                        "example": 1
                      },
                      "pages": {
                        "type": "number",
                        "description": "Total number of pages",
                        "example": 10
                      }
                    }
                  }
                }
              }
            },
            "400": {
              "description": "Error"
            }
          }
        }
      },
      "/groups/{groupId}": {
        "description": "Group info",
        "get": {
          "summary": "Get group",
          "description": "Get group info",
          "security": [
            {
              "ClientsAPIScopes": [
                "groups:read"
              ]
            }
          ],
          "parameters": [
            {
              "$ref": "#/components/parameters/groupId"
            }
          ],
          "responses": {
            "200": {
              "description": "group detail",
              "content": {
                "application/json": {
                  "schema": {
                    "type": "object",
                    "description": "group info",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Group id",
                        "example": "507f1f77bcf86cd799439011"
                      },
                      "name": {
                        "type": "string",
                        "description": "Group name",
                        "example": "Awesome group"
                      },
                      "startDate": {
                        "type": "string",
                        "description": "Start date",
                        "example": "2020-01-01T00:00:00.000Z"
                      },
                      "endDate": {
                        "type": "string",
                        "description": "End date",
                        "example": "2020-12-31T23:59:59.999Z"
                      },
                      "numberOfLicenses": {
                        "type": "number",
                        "description": "Number of licenses",
                        "example": 10
                      },
                      "tags": {
                        "type": "array",
                        "description": "Group tags",
                        "items": {
                          "type": "string",
                          "example": "tag"
                        }
                      }
                    }
                  }
                }
              }
            },
            "400": {
              "description": "Error"
            }
          }
        }
      },
      "/groups/{groupId}/licenses": {
        "description": "Group licenses",
        "get": {
          "summary": "Get licenses",
          "description": "Get licenses with pagination",
          "security": [
            {
              "ClientsAPIScopes": [
                "groups:read",
                "licenses:read"
              ]
            }
          ],
          "parameters": [
            {
              "$ref": "#/components/parameters/groupId"
            }
          ],
          "responses": {
            "200": {
              "description": "licenses matching pagination options",
              "content": {
                "application/json": {
                  "schema": {
                    "type": "object",
                    "description": "licenses and pagination info",
                    "properties": {
                      "items": {
                        "type": "object",
                        "description": "License info",
                        "properties": {
                          "userEmail": {
                            "type": "string",
                            "description": "Name of student",
                            "example": "fullname@example.com"
                          },
                          "startDate": {
                            "type": "string",
                            "description": "License start date",
                            "example": "2020-01-01T00:00:00.000Z"
                          },
                          "endDate": {
                            "type": "string",
                            "description": "License end date",
                            "example": "2020-12-31T23:59:59.999Z"
                          },
                          "status": {
                            "type": "string",
                            "description": "License status",
                            "example": "Complete"
                          },
                          "progress": {
                            "type": "number",
                            "description": "License progress %",
                            "example": 30
                          },
                          "pid": {
                            "type": "string",
                            "description": "License user PID",
                            "example": "1234567"
                          },
                          "lastConnectionDate": {
                            "type": "number",
                            "description": "License last connection date",
                            "example": "2020-12-31T23:59:59.999Z"
                          },
                          "durationSeconds": {
                            "type": "number",
                            "description": "License duration in seconds",
                            "example": 300
                          },
                          "points": {
                            "type": "number",
                            "description": "License score",
                            "example": 30
                          }
                        }
                      },
                      "limit": {
                        "type": "number",
                        "description": "Number of groups",
                        "example": 10
                      },
                      "total": {
                        "type": "number",
                        "description": "Total number of groups",
                        "example": 99
                      },
                      "page": {
                        "type": "number",
                        "description": "Page number",
                        "example": 1
                      },
                      "pages": {
                        "type": "number",
                        "description": "Total number of pages",
                        "example": 10
                      }
                    }
                  }
                }
              }
            },
            "400": {
              "description": "Error"
            }
          }
        }
      }
    }
  }