This package has been deprecated

Author message:

WARNING: This project has been renamed to @rimiti/keldoc-js-sdk. Install using new-package-name instead.

keldoc-js-sdk

2.4.0 • Public • Published

keldoc-js-sdk

Dependencies Dependencies Code Climate score Coverage Code Climate coverage Node.js version NPM version Build Status Security version MIT License PRs Welcome

Description

This module provides an Keldoc API implementation.

Install

$ npm install keldoc-js-sdk --save

Features

  • Agendas
  • Appointments
  • Availabilities
  • Available slots
  • Config
  • ConfigWebhooks
  • Motives
  • Patients
  • Specialities

Documentation

Examples

Create your keldoc sdk by requiring it, making it's initial configuration and instantiating it.

From import

import * as sdk from 'keldoc-js-sdk'
 
sdk.configure({
  auth_token: '165416s5dfsds564sfdf2df',
  host: 'http://www.example.com'
})
 
const keldoc = sdk.create()

From require

const sdk = require('keldoc-js-sdk');
 
sdk.configure({
  auth_token: '165416s5dfsds564sfdf2df',
  host: 'http://www.example.com',
  routes: {
    agendas: '/agendas.json',
    appointments: '/appointments',
    availabilities: '/availabilities',
    availableSlots: '/available_slots',
    motives: '/motives.json',
    patients: '/patients',
    specialties: '/specialties',
    config: '/config',
    configWebhooks: '/config/webhooks' },
});
 
const keldoc = sdk.create();

API Methods

Agenda

  • Fetch all agendas.

    Function

    keldoc.agendas.get()
      .then((response) => {
        //use your response
      });

Appointments

  • Create a new appointment

    Arguments

    start_at                  {Datetime} start date (required).
    agenda_id                 {Integer} Agenda ID (required).
    state                     {String} 'confirmed' or 'canceled' (required).
    duration                  {Integer} duration in seconds.
    no_show                   {Boolean} patient hasn ' t come.
    patient_arrived           {Boolean} patient is waiting in the waiting room.
    no_show_excused           {Boolean} patient hasn ' t come but he excused.
    motive_id                 {Integer} motive id.
    skip_sms_confirmation     {Boolean} disable sms confirmation for consultation.
    skip_email_confirmation   {Boolean} disable email confirmation for consultation.
    skip_sms_reminder         {Boolean} disable sms reminder for consultation.
    skip_email_reminder       {Boolean} disable email reminder for consultation.
    patient_id                {Integer} patient ID.
    patient.first_name        {String} patient firstname.
    patient.last_name         {String} patient lastname.
    patient.maiden_name       {String} patient maiden name.
    patient.gender            {Char} 'm' or 'f'.
    patient.phone             {String} patient phone number.
    patient.phone2            {String} patient alternative phone number.
    patient.email             {String} patient email address.
    patient.street            {String} patient street number & streetnames.
    patient.city              {String} patient city name.
    patient.zipcode           {String} patient city zipcode.
    keldoc.appointments.create({start_at: '2001-09-23', agenda_id: '2135', state: 'confirmed'})
      .then((response) => {
        //use your response
      });
  • Update an existing appointment

    Arguments

    id                        {Integer} KelDoc internal ID for appointment to update.
    start_at                  {Datetime} start date (required).
    agenda_id                 {Integer} Agenda ID (required).
    state                     {String} 'confirmed' or 'canceled' (required).
    duration                  {Integer} duration in seconds.
    no_show                   {Boolean} patient hasn ' t come.
    patient_arrived           {Boolean} patient is waiting in the waiting room.
    no_show_excused           {Boolean} patient hasn ' t come but he excused.
    motive_id                 {Integer} motive id.
    skip_sms_confirmation     {Boolean} disable sms confirmation for consultation.
    skip_email_confirmation   {Boolean} disable email confirmation for consultation.
    skip_sms_reminder         {Boolean} disable sms reminder for consultation.
    skip_email_reminder       {Boolean} disable email reminder for consultation.
    patient_id                {Integer} patient ID.
    patient.first_name        {String} patient firstname.
    patient.last_name         {String} patient lastname.
    patient.maiden_name       {String} patient maiden name.
    patient.gender            {Char} 'm' or 'f'.
    patient.phone             {String} patient phone number.
    patient.phone2            {String} patient alternative phone number.
    patient.email             {String} patient email address.
    patient.street            {String} patient street number & streetnames.
    patient.city              {String} patient city name.
    patient.zipcode           {String} patient city zipcode.
    keldoc.appointments.update(21354, {start_at: '2001-09-23', agenda_id: '2135', state: 'confirmed'})
      .then((response) => {
        //use your response
      });
  • Delete an appointment

    Arguments

    id          {Integer} KelDoc internal ID for appointment to remove.
    keldoc.appointments.remove(21321)
      .then((response) => {
        //use your response
      });

