fix(docs): /users API docs ZMS-110 (#575)

* /users GET endpoint added

* added /users POST to api generation

* added /users/resolve/:username GET endpoint for api generation

* fixes + request user info GET endpoint added

* Added Update User information api path to api docs generation

* added Log out User endpoint to api generation

* Added Recalculate User quota endpoint to API generation

* added Recalculate Quota for all users endpoint to api generation

* added Export data endpoint to API generation

* added Import user data endpoint to API generation

* Reset password for a User endpoint added to API generation

* Reset password for a User endpoint add param to res

* add missing response types

* added Delete a User, Return recovery info for a deleted User, Cancel user deletion task - endpoints to API generation

* fix typo in users.js
This commit is contained in:
NickOvt 2023-12-21 10:42:09 +02:00 committed by GitHub
parent 29cffe0d5f
commit a15878c7d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 873 additions and 218 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,9 +1,32 @@
'use strict';
const Joi = require('joi');
const { booleanSchema } = require('../../schemas');
const successRes = booleanSchema.required().description('Indicates successful response');
const totalRes = Joi.number().required().description('How many results were found');
const pageRes = Joi.number().required().description('Current page number. Derived from page query argument');
const previousCursorRes = Joi.alternatives()
.try(Joi.string(), booleanSchema)
.required()
.description('Either a cursor string or false if there are not any previous results');
const nextCursorRes = Joi.alternatives()
.try(Joi.string(), booleanSchema)
.required()
.description('Either a cursor string or false if there are not any next results');
const quotaRes = Joi.object({
allowed: Joi.number().required().description('Allowed quota of the user in bytes'),
used: Joi.number().required().description('Space used in bytes')
})
.$_setFlag('objectName', 'Quota')
.description('Quota usage limits');
module.exports = {
successRes
successRes,
totalRes,
pageRes,
previousCursorRes,
nextCursorRes,
quotaRes
};

View file

@ -0,0 +1,29 @@
'use strict';
const Joi = require('joi');
const { booleanSchema } = require('../../schemas');
const { quotaRes } = require('./general-schemas');
const GetUsersResult = Joi.object({
id: Joi.string().required().description('Users unique ID (24byte hex)'),
username: Joi.string().required().description('Username of the User'),
name: Joi.string().required().description('Name of the User'),
address: Joi.string().required().description('Main email address of the User'),
tags: Joi.array().items(Joi.string()).required().description('List of tags associated with the User'),
targets: Joi.array().items(Joi.string()).required().description('List of forwarding targets'),
enabled2fa: Joi.array().items(Joi.string()).required().description('List of enabled 2FA methods'),
autoreply: booleanSchema.required().description('Is autoreply enabled or not (start time may still be in the future or end time in the past)'),
encryptMessages: booleanSchema.required().description('If true then received messages are encrypted'),
encryptForwarded: booleanSchema.required().description('If true then forwarded messages are encrypted'),
quota: quotaRes,
metaData: Joi.object().description('Custom metadata value. Included if metaData query argument was true'),
internalData: Joi.object().description(
'Custom metadata value for internal use. Included if internalData query argument was true and request was not made using user-role token'
),
hasPasswordSet: booleanSchema.required().description('If true then the User has a password set and can authenticate'),
activated: booleanSchema.required().description('Is the account activated'),
disabled: booleanSchema.required().description('If true then user can not authenticate or receive any new mail'),
suspended: booleanSchema.required().description('If true then user can not authenticate')
}).$_setFlag('objectName', 'GetUsersResult');
module.exports = { GetUsersResult };