openapi: 3.1.0 info: title: fw_teams version: '1.0' servers: - url: 'https://api.resourcewatch.org' description: Production - url: 'https://gfw-staging.globalforestwatch.org' description: Staging - url: 'https://dev-fw-api.globalforestwatch.org' description: Dev - description: Local url: 'http://localhost:3035' paths: /v1/teams: post: summary: Create Team operationId: post-team responses: '200': $ref: '#/components/responses/Team' '400': $ref: '#/components/responses/Error' '401': $ref: '#/components/responses/Error' requestBody: $ref: '#/components/requestBodies/Team' tags: - v1 '/v1/teams/{id}': parameters: - schema: type: string name: id in: path required: true description: Team ObjectId get: summary: Get Team operationId: get-team responses: '200': $ref: '#/components/responses/Team' '401': $ref: '#/components/responses/Error' description: '' tags: - v1 patch: summary: Update Team operationId: patch-team responses: '200': $ref: '#/components/responses/Team' '401': $ref: '#/components/responses/Error' requestBody: $ref: '#/components/requestBodies/Team' tags: - v1 delete: summary: Delete Team operationId: delete-team responses: '204': description: No Content '401': $ref: '#/components/responses/Error' '404': $ref: '#/components/responses/Error' tags: - v1 '/v1/teams/user/{userId}': parameters: - schema: type: string name: userId in: path required: true get: summary: Get Team By User Id operationId: get-team-by-user-id responses: '200': $ref: '#/components/responses/Team' '401': $ref: '#/components/responses/Error' '404': $ref: '#/components/responses/Error' description: Retrieve team by given user id tags: - v1 '/v1/teams/confirm/{token}': parameters: - schema: type: string name: token in: path required: true description: Valid user JWT token get: summary: Confirm user is within team operationId: confirm-user-is-within-team responses: '200': description: OK headers: {} content: application/json: schema: description: '' type: object x-examples: example-1: status: 200 detail: User confirmed properties: status: type: number example: 200 detail: type: string minLength: 1 example: User confirmed required: - status - detail examples: example-1: value: status: 200 detail: User confirmed '400': $ref: '#/components/responses/Error' '401': $ref: '#/components/responses/Error' description: |- Confirms the user is within the team with the id given in the JWT token. If not then the user is added to that team and if needed remove from an existing team. tags: - v1 /v1/fw_teams/healthcheck: get: summary: Healthcheck responses: '200': $ref: '#/components/responses/Healthcheck' operationId: get-fw_teams-healthcheck security: [] description: '' /v3/myteams: get: summary: Get all Teams associated with Authenticated user tags: - v3 responses: '200': $ref: '#/components/responses/Teams-v3' '400': $ref: '#/components/responses/Error' '401': $ref: '#/components/responses/Error' '404': $ref: '#/components/responses/Error' operationId: get-v3-myteams description: |- Receive all Teams the authenticated user is associated with. To filter the respoonse pass the query param `?userRole=` with the available options (comma-seperated): - `manager` - `monitor` - `invited` parameters: - schema: type: string default: 'manager,monitor,invited' in: query name: userRole description: 'Roles to filter the teams by either `manager`, `monitor` or `invited`' parameters: [] '/v3/teams/leave/{teamID}': parameters: - schema: type: string name: teamID in: path required: true description: The team id the user would like to be removed from patch: summary: Remove authenticated user from team operationId: patch-v3-teams-leave-teamID responses: '200': $ref: '#/components/responses/Team-v3' '400': $ref: '#/components/responses/Error' '401': $ref: '#/components/responses/Error' '404': $ref: '#/components/responses/Error' tags: - v3 description: 'Remove the authenticated user from the give team. This will remove the authenticated user is they are a monitor *or* manager, unless they are the only manager.' '/v3/teams/reject/{teamID}': parameters: - schema: type: string name: teamID in: path required: true description: The team id the user would like to reject their invite from patch: summary: Reject the authenticated user's invite to a team operationId: patch-v3-teams-reject-teamID responses: '200': $ref: '#/components/responses/Team-v3' '400': $ref: '#/components/responses/Error' '401': $ref: '#/components/responses/Error' '404': $ref: '#/components/responses/Error' tags: - v3 description: '' components: schemas: Team: title: Team type: object examples: - name: string managers: - id: string email: string users: - string sentInvitations: - string areas: - null layers: - null confirmedUsers: - id: string email: string createdAt: '2019-08-24T14:15:22Z' x-tags: - v1 properties: name: type: string managers: type: array items: type: object properties: id: type: string email: type: string users: type: array items: type: string sentInvitations: type: array deprecated: true items: type: string areas: type: array items: {} layers: type: array items: {} confirmedUsers: type: array items: type: object properties: id: type: string email: type: string createdAt: type: string format: date-time readOnly: true required: - createdAt description: '' Team-v3: title: Team v3 type: object examples: - name: string managers: - id: string email: string users: - string sentInvitations: - string areas: - null layers: - null confirmedUsers: - id: string email: string createdAt: '2019-08-24T14:15:22Z' userRole: string description: '' x-tags: - v3 properties: name: type: string managers: type: array items: type: object properties: id: type: string email: type: string users: type: array items: type: string sentInvitations: type: array deprecated: true items: type: string areas: type: array items: {} layers: type: array items: {} confirmedUsers: type: array items: type: object properties: id: type: string email: type: string createdAt: type: string format: date-time readOnly: true userRole: type: string required: - createdAt securitySchemes: Authorization: type: http scheme: bearer requestBodies: Team: content: application/json: schema: $ref: '#/components/schemas/Team' examples: Team: value: name: string managers: - null users: - null sentInvitations: - null areas: - null layers: - null confirmedUsers: - null createdAt: '2019-08-24T14:15:22Z' responses: Error: description: Error Response content: application/json: schema: description: '' type: object properties: errors: type: array uniqueItems: true minItems: 1 items: required: - status - detail properties: status: type: number detail: type: string minLength: 1 required: - errors examples: {} Team: description: Team response content: application/json: schema: type: object properties: data: type: object properties: type: type: string default: teams id: type: string description: ObjectId attributes: $ref: '#/components/schemas/Team' required: - type - id examples: Team: value: data: type: teams id: string attributes: name: string managers: - null users: - null sentInvitations: - null areas: - null layers: - null confirmedUsers: - null createdAt: '2019-08-24T14:15:22Z' Teams: description: Example response content: application/json: schema: type: object properties: data: type: array items: type: object properties: id: type: string type: type: string attributes: $ref: '#/components/schemas/Team' required: - id - type examples: Teams: value: data: - id: string type: string attributes: name: string managers: - null users: - null sentInvitations: - null areas: - null layers: - null confirmedUsers: - null createdAt: '2019-08-24T14:15:22Z' Healthcheck: description: Healthcheck response content: application/json: schema: type: object properties: uptime: type: number examples: {} Teams-v3: description: Example response content: application/json: schema: type: object properties: data: type: array items: type: object properties: id: type: string type: type: string attrbiutes: $ref: '#/components/schemas/Team-v3' examples: Teams: value: data: - id: string type: string attrbiutes: name: string managers: - id: string email: string users: - string sentInvitations: - string areas: - null layers: - null confirmedUsers: - id: string email: string createdAt: '2019-08-24T14:15:22Z' userRole: string Team-v3: description: Example response content: application/json: schema: type: object properties: data: type: object properties: type: type: string id: type: string attributes: $ref: '#/components/schemas/Team-v3' examples: Team: value: data: type: string id: string attributes: name: string managers: - id: string email: string users: - string sentInvitations: - string areas: - null layers: - null confirmedUsers: - id: string email: string createdAt: '2019-08-24T14:15:22Z' userRole: string security: - Authorization: []