refactor(server): user endpoints (#9730)
* refactor(server): user endpoints * fix repos * fix unit tests --------- Co-authored-by: Daniel Dietzler <mail@ddietzler.dev> Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
+412
-326
@@ -206,6 +206,274 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/admin/users": {
|
||||
"get": {
|
||||
"operationId": "searchUsersAdmin",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"required": false,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/UserAdminResponseDto"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
},
|
||||
{
|
||||
"cookie": []
|
||||
},
|
||||
{
|
||||
"api_key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
]
|
||||
},
|
||||
"post": {
|
||||
"operationId": "createUserAdmin",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/UserAdminCreateDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"201": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/UserAdminResponseDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
},
|
||||
{
|
||||
"cookie": []
|
||||
},
|
||||
{
|
||||
"api_key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/admin/users/{id}": {
|
||||
"delete": {
|
||||
"operationId": "deleteUserAdmin",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"required": true,
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"format": "uuid",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/UserAdminDeleteDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/UserAdminResponseDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
},
|
||||
{
|
||||
"cookie": []
|
||||
},
|
||||
{
|
||||
"api_key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
]
|
||||
},
|
||||
"get": {
|
||||
"operationId": "getUserAdmin",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"required": true,
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"format": "uuid",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/UserAdminResponseDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
},
|
||||
{
|
||||
"cookie": []
|
||||
},
|
||||
{
|
||||
"api_key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
]
|
||||
},
|
||||
"put": {
|
||||
"operationId": "updateUserAdmin",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"required": true,
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"format": "uuid",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/UserAdminUpdateDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/UserAdminResponseDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
},
|
||||
{
|
||||
"cookie": []
|
||||
},
|
||||
{
|
||||
"api_key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/admin/users/{id}/restore": {
|
||||
"post": {
|
||||
"operationId": "restoreUserAdmin",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"required": true,
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"format": "uuid",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/UserAdminResponseDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
},
|
||||
{
|
||||
"cookie": []
|
||||
},
|
||||
{
|
||||
"api_key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/albums": {
|
||||
"get": {
|
||||
"operationId": "getAllAlbums",
|
||||
@@ -1879,7 +2147,7 @@
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/UserResponseDto"
|
||||
"$ref": "#/components/schemas/UserAdminResponseDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1910,7 +2178,7 @@
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/UserResponseDto"
|
||||
"$ref": "#/components/schemas/UserAdminResponseDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -3160,7 +3428,7 @@
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/UserResponseDto"
|
||||
"$ref": "#/components/schemas/UserAdminResponseDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -3206,7 +3474,7 @@
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/UserResponseDto"
|
||||
"$ref": "#/components/schemas/UserAdminResponseDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -6030,17 +6298,8 @@
|
||||
},
|
||||
"/users": {
|
||||
"get": {
|
||||
"operationId": "getAllUsers",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "isAll",
|
||||
"required": true,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
],
|
||||
"operationId": "searchUsers",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
@@ -6070,26 +6329,18 @@
|
||||
"tags": [
|
||||
"User"
|
||||
]
|
||||
},
|
||||
"post": {
|
||||
"operationId": "createUser",
|
||||
}
|
||||
},
|
||||
"/users/me": {
|
||||
"get": {
|
||||
"operationId": "getMyUser",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/CreateUserDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"201": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/UserResponseDto"
|
||||
"$ref": "#/components/schemas/UserAdminResponseDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -6112,13 +6363,13 @@
|
||||
]
|
||||
},
|
||||
"put": {
|
||||
"operationId": "updateUser",
|
||||
"operationId": "updateMyUser",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/UpdateUserDto"
|
||||
"$ref": "#/components/schemas/UserUpdateMeDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -6129,39 +6380,7 @@
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/UserResponseDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
},
|
||||
{
|
||||
"cookie": []
|
||||
},
|
||||
{
|
||||
"api_key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/users/me": {
|
||||
"get": {
|
||||
"operationId": "getMyUserInfo",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/UserResponseDto"
|
||||
"$ref": "#/components/schemas/UserAdminResponseDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -6251,58 +6470,8 @@
|
||||
}
|
||||
},
|
||||
"/users/{id}": {
|
||||
"delete": {
|
||||
"operationId": "deleteUser",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"required": true,
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"format": "uuid",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/DeleteUserDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/UserResponseDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
},
|
||||
{
|
||||
"cookie": []
|
||||
},
|
||||
{
|
||||
"api_key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
]
|
||||
},
|
||||
"get": {
|
||||
"operationId": "getUserById",
|
||||
"operationId": "getUser",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
@@ -6384,48 +6553,6 @@
|
||||
"User"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/users/{id}/restore": {
|
||||
"post": {
|
||||
"operationId": "restoreUser",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"required": true,
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"format": "uuid",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/UserResponseDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
},
|
||||
{
|
||||
"cookie": []
|
||||
},
|
||||
{
|
||||
"api_key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"info": {
|
||||
@@ -6567,7 +6694,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"user": {
|
||||
"$ref": "#/components/schemas/UserDto"
|
||||
"$ref": "#/components/schemas/UserResponseDto"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -7775,52 +7902,6 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"CreateUserDto": {
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"memoriesEnabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"notify": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"password": {
|
||||
"type": "string"
|
||||
},
|
||||
"quotaSizeInBytes": {
|
||||
"format": "int64",
|
||||
"minimum": 1,
|
||||
"nullable": true,
|
||||
"type": "integer"
|
||||
},
|
||||
"shouldChangePassword": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"storageLabel": {
|
||||
"nullable": true,
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"email",
|
||||
"name",
|
||||
"password"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"DeleteUserDto": {
|
||||
"properties": {
|
||||
"force": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"DownloadArchiveInfo": {
|
||||
"properties": {
|
||||
"assetIds": {
|
||||
@@ -8803,15 +8884,6 @@
|
||||
"avatarColor": {
|
||||
"$ref": "#/components/schemas/UserAvatarColor"
|
||||
},
|
||||
"createdAt": {
|
||||
"format": "date-time",
|
||||
"type": "string"
|
||||
},
|
||||
"deletedAt": {
|
||||
"format": "date-time",
|
||||
"nullable": true,
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -8821,62 +8893,19 @@
|
||||
"inTimeline": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"isAdmin": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"memoriesEnabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"oauthId": {
|
||||
"type": "string"
|
||||
},
|
||||
"profileImagePath": {
|
||||
"type": "string"
|
||||
},
|
||||
"quotaSizeInBytes": {
|
||||
"format": "int64",
|
||||
"nullable": true,
|
||||
"type": "integer"
|
||||
},
|
||||
"quotaUsageInBytes": {
|
||||
"format": "int64",
|
||||
"nullable": true,
|
||||
"type": "integer"
|
||||
},
|
||||
"shouldChangePassword": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"status": {
|
||||
"$ref": "#/components/schemas/UserStatus"
|
||||
},
|
||||
"storageLabel": {
|
||||
"nullable": true,
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"format": "date-time",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"avatarColor",
|
||||
"createdAt",
|
||||
"deletedAt",
|
||||
"email",
|
||||
"id",
|
||||
"isAdmin",
|
||||
"name",
|
||||
"oauthId",
|
||||
"profileImagePath",
|
||||
"quotaSizeInBytes",
|
||||
"quotaUsageInBytes",
|
||||
"shouldChangePassword",
|
||||
"status",
|
||||
"storageLabel",
|
||||
"updatedAt"
|
||||
"profileImagePath"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
@@ -10810,48 +10839,6 @@
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"UpdateUserDto": {
|
||||
"properties": {
|
||||
"avatarColor": {
|
||||
"$ref": "#/components/schemas/UserAvatarColor"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"format": "uuid",
|
||||
"type": "string"
|
||||
},
|
||||
"isAdmin": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"memoriesEnabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"password": {
|
||||
"type": "string"
|
||||
},
|
||||
"quotaSizeInBytes": {
|
||||
"format": "int64",
|
||||
"minimum": 1,
|
||||
"nullable": true,
|
||||
"type": "integer"
|
||||
},
|
||||
"shouldChangePassword": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"storageLabel": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"UsageByUserDto": {
|
||||
"properties": {
|
||||
"photos": {
|
||||
@@ -10886,49 +10873,53 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"UserAvatarColor": {
|
||||
"enum": [
|
||||
"primary",
|
||||
"pink",
|
||||
"red",
|
||||
"yellow",
|
||||
"blue",
|
||||
"green",
|
||||
"purple",
|
||||
"orange",
|
||||
"gray",
|
||||
"amber"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"UserDto": {
|
||||
"UserAdminCreateDto": {
|
||||
"properties": {
|
||||
"avatarColor": {
|
||||
"$ref": "#/components/schemas/UserAvatarColor"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
"memoriesEnabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"profileImagePath": {
|
||||
"notify": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"password": {
|
||||
"type": "string"
|
||||
},
|
||||
"quotaSizeInBytes": {
|
||||
"format": "int64",
|
||||
"minimum": 1,
|
||||
"nullable": true,
|
||||
"type": "integer"
|
||||
},
|
||||
"shouldChangePassword": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"storageLabel": {
|
||||
"nullable": true,
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"avatarColor",
|
||||
"email",
|
||||
"id",
|
||||
"name",
|
||||
"profileImagePath"
|
||||
"password"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"UserResponseDto": {
|
||||
"UserAdminDeleteDto": {
|
||||
"properties": {
|
||||
"force": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"UserAdminResponseDto": {
|
||||
"properties": {
|
||||
"avatarColor": {
|
||||
"$ref": "#/components/schemas/UserAvatarColor"
|
||||
@@ -11007,6 +10998,81 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"UserAdminUpdateDto": {
|
||||
"properties": {
|
||||
"avatarColor": {
|
||||
"$ref": "#/components/schemas/UserAvatarColor"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"memoriesEnabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"password": {
|
||||
"type": "string"
|
||||
},
|
||||
"quotaSizeInBytes": {
|
||||
"format": "int64",
|
||||
"minimum": 1,
|
||||
"nullable": true,
|
||||
"type": "integer"
|
||||
},
|
||||
"shouldChangePassword": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"storageLabel": {
|
||||
"nullable": true,
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"UserAvatarColor": {
|
||||
"enum": [
|
||||
"primary",
|
||||
"pink",
|
||||
"red",
|
||||
"yellow",
|
||||
"blue",
|
||||
"green",
|
||||
"purple",
|
||||
"orange",
|
||||
"gray",
|
||||
"amber"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"UserResponseDto": {
|
||||
"properties": {
|
||||
"avatarColor": {
|
||||
"$ref": "#/components/schemas/UserAvatarColor"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"profileImagePath": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"avatarColor",
|
||||
"email",
|
||||
"id",
|
||||
"name",
|
||||
"profileImagePath"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"UserStatus": {
|
||||
"enum": [
|
||||
"active",
|
||||
@@ -11015,6 +11081,26 @@
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"UserUpdateMeDto": {
|
||||
"properties": {
|
||||
"avatarColor": {
|
||||
"$ref": "#/components/schemas/UserAvatarColor"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"memoriesEnabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"password": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"ValidateAccessTokenResponseDto": {
|
||||
"properties": {
|
||||
"authStatus": {
|
||||
|
||||
@@ -13,13 +13,22 @@ npm i --save @immich/sdk
|
||||
For a more detailed example, check out the [`@immich/cli`](https://github.com/immich-app/immich/tree/main/cli).
|
||||
|
||||
```typescript
|
||||
<<<<<<< HEAD
|
||||
import { getAllAlbums, getAllAssets, getMyUser, init } from "@immich/sdk";
|
||||
=======
|
||||
import { getAllAlbums, getMyUserInfo, init } from "@immich/sdk";
|
||||
>>>>>>> e7c8501930a988dfb6c23ce1c48b0beb076a58c2
|
||||
|
||||
const API_KEY = "<API_KEY>"; // process.env.IMMICH_API_KEY
|
||||
|
||||
init({ baseUrl: "https://demo.immich.app/api", apiKey: API_KEY });
|
||||
|
||||
<<<<<<< HEAD
|
||||
const user = await getMyUser();
|
||||
const assets = await getAllAssets({ take: 1000 });
|
||||
=======
|
||||
const user = await getMyUserInfo();
|
||||
>>>>>>> e7c8501930a988dfb6c23ce1c48b0beb076a58c2
|
||||
const albums = await getAllAlbums({});
|
||||
|
||||
console.log({ user, albums });
|
||||
|
||||
@@ -14,7 +14,7 @@ const oazapfts = Oazapfts.runtime(defaults);
|
||||
export const servers = {
|
||||
server1: "/api"
|
||||
};
|
||||
export type UserDto = {
|
||||
export type UserResponseDto = {
|
||||
avatarColor: UserAvatarColor;
|
||||
email: string;
|
||||
id: string;
|
||||
@@ -27,7 +27,7 @@ export type ActivityResponseDto = {
|
||||
createdAt: string;
|
||||
id: string;
|
||||
"type": Type;
|
||||
user: UserDto;
|
||||
user: UserResponseDto;
|
||||
};
|
||||
export type ActivityCreateDto = {
|
||||
albumId: string;
|
||||
@@ -38,7 +38,7 @@ export type ActivityCreateDto = {
|
||||
export type ActivityStatisticsResponseDto = {
|
||||
comments: number;
|
||||
};
|
||||
export type UserResponseDto = {
|
||||
export type UserAdminResponseDto = {
|
||||
avatarColor: UserAvatarColor;
|
||||
createdAt: string;
|
||||
deletedAt: string | null;
|
||||
@@ -56,6 +56,29 @@ export type UserResponseDto = {
|
||||
storageLabel: string | null;
|
||||
updatedAt: string;
|
||||
};
|
||||
export type UserAdminCreateDto = {
|
||||
email: string;
|
||||
memoriesEnabled?: boolean;
|
||||
name: string;
|
||||
notify?: boolean;
|
||||
password: string;
|
||||
quotaSizeInBytes?: number | null;
|
||||
shouldChangePassword?: boolean;
|
||||
storageLabel?: string | null;
|
||||
};
|
||||
export type UserAdminDeleteDto = {
|
||||
force?: boolean;
|
||||
};
|
||||
export type UserAdminUpdateDto = {
|
||||
avatarColor?: UserAvatarColor;
|
||||
email?: string;
|
||||
memoriesEnabled?: boolean;
|
||||
name?: string;
|
||||
password?: string;
|
||||
quotaSizeInBytes?: number | null;
|
||||
shouldChangePassword?: boolean;
|
||||
storageLabel?: string | null;
|
||||
};
|
||||
export type AlbumUserResponseDto = {
|
||||
role: AlbumUserRole;
|
||||
user: UserResponseDto;
|
||||
@@ -517,22 +540,11 @@ export type OAuthCallbackDto = {
|
||||
};
|
||||
export type PartnerResponseDto = {
|
||||
avatarColor: UserAvatarColor;
|
||||
createdAt: string;
|
||||
deletedAt: string | null;
|
||||
email: string;
|
||||
id: string;
|
||||
inTimeline?: boolean;
|
||||
isAdmin: boolean;
|
||||
memoriesEnabled?: boolean;
|
||||
name: string;
|
||||
oauthId: string;
|
||||
profileImagePath: string;
|
||||
quotaSizeInBytes: number | null;
|
||||
quotaUsageInBytes: number | null;
|
||||
shouldChangePassword: boolean;
|
||||
status: UserStatus;
|
||||
storageLabel: string | null;
|
||||
updatedAt: string;
|
||||
};
|
||||
export type UpdatePartnerDto = {
|
||||
inTimeline: boolean;
|
||||
@@ -1060,27 +1072,12 @@ export type TimeBucketResponseDto = {
|
||||
count: number;
|
||||
timeBucket: string;
|
||||
};
|
||||
export type CreateUserDto = {
|
||||
email: string;
|
||||
memoriesEnabled?: boolean;
|
||||
name: string;
|
||||
notify?: boolean;
|
||||
password: string;
|
||||
quotaSizeInBytes?: number | null;
|
||||
shouldChangePassword?: boolean;
|
||||
storageLabel?: string | null;
|
||||
};
|
||||
export type UpdateUserDto = {
|
||||
export type UserUpdateMeDto = {
|
||||
avatarColor?: UserAvatarColor;
|
||||
email?: string;
|
||||
id: string;
|
||||
isAdmin?: boolean;
|
||||
memoriesEnabled?: boolean;
|
||||
name?: string;
|
||||
password?: string;
|
||||
quotaSizeInBytes?: number | null;
|
||||
shouldChangePassword?: boolean;
|
||||
storageLabel?: string;
|
||||
};
|
||||
export type CreateProfileImageDto = {
|
||||
file: Blob;
|
||||
@@ -1089,9 +1086,6 @@ export type CreateProfileImageResponseDto = {
|
||||
profileImagePath: string;
|
||||
userId: string;
|
||||
};
|
||||
export type DeleteUserDto = {
|
||||
force?: boolean;
|
||||
};
|
||||
export function getActivities({ albumId, assetId, level, $type, userId }: {
|
||||
albumId: string;
|
||||
assetId?: string;
|
||||
@@ -1146,6 +1140,77 @@ export function deleteActivity({ id }: {
|
||||
method: "DELETE"
|
||||
}));
|
||||
}
|
||||
export function searchUsersAdmin({ withDeleted }: {
|
||||
withDeleted?: boolean;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: UserAdminResponseDto[];
|
||||
}>(`/admin/users${QS.query(QS.explode({
|
||||
withDeleted
|
||||
}))}`, {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
export function createUserAdmin({ userAdminCreateDto }: {
|
||||
userAdminCreateDto: UserAdminCreateDto;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 201;
|
||||
data: UserAdminResponseDto;
|
||||
}>("/admin/users", oazapfts.json({
|
||||
...opts,
|
||||
method: "POST",
|
||||
body: userAdminCreateDto
|
||||
})));
|
||||
}
|
||||
export function deleteUserAdmin({ id, userAdminDeleteDto }: {
|
||||
id: string;
|
||||
userAdminDeleteDto: UserAdminDeleteDto;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: UserAdminResponseDto;
|
||||
}>(`/admin/users/${encodeURIComponent(id)}`, oazapfts.json({
|
||||
...opts,
|
||||
method: "DELETE",
|
||||
body: userAdminDeleteDto
|
||||
})));
|
||||
}
|
||||
export function getUserAdmin({ id }: {
|
||||
id: string;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: UserAdminResponseDto;
|
||||
}>(`/admin/users/${encodeURIComponent(id)}`, {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
export function updateUserAdmin({ id, userAdminUpdateDto }: {
|
||||
id: string;
|
||||
userAdminUpdateDto: UserAdminUpdateDto;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: UserAdminResponseDto;
|
||||
}>(`/admin/users/${encodeURIComponent(id)}`, oazapfts.json({
|
||||
...opts,
|
||||
method: "PUT",
|
||||
body: userAdminUpdateDto
|
||||
})));
|
||||
}
|
||||
export function restoreUserAdmin({ id }: {
|
||||
id: string;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 201;
|
||||
data: UserAdminResponseDto;
|
||||
}>(`/admin/users/${encodeURIComponent(id)}/restore`, {
|
||||
...opts,
|
||||
method: "POST"
|
||||
}));
|
||||
}
|
||||
export function getAllAlbums({ assetId, shared }: {
|
||||
assetId?: string;
|
||||
shared?: boolean;
|
||||
@@ -1589,7 +1654,7 @@ export function signUpAdmin({ signUpDto }: {
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 201;
|
||||
data: UserResponseDto;
|
||||
data: UserAdminResponseDto;
|
||||
}>("/auth/admin-sign-up", oazapfts.json({
|
||||
...opts,
|
||||
method: "POST",
|
||||
@@ -1601,7 +1666,7 @@ export function changePassword({ changePasswordDto }: {
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: UserResponseDto;
|
||||
data: UserAdminResponseDto;
|
||||
}>("/auth/change-password", oazapfts.json({
|
||||
...opts,
|
||||
method: "POST",
|
||||
@@ -1934,7 +1999,7 @@ export function linkOAuthAccount({ oAuthCallbackDto }: {
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 201;
|
||||
data: UserResponseDto;
|
||||
data: UserAdminResponseDto;
|
||||
}>("/oauth/link", oazapfts.json({
|
||||
...opts,
|
||||
method: "POST",
|
||||
@@ -1949,7 +2014,7 @@ export function redirectOAuthToMobile(opts?: Oazapfts.RequestOpts) {
|
||||
export function unlinkOAuthAccount(opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 201;
|
||||
data: UserResponseDto;
|
||||
data: UserAdminResponseDto;
|
||||
}>("/oauth/unlink", {
|
||||
...opts,
|
||||
method: "POST"
|
||||
@@ -2687,50 +2752,34 @@ export function restoreAssets({ bulkIdsDto }: {
|
||||
body: bulkIdsDto
|
||||
})));
|
||||
}
|
||||
export function getAllUsers({ isAll }: {
|
||||
isAll: boolean;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
export function searchUsers(opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: UserResponseDto[];
|
||||
}>(`/users${QS.query(QS.explode({
|
||||
isAll
|
||||
}))}`, {
|
||||
}>("/users", {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
export function createUser({ createUserDto }: {
|
||||
createUserDto: CreateUserDto;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 201;
|
||||
data: UserResponseDto;
|
||||
}>("/users", oazapfts.json({
|
||||
...opts,
|
||||
method: "POST",
|
||||
body: createUserDto
|
||||
})));
|
||||
}
|
||||
export function updateUser({ updateUserDto }: {
|
||||
updateUserDto: UpdateUserDto;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
export function getMyUser(opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: UserResponseDto;
|
||||
}>("/users", oazapfts.json({
|
||||
...opts,
|
||||
method: "PUT",
|
||||
body: updateUserDto
|
||||
})));
|
||||
}
|
||||
export function getMyUserInfo(opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: UserResponseDto;
|
||||
data: UserAdminResponseDto;
|
||||
}>("/users/me", {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
export function updateMyUser({ userUpdateMeDto }: {
|
||||
userUpdateMeDto: UserUpdateMeDto;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: UserAdminResponseDto;
|
||||
}>("/users/me", oazapfts.json({
|
||||
...opts,
|
||||
method: "PUT",
|
||||
body: userUpdateMeDto
|
||||
})));
|
||||
}
|
||||
export function deleteProfileImage(opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchText("/users/profile-image", {
|
||||
...opts,
|
||||
@@ -2749,20 +2798,7 @@ export function createProfileImage({ createProfileImageDto }: {
|
||||
body: createProfileImageDto
|
||||
})));
|
||||
}
|
||||
export function deleteUser({ id, deleteUserDto }: {
|
||||
id: string;
|
||||
deleteUserDto: DeleteUserDto;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: UserResponseDto;
|
||||
}>(`/users/${encodeURIComponent(id)}`, oazapfts.json({
|
||||
...opts,
|
||||
method: "DELETE",
|
||||
body: deleteUserDto
|
||||
})));
|
||||
}
|
||||
export function getUserById({ id }: {
|
||||
export function getUser({ id }: {
|
||||
id: string;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
@@ -2782,17 +2818,6 @@ export function getProfileImage({ id }: {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
export function restoreUser({ id }: {
|
||||
id: string;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 201;
|
||||
data: UserResponseDto;
|
||||
}>(`/users/${encodeURIComponent(id)}/restore`, {
|
||||
...opts,
|
||||
method: "POST"
|
||||
}));
|
||||
}
|
||||
export enum ReactionLevel {
|
||||
Album = "album",
|
||||
Asset = "asset"
|
||||
@@ -2817,15 +2842,15 @@ export enum UserAvatarColor {
|
||||
Gray = "gray",
|
||||
Amber = "amber"
|
||||
}
|
||||
export enum AlbumUserRole {
|
||||
Editor = "editor",
|
||||
Viewer = "viewer"
|
||||
}
|
||||
export enum UserStatus {
|
||||
Active = "active",
|
||||
Removing = "removing",
|
||||
Deleted = "deleted"
|
||||
}
|
||||
export enum AlbumUserRole {
|
||||
Editor = "editor",
|
||||
Viewer = "viewer"
|
||||
}
|
||||
export enum TagTypeEnum {
|
||||
Object = "OBJECT",
|
||||
Face = "FACE",
|
||||
|
||||
Reference in New Issue
Block a user