Giter Site home page Giter Site logo

keldoc-js-sdk's Introduction

keldoc-js-sdk

Dependencies Coverage Build Status MIT License PRs Welcome

Description

This module provides an Keldoc API implementation.

Install

$ npm install @rimiti/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 '@rimiti/keldoc-js-sdk'

sdk.configure({
  credentials: {
    clientAccessKeyId: 'CLIENT_ACCESS_KEY_ID',
    secretAccessKeyId: 'SECRET_ACCESS_KEY_ID',
  },
  host: 'http://www.example.com'
});

const keldoc = sdk.create()

From require

const sdk = require('@rimiti/keldoc-js-sdk');

sdk.configure({
  credentials: {
    clientAccessKeyId: 'CLIENT_ACCESS_KEY_ID',
    secretAccessKeyId: 'SECRET_ACCESS_KEY_ID',
  },
  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

  • Fetch all agendas.

    Function

    const response = await keldoc.agendas.get();

  • 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.
    const response = await keldoc.appointments.create({start_at: '2001-09-23', agenda_id: '2135', state: 'confirmed'});
  • 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.
    const response = await keldoc.appointments.update(21354, {start_at: '2001-09-23', agenda_id: '2135', state: 'confirmed'});
  • Delete an appointment

    Arguments

    id {Integer} KelDoc internal ID for appointment to remove.
    const response = await keldoc.appointments.remove(21321);

  • 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.
    const response = await keldoc.availabilities.get({
      agenda_ids: 112,
      end_date: '2017-09-17',
      start_date: '2017-09-18',
      motive_id: '366',
    });

  • 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.
    const response = await keldoc.availableSlots.get({
      agenda_id: 112,
      start_date: '2017-09-18',
      end_date: '2017-09-17',
    });

  • Retrieves account configuration : agendas, motives, specialties
    const response = await keldoc.config.get();

Fetch all motives

    const response = await keldoc.motives.get();

  • 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.
    const response = await keldoc.patients.create({
      first_name: 'test',
      last_name: 'john',
      gender: 'm',
      email: '[email protected]'
    });
  • 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.
   const response = await keldoc.patients.update(12026, {
      first_name: 'test',
      last_name: 'john',
      gender: 'm',
      email: '[email protected]'
    });

  • Fetch all specialties
    const response = await keldoc.specialties.get();

  • Create account webhook

    Arguments

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

    Arguments

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

    Arguments

    url {String} Webhook url.
    const response = await keldoc.configWebhooks();

Run using npm run <script> command.

clean - remove coverage data, Jest cache and transpiled files,
lint - lint source files and tests,
typecheck - check type annotations,
test - lint, typecheck and run tests with coverage,
test-only - run tests with coverage,
test:watch - interactive watch mode to automatically re-run tests,
build - compile source files,
build:watch - interactive watch mode, compile sources on change.

License

MIT © Dimitri DO BAIRRO

keldoc-js-sdk's People

Contributors

oussamaouss avatar rimiti avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

keldoc-js-sdk's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.