Admin API to add user emails
This commit is contained in:
@@ -1462,6 +1462,107 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"tags": [
|
||||
"user-email"
|
||||
],
|
||||
"summary": "Add a user email",
|
||||
"description": "Add an email address to a user.\nNote that this endpoint ignores any policy which would normally prevent the email from being added.",
|
||||
"operationId": "addUserEmail",
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/AddUserEmailRequest"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "User email was created",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/SingleResponse_for_UserEmail"
|
||||
},
|
||||
"example": {
|
||||
"data": {
|
||||
"type": "user-email",
|
||||
"id": "01040G2081040G2081040G2081",
|
||||
"attributes": {
|
||||
"created_at": "1970-01-01T00:00:00Z",
|
||||
"user_id": "02081040G2081040G2081040G2",
|
||||
"email": "alice@example.com"
|
||||
},
|
||||
"links": {
|
||||
"self": "/api/admin/v1/user-emails/01040G2081040G2081040G2081"
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"self": "/api/admin/v1/user-emails/01040G2081040G2081040G2081"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "Email already in use",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
},
|
||||
"example": {
|
||||
"errors": [
|
||||
{
|
||||
"title": "User email \"alice@example.com\" already in use"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Email is not valid",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
},
|
||||
"example": {
|
||||
"errors": [
|
||||
{
|
||||
"title": "Email \"not a valid email\" is not valid"
|
||||
},
|
||||
{
|
||||
"title": "Missing domain or user"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "User was not found",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
},
|
||||
"example": {
|
||||
"errors": [
|
||||
{
|
||||
"title": "User ID 00000000000000000000000000 not found"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/admin/v1/user-emails/{id}": {
|
||||
@@ -2844,6 +2945,25 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"AddUserEmailRequest": {
|
||||
"title": "JSON payload for the `POST /api/admin/v1/user-emails`",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"email",
|
||||
"user_id"
|
||||
],
|
||||
"properties": {
|
||||
"user_id": {
|
||||
"description": "The ID of the user to which the email should be added.",
|
||||
"$ref": "#/components/schemas/ULID"
|
||||
},
|
||||
"email": {
|
||||
"description": "The email address of the user to add.",
|
||||
"type": "string",
|
||||
"format": "email"
|
||||
}
|
||||
}
|
||||
},
|
||||
"SingleResponse_for_UserEmail": {
|
||||
"description": "A top-level response with a single resource",
|
||||
"type": "object",
|
||||
|
||||
Reference in New Issue
Block a user