Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions openapi/components/paths.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,8 @@
$ref: "./paths/inventory.yaml#/paths/~1user~1{userId}~1inventory~1{inventoryItemId}"
"/user/{userId}/listings":
$ref: "./paths/economy.yaml#/paths/~1user~1{userId}~1listings"
"/user/{userId}/moderations":
$ref: "./paths/playermoderation.yaml#/paths/~1user~1{userId}~1moderations"
"/user/{userId}/products":
$ref: "./paths/economy.yaml#/paths/~1user~1{userId}~1products"
"/user/{userId}/tilia/kyc":
Expand Down
30 changes: 29 additions & 1 deletion openapi/components/paths/playermoderation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: 3.2.1
info:
title: playermoderation
description: |-
There are two different moderation API's, "moderation" for Staff actions, and "playermoderation" for players.
There are two kinds of moderation here: player moderations, and moderations created through `createUserModeration`, such as an instance kick.
PlayerModerations are user-generated actions towards others, such as muting them, blocking, or toggling interaction.

Your global permission settings are stored locally on your computer.
Expand Down Expand Up @@ -130,6 +130,34 @@ paths:
$ref: ../responses/RequestValidationError.yaml
"401":
$ref: ../responses/MissingCredentialsError.yaml
"/user/{userId}/moderations":
parameters:
- $ref: ../parameters.yaml#/userId
post:
operationId: createUserModeration
summary: Create User Moderation
description: With `type` `kick`, bans the user in the path from the instance given by `worldId` and `instanceId`. The user is not removed from the instance, but cannot join it again, even by invite.
tags:
- playermoderation
requestBody:
required: true
content:
application/json:
schema:
$ref: ../requests/CreateUserModerationRequest.yaml
security:
- authCookie: []
responses:
"200":
$ref: ../responses/playermoderation/CreateUserModerationResponse.yaml
"400":
$ref: ../responses/RequestValidationError.yaml
"401":
$ref: ../responses/MissingCredentialsError.yaml
"403":
$ref: ../responses/playermoderation/CreateUserModerationForbiddenError.yaml
"404":
$ref: ../responses/ResourceNotFoundError.yaml
components:
securitySchemes:
$ref: ../securitySchemes.yaml
Expand Down
19 changes: 19 additions & 0 deletions openapi/components/requests/CreateUserModerationRequest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
title: CreateUserModerationRequest
type: object
properties:
expires:
type: string
format: date-time
instanceId:
$ref: ../schemas/InstanceID.yaml
isPermanent:
type: boolean
reason:
type: string
type:
$ref: ../schemas/CreateUserModerationRequestType.yaml
worldId:
$ref: ../schemas/WorldID.yaml
required:
- reason
- type
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
description: Error response when the user in the path can't be moderated, such as when they aren't in the instance given by `worldId` and `instanceId`, either of those is missing, or the user is you.
content:
application/json:
examples:
Cannot Moderate User:
value:
error:
message: You cannot moderate this user․
status_code: 403
schema:
$ref: ../../schemas/Error.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
description: Returns the ID of the created moderation.
content:
application/json:
schema:
$ref: ../../schemas/CreateUserModerationResponse.yaml
25 changes: 25 additions & 0 deletions openapi/components/schemas/CreateUserModerationRequestType.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
title: CreateUserModerationRequestType
enum:
- avatar
- ban
- banpubliconly
- chat
- emoji
- event
- gallery
- group
- hardban
- icon
- kick
- note
- nuisance
- print
- profile
- publicinstance
- sticker
- voice
- warn
- warning
- world
examples:
- kick
7 changes: 7 additions & 0 deletions openapi/components/schemas/CreateUserModerationResponse.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
title: CreateUserModerationResponse
type: object
properties:
id:
$ref: ./ModerationID.yaml
required:
- id
4 changes: 4 additions & 0 deletions openapi/components/schemas/ModerationID.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
title: ModerationID
type: string
examples:
- mod_f862716d-23bf-49e0-a931-a08759450834
132 changes: 132 additions & 0 deletions test/arazzo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14025,6 +14025,138 @@ workflows:
successCriteria:
- condition: $statusCode == 401

