1.1.9 • Published 4 years ago

@slmdevs/celeraone v1.1.9

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

This is a NPM Package to use for all the CeleraOne interactions.


Users


Find user

Async function to fetch a specific user from CeleraOne

Parameters

Name TypeExample Description
contractorIdstring payway-550198b3a67201153c000007 The users social security number

Execution

import { findUser } from '@slmdevs/celeraone'

const user = await findUser('payway-550198b3a67201153c000007')

Response

{
  "userId": "b16eccba-4016-4968-90b2-3176172c5421",
  "login": "sven@svensson.com",
  "accountState": "registered",
  "socialSecurityNumber": "199009249179",
  "firstName": "Sven",
  "lastName": "Svensson",
  "email": "sven@svensson.com"
}

Update user password (hashed_password)

Async function to update a users hashed_password in CeleraOne

Name TypeExample Description
 userId string b16eccba-4016-4968-90b2-3176172c5421The userId the user has in CeleraOne
passwordHash string $2a$10$bZlWSl9mMRapbiCdV0qIwuaD52GGfKUPV0hASAerMqeMz2BFlO14C The bcrypt hash

Execution

import { updateUserPassword } from '@slmdevs/celeraone'

const success = await updateUserPassword('b16eccba-4016-4968-90b2-3176172c5421', '$2a$10$bZlWSl9mMRapbiCdV0qIwuaD52GGfKUPV0hASAerMqeMz2BFlO14C')

Response

true / false

Update user login

Async function to update the users login

Parameters

Name TypeExample Description
 userId string b16eccba-4016-4968-90b2-3176172c5421 The userId the user has in CeleraOne
 newLogin stringexample@email.com The new login for the user

Execution

import { updateUserLogin } from '@slmdevs/celeraone'

const success = await updateUserLogin('b16eccba-4016-4968-90b2-3176172c5421', 'example@mail.com')

Response

true / false

Update the users MasterData

Async function to update the users MasterData in CeleraOne

Parameters

Name TypeExample Description
 userId stringb16eccba-4016-4968-90b2-3176172c5421 The userId the user has in CeleraOne
data MasterDataInterface { first_name: 'Sven', last_name: 'Svensson' } The MasterData properties that you want to update

Execution

import { updateUserMasterData } from '@slmdevs/celeraone'

const success = await updateUserMasterData('b16eccba-4016-4968-90b2-3176172c5421', {
  first_name: 'Sven',
  last_name: 'Svensson'
})

Response

true / false

Add user propertyy

Async function to add a property to the user in CeleraOne

Parameters

Name TypeExample Description
userIdstringb16eccba-4016-4968-90b2-3176172c5421 The userId the user has in CeleraOne
name stringactive_prodcuts The property name
value string'gp-digital-bas,e-tidning' The value to be set

Execution

import { addUserProperty } from '@slmdevs/celeraone'

const success = await addUserProperty('5a9b882c-59e7-4221-b009-736aa3351604', 'active_products', 'hejsan123')

Response

true / false

Import user

Async function to import a user into CeleraOne

Parameters

Name TypeExample Description
 user UserInterface { socialSecurityNumber: '199009249179', email: 'example@mail.com', firstName: 'Sven', lastName: 'Svensson', hashedPassword: '$2a$10$bZlWSl9mMRapbiCdV0qIwuaD52GGfKUPV0hASAerMqeMz2BFlO14C' }The user object that will be imported

Execution

import { importUser } from '@slmdevs/celeraone'

const userId = await importUser({
    socialSecurityNumber: '199009249179',
    email: 'example@mail.com',
    firstName: 'Sven',
    lastName: 'Svensson',
    hashedPassword: '$2a$10$bZlWSl9mMRapbiCdV0qIwuaD52GGfKUPV0hASAerMqeMz2BFlO14C'
})

Response

4dd949a7-1231-4267-8131-c05d93f7936e

Get userId via users session_id

Async function to fetch the userId from the users session_id

Parameters

Name TypeExample Description
 sessionId string 76d67999399263996f177f8e08a74677The users session_id
 serviceId ServiceId ServiceId.GPThe serviceId in CeleraOne

Execution

import { getUserIdFromSessionId, ServiceId } from `@slmdevs/celeraone`

const userId = await getUserIdFromSessionId('76d67999399263996f177f8e08a74677', ServiceId.GP)

Response

461df36e-9c9e-4049-b7ef-0c3aa39fd704
1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.1

5 years ago

1.1.2

5 years ago

1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.3

5 years ago

1.0.0

5 years ago