caymland-js
Advanced tools
Comparing version 1.0.7 to 1.0.8
const Caymland = require('./../src/index') | ||
const client = new Caymland({ | ||
baseUrl: 'https://local.caymland.app', | ||
auth: 'bnNhbG9za2k6bmVybWluc2E=' | ||
auth: '' | ||
}) | ||
@@ -16,8 +16,6 @@ | ||
console.log('## list contacts') | ||
const listContactsResponse = await client.contacts.list(encodeURI('search=Nermin')) | ||
const listContactsResponse2 = await client.contacts.list({ search: 'Nermin' }) | ||
print(listContactsResponse.data.total) | ||
print(listContactsResponse2.data.total) | ||
const listContactsResponse = await client.activities.list(encodeURI('where[0][col]=owner&where[0][expr]=eq&where[0][val]=1')) | ||
print(listContactsResponse.data) | ||
} | ||
run() |
{ | ||
"name": "caymland-js", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "Javascript library to the Caymland REST API - https://api.m-4.ch/#rest-api", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -44,13 +44,4 @@ const axios = require('axios') | ||
list (resourceUri, params = {}) { | ||
let stringParams = '' | ||
let objectParams = {} | ||
if (typeof (params) === 'object') { | ||
objectParams = params | ||
} else { | ||
stringParams = '?' + params | ||
} | ||
return axios.get(`${this.baseUrl}/api/${resourceUri}${stringParams}`, { | ||
params: objectParams, | ||
list (resourceUri, params = '') { | ||
return axios.get(`${this.baseUrl}/api/${resourceUri}?${params}`, { | ||
headers: this.headers, | ||
@@ -57,0 +48,0 @@ }).then(responseWith).catch(responseErrWith) |
@@ -11,3 +11,3 @@ class Activity { | ||
list (params = {}) { | ||
return this.client.get('contacts/activities', params) | ||
return this.client.list('contacts/activities', params) | ||
} | ||
@@ -14,0 +14,0 @@ |
@@ -11,3 +11,3 @@ class Company { | ||
list (data = {}) { | ||
return this.client.get('companies', data) | ||
return this.client.list('companies', data) | ||
} | ||
@@ -14,0 +14,0 @@ |
@@ -11,3 +11,3 @@ class User { | ||
list (params = {}) { | ||
return this.client.get('users', params) | ||
return this.client.list('users', params) | ||
} | ||
@@ -14,0 +14,0 @@ |
24293
20
494