npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

workplayerapi

v1.0.59

Published

API for Work Player app REST requests

Downloads

301

Readme

WorkPlayerAPI

npm version install size

API para encapsulamento de chamadas REST para o projeto Work Player da Kyros Tecnologias.

Instalando

Usando npm:

$ npm install workplayerapi

Usando bower:

$ bower install workplayerapi

Usando yarn:

$ yarn add workplayerapi

Classes

Card

import { Card } from 'workplayerapi/classes/Card';

let obj = {};
// Criando novo Card
let card = new Card(obj);

console.log(card.cardId);                  // Number
console.log(card.skillId);                 // Number
console.log(card.skillName);               // String
console.log(card.skillDescription);        // String
console.log(card.cardName);                // String
console.log(card.cardDescription);         // String
console.log(card.url);                     // String
console.log(card.attributeDefinitionList); // String

Player

import { Player } from 'workplayerapi/classes/Player';

let obj = {};
// Criando novo Player
let player = new Player(obj);

console.log(player.id);             // Number
console.log(player.name);           // String
console.log(player.birthdate);      // String
console.log(player.zipcode);        // String
console.log(player.email);          // String
console.log(player.cellphone);      // String
console.log(player.landline);       // String
console.log(player.documentNumber); // String
console.log(player.city);           // String
console.log(player.department);     // String
console.log(player.departmentId);   // Number
console.log(player.function);       // String
console.log(player.functionId);     // Number
console.log(player.team);           // String
console.log(player.teamId);         // Number

User

import { User } from 'workplayerapi/classes/User';

let obj = {};
// Criando novo User
let user = new User(obj);

console.log(user.userId);      // Number
console.log(user.username);    // String
console.log(user.name);        // String
console.log(user.displayName); // String
console.log(user.companyId);   // Number
console.log(user.companyName); // String
console.log(user.email);       // String

Task

import { Task } from 'workplayerapi/classes/Task';

let obj = {};
// Criando nova Task
let task = new Task(obj);

console.log(task.id);          // Number
console.log(task.projectId);   // Number
console.log(task.name);        // String
console.log(task.description); // String
console.log(task.duration);    // Number
console.log(task.startedAt);   // Number
console.log(task.expectedAt);  // Number
console.log(task.finalizedAt); // Number
console.log(task.createdAt);   // Number
console.log(task.createdBy);   // String
console.log(task.updatedBy);   // String
console.log(task.status);      // String
console.log(task.card);        // Card

Validações

E-mail

import { validateEmail } from 'workplayerapi/global/validators';

let email = '[email protected]';

// Passando o e-mail
if (validateEmail(email)) console.log('E-mail é válido!');
else console.log('E-mail é inválido');

Senha

import { validatePassword } from 'workplayerapi/global/validators';

let password = '[email protected]';

// Passando a senha
if (validatePassword(password)) console.log('Senha é válida!');
else console.log('Senha é inválida');

Usuário autenticado

import { setToken } from 'workplayerapi/config/logged';

// Pegar o token persistido com o Redux
let token = 'token';

setToken(token);

Serviços

User

Requisições que retornam um objeto do tipo User ou que trabalham com tal.

Login

import { makeLogin } from 'workplayerapi/routes/login';

let email = '[email protected]';
let senha = 'password';

// Passando o e-mail e senha
makeLogin(email, senha)
    .then((result) => {
              if (result.login_success) {
                console.log(JSON.stringify(result.user));
                console.log(JSON.stringify(result.token));
              }
              else console.log(JSON.stringify(result.message));
});

Players

Requisições que retornam um objeto do tipo Player ou que trabalham com tal.

Get all players

import { getAllPlayers } from 'workplayerapi/routes/player';

// Passar todos os filtros necessários diretamente pela função
// Caso algum filtro não seja necessário, passar com valor 'null'
let departmentId = 1;
let teamId       = 1;
let name         = 'Kim';
let pageSize     = 10;
let page         = 2;
let email        = '[email protected]';
let functionId   = 1;

getAllPlayers(departmentId, teamId, name, pageSize, page, email, functionId)
    .then((result) => console.log(JSON.stringify(result)));

Cards

Requisições que retornam um objeto do tipo Card ou que trabalham com tal.

Get my card's deck

import { getMyDeck } from 'workplayerapi/routes/cards';

// Ao chamar este serviço será retornado um deck (uma lista de cards)

getMyDeck()
    .then((result) => {
        // Aqui retornará uma mensagem pronta avisando o usuário que seu deck está vazio
        if (result.deck === null) console.log(JSON.stringify(result.message));
        else console.log(JSON.stringify(result.deck));
});

Tasks

Requisições que retornam um objeto do tipo Task ou que trabalham com tal.

Get all tasks

import { getTasks } from 'workplayerapi/routes/tasks';

// Ao chamar este serviço será retornado uma lista de tasks

getTasks()
    .then((result) => {
        // Aqui retornará uma mensagem pronta avisando o usuário que não possui mais tasks
        if (result.tasks === null) console.log(JSON.stringify(result.message));
        else console.log(JSON.stringify(result.tasks));
});

Finalize a task

import { checkOutTask } from 'workplayerapi/routes/tasks';

// Passar o id da task como parâmetro
let id     = 1866;

checkOutTask(id)
    .then((result) => {
        if (result.taskId === null) console.log(JSON.stringify(result.message));
        else console.log('Task ' + result.taskName + ' fished successfully!');
});

suspend a task

import { suspendTask } from 'workplayerapi/routes/tasks';

// Passar o id da task e o motivo como parâmetros
let id     = 1866;
let reason = '';

suspendTask(id, reason)
    .then((result) => {
        if (result.taskId === null) console.log(JSON.stringify(result.message));
        else console.log('Task ' + result.taskName + ' suspended successfully!');
});

Return a task

import { giveBackTask } from 'workplayerapi/routes/tasks';

// Passar o id da task e o motivo como parâmetros
let id     = 1866;
let reason = '';

giveBackTask(id, reason)
    .then((result) => {
        if (result.taskId === null) console.log(JSON.stringify(result.message));
        else console.log('Task ' + result.taskName + ' returned successfully!');
});
NOTA

A API está sendo construída aos poucos, portanto qualquer dúvida ou caso seja encontrado algum bug, reportar na seção de Issues.

Autor

Kim Ruan Lopes - Kyros Tecnologias

Lisença

MIT