import { AppwriteException } from '../client.mjs'; // src/services/users.ts var Users = class { constructor(client) { this.client = client; } list(paramsOrFirst, ...rest) { let params; if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { queries: paramsOrFirst, search: rest[0], total: rest[1] }; } const queries = params.queries; const search = params.search; const total = params.total; const apiPath = "/users"; const payload = {}; if (typeof queries !== "undefined") { payload["queries"] = queries; } if (typeof search !== "undefined") { payload["search"] = search; } if (typeof total !== "undefined") { payload["total"] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = {}; return this.client.call( "get", uri, apiHeaders, payload ); } create(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, email: rest[0], phone: rest[1], password: rest[2], name: rest[3] }; } const userId = params.userId; const email = params.email; const phone = params.phone; const password = params.password; const name = params.name; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } const apiPath = "/users"; const payload = {}; if (typeof userId !== "undefined") { payload["userId"] = userId; } if (typeof email !== "undefined") { payload["email"] = email; } if (typeof phone !== "undefined") { payload["phone"] = phone; } if (typeof password !== "undefined") { payload["password"] = password; } if (typeof name !== "undefined") { payload["name"] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "post", uri, apiHeaders, payload ); } createArgon2User(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, email: rest[0], password: rest[1], name: rest[2] }; } const userId = params.userId; const email = params.email; const password = params.password; const name = params.name; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof email === "undefined") { throw new AppwriteException('Missing required parameter: "email"'); } if (typeof password === "undefined") { throw new AppwriteException('Missing required parameter: "password"'); } const apiPath = "/users/argon2"; const payload = {}; if (typeof userId !== "undefined") { payload["userId"] = userId; } if (typeof email !== "undefined") { payload["email"] = email; } if (typeof password !== "undefined") { payload["password"] = password; } if (typeof name !== "undefined") { payload["name"] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "post", uri, apiHeaders, payload ); } createBcryptUser(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, email: rest[0], password: rest[1], name: rest[2] }; } const userId = params.userId; const email = params.email; const password = params.password; const name = params.name; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof email === "undefined") { throw new AppwriteException('Missing required parameter: "email"'); } if (typeof password === "undefined") { throw new AppwriteException('Missing required parameter: "password"'); } const apiPath = "/users/bcrypt"; const payload = {}; if (typeof userId !== "undefined") { payload["userId"] = userId; } if (typeof email !== "undefined") { payload["email"] = email; } if (typeof password !== "undefined") { payload["password"] = password; } if (typeof name !== "undefined") { payload["name"] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "post", uri, apiHeaders, payload ); } listIdentities(paramsOrFirst, ...rest) { let params; if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { queries: paramsOrFirst, search: rest[0], total: rest[1] }; } const queries = params.queries; const search = params.search; const total = params.total; const apiPath = "/users/identities"; const payload = {}; if (typeof queries !== "undefined") { payload["queries"] = queries; } if (typeof search !== "undefined") { payload["search"] = search; } if (typeof total !== "undefined") { payload["total"] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = {}; return this.client.call( "get", uri, apiHeaders, payload ); } deleteIdentity(paramsOrFirst) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { identityId: paramsOrFirst }; } const identityId = params.identityId; if (typeof identityId === "undefined") { throw new AppwriteException('Missing required parameter: "identityId"'); } const apiPath = "/users/identities/{identityId}".replace("{identityId}", identityId); const payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "delete", uri, apiHeaders, payload ); } createMD5User(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, email: rest[0], password: rest[1], name: rest[2] }; } const userId = params.userId; const email = params.email; const password = params.password; const name = params.name; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof email === "undefined") { throw new AppwriteException('Missing required parameter: "email"'); } if (typeof password === "undefined") { throw new AppwriteException('Missing required parameter: "password"'); } const apiPath = "/users/md5"; const payload = {}; if (typeof userId !== "undefined") { payload["userId"] = userId; } if (typeof email !== "undefined") { payload["email"] = email; } if (typeof password !== "undefined") { payload["password"] = password; } if (typeof name !== "undefined") { payload["name"] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "post", uri, apiHeaders, payload ); } createPHPassUser(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, email: rest[0], password: rest[1], name: rest[2] }; } const userId = params.userId; const email = params.email; const password = params.password; const name = params.name; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof email === "undefined") { throw new AppwriteException('Missing required parameter: "email"'); } if (typeof password === "undefined") { throw new AppwriteException('Missing required parameter: "password"'); } const apiPath = "/users/phpass"; const payload = {}; if (typeof userId !== "undefined") { payload["userId"] = userId; } if (typeof email !== "undefined") { payload["email"] = email; } if (typeof password !== "undefined") { payload["password"] = password; } if (typeof name !== "undefined") { payload["name"] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "post", uri, apiHeaders, payload ); } createScryptUser(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, email: rest[0], password: rest[1], passwordSalt: rest[2], passwordCpu: rest[3], passwordMemory: rest[4], passwordParallel: rest[5], passwordLength: rest[6], name: rest[7] }; } const userId = params.userId; const email = params.email; const password = params.password; const passwordSalt = params.passwordSalt; const passwordCpu = params.passwordCpu; const passwordMemory = params.passwordMemory; const passwordParallel = params.passwordParallel; const passwordLength = params.passwordLength; const name = params.name; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof email === "undefined") { throw new AppwriteException('Missing required parameter: "email"'); } if (typeof password === "undefined") { throw new AppwriteException('Missing required parameter: "password"'); } if (typeof passwordSalt === "undefined") { throw new AppwriteException('Missing required parameter: "passwordSalt"'); } if (typeof passwordCpu === "undefined") { throw new AppwriteException('Missing required parameter: "passwordCpu"'); } if (typeof passwordMemory === "undefined") { throw new AppwriteException('Missing required parameter: "passwordMemory"'); } if (typeof passwordParallel === "undefined") { throw new AppwriteException('Missing required parameter: "passwordParallel"'); } if (typeof passwordLength === "undefined") { throw new AppwriteException('Missing required parameter: "passwordLength"'); } const apiPath = "/users/scrypt"; const payload = {}; if (typeof userId !== "undefined") { payload["userId"] = userId; } if (typeof email !== "undefined") { payload["email"] = email; } if (typeof password !== "undefined") { payload["password"] = password; } if (typeof passwordSalt !== "undefined") { payload["passwordSalt"] = passwordSalt; } if (typeof passwordCpu !== "undefined") { payload["passwordCpu"] = passwordCpu; } if (typeof passwordMemory !== "undefined") { payload["passwordMemory"] = passwordMemory; } if (typeof passwordParallel !== "undefined") { payload["passwordParallel"] = passwordParallel; } if (typeof passwordLength !== "undefined") { payload["passwordLength"] = passwordLength; } if (typeof name !== "undefined") { payload["name"] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "post", uri, apiHeaders, payload ); } createScryptModifiedUser(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, email: rest[0], password: rest[1], passwordSalt: rest[2], passwordSaltSeparator: rest[3], passwordSignerKey: rest[4], name: rest[5] }; } const userId = params.userId; const email = params.email; const password = params.password; const passwordSalt = params.passwordSalt; const passwordSaltSeparator = params.passwordSaltSeparator; const passwordSignerKey = params.passwordSignerKey; const name = params.name; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof email === "undefined") { throw new AppwriteException('Missing required parameter: "email"'); } if (typeof password === "undefined") { throw new AppwriteException('Missing required parameter: "password"'); } if (typeof passwordSalt === "undefined") { throw new AppwriteException('Missing required parameter: "passwordSalt"'); } if (typeof passwordSaltSeparator === "undefined") { throw new AppwriteException('Missing required parameter: "passwordSaltSeparator"'); } if (typeof passwordSignerKey === "undefined") { throw new AppwriteException('Missing required parameter: "passwordSignerKey"'); } const apiPath = "/users/scrypt-modified"; const payload = {}; if (typeof userId !== "undefined") { payload["userId"] = userId; } if (typeof email !== "undefined") { payload["email"] = email; } if (typeof password !== "undefined") { payload["password"] = password; } if (typeof passwordSalt !== "undefined") { payload["passwordSalt"] = passwordSalt; } if (typeof passwordSaltSeparator !== "undefined") { payload["passwordSaltSeparator"] = passwordSaltSeparator; } if (typeof passwordSignerKey !== "undefined") { payload["passwordSignerKey"] = passwordSignerKey; } if (typeof name !== "undefined") { payload["name"] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "post", uri, apiHeaders, payload ); } createSHAUser(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, email: rest[0], password: rest[1], passwordVersion: rest[2], name: rest[3] }; } const userId = params.userId; const email = params.email; const password = params.password; const passwordVersion = params.passwordVersion; const name = params.name; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof email === "undefined") { throw new AppwriteException('Missing required parameter: "email"'); } if (typeof password === "undefined") { throw new AppwriteException('Missing required parameter: "password"'); } const apiPath = "/users/sha"; const payload = {}; if (typeof userId !== "undefined") { payload["userId"] = userId; } if (typeof email !== "undefined") { payload["email"] = email; } if (typeof password !== "undefined") { payload["password"] = password; } if (typeof passwordVersion !== "undefined") { payload["passwordVersion"] = passwordVersion; } if (typeof name !== "undefined") { payload["name"] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "post", uri, apiHeaders, payload ); } get(paramsOrFirst) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst }; } const userId = params.userId; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } const apiPath = "/users/{userId}".replace("{userId}", userId); const payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = {}; return this.client.call( "get", uri, apiHeaders, payload ); } delete(paramsOrFirst) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst }; } const userId = params.userId; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } const apiPath = "/users/{userId}".replace("{userId}", userId); const payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "delete", uri, apiHeaders, payload ); } updateEmail(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, email: rest[0] }; } const userId = params.userId; const email = params.email; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof email === "undefined") { throw new AppwriteException('Missing required parameter: "email"'); } const apiPath = "/users/{userId}/email".replace("{userId}", userId); const payload = {}; if (typeof email !== "undefined") { payload["email"] = email; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "patch", uri, apiHeaders, payload ); } createJWT(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, sessionId: rest[0], duration: rest[1] }; } const userId = params.userId; const sessionId = params.sessionId; const duration = params.duration; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } const apiPath = "/users/{userId}/jwts".replace("{userId}", userId); const payload = {}; if (typeof sessionId !== "undefined") { payload["sessionId"] = sessionId; } if (typeof duration !== "undefined") { payload["duration"] = duration; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "post", uri, apiHeaders, payload ); } updateLabels(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, labels: rest[0] }; } const userId = params.userId; const labels = params.labels; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof labels === "undefined") { throw new AppwriteException('Missing required parameter: "labels"'); } const apiPath = "/users/{userId}/labels".replace("{userId}", userId); const payload = {}; if (typeof labels !== "undefined") { payload["labels"] = labels; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "put", uri, apiHeaders, payload ); } listLogs(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, queries: rest[0], total: rest[1] }; } const userId = params.userId; const queries = params.queries; const total = params.total; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } const apiPath = "/users/{userId}/logs".replace("{userId}", userId); const payload = {}; if (typeof queries !== "undefined") { payload["queries"] = queries; } if (typeof total !== "undefined") { payload["total"] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = {}; return this.client.call( "get", uri, apiHeaders, payload ); } listMemberships(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, queries: rest[0], search: rest[1], total: rest[2] }; } const userId = params.userId; const queries = params.queries; const search = params.search; const total = params.total; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } const apiPath = "/users/{userId}/memberships".replace("{userId}", userId); const payload = {}; if (typeof queries !== "undefined") { payload["queries"] = queries; } if (typeof search !== "undefined") { payload["search"] = search; } if (typeof total !== "undefined") { payload["total"] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = {}; return this.client.call( "get", uri, apiHeaders, payload ); } updateMfa(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, mfa: rest[0] }; } const userId = params.userId; const mfa = params.mfa; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof mfa === "undefined") { throw new AppwriteException('Missing required parameter: "mfa"'); } const apiPath = "/users/{userId}/mfa".replace("{userId}", userId); const payload = {}; if (typeof mfa !== "undefined") { payload["mfa"] = mfa; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "patch", uri, apiHeaders, payload ); } updateMFA(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, mfa: rest[0] }; } const userId = params.userId; const mfa = params.mfa; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof mfa === "undefined") { throw new AppwriteException('Missing required parameter: "mfa"'); } const apiPath = "/users/{userId}/mfa".replace("{userId}", userId); const payload = {}; if (typeof mfa !== "undefined") { payload["mfa"] = mfa; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "patch", uri, apiHeaders, payload ); } deleteMfaAuthenticator(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, type: rest[0] }; } const userId = params.userId; const type = params.type; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof type === "undefined") { throw new AppwriteException('Missing required parameter: "type"'); } const apiPath = "/users/{userId}/mfa/authenticators/{type}".replace("{userId}", userId).replace("{type}", type); const payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "delete", uri, apiHeaders, payload ); } deleteMFAAuthenticator(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, type: rest[0] }; } const userId = params.userId; const type = params.type; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof type === "undefined") { throw new AppwriteException('Missing required parameter: "type"'); } const apiPath = "/users/{userId}/mfa/authenticators/{type}".replace("{userId}", userId).replace("{type}", type); const payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "delete", uri, apiHeaders, payload ); } listMfaFactors(paramsOrFirst) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst }; } const userId = params.userId; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } const apiPath = "/users/{userId}/mfa/factors".replace("{userId}", userId); const payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = {}; return this.client.call( "get", uri, apiHeaders, payload ); } listMFAFactors(paramsOrFirst) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst }; } const userId = params.userId; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } const apiPath = "/users/{userId}/mfa/factors".replace("{userId}", userId); const payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = {}; return this.client.call( "get", uri, apiHeaders, payload ); } getMfaRecoveryCodes(paramsOrFirst) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst }; } const userId = params.userId; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } const apiPath = "/users/{userId}/mfa/recovery-codes".replace("{userId}", userId); const payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = {}; return this.client.call( "get", uri, apiHeaders, payload ); } getMFARecoveryCodes(paramsOrFirst) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst }; } const userId = params.userId; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } const apiPath = "/users/{userId}/mfa/recovery-codes".replace("{userId}", userId); const payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = {}; return this.client.call( "get", uri, apiHeaders, payload ); } updateMfaRecoveryCodes(paramsOrFirst) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst }; } const userId = params.userId; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } const apiPath = "/users/{userId}/mfa/recovery-codes".replace("{userId}", userId); const payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "put", uri, apiHeaders, payload ); } updateMFARecoveryCodes(paramsOrFirst) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst }; } const userId = params.userId; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } const apiPath = "/users/{userId}/mfa/recovery-codes".replace("{userId}", userId); const payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "put", uri, apiHeaders, payload ); } createMfaRecoveryCodes(paramsOrFirst) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst }; } const userId = params.userId; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } const apiPath = "/users/{userId}/mfa/recovery-codes".replace("{userId}", userId); const payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "patch", uri, apiHeaders, payload ); } createMFARecoveryCodes(paramsOrFirst) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst }; } const userId = params.userId; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } const apiPath = "/users/{userId}/mfa/recovery-codes".replace("{userId}", userId); const payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "patch", uri, apiHeaders, payload ); } updateName(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, name: rest[0] }; } const userId = params.userId; const name = params.name; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof name === "undefined") { throw new AppwriteException('Missing required parameter: "name"'); } const apiPath = "/users/{userId}/name".replace("{userId}", userId); const payload = {}; if (typeof name !== "undefined") { payload["name"] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "patch", uri, apiHeaders, payload ); } updatePassword(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, password: rest[0] }; } const userId = params.userId; const password = params.password; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof password === "undefined") { throw new AppwriteException('Missing required parameter: "password"'); } const apiPath = "/users/{userId}/password".replace("{userId}", userId); const payload = {}; if (typeof password !== "undefined") { payload["password"] = password; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "patch", uri, apiHeaders, payload ); } updatePhone(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, number: rest[0] }; } const userId = params.userId; const number = params.number; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof number === "undefined") { throw new AppwriteException('Missing required parameter: "number"'); } const apiPath = "/users/{userId}/phone".replace("{userId}", userId); const payload = {}; if (typeof number !== "undefined") { payload["number"] = number; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "patch", uri, apiHeaders, payload ); } getPrefs(paramsOrFirst) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst }; } const userId = params.userId; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } const apiPath = "/users/{userId}/prefs".replace("{userId}", userId); const payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = {}; return this.client.call( "get", uri, apiHeaders, payload ); } updatePrefs(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, prefs: rest[0] }; } const userId = params.userId; const prefs = params.prefs; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof prefs === "undefined") { throw new AppwriteException('Missing required parameter: "prefs"'); } const apiPath = "/users/{userId}/prefs".replace("{userId}", userId); const payload = {}; if (typeof prefs !== "undefined") { payload["prefs"] = prefs; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "patch", uri, apiHeaders, payload ); } listSessions(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, total: rest[0] }; } const userId = params.userId; const total = params.total; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } const apiPath = "/users/{userId}/sessions".replace("{userId}", userId); const payload = {}; if (typeof total !== "undefined") { payload["total"] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = {}; return this.client.call( "get", uri, apiHeaders, payload ); } createSession(paramsOrFirst) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst }; } const userId = params.userId; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } const apiPath = "/users/{userId}/sessions".replace("{userId}", userId); const payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "post", uri, apiHeaders, payload ); } deleteSessions(paramsOrFirst) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst }; } const userId = params.userId; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } const apiPath = "/users/{userId}/sessions".replace("{userId}", userId); const payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "delete", uri, apiHeaders, payload ); } deleteSession(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, sessionId: rest[0] }; } const userId = params.userId; const sessionId = params.sessionId; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof sessionId === "undefined") { throw new AppwriteException('Missing required parameter: "sessionId"'); } const apiPath = "/users/{userId}/sessions/{sessionId}".replace("{userId}", userId).replace("{sessionId}", sessionId); const payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "delete", uri, apiHeaders, payload ); } updateStatus(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, status: rest[0] }; } const userId = params.userId; const status = params.status; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof status === "undefined") { throw new AppwriteException('Missing required parameter: "status"'); } const apiPath = "/users/{userId}/status".replace("{userId}", userId); const payload = {}; if (typeof status !== "undefined") { payload["status"] = status; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "patch", uri, apiHeaders, payload ); } listTargets(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, queries: rest[0], total: rest[1] }; } const userId = params.userId; const queries = params.queries; const total = params.total; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } const apiPath = "/users/{userId}/targets".replace("{userId}", userId); const payload = {}; if (typeof queries !== "undefined") { payload["queries"] = queries; } if (typeof total !== "undefined") { payload["total"] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = {}; return this.client.call( "get", uri, apiHeaders, payload ); } createTarget(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, targetId: rest[0], providerType: rest[1], identifier: rest[2], providerId: rest[3], name: rest[4] }; } const userId = params.userId; const targetId = params.targetId; const providerType = params.providerType; const identifier = params.identifier; const providerId = params.providerId; const name = params.name; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof targetId === "undefined") { throw new AppwriteException('Missing required parameter: "targetId"'); } if (typeof providerType === "undefined") { throw new AppwriteException('Missing required parameter: "providerType"'); } if (typeof identifier === "undefined") { throw new AppwriteException('Missing required parameter: "identifier"'); } const apiPath = "/users/{userId}/targets".replace("{userId}", userId); const payload = {}; if (typeof targetId !== "undefined") { payload["targetId"] = targetId; } if (typeof providerType !== "undefined") { payload["providerType"] = providerType; } if (typeof identifier !== "undefined") { payload["identifier"] = identifier; } if (typeof providerId !== "undefined") { payload["providerId"] = providerId; } if (typeof name !== "undefined") { payload["name"] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "post", uri, apiHeaders, payload ); } getTarget(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, targetId: rest[0] }; } const userId = params.userId; const targetId = params.targetId; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof targetId === "undefined") { throw new AppwriteException('Missing required parameter: "targetId"'); } const apiPath = "/users/{userId}/targets/{targetId}".replace("{userId}", userId).replace("{targetId}", targetId); const payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = {}; return this.client.call( "get", uri, apiHeaders, payload ); } updateTarget(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, targetId: rest[0], identifier: rest[1], providerId: rest[2], name: rest[3] }; } const userId = params.userId; const targetId = params.targetId; const identifier = params.identifier; const providerId = params.providerId; const name = params.name; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof targetId === "undefined") { throw new AppwriteException('Missing required parameter: "targetId"'); } const apiPath = "/users/{userId}/targets/{targetId}".replace("{userId}", userId).replace("{targetId}", targetId); const payload = {}; if (typeof identifier !== "undefined") { payload["identifier"] = identifier; } if (typeof providerId !== "undefined") { payload["providerId"] = providerId; } if (typeof name !== "undefined") { payload["name"] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "patch", uri, apiHeaders, payload ); } deleteTarget(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, targetId: rest[0] }; } const userId = params.userId; const targetId = params.targetId; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof targetId === "undefined") { throw new AppwriteException('Missing required parameter: "targetId"'); } const apiPath = "/users/{userId}/targets/{targetId}".replace("{userId}", userId).replace("{targetId}", targetId); const payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "delete", uri, apiHeaders, payload ); } createToken(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, length: rest[0], expire: rest[1] }; } const userId = params.userId; const length = params.length; const expire = params.expire; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } const apiPath = "/users/{userId}/tokens".replace("{userId}", userId); const payload = {}; if (typeof length !== "undefined") { payload["length"] = length; } if (typeof expire !== "undefined") { payload["expire"] = expire; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "post", uri, apiHeaders, payload ); } updateEmailVerification(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, emailVerification: rest[0] }; } const userId = params.userId; const emailVerification = params.emailVerification; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof emailVerification === "undefined") { throw new AppwriteException('Missing required parameter: "emailVerification"'); } const apiPath = "/users/{userId}/verification".replace("{userId}", userId); const payload = {}; if (typeof emailVerification !== "undefined") { payload["emailVerification"] = emailVerification; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "patch", uri, apiHeaders, payload ); } updatePhoneVerification(paramsOrFirst, ...rest) { let params; if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) { params = paramsOrFirst || {}; } else { params = { userId: paramsOrFirst, phoneVerification: rest[0] }; } const userId = params.userId; const phoneVerification = params.phoneVerification; if (typeof userId === "undefined") { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof phoneVerification === "undefined") { throw new AppwriteException('Missing required parameter: "phoneVerification"'); } const apiPath = "/users/{userId}/verification/phone".replace("{userId}", userId); const payload = {}; if (typeof phoneVerification !== "undefined") { payload["phoneVerification"] = phoneVerification; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders = { "content-type": "application/json" }; return this.client.call( "patch", uri, apiHeaders, payload ); } }; export { Users }; //# sourceMappingURL=out.js.map //# sourceMappingURL=users.mjs.map