Skip to content

Commit

Permalink
chore: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
vacijj committed Sep 17, 2024
0 parents commit 44405f4
Show file tree
Hide file tree
Showing 414 changed files with 70,389 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = space
indent_size = 2
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
coverage
dist
.vscode
.DS_Store
.eslintcache
*.log*
*.env
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
100 changes: 100 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# @itplusx/sevdesk-api-ts-client

<!-- automd:badges -->

[![npm version](https://flat.badgen.net/npm/v/@itplusx/sevdesk-api-ts-client)](https://www.npmjs.com/package/@itplusx/sevdesk-api-ts-client)
[![npm downloads](https://flat.badgen.net/npm/dm/@itplusx/sevdesk-api-ts-client)](https://www.npmjs.com/package/@itplusx/sevdesk-api-ts-client)

<!-- /automd -->

TypeScript Client for [sevdesk API (2.0.0)](https://api.sevdesk.de/)

## Usage

Install package:

<!-- automd:pm-install -->

```sh
# ✨ Auto-detect
npx nypm install @itplusx/sevdesk-api-ts-client

# npm
npm install @itplusx/sevdesk-api-ts-client

# yarn
yarn add @itplusx/sevdesk-api-ts-client

# pnpm
pnpm add @itplusx/sevdesk-api-ts-client

# bun
bun install @itplusx/sevdesk-api-ts-client
```

<!-- /automd -->

Usage:

<!-- automd:jsimport cjs cdn name="pkg" -->

**ESM** (Node.js, Bun)

```js
import { SevdeskApiClient } from '@itplusx/sevdesk-api-ts-client'

const sevdeskApiClient = new SevdeskApiClient({ apiKey: 'your-secret-api-key' })
const basics = await sevdeskApiClient.apis.basicsApi.bookkeepingSystemVersion()

console.log(basics)
```

**CommonJS** (Legacy Node.js)

```js
const { SevdeskApiClient } = require('@itplusx/sevdesk-api-ts-client')

const sevdeskApiClient = new SevdeskApiClient({ apiKey: 'your-secret-api-key' })
const basics = await sevdeskApiClient.apis.basicsApi.bookkeepingSystemVersion()

console.log(basics)
```

<!-- /automd -->

## Development

<details>

<summary>local development</summary>

- Clone this repository
- Install latest LTS version of [Node.js](https://nodejs.org/en/)
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
- Install dependencies using `pnpm install`
- Add `SEVDESK_API_KEY=replace-with-your-secret-api-key` to `.env` file in project root
- Run playground using `pnpm play`
- Run interactive tests using `pnpm dev`

</details>

## License

<!-- automd:contributors license=MIT -->

Published under the [MIT](https://github.com/itplusx/sevdesk-api-ts-client/blob/main/LICENSE) license.
Made by [community](https://github.com/itplusx/sevdesk-api-ts-client/graphs/contributors) 💛
<br><br>
<a href="https://github.com/itplusx/sevdesk-api-ts-client/graphs/contributors">
<img src="https://contrib.rocks/image?repo=itplusx/sevdesk-api-ts-client" />
</a>

<!-- /automd -->

<!-- automd:with-automd -->

---

_🤖 auto updated with [automd](https://automd.unjs.io)_

<!-- /automd -->
23 changes: 23 additions & 0 deletions build.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
// If entries is not provided, will be automatically inferred from package.json
entries: [
// default
'./src/index',
// mkdist builder transpiles file-to-file keeping original sources structure
{
builder: 'mkdist',
input: './src/generated/',
outDir: './dist/generated',
},
],

// Generates .d.ts declaration file
declaration: true,

// See https://github.com/unjs/unbuild/issues/268#issuecomment-1877020726
rollup: {
emitCJS: true
}
});
15 changes: 15 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import unjs from "eslint-config-unjs"

export default unjs({
ignores: [
'src/generated'
],
rules: {
// rule overrides
},
markdown: {
rules: {
// markdown rule overrides
},
},
});
14 changes: 14 additions & 0 deletions generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

rm -rf ./src/generated
rm openapi.yaml

curl https://api.sevdesk.de/openapi.yaml -o openapi.yaml

docker run --rm \
-v ${PWD}/openapi.yaml:/openapi.yaml \
-v ${PWD}/src/generated:/local/out/typescript-fetch \
openapitools/openapi-generator-cli generate \
-i openapi.yaml \
-g typescript-fetch \
-o /local/out/typescript-fetch
16,668 changes: 16,668 additions & 0 deletions openapi.yaml

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"name": "@itplusx/sevdesk-api-ts-client",
"version": "0.0.0",
"description": "TypeScript API Client for sevdesk API (2.0.0)",
"license": "MIT",
"sideEffects": false,
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"keywords": [
"sevdesk",
"typescript",
"api"
],
"scripts": {
"build": "unbuild",
"dev": "vitest dev",
"lint": "eslint .",
"lint:fix": "automd && eslint . --fix",
"prepack": "pnpm build",
"play": "jiti playground",
"release": "pnpm test && pnpm build && changelogen --release && pnpm publish && git push --follow-tags",
"test": "pnpm lint && pnpm test:types && vitest run --coverage",
"test:types": "tsc --noEmit --skipLibCheck"
},
"devDependencies": {
"@types/node": "^22.1.0",
"@vitest/coverage-v8": "^2.0.5",
"automd": "^0.3.8",
"changelogen": "^0.5.5",
"dotenv": "^16.4.5",
"eslint": "^9.8.0",
"eslint-config-unjs": "^0.3.2",
"jiti": "^2.0.0-beta.3",
"prettier": "^3.3.3",
"typescript": "^5.5.4",
"unbuild": "^3.0.0-rc.7",
"vitest": "^2.0.5"
},
"packageManager": "pnpm@9.7.0"
}
8 changes: 8 additions & 0 deletions playground/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import 'dotenv/config'
import { SevdeskApiClient } from '../src'

const sevdeskApiClient = new SevdeskApiClient({ apiKey: process.env.SEVDESK_API_KEY })

const basics = await sevdeskApiClient.apis.basicsApi.bookkeepingSystemVersion()

console.log(basics)
Loading

0 comments on commit 44405f4

Please sign in to comment.