- workflowId: create-user-moderation-invalid-type
summary: createUserModeration refuses a type it does not know
parameters:
- reference: $components.parameters.userAgent
x-security:
- schemeName: authCookie
values:
apiKey: $workflows.session.outputs.sessionToken
steps:
- stepId: create-user-moderation
operationId: $sourceDescriptions.default.createUserModeration
parameters:
- name: userId
in: path
value: usr_00000000-0000-0000-0000-000000000000
requestBody:
contentType: application/json
payload:
reason: x
type: x
successCriteria:
- condition: $statusCode == 400
- condition: $response.body#/error/message == 'type must be one of ["ban"‚"note"‚"warning"‚"nuisance"‚"hardban"‚"kick"‚"warn"‚"banpubliconly"‚"publicinstance"‚"avatar"‚"world"‚"event"‚"group"‚"voice"‚"chat"‚"profile"‚"sticker"‚"emoji"‚"gallery"‚"print"‚"icon"]‚ not "x"'

- workflowId: create-user-moderation-not-found
summary: createUserModeration refuses a user that does not exist
parameters:
- reference: $components.parameters.userAgent
x-security:
- schemeName: authCookie
values:
apiKey: $workflows.session.outputs.sessionToken
steps:
- stepId: create-user-moderation
operationId: $sourceDescriptions.default.createUserModeration
parameters:
- name: userId
in: path
value: usr_00000000-0000-0000-0000-000000000000
requestBody:
contentType: application/json
payload:
reason: x
type: kick
successCriteria:
- condition: $statusCode == 404

- workflowId: create-user-moderation-not-in-instance
summary: createUserModeration refuses a user who is not in the instance it names
inputs:
type: object
required:
- friendId
properties:
friendId:
type: string
parameters:
- reference: $components.parameters.userAgent
x-security:
- schemeName: authCookie
values:
apiKey: $workflows.session.outputs.sessionToken
steps:
- stepId: create-instance
operationId: $sourceDescriptions.default.createInstance
requestBody:
contentType: application/json
payload:
worldId: wrld_4cf554b4-430c-4f8f-b53e-1f294eed230b
type: private
region: use
ownerId: $workflows.session.outputs.userId
successCriteria:
- condition: $statusCode == 200
outputs:
instanceId: $response.body#/instanceId

- stepId: create-user-moderation
operationId: $sourceDescriptions.default.createUserModeration
parameters:
- name: userId
in: path
value: $inputs.friendId
requestBody:
contentType: application/json
payload:
instanceId: $steps.create-instance.outputs.instanceId
reason: x
type: kick
worldId: wrld_4cf554b4-430c-4f8f-b53e-1f294eed230b
successCriteria:
- condition: $statusCode == 403
- condition: $response.body#/error/message == 'You cannot moderate this user․'

- workflowId: create-user-moderation-self
summary: createUserModeration refuses the caller as its target
parameters:
- reference: $components.parameters.userAgent
x-security:
- schemeName: authCookie
values:
apiKey: $workflows.session.outputs.sessionToken
steps:
- stepId: create-user-moderation
operationId: $sourceDescriptions.default.createUserModeration
parameters:
- name: userId
in: path
value: $workflows.session.outputs.userId
requestBody:
contentType: application/json
payload:
reason: x
type: kick
successCriteria:
- condition: $statusCode == 403
- condition: $response.body#/error/message == 'You cannot moderate this user․'

- workflowId: create-user-moderation-unauthenticated
summary: createUserModeration refuses an anonymous caller
parameters:
- reference: $components.parameters.userAgent
steps:
- stepId: create-user-moderation
operationId: $sourceDescriptions.default.createUserModeration
parameters:
- name: userId
in: path
value: usr_00000000-0000-0000-0000-000000000000
successCriteria:
- condition: $statusCode == 401

- workflowId: delete-all-user-persistence-data-unauthenticated
summary: deleteAllUserPersistenceData refuses an anonymous caller
parameters:
Expand Down