UNPKG

@mft/moneyhub-api-client

Version:
100 lines 3.49 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = ({ config, request }) => { const { identityServiceUrl } = config; const usersEndpoint = identityServiceUrl + "/users"; const scimUsersEndpoint = identityServiceUrl + "/scim/users"; return { registerUser: async ({ clientUserId }, options) => request(usersEndpoint, { method: "POST", cc: { scope: "user:create", }, body: { clientUserId }, options, }), getUsers: async (params = {}, options) => request(usersEndpoint, { searchParams: params, cc: { scope: "user:read", }, options, }), registerSCIMUser: async ({ externalId, name, emails, }, options) => request(scimUsersEndpoint, { method: "POST", cc: { scope: "scim_user:write", }, body: { externalId, name, emails, }, options, }), getSCIMUser: async ({ userId }, options) => request(`${scimUsersEndpoint}/${userId}`, { cc: { scope: "scim_user:read", }, options, }), getUser: async ({ userId }, options) => request(`${usersEndpoint}/${userId}`, { cc: { scope: "user:read", }, options, }), getUserConnections: async ({ userId }, options) => request(`${usersEndpoint}/${userId}/connections`, { cc: { scope: "connection:read", }, options, }), deleteUserConnection: async ({ userId, connectionId }, options) => request(`${usersEndpoint}/${userId}/connection/${connectionId}`, { method: "DELETE", returnStatus: true, cc: { scope: "connection:delete", }, options, }), deleteUser: async ({ userId }, options) => request(`${usersEndpoint}/${userId}`, { method: "DELETE", returnStatus: true, cc: { scope: "user:delete", }, options, }), getConnectionSyncs: async ({ userId, connectionId, params = {} }, options) => request(`${usersEndpoint}/${userId}/connections/${connectionId}/syncs`, { searchParams: params, cc: { scope: "connection:read", }, options, }), getUserSyncs: async ({ userId, params = {} }, options) => request(`${usersEndpoint}/${userId}/syncs`, { searchParams: params, cc: { scope: "connection:read", }, options, }), getSync: async ({ userId, syncId }, options) => request(`${usersEndpoint}/${userId}/syncs/${syncId}`, { cc: { scope: "connection:read", }, options, }), updateUserConnection: async ({ userId, connectionId, expiresAt }, options) => request(`${usersEndpoint}/${userId}/connections/${connectionId}`, { method: "PATCH", returnStatus: true, cc: { scope: "connection:update", }, body: { expiresAt }, options, }), }; }; //# sourceMappingURL=users-and-connections.js.map