Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

evosphere-router

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

evosphere-router

Routing Container for Evosphere API.

  • 0.1.17
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-89.66%
Maintainers
1
Weekly downloads
 
Created
Source

Evosphere JS Router v0.1.16

Le router Evosphere est un outil Javascript contenant les liens vers les différentes entrées de l'API Evosphere. Elle donne un libellé à chaque route.

Attention : le routeur ne réalise aucune requête HTTP. Son rôle est purement de distribuer les routes et de permettre de les générer lorsque celles-ci demandent des paramètres.

Utilisation

L'objet Router est en réalité une Usine. Elle ne représente pas le routeur lui-même mais permet d'en créer.

Afin de récupérer une route, il suffit de récupérer son libellé dans l'objet routes.

import Router from 'evosphere-router';


const router = Router();
const getApikeyRoute = router.routes.apikey();

Si une route nécessite des paramètres d'URL, il suffit d'envoyer en paramètre de la route un objet contenant le nom du paramètre à renseigner.


const getUserRoute = router.routes.user.getUser({
  id: 2164
});

Routes disponibles

const routes = (domain, version) => ({
  activity: {
    getStats: createRoute(getVersionURL("/users/{id}/activities", domain, version)),
    getActivities: createRoute(getVersionURL("/activities", domain, version)),
    getActivity: createRoute(getVersionURL("/activities/{id}", domain, version)),
    createActivity: createRoute(getVersionURL("/activities", domain, version)),

    getCategories: createRoute(getVersionURL("/activities/categories", domain, version)),
    getCategory: createRoute(getVersionURL("/activities/categories/{id}", domain, version)),

    addActivityToPracticeList: createRoute(getVersionURL("/activities/practice", domain, version)),
    removeActivityFromPracticeList: createRoute(getVersionURL("/activities/{id}/practice", domain, version)),

    getSessions: createRoute(getVersionURL("/sessions", domain, version)),
    createSession: createRoute(getVersionURL("/sessions", domain, version)),

    getSession: createRoute(getVersionURL("/sessions/{id}", domain, version)),
    patchSession: createRoute(getVersionURL("/sessions/{id}", domain, version)),
    finishSession: createRoute(getVersionURL("/sessions/{id}/finish", domain, version)),
    deleteSession: createRoute(getVersionURL("/sessions/{id}", domain, version)),

    likeSession: createRoute(getVersionURL("/sessions/{id}/likes", domain, version)),
    unlikeSession: createRoute(getVersionURL("/sessions/{id}/likes", domain, version)),
    getSessionLikes: createRoute(getVersionURL("/sessions/{id}/likes", domain, version)),

    getSessionComments: createRoute(getVersionURL("/sessions/{id}/comments", domain, version)),
    createSessionComment: createRoute(getVersionURL("/sessions/{id}/comments", domain, version)),

    unsubscribeToSession: createRoute(getVersionURL("/sessions/{id}/subscribes", domain, version)),
    isSubscribedToSession: createRoute(getVersionURL("/sessions/{id}/subscribes/isSubscribed", domain, version)),

    practice: {
      get: createRoute(getVersionURL("/sessions/practice", domain, version)),
      start: createRoute(getVersionURL("/sessions/practice", domain, version)),
      update: createRoute(getVersionURL("/sessions/practice", domain, version)),
      finish: createRoute(getVersionURL("/sessions/practice/finish", domain, version)),
      revive: createRoute(getVersionURL("/sessions/practice/{id}/revive", domain, version)),
    }
  },
  apikey: createRoute(getStandardURL("apikey", domain)),
  notification:{
    getNotifications: createRoute(getVersionURL("/notifications", domain, version)),

    patchNotification: createRoute(getVersionURL("/notifications/{id}", domain, version)),
    getNotification: createRoute(getVersionURL("/notifications/{id}", domain, version)),
  },
  relation:{
    getFollowers: createRoute(getVersionURL("/users/{id}/followers", domain, version)),
    follow: createRoute(getVersionURL("/users/{id}/followers", domain, version)),
    unfollow: createRoute(getVersionURL("/users/{id}/followers", domain, version)),
    getFollowing: createRoute(getVersionURL("/users/{id}/followers", domain, version)),

    getFriends: createRoute(getVersionURL("/users/{id}/friends", domain, version)),

    getFriendship: createRoute(getVersionURL("/users/{id}/friendship", domain, version)),
    sendFriendRequest: createRoute(getVersionURL("/users/{id}/friendship", domain, version)),
    acceptOrDeclineFriendRequest: createRoute(getVersionURL("/users/{id}/friendship", domain, version)),
    removeFromFriends: createRoute(getVersionURL("/users/{id}/friendship", domain, version)),
  },
  social: {
    getPosts: createRoute(getVersionURL("/posts", domain, version)),
    postPost: createRoute(getVersionURL("/posts", domain, version)),

    getPost: createRoute(getVersionURL("/posts/{id}", domain, version)),
    patchPost: createRoute(getVersionURL("/posts/{id}", domain, version)),
    deletePost: createRoute(getVersionURL("/posts/{id}", domain, version)),

    likePost: createRoute(getVersionURL("/posts/{id}/likes", domain, version)),
    unlikePost: createRoute(getVersionURL("/posts/{id}/likes", domain, version)),
    getPostLikes: createRoute(getVersionURL("/posts/{id}/likes", domain, version)),

    subscribeToPost: createRoute(getVersionURL("/posts/{id}/subscribes", domain, version)),
    unsubscribeToPost: createRoute(getVersionURL("/posts/{id}/subscribes", domain, version)),
    getPostSubscribers: createRoute(getVersionURL("/posts/{id}/subscribes", domain, version)),

    commentPost: createRoute(getVersionURL("/posts/{id}/comments", domain, version)),
    getPostComments: createRoute(getVersionURL("/posts/{id}/comments", domain, version)),

    getComment: createRoute(getVersionURL("/comments/{id}", domain, version)),
    getAnswerComments: createRoute(getVersionURL("/comments/{id}", domain, version)),
    answerTo: createRoute(getVersionURL("/comments/{id}", domain, version)),
    patchComment: createRoute(getVersionURL("/comments/{id}", domain, version)),
    deleteComment: createRoute(getVersionURL("/comments/{id}", domain, version)),

    likeComment: createRoute(getVersionURL("/comments/{id}/likes", domain, version)),
    unlikeComment: createRoute(getVersionURL("/comments/{id}/likes", domain, version)),
    getCommentLikes: createRoute(getVersionURL("/comments/{id}/likes", domain, version)),

    subscribeToComment: createRoute(getVersionURL("/comments/{id}/subscribes", domain, version)),
    unsubscribeToComment: createRoute(getVersionURL("/comments/{id}/subscribes", domain, version)),
    getCommentSubscribers: createRoute(getVersionURL("/comments/{id}/subscribes", domain, version))
  },
  user: {
    getUser: createRoute(getVersionURL("/users/{id}", domain, version)),
    getUsers: createRoute(getVersionURL("/users", domain, version)),
    getUserStatus: createRoute(getVersionURL("/users/{id}/status", domain, version)),
    sendPasswordResetRequest: createRoute(getVersionURL("/users/{id}/password/retrieve", domain, version)),
    confirmPasswordResetRequest: createRoute(getVersionURL("/users/{id}/password/retrieve/confirm", domain, version)),
    updateProfile: createRoute(getVersionURL("/profile", domain, version)),
    register: createRoute(getVersionURL("/register", domain, version)),
    preregister: createRoute(getVersionURL("/preregistration", domain, version))
  }
});

Keywords

FAQs

Package last updated on 02 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc