billomat-ts
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -154,2 +154,3 @@ "use strict"; | ||
['countries', 'country'], | ||
['contacts', 'contact'], | ||
['credit-notes', 'credit-note'], | ||
@@ -156,0 +157,0 @@ ['currencies', 'currency'], |
@@ -16,2 +16,3 @@ "use strict"; | ||
countries: 'country', | ||
contacts: 'contact', | ||
'credit-notes': 'credit-note', | ||
@@ -31,3 +32,3 @@ currencies: 'currency', | ||
var isImplemented = function (resourceName) { | ||
return ['clients', 'client-property-values', 'confirmations', 'invoices'].includes(resourceName); | ||
return ['clients', 'client-property-values', 'confirmations', 'contacts', 'invoices'].includes(resourceName); | ||
}; | ||
@@ -34,0 +35,0 @@ describe('Billomat API', function () { |
@@ -114,2 +114,25 @@ import { BILLOMAT_RESOURCE_NAMES } from './get-billomat-api-client'; | ||
} | ||
interface Contact extends Resource { | ||
created?: string; | ||
updated?: string; | ||
client_id: string; | ||
label?: string; | ||
name?: string; | ||
salutation?: string; | ||
first_name?: string; | ||
last_name?: string; | ||
street?: string; | ||
zip?: string; | ||
city?: string; | ||
state?: string; | ||
country_code?: string; | ||
address?: string; | ||
phone?: string; | ||
fax?: string; | ||
mobile?: string; | ||
email?: string; | ||
www?: string; | ||
locale?: string; | ||
customfield?: string; | ||
} | ||
interface Invoice extends Resource { | ||
@@ -116,0 +139,0 @@ created?: string; |
import { Billomat } from './billomat'; | ||
import { BillomatResourceClient } from './billomat-resource-client'; | ||
export declare const BILLOMAT_RESOURCE_NAMES: readonly ["activity-feed", "articles", "client-property-values", "clients", "confirmations", "countries", "credit-notes", "currencies", "delivery-notes", "estimates", "incomings", "invoices", "letters", "recurrings", "reminders", "search", "suppliers", "users"]; | ||
export declare const BILLOMAT_RESOURCE_NAMES: readonly ["activity-feed", "articles", "client-property-values", "clients", "confirmations", "countries", "contacts", "credit-notes", "currencies", "delivery-notes", "estimates", "incomings", "invoices", "letters", "recurrings", "reminders", "search", "suppliers", "users"]; | ||
export interface MappedBillomatResourceType { | ||
@@ -9,2 +9,3 @@ articles: Billomat.Article; | ||
confirmations: Billomat.Confirmation; | ||
contacts: Billomat.Contact; | ||
invoices: Billomat.Invoice; | ||
@@ -11,0 +12,0 @@ [name: string]: Billomat.Resource; |
@@ -12,2 +12,3 @@ "use strict"; | ||
'countries', | ||
'contacts', | ||
'credit-notes', | ||
@@ -14,0 +15,0 @@ 'currencies', |
125
package.json
{ | ||
"name": "billomat-ts", | ||
"version": "0.1.0", | ||
"description": "Billomat API implementation in TypeScript for use in Node.js", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"dependencies": { | ||
"@types/superagent": "^4.1.10", | ||
"superagent": "^6.1.0" | ||
}, | ||
"devDependencies": { | ||
"@types/chai": "^4.2.15", | ||
"@types/mocha": "^8.2.1", | ||
"@types/nock": "^11.1.0", | ||
"@types/proxyquire": "^1.3.28", | ||
"@types/sinon": "^9.0.10", | ||
"@typescript-eslint/eslint-plugin": "^4.15.1", | ||
"@typescript-eslint/eslint-plugin-tslint": "^4.15.1", | ||
"@typescript-eslint/parser": "^4.15.1", | ||
"chai": "^4.3.0", | ||
"eslint": "^7.20.0", | ||
"eslint-config-google": "^0.14.0", | ||
"eslint-config-prettier": "^7.2.0", | ||
"eslint-plugin-jsdoc": "^32.0.2", | ||
"eslint-plugin-prefer-arrow": "^1.2.3", | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"mocha": "^8.3.0", | ||
"nock": "^13.0.7", | ||
"proxyquire": "^2.1.3", | ||
"sinon": "^9.2.4", | ||
"ts-node": "^9.1.1", | ||
"typescript": "^4.1.5" | ||
}, | ||
"scripts": { | ||
"lint": "eslint . --ext .js,.ts,.spec.js,.spec.ts", | ||
"test": "mocha --require ts-node/register --extensions ts 'src/**/*.spec.ts'", | ||
"build": "tsc", | ||
"prepare": "npm run build", | ||
"prepublishOnly": "npm test && npm run lint", | ||
"preversion": "npm run lint", | ||
"version": "git add -A src", | ||
"postversion": "git push && git push --tags" | ||
}, | ||
"author": "Seibert Media GmbH", | ||
"keywords": [ | ||
"billomat", | ||
"api", | ||
"client", | ||
"accounting" | ||
], | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/seibert-media/billomat-ts/issues" | ||
}, | ||
"homepage": "https://github.com/seibert-media/billomat-ts/blob/master/README.md", | ||
"repository": { | ||
"type": "git", | ||
"url": "git@github.com:seibert-media/billomat-ts.git", | ||
"directory": "." | ||
}, | ||
"files": [ | ||
"dist/**/*" | ||
] | ||
"name": "billomat-ts", | ||
"version": "0.2.0", | ||
"description": "Billomat API implementation in TypeScript for use in Node.js", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"dependencies": { | ||
"@types/superagent": "^4.1.10", | ||
"superagent": "^6.1.0" | ||
}, | ||
"devDependencies": { | ||
"@types/chai": "^4.2.15", | ||
"@types/mocha": "^8.2.1", | ||
"@types/nock": "^11.1.0", | ||
"@types/proxyquire": "^1.3.28", | ||
"@types/sinon": "^9.0.10", | ||
"@typescript-eslint/eslint-plugin": "^4.15.1", | ||
"@typescript-eslint/eslint-plugin-tslint": "^4.15.1", | ||
"@typescript-eslint/parser": "^4.15.1", | ||
"chai": "^4.3.0", | ||
"eslint": "^7.20.0", | ||
"eslint-config-google": "^0.14.0", | ||
"eslint-config-prettier": "^7.2.0", | ||
"eslint-plugin-jsdoc": "^32.0.2", | ||
"eslint-plugin-prefer-arrow": "^1.2.3", | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"mocha": "^8.3.0", | ||
"nock": "^13.0.7", | ||
"npm-run-all": "^4.1.5", | ||
"proxyquire": "^2.1.3", | ||
"sinon": "^9.2.4", | ||
"ts-node": "^9.1.1", | ||
"typescript": "^4.1.5" | ||
}, | ||
"scripts": { | ||
"lint": "eslint . --ext .js,.ts,.spec.js,.spec.ts", | ||
"test": "mocha --require ts-node/register --extensions ts 'src/**/*.spec.ts'", | ||
"build": "tsc", | ||
"prepare": "run-s build", | ||
"prepublishOnly": "run-p lint test", | ||
"preversion": "run-s lint", | ||
"version": "git add -A src", | ||
"postversion": "git push && git push --tags" | ||
}, | ||
"author": "Seibert Media GmbH", | ||
"keywords": [ | ||
"billomat", | ||
"api", | ||
"client", | ||
"accounting" | ||
], | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/seibert-media/billomat-ts/issues" | ||
}, | ||
"homepage": "https://github.com/seibert-media/billomat-ts/blob/master/README.md", | ||
"repository": { | ||
"type": "git", | ||
"url": "git@github.com:seibert-media/billomat-ts.git", | ||
"directory": "." | ||
}, | ||
"files": [ | ||
"dist/**/*" | ||
] | ||
} |
@@ -17,6 +17,7 @@ # billomat-ts | ||
Before you begin, ensure you have met the following requirements: | ||
* You have installed the latest version of `node` and `npm` | ||
* You have read Billomat's own documentation about their API | ||
* [You have authentication information ready](https://www.billomat.com/en/api/basics/authentication/). [You'll likely want to configure an app inside of Billomat](https://www.billomat.com/en/api/basics/rate-limiting/). Make sure you have the base url to your Billomat instance, and an API key. If you go ahead an configure an app, you can also pass your app secret and app id into `billomat-ts`. | ||
- You have installed the latest version of `node` and `npm` | ||
- You have read Billomat's own documentation about their API | ||
- [You have authentication information ready](https://www.billomat.com/en/api/basics/authentication/). [You'll likely want to configure an app inside of Billomat](https://www.billomat.com/en/api/basics/rate-limiting/). Make sure you have the base url to your Billomat instance, and an API key. If you go ahead an configure an app, you can also pass your app secret and app id into `billomat-ts`. | ||
## Installing `billomat-ts` | ||
@@ -38,13 +39,14 @@ | ||
const config = JSON.parse(readFileSync('config.json', 'utf-8')); | ||
const config = JSON.parse(readFileSync('config.json', 'utf-8')); | ||
const billomat = getBillomatApiClient(config); | ||
billomat.clients.list() | ||
.then((clients: Billomat.Client[]) => clients | ||
.map((client: Billomat.Client) => client.name) | ||
.map((name) => console.log(name))) | ||
billomat.clients | ||
.list() | ||
.then((clients: Billomat.Client[]) => | ||
clients.map((client: Billomat.Client) => client.name).map((name) => console.log(name)) | ||
) | ||
.catch(console.error); | ||
``` | ||
`billomat-ts` currently supports `list`, `get`, `create`, and `edit` operations on all known data types. The `list` functions accept query arguments, etc. In case these methods don't satisfy your requirements, you can instead use the `raw` method to perform your own requests. | ||
`billomat-ts` currently supports `list`, `get`, `create`, and `edit` operations on all known data types. The `list` functions accept query arguments, etc. In case these methods don't satisfy your requirements, you can instead use the `raw` method to perform your own requests. | ||
@@ -51,0 +53,0 @@ ## Contact |
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
31666
679
58
22