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 🙏

© 2025 – Pkg Stats / Ryan Hefner

schedcore-sdk

v1.0.3

Published

SDK TypeScript pour l'API SchedCore - Gestion de calendriers et réservations

Readme

SchedCore SDK

Un SDK TypeScript moderne pour l'API SchedCore, facilitant l'intégration de fonctionnalités de réservation et de gestion de calendrier dans vos applications.

Installation

npm install schedcore-sdk
# ou
yarn add schedcore-sdk

Démarrage rapide

Initialisation

import { SchedCoreSDK } from "schedcore-sdk";

// Configuration de base
const schedCore = new SchedCoreSDK({
  baseURL: "https://api.schedcore.com", // ou votre URL d'API
  environment: "production", // ou 'development'
});

// Configuration pour le développement local
const schedCoreDev = new SchedCoreSDK({
  baseURL: "http://localhost:8585",
  environment: "development",
});

Authentification

// Inscription
try {
  const user = await schedCore.register({
    email: "[email protected]",
    password: "password123",
    firstName: "John",
    lastName: "Doe",
  });
  console.log("Utilisateur créé:", user);
} catch (error) {
  console.error("Erreur d'inscription:", error);
}

// Connexion
try {
  const user = await schedCore.login("[email protected]", "password123");
  console.log("Utilisateur connecté:", user);
} catch (error) {
  console.error("Erreur de connexion:", error);
}

// Vérifier l'état d'authentification
if (schedCore.isAuthenticated()) {
  const currentUser = schedCore.getUser();
  console.log("Utilisateur actuel:", currentUser);
}

// Déconnexion
await schedCore.logout();

Gestion des entreprises

// Créer une entreprise
const business = await schedCore.business.createBusiness({
  name: "Mon Salon de Coiffure",
  email: "[email protected]",
  phone: "+33123456789",
  address: "123 Rue de la Paix, Paris",
  category: "Beauty & Wellness",
});

// Récupérer mes entreprises
const myBusinesses = await schedCore.business.getMyBusinesses();

// Mettre à jour une entreprise
const updatedBusiness = await schedCore.business.updateBusiness(business.id, {
  name: "Nouveau nom",
  description: "Description mise à jour",
});

Gestion du calendrier

// Définir les horaires d'ouverture
const weeklySchedule = {
  monday: {
    isOpen: true,
    timeSlots: [
      { startTime: "09:00", endTime: "12:00" },
      { startTime: "14:00", endTime: "18:00" },
    ],
  },
  tuesday: {
    isOpen: true,
    timeSlots: [
      { startTime: "09:00", endTime: "12:00" },
      { startTime: "14:00", endTime: "18:00" },
    ],
  },
  // ... autres jours
  sunday: {
    isOpen: false,
    timeSlots: [],
  },
};

await schedCore.calendar.updateWeeklySchedule(businessId, weeklySchedule);

// Ajouter une exception (jour férié)
await schedCore.calendar.addException(businessId, {
  date: "2024-12-25",
  type: "HOLIDAY",
  reason: "Noël",
});

// Récupérer la disponibilité
const availability = await schedCore.calendar.getAvailability(businessId, {
  date: "2024-12-20",
  duration: 60,
});

Gestion des réservations

// Créer une réservation
const booking = await schedCore.booking.createBooking({
  businessId: "business_123",
  serviceName: "Coupe et brushing",
  date: "2024-12-20",
  startTime: "10:00",
  duration: 60,
  customerInfo: {
    name: "Marie Dubois",
    email: "[email protected]",
    phone: "+33987654321",
  },
  notes: "Première visite",
});

// Récupérer les réservations d'une entreprise
const bookings = await schedCore.booking.getBusinessBookings(businessId, {
  status: "CONFIRMED",
  dateFrom: "2024-12-01",
  dateTo: "2024-12-31",
});

// Confirmer une réservation
await schedCore.booking.confirmBooking(businessId, booking.id);

// Annuler une réservation
await schedCore.booking.cancelBooking(businessId, booking.id, {
  reason: "Demande du client",
  notifyCustomer: true,
});

Gestion des paiements

// Créer une intention de paiement
const paymentIntent = await schedCore.payment.createPaymentIntent({
  bookingId: booking.id,
  amount: 5000, // en centimes (50€)
  currency: "EUR",
  method: "CARD",
  customerInfo: {
    name: "Marie Dubois",
    email: "[email protected]",
  },
});

// Traiter le paiement
const payment = await schedCore.payment.processPayment(paymentIntent.id, {
  cardDetails: {
    number: "4242424242424242",
    expMonth: 12,
    expYear: 2025,
    cvc: "123",
  },
});

// Créer un remboursement
const refund = await schedCore.payment.createRefund(payment.id, {
  amount: 2500, // remboursement partiel (25€)
  reason: "Annulation partielle",
});

Gestion des événements

// Écouter les événements d'authentification
schedCore.on("auth:login", (user) => {
  console.log("Utilisateur connecté:", user);
});

schedCore.on("auth:logout", () => {
  console.log("Utilisateur déconnecté");
});

schedCore.on("auth:error", (error) => {
  console.error("Erreur d'authentification:", error);
});

Configuration avancée

const schedCore = new SchedCoreSDK({
  baseURL: "https://api.schedcore.com",
  timeout: 30000,
  retry: {
    attempts: 3,
    delay: 1000,
  },
  headers: {
    "Custom-Header": "value",
  },
});

// Mettre à jour la configuration
schedCore.updateConfig({
  timeout: 60000,
});

// Test de connectivité
const isOnline = await schedCore.healthCheck();

Gestion des erreurs

import { SchedCoreError, AuthenticationError } from "schedcore-sdk";

try {
  await schedCore.login("[email protected]", "wrong-password");
} catch (error) {
  if (error instanceof AuthenticationError) {
    console.error("Erreur d'authentification:", error.message);
  } else if (error instanceof SchedCoreError) {
    console.error("Erreur SchedCore:", error.code, error.message);
  } else {
    console.error("Erreur inconnue:", error);
  }
}

Types TypeScript

Le SDK est entièrement typé avec TypeScript. Vous avez accès à tous les types :

import {
  User,
  Business,
  Booking,
  Calendar,
  Payment,
  CreateBookingData,
  BookingStatus,
} from "schedcore-sdk";

// Utilisation des types
const bookingData: CreateBookingData = {
  businessId: "business_123",
  serviceName: "Coupe",
  date: "2024-12-20",
  startTime: "10:00",
  duration: 60,
  customerInfo: {
    name: "Client",
    email: "[email protected]",
  },
};

Cache et performances

Le SDK gère automatiquement le cache et inclut des mécanismes de retry pour améliorer les performances et la fiabilité.

// Vider le cache
schedCore.clearCache();

// Réinitialiser complètement le SDK
schedCore.reset();

Support

Pour toute question ou problème, consultez la documentation complète ou contactez le support technique.

License

MIT