@keyro/kl-sdk-directory
v0.2.6
Published
Centralized way to request kl-core-directory
Downloads
10
Readme
Install
yarn add @keyro/kl-sdk-directory
Usage
import { getUser } from '@keyro/kl-sdk-directory'
async foo() {
const user = await getUser('xxxx-xxxxxx-xxxxx-xxxxxxxx') // You get all fields by default
}
async bar() {
const user = await getUser('xxxx-xxxxxx-xxxxx-xxxxxxxx', `id avatar`) // You ask only what you want through graphql syntax
}
Doc
Features
function | description | returns
---------|-------------|--------
addResource(resourcesIds, teamId, fields)
| Add resources to a team | Team
createOrganization(organization, fields)
| Create an organization | Organization
createTeam(team, organizationId, fields)
| Create a team | Team
getAllResources(filters, fields)
| Fetch all resources matching a given filter | [Resource]
getOrganization(id, fields)
| Fetch an organization with id | Organization
getPublicOrganization(id, fields)
| Fetch the public data of an organization with id | Organization
getTeam(id, fields)
| Fetch an team with id | Team
getUser(id, fields)
| Fetch an user with id | User
joinOrganization(userId, organizationId, fields)
| Make a user member of an organization | Organization
joinTeam(userIds, teamId, fields)
| Make a user member of a team | Team
leaveOrganization(userId, organizationId, fields)
| Kick a user from an organization | Organization
leaveTeam(userId, teamId, fields)
| Kick a user from a team | Team
resourcesApps(fields)
| List all available resourcesApps to be use as an enumeration | ResourceApp
resourcesTypes(fields)
| List all available resourcesTypes to be use as an enumeration | ResourceType
saveProfile(user, fields)
| Save changes to a user profile | User
saveProfilePicture(avatarUrl, fields)
| Specifically change the user avatar picture | User
updateOrganization(organization, fields)
| Save changes made to an organization | Organization
Objects
type Organization {
id: ID
name: String
siteUri: String
logoUri: String
contracted: Boolean,
description: String
users: [User]
paginatedUsers: PaginatedUser
teams: [Team]
owners: [User]
admins: [User]
employeesLength: Int
employees: [User]
createdAt: Datetime
deletedAt: Datetime
}
input InputOrganizationFilter {
id: ID
name: String
}
input InputUserOrganizationCreate {
name: String
description: String
contracted: Boolean,
siteUri: String
logoUri: String
}
input InputUserOrganizationUpdate {
id: ID!
name: String
description: String
contracted: Boolean,
siteUri: String
logoUri: String
}
input InputResource {
id: ID
name: String
typeId: ID
url: String
appId: ID
}
input InputResourceFilters {
id: ID
appId: ID
typeId: ID
teamId: ID
orgId: ID
userId: ID
}
type Resource {
id: ID
name: String
type: String
url: String
app: String
}
type ResourceType {
id: ID!
name: String!
}
type ResourceApp {
id: ID!
name: String!
}
input InputTeam {
id: ID
name: String
organizationId: ID
}
type Team {
id: ID
name: String
organizationId: ID
members: [User]
}
type User @key(fields: "id") {
id: ID!
email: String!
firstName: String
lastName: String
gender: Gender
company: String
birthdate: String
phone: String
zipcode: String
city: String
address: String
avatar: String
alias: String
createdAt: Datetime
deletedAt: Datetime
}
input InputUserProfileUpdate {
email: String!
firstName: String
lastName: String
gender: Gender
company: String
birthdate: String
phone: String
zipcode: String
city: String
address: String
avatar: String
alias: String!
}
enum Gender {
FEMALE
MALE
UNKNOWN
}
type PaginatedUser {
page: Int
perPage: Int
items: [User]
count: Int
}