@apideck/node
Advanced tools
Comparing version 0.1.0 to 0.2.0
{ | ||
"name": "@apideck/node", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Apideck API wrapper", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -35,3 +35,3 @@ # Apideck Node.js library | ||
const apideckClient = new Apideck({ | ||
const apideck = new Apideck({ | ||
apiKey: <insert-api-key-here>, | ||
@@ -47,3 +47,3 @@ applicationId: <insert-application-id-here>, | ||
```typescript | ||
const response = await apideckClient.crm.contacts.list({ | ||
const response = await apideck.crm.contacts.list({ | ||
limit: '10', | ||
@@ -61,3 +61,3 @@ serviceId: '<insert-service-id-here>', | ||
const apideckClient = new Apideck({ | ||
const apideck = new Apideck({ | ||
apiKey: <insert-api-key-here>, | ||
@@ -72,31 +72,31 @@ applicationId: <insert-application-id-here>, | ||
```typescript | ||
apideckClient.companies.list(parameters); | ||
apideckClient.companies.retrieve(parameters); | ||
apideckClient.companies.create(parameters); | ||
apideckClient.companies.update(parameters); | ||
apideckClient.companies.delete(parameters); | ||
apideck.companies.list(parameters); | ||
apideck.companies.retrieve(parameters); | ||
apideck.companies.create(parameters); | ||
apideck.companies.update(parameters); | ||
apideck.companies.delete(parameters); | ||
``` | ||
### ContactsApi | ||
```typescript | ||
apideckClient.contacts.list(parameters); | ||
apideckClient.contacts.retrieve(parameters); | ||
apideckClient.contacts.create(parameters); | ||
apideckClient.contacts.update(parameters); | ||
apideckClient.contacts.delete(parameters); | ||
apideck.contacts.list(parameters); | ||
apideck.contacts.retrieve(parameters); | ||
apideck.contacts.create(parameters); | ||
apideck.contacts.update(parameters); | ||
apideck.contacts.delete(parameters); | ||
``` | ||
### LeadsApi | ||
```typescript | ||
apideckClient.leads.list(parameters); | ||
apideckClient.leads.retrieve(parameters); | ||
apideckClient.leads.create(parameters); | ||
apideckClient.leads.update(parameters); | ||
apideckClient.leads.delete(parameters); | ||
apideck.leads.list(parameters); | ||
apideck.leads.retrieve(parameters); | ||
apideck.leads.create(parameters); | ||
apideck.leads.update(parameters); | ||
apideck.leads.delete(parameters); | ||
``` | ||
### OpportunitiesApi | ||
```typescript | ||
apideckClient.opportunities.list(parameters); | ||
apideckClient.opportunities.retrieve(parameters); | ||
apideckClient.opportunities.create(parameters); | ||
apideckClient.opportunities.update(parameters); | ||
apideckClient.opportunities.delete(parameters); | ||
apideck.opportunities.list(parameters); | ||
apideck.opportunities.retrieve(parameters); | ||
apideck.opportunities.create(parameters); | ||
apideck.opportunities.update(parameters); | ||
apideck.opportunities.delete(parameters); | ||
``` | ||
@@ -109,5 +109,5 @@ | ||
```typescript | ||
import { Apideck, PhoneNumberTypeEnum } from 'apideck' | ||
import { Apideck, PhoneNumberType } from 'apideck' | ||
const apideckClient = new Apideck({ | ||
const apideck = new Apideck({ | ||
apiKey: <insert-api-key-here>, | ||
@@ -119,7 +119,7 @@ applicationId: <insert-application-id-here>, | ||
const { data } = await apideckClient.crm.contacts.list({ | ||
const { data } = await apideck.crm.contacts.list({ | ||
limit: 10 | ||
}) | ||
const result = await apideckClient.crm.contacts.update({ | ||
const result = await apideck.crm.contacts.update({ | ||
id: data[0].id!, | ||
@@ -137,3 +137,3 @@ contact: { | ||
number: '0486565656', | ||
phoneType: PhoneNumberTypeEnum.Home | ||
phoneType: PhoneNumberType.Home | ||
}] | ||
@@ -140,0 +140,0 @@ } |
@@ -183,7 +183,17 @@ import * as Crm from './gen/crm'; | ||
const isNode = | ||
typeof process !== 'undefined' && | ||
process.versions != null && | ||
process.versions.node != null; | ||
export class Apideck { | ||
readonly crm: CrmApi; | ||
constructor(readonly config: Crm.ConfigurationParameters) { | ||
if (!isNode) { | ||
console.warn( | ||
"THIS IS A SERVERSIDE (Node.js) LIBRARY AND SHOULDN'T BE USED IN THE BROWSER OR YOU RISK LEAKING YOUR APIKEYS. PLEASE BE CAREFULL AND DON'T SHIP THIS TO PRODUCTION." | ||
); | ||
} | ||
this.crm = new CrmApi(config); | ||
} | ||
} |
@@ -55,2 +55,12 @@ /* tslint:disable */ | ||
if ( | ||
context.query !== undefined && | ||
Object.keys(context.query).length !== 0 | ||
) { | ||
// only add the querystring to the URL if there are query parameters. | ||
// this is done to avoid urls ending with a "?" character which buggy webservers | ||
// do not handle correctly sometimes. | ||
url += '?' + querystring(context.query); | ||
} | ||
const body = | ||
@@ -57,0 +67,0 @@ (typeof FormData !== 'undefined' && context.body instanceof FormData) || |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1688833
20958