Availabilities

  • Fetch available slots for agendas. Maximum duration between start date and end date is 7 days.

    Arguments

    motive_id   {Integer} KelDoc internal ID (required).
    start_date  {Datetime} start date.
    end_date    {Datetime} end date.
    agenda_ids  {Array} IDs of agendas.
    keldoc.availabilities.get({
      agenda_ids: 112,
      end_date: '2017-09-17',
      start_date: '2017-09-18',
      motive_id: '366',
    })
      .then((response) => {
        //use your response
      });

Available slots

  • Fetch available slots for agendas. Maximum duration between start date and end date is 2 months (default is 2 months from now).
  • When motive_ids is [], it means the available slot is for all motives. Arguments
    agenda_id   {Array} ID of agenda.
    start_date  {Datetime} start date.
    end_date    {Datetime} end date.
    keldoc.availableSlots.get({
      agenda_id: 112,
      start_date: '2017-09-18',
      end_date: '2017-09-17',
    })
      .then((response) => {
        //use your response
      });

Config

  • Retrieves account configuration : agendas, motives, specialties
    keldoc.config.get()
      .then((response) => {
        // use your response
      });

Motives

Fetch all motives

    keldoc.motives.get()
      .then((response) => {
        // use your response
      });

Patients

  • Create a new patient

    Arguments

    first_name  {String} patient firstname.
    last_name   {String} patient lastname.
    maiden_name {String} patient maiden name.
    gender      {Char} 'm' or 'f'.
    phone       {String} patient phone number.
    email       {String} patient email address.
    street      {String} patient street number & streetnames.
    city        {String} patient city name.
    zipcode     {String} patient city zipcode.
    keldoc.patients.create({
      first_name: 'test',
      last_name: 'john',
      gender: 'm',
      email: 'test.john@test.com'
    })
      .then((response) => {
        // use your response
      });
  • Update an existing patient

    Arguments

    id          {Integer} KelDoc internal ID for patient to update.
    first_name  {String} patient firstname.
    last_name   {String} patient lastname.
    maiden_name {String} patient maiden name.
    gender      {Char} 'm' or 'f'.
    phone       {String} patient phone number.
    email       {String} patient email address.
    street      {String} patient street number & streetnames.
    city        {String} patient city name.
    zipcode     {String} patient city zipcode.
    keldoc.patients.update(12026, {
      first_name: 'test',
      last_name: 'john',
      gender: 'm',
      email: 'test.john@test.com'
    })
      .then((response) => {
        expect(response.status).toEqual(200);
        done();
      });

Specialties

  • Fetch all specialties
    keldoc.specialties.get()
      .then((response) => {
        // use your response
      });

ConfigWebhooks

  • Create account webhook

    Arguments

    url         {String} Webhook url.
    keldoc.configWebhooks.create({url: 'http://test.webhook.com'})
      .then((response) => {
        // use your response
      });
  • Update account webhook

    Arguments

    url         {String} Webhook url.
    keldoc.configWebhooks.update({url: 'http://test.webhook.com'})
      .then((response) => {
        // use your response
      });
  • Delete account webhook

    Arguments

    url         {String} Webhook url.
    keldoc.configWebhooks()
      .then((response) => {
        // use your response
      });

Scripts

Run using npm run

Readme

Keywords

Package Sidebar

Install

npm i keldoc-js-sdk

Weekly Downloads

0

Version

2.4.0

License

MIT

Unpacked Size

128 kB

Total Files

83

Last publish

Collaborators

  • oussamaouss
  • rimiti