Code Docs


Pluvo Developers Docs


Back to website:

Dutch: Pluvo.nl

English: Pluvo.eu

Model

<aside> 💡 See  schema for more information about the schema.

</aside>

type User {
    id: UUID!
    isActive: Boolean!
    email: String!
    name: String!
    ref: String
    roles: [Role]
    profileImage: String!
    language: Language!
    extraFields: JSONString!
		afasEmployeeId: String
		afasPersonId: String
}

Queries

Get users

Get a list of all users in your organization.

query users {
    users {
        ref
        name
        email
        isActive
    }
}

query users {
	  users(active: true) {
		    ref
				name
		    email
  }
}

Get user

Get a single user in your organization. You can use the ref of the user to get it.

query user {
    user(ref: "user-ref") {
        ref
        name
        email
        isActive
    }
}

Mutations

Create user

Create a new user in your organization, you can pass your own custom ref.

mutation createUser {
    createUser(sendInvite: true, user: {ref: "user-ref", name: "Test User", email: "[email protected]"}) {
        user {
            ref
            name
            email
        }
    }
}

Update user

Update a user using ref.

mutation updateUser {
    updateUser(ref: "user-ref", user: {name: "New name"}) {
        user {
            ref
            name
            email
        }
    }
}

The create user will give an error when a user already exists, to prevent doing two requests each times to create and/or update an user we can send a updateOrCreate request.

Update or Create User

You can use a ref or email as the selector, if no user is found with this selector it will create a new one. When sendInvite is set to true the new user gets an invite e-mail.

# Use ref
mutation updateOrCreateUser {
  updateOrCreateUser(sendInvite: true, ref: "user-ref", user: {name: "New name", email: "[email protected]", afasEmployeeId: "123" }) {
    created # Is the user created.
    user {
      id
			ref
      email
      name
    }
  }
}

# Use email
mutation updateOrCreateUser {
  updateOrCreateUser(sendInvite: true, email: "[email protected]", user: {name: "New name", email: "[email protected]"}) {
    created # Is the user created.
    user {
      id
			ref
      email
      name
    }
  }
}

Archive user

To disable a user we can archive it. This can be done via the updateUser mutation

mutation updateUser {
    updateUser(ref: "user-ref", user: {isActive: false}) {
        user {
            ref
            name
            isActive
        }
    }
}

Table of Contents