2.1.4 • Published 5 years ago
sutro-client v2.1.4
sutro-client  
  
 
A simple and sugary client for using sutro APIs.
Install
npm install sutro-client --saveExample
sutro Server
{
  user: {
    create: async ({ data }) => User.create(data),
    find: async ({ options }) => User.findAll(options),
    findById: async ({ userId }) => User.findById(userId),
    updateById: async ({ userId, data }) => User.updateById(userId, data),
    replaceById: async ({ userId, data }) => User.replaceById(userId, data),
    deleteById: async ({ userId }) => User.deleteById(userId),
    friend: {
      create: async ({ userId, data }) => {
        const me = await User.findById(userId)
        await me.addFriend(data)
        return me
      },
      find: async ({ userId, options }) => {
        const me = await User.findById(userId)
        return me.findFriends(options)
      },
      findById: async ({ userId, friendId }) => {
        const me = await User.findById(userId)
        return me.findFriendById(friendId)
      }
    }
  }
}sutro-client Output
import client from 'sutro-client'
const api = client(server.meta)
/*
All functions return promises:
api.user.create()
api.user.find()
api.user.findById()
api.user.updateById()
api.user.replaceById()
api.user.deleteById()
api.user.friend.create()
api.user.friend.find()
api.user.friend.findById()
*/3.0.4
5 years ago
3.0.3
5 years ago
3.0.2
5 years ago
3.0.1
5 years ago
3.0.0
5 years ago
2.2.3
5 years ago
2.2.1
5 years ago
2.2.0
5 years ago
2.1.5
5 years ago
2.1.4
5 years ago
2.1.2
5 years ago
2.1.1
5 years ago
2.1.3
5 years ago
2.0.5
5 years ago
2.1.0
5 years ago
2.0.4
5 years ago
2.0.3
5 years ago
2.0.2
5 years ago
2.0.0-beta.1
5 years ago
2.0.0-beta.0
5 years ago
2.0.1
5 years ago
2.0.0
5 years ago
1.6.2
5 years ago
1.6.1
5 years ago
1.6.0
5 years ago
1.5.1
5 years ago
1.5.0
6 years ago
1.4.0
6 years ago
1.3.0
6 years ago
1.2.4
7 years ago
1.2.3
7 years ago
1.2.2
7 years ago
1.2.1
7 years ago
1.2.0
7 years ago
1.1.0
7 years ago
1.0.6
7 years ago
1.0.5
7 years ago
1.0.4
7 years ago
1.0.3
7 years ago
1.0.2
7 years ago
1.0.1
7 years ago
1.0.0
7 years ago