Compare commits
14 Commits
f2e54490f2
...
1.2.7
| Author | SHA1 | Date | |
|---|---|---|---|
|
9a87a52ed6
|
|||
|
93e30efd8a
|
|||
|
a595166b9d
|
|||
|
d6a11cf418
|
|||
|
645cc59535
|
|||
|
00ce1c6b3a
|
|||
|
4fa6e8a1db
|
|||
|
87e05ff637
|
|||
|
03a778c24f
|
|||
|
ef2bc38a63
|
|||
|
26d518fb8e
|
|||
|
087371b3ce
|
|||
|
7238275835
|
|||
|
962d1f40b4
|
20
README.md
20
README.md
@@ -5,7 +5,25 @@ The official library for the LfK [backend server](https://git.odit.services/lfk/
|
|||||||
Automagicly™ generated by [openapi-typescript-codegen](https://www.npmjs.com/package/openapi-typescript-codegen)
|
Automagicly™ generated by [openapi-typescript-codegen](https://www.npmjs.com/package/openapi-typescript-codegen)
|
||||||
|
|
||||||
## 🛠 Building
|
## 🛠 Building
|
||||||
Get's automagicly™ build by drone for every new backend release.
|
|
||||||
|
### Setup ⬇️
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://git.odit.services/lfk/lfk-client-js.git
|
||||||
|
cd lfk-client-js
|
||||||
|
pnpm i
|
||||||
|
```
|
||||||
|
|
||||||
|
### Build 🔨
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pnpm update:openapi # Update the openapi.json file
|
||||||
|
pnpm build # Build the project
|
||||||
|
pnpm release # Bump and release to npm
|
||||||
|
|
||||||
|
# Or just do it all in one command
|
||||||
|
pnpm update:auto
|
||||||
|
```
|
||||||
|
|
||||||
## Use
|
## Use
|
||||||
|
|
||||||
|
|||||||
2
dist/core/OpenAPI.js
vendored
2
dist/core/OpenAPI.js
vendored
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||||||
exports.OpenAPI = void 0;
|
exports.OpenAPI = void 0;
|
||||||
exports.OpenAPI = {
|
exports.OpenAPI = {
|
||||||
BASE: '',
|
BASE: '',
|
||||||
VERSION: '1.3.11',
|
VERSION: '1.4.3',
|
||||||
WITH_CREDENTIALS: false,
|
WITH_CREDENTIALS: false,
|
||||||
TOKEN: undefined,
|
TOKEN: undefined,
|
||||||
USERNAME: undefined,
|
USERNAME: undefined,
|
||||||
|
|||||||
2
dist/index.d.ts
vendored
2
dist/index.d.ts
vendored
@@ -7,6 +7,7 @@ export type { AddressFirstLineEmptyError } from './models/AddressFirstLineEmptyE
|
|||||||
export type { AddressPostalCodeEmptyError } from './models/AddressPostalCodeEmptyError';
|
export type { AddressPostalCodeEmptyError } from './models/AddressPostalCodeEmptyError';
|
||||||
export type { AddressPostalCodeInvalidError } from './models/AddressPostalCodeInvalidError';
|
export type { AddressPostalCodeInvalidError } from './models/AddressPostalCodeInvalidError';
|
||||||
export type { ConfigFlag } from './models/ConfigFlag';
|
export type { ConfigFlag } from './models/ConfigFlag';
|
||||||
|
export type { CreateAnonymousDonation } from './models/CreateAnonymousDonation';
|
||||||
export type { CreateAuth } from './models/CreateAuth';
|
export type { CreateAuth } from './models/CreateAuth';
|
||||||
export type { CreateDistanceDonation } from './models/CreateDistanceDonation';
|
export type { CreateDistanceDonation } from './models/CreateDistanceDonation';
|
||||||
export type { CreateDonation } from './models/CreateDonation';
|
export type { CreateDonation } from './models/CreateDonation';
|
||||||
@@ -70,6 +71,7 @@ export type { RefreshAuth } from './models/RefreshAuth';
|
|||||||
export type { RefreshTokenCountInvalidError } from './models/RefreshTokenCountInvalidError';
|
export type { RefreshTokenCountInvalidError } from './models/RefreshTokenCountInvalidError';
|
||||||
export type { ResetAlreadyRequestedError } from './models/ResetAlreadyRequestedError';
|
export type { ResetAlreadyRequestedError } from './models/ResetAlreadyRequestedError';
|
||||||
export type { ResetPassword } from './models/ResetPassword';
|
export type { ResetPassword } from './models/ResetPassword';
|
||||||
|
export type { ResponseAnonymousDonation } from './models/ResponseAnonymousDonation';
|
||||||
export type { ResponseAuth } from './models/ResponseAuth';
|
export type { ResponseAuth } from './models/ResponseAuth';
|
||||||
export type { ResponseDistanceDonation } from './models/ResponseDistanceDonation';
|
export type { ResponseDistanceDonation } from './models/ResponseDistanceDonation';
|
||||||
export type { ResponseDonation } from './models/ResponseDonation';
|
export type { ResponseDonation } from './models/ResponseDonation';
|
||||||
|
|||||||
5
dist/models/CreateAnonymousDonation.d.ts
vendored
Normal file
5
dist/models/CreateAnonymousDonation.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export type CreateAnonymousDonation = {
|
||||||
|
amount: number;
|
||||||
|
donor?: number;
|
||||||
|
paidAmount?: number;
|
||||||
|
};
|
||||||
5
dist/models/CreateAnonymousDonation.js
vendored
Normal file
5
dist/models/CreateAnonymousDonation.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
"use strict";
|
||||||
|
/* istanbul ignore file */
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
4
dist/models/CreateDistanceDonation.d.ts
vendored
4
dist/models/CreateDistanceDonation.d.ts
vendored
@@ -1,6 +1,6 @@
|
|||||||
export type CreateDistanceDonation = {
|
export type CreateDistanceDonation = {
|
||||||
|
donor?: number;
|
||||||
|
paidAmount?: number;
|
||||||
runner: number;
|
runner: number;
|
||||||
amountPerDistance: number;
|
amountPerDistance: number;
|
||||||
donor: number;
|
|
||||||
paidAmount?: number;
|
|
||||||
};
|
};
|
||||||
|
|||||||
2
dist/models/CreateDonation.d.ts
vendored
2
dist/models/CreateDonation.d.ts
vendored
@@ -1,4 +1,4 @@
|
|||||||
export type CreateDonation = {
|
export type CreateDonation = {
|
||||||
donor: number;
|
donor?: number;
|
||||||
paidAmount?: number;
|
paidAmount?: number;
|
||||||
};
|
};
|
||||||
|
|||||||
4
dist/models/CreateFixedDonation.d.ts
vendored
4
dist/models/CreateFixedDonation.d.ts
vendored
@@ -1,5 +1,5 @@
|
|||||||
export type CreateFixedDonation = {
|
export type CreateFixedDonation = {
|
||||||
amount: number;
|
donor?: number;
|
||||||
donor: number;
|
|
||||||
paidAmount?: number;
|
paidAmount?: number;
|
||||||
|
amount: number;
|
||||||
};
|
};
|
||||||
|
|||||||
1
dist/models/DistanceDonation.d.ts
vendored
1
dist/models/DistanceDonation.d.ts
vendored
@@ -2,6 +2,5 @@ export type DistanceDonation = {
|
|||||||
runner: string;
|
runner: string;
|
||||||
amountPerDistance: number;
|
amountPerDistance: number;
|
||||||
id: number;
|
id: number;
|
||||||
donor: string;
|
|
||||||
paidAmount: number;
|
paidAmount: number;
|
||||||
};
|
};
|
||||||
|
|||||||
1
dist/models/Donation.d.ts
vendored
1
dist/models/Donation.d.ts
vendored
@@ -1,5 +1,4 @@
|
|||||||
export type Donation = {
|
export type Donation = {
|
||||||
id: number;
|
id: number;
|
||||||
donor: string;
|
|
||||||
paidAmount: number;
|
paidAmount: number;
|
||||||
};
|
};
|
||||||
|
|||||||
1
dist/models/FixedDonation.d.ts
vendored
1
dist/models/FixedDonation.d.ts
vendored
@@ -2,6 +2,5 @@ export type FixedDonation = {
|
|||||||
_amount: number;
|
_amount: number;
|
||||||
amount: number;
|
amount: number;
|
||||||
id: number;
|
id: number;
|
||||||
donor: string;
|
|
||||||
paidAmount: number;
|
paidAmount: number;
|
||||||
};
|
};
|
||||||
|
|||||||
5
dist/models/ResponseAnonymousDonation.d.ts
vendored
Normal file
5
dist/models/ResponseAnonymousDonation.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export type ResponseAnonymousDonation = {
|
||||||
|
id: number;
|
||||||
|
amount: number;
|
||||||
|
paidAmount: number;
|
||||||
|
};
|
||||||
5
dist/models/ResponseAnonymousDonation.js
vendored
Normal file
5
dist/models/ResponseAnonymousDonation.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
"use strict";
|
||||||
|
/* istanbul ignore file */
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
1
dist/models/ResponseRunner.d.ts
vendored
1
dist/models/ResponseRunner.d.ts
vendored
@@ -1,5 +1,6 @@
|
|||||||
export type ResponseRunner = {
|
export type ResponseRunner = {
|
||||||
distance: number;
|
distance: number;
|
||||||
|
donationAmount: number;
|
||||||
group: any;
|
group: any;
|
||||||
selfserviceLink?: string;
|
selfserviceLink?: string;
|
||||||
id: number;
|
id: number;
|
||||||
|
|||||||
14
dist/services/DonationService.d.ts
vendored
14
dist/services/DonationService.d.ts
vendored
@@ -1,5 +1,7 @@
|
|||||||
|
import type { CreateAnonymousDonation } from '../models/CreateAnonymousDonation';
|
||||||
import type { CreateDistanceDonation } from '../models/CreateDistanceDonation';
|
import type { CreateDistanceDonation } from '../models/CreateDistanceDonation';
|
||||||
import type { CreateFixedDonation } from '../models/CreateFixedDonation';
|
import type { CreateFixedDonation } from '../models/CreateFixedDonation';
|
||||||
|
import type { ResponseAnonymousDonation } from '../models/ResponseAnonymousDonation';
|
||||||
import type { ResponseDistanceDonation } from '../models/ResponseDistanceDonation';
|
import type { ResponseDistanceDonation } from '../models/ResponseDistanceDonation';
|
||||||
import type { ResponseDonation } from '../models/ResponseDonation';
|
import type { ResponseDonation } from '../models/ResponseDonation';
|
||||||
import type { ResponseEmpty } from '../models/ResponseEmpty';
|
import type { ResponseEmpty } from '../models/ResponseEmpty';
|
||||||
@@ -14,7 +16,7 @@ export declare class DonationService {
|
|||||||
* @result any
|
* @result any
|
||||||
* @throws ApiError
|
* @throws ApiError
|
||||||
*/
|
*/
|
||||||
static donationControllerGetAll(page?: number, pageSize?: number): Promise<(Array<ResponseDonation> | Array<ResponseDistanceDonation>)>;
|
static donationControllerGetAll(page?: number, pageSize?: number): Promise<(Array<ResponseDonation> | Array<ResponseDistanceDonation> | Array<ResponseAnonymousDonation>)>;
|
||||||
/**
|
/**
|
||||||
* Get one
|
* Get one
|
||||||
* Lists all information about the donation whose id got provided. This includes the donation's runner's distance ran (if distance donation).
|
* Lists all information about the donation whose id got provided. This includes the donation's runner's distance ran (if distance donation).
|
||||||
@@ -22,7 +24,7 @@ export declare class DonationService {
|
|||||||
* @result any
|
* @result any
|
||||||
* @throws ApiError
|
* @throws ApiError
|
||||||
*/
|
*/
|
||||||
static donationControllerGetOne(id: number): Promise<(ResponseDonation | ResponseDistanceDonation)>;
|
static donationControllerGetOne(id: number): Promise<(ResponseDonation | ResponseDistanceDonation | ResponseAnonymousDonation)>;
|
||||||
/**
|
/**
|
||||||
* Remove
|
* Remove
|
||||||
* Delete the donation whose id you provided. <br> If no donation with this id exists it will just return 204(no content).
|
* Delete the donation whose id you provided. <br> If no donation with this id exists it will just return 204(no content).
|
||||||
@@ -41,6 +43,14 @@ export declare class DonationService {
|
|||||||
* @throws ApiError
|
* @throws ApiError
|
||||||
*/
|
*/
|
||||||
static donationControllerPostFixed(requestBody?: CreateFixedDonation): Promise<ResponseDonation>;
|
static donationControllerPostFixed(requestBody?: CreateFixedDonation): Promise<ResponseDonation>;
|
||||||
|
/**
|
||||||
|
* Post anonymous
|
||||||
|
* Create a anonymous donation
|
||||||
|
* @param requestBody CreateAnonymousDonation
|
||||||
|
* @result ResponseDonation
|
||||||
|
* @throws ApiError
|
||||||
|
*/
|
||||||
|
static donationControllerPostAnonymous(requestBody?: CreateAnonymousDonation): Promise<ResponseDonation>;
|
||||||
/**
|
/**
|
||||||
* Post distance
|
* Post distance
|
||||||
* Create a distance donation (not fixed donation - use /donations/fixed instead). <br> Please rmemember to provide the donation's donors's and runners ids and amount per distance (kilometer).
|
* Create a distance donation (not fixed donation - use /donations/fixed instead). <br> Please rmemember to provide the donation's donors's and runners ids and amount per distance (kilometer).
|
||||||
|
|||||||
15
dist/services/DonationService.js
vendored
15
dist/services/DonationService.js
vendored
@@ -70,6 +70,21 @@ class DonationService {
|
|||||||
});
|
});
|
||||||
return result.body;
|
return result.body;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Post anonymous
|
||||||
|
* Create a anonymous donation
|
||||||
|
* @param requestBody CreateAnonymousDonation
|
||||||
|
* @result ResponseDonation
|
||||||
|
* @throws ApiError
|
||||||
|
*/
|
||||||
|
static async donationControllerPostAnonymous(requestBody) {
|
||||||
|
const result = await (0, request_1.request)({
|
||||||
|
method: 'POST',
|
||||||
|
path: `/api/donations/anonymous`,
|
||||||
|
body: requestBody,
|
||||||
|
});
|
||||||
|
return result.body;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Post distance
|
* Post distance
|
||||||
* Create a distance donation (not fixed donation - use /donations/fixed instead). <br> Please rmemember to provide the donation's donors's and runners ids and amount per distance (kilometer).
|
* Create a distance donation (not fixed donation - use /donations/fixed instead). <br> Please rmemember to provide the donation's donors's and runners ids and amount per distance (kilometer).
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
23
package.json
23
package.json
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@odit/lfk-client-js",
|
"name": "@odit/lfk-client-js",
|
||||||
"description": "A lib to interact with https://git.odit.services/lfk/backend. Use this version for native JS applications.",
|
"description": "A lib to interact with https://git.odit.services/lfk/backend. Use this version for native JS applications.",
|
||||||
"version": "1.2.4",
|
"version": "1.2.7",
|
||||||
"license": "CC-BY-NC-SA-4.0",
|
"license": "CC-BY-NC-SA-4.0",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
@@ -25,7 +25,11 @@
|
|||||||
"build:prepare": "rimraf ./lib ./dist",
|
"build:prepare": "rimraf ./lib ./dist",
|
||||||
"build:lib": "openapi --input ./openapi.json --output ./lib --client fetch",
|
"build:lib": "openapi --input ./openapi.json --output ./lib --client fetch",
|
||||||
"build:compile": "tsc",
|
"build:compile": "tsc",
|
||||||
"build:cleanup": "rimraf ./lib"
|
"build:cleanup": "rimraf ./lib",
|
||||||
|
"update:openapi": "rimraf ./openapi.json && node ./scripts/getliveopenapi.js",
|
||||||
|
"update:auto": "npm run update:openapi && npm run build && npm run update:commit && npm run release",
|
||||||
|
"update:commit": "git add . && git commit -m \"chore: update openapi.json\"",
|
||||||
|
"release": "release-it --only-version && npm publish"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://git.odit.services/lfk/lfk-client-js/issues"
|
"url": "https://git.odit.services/lfk/lfk-client-js/issues"
|
||||||
@@ -33,7 +37,22 @@
|
|||||||
"homepage": "https://git.odit.services/lfk/lfk-client-js/",
|
"homepage": "https://git.odit.services/lfk/lfk-client-js/",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"openapi-typescript-codegen": "0.7.0",
|
"openapi-typescript-codegen": "0.7.0",
|
||||||
|
"release-it": "17.10.0",
|
||||||
"rimraf": "6.0.1",
|
"rimraf": "6.0.1",
|
||||||
"typescript": "4.9.5"
|
"typescript": "4.9.5"
|
||||||
|
},
|
||||||
|
"release-it": {
|
||||||
|
"git": {
|
||||||
|
"commit": true,
|
||||||
|
"requireCleanWorkingDir": false,
|
||||||
|
"commitMessage": "chore(release): ${version}",
|
||||||
|
"push": true,
|
||||||
|
"tag": true,
|
||||||
|
"tagName": "${version}",
|
||||||
|
"tagAnnotation": "${version}"
|
||||||
|
},
|
||||||
|
"npm": {
|
||||||
|
"publish": false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1835
pnpm-lock.yaml
generated
1835
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
27
scripts/getliveopenapi.js
Normal file
27
scripts/getliveopenapi.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
const https = require('https');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
const url = 'https://run.lauf-fuer-kaya.de/api/docs/openapi.json';
|
||||||
|
const output = 'openapi.json';
|
||||||
|
|
||||||
|
https.get(url, (res) => {
|
||||||
|
if (res.statusCode !== 200) {
|
||||||
|
console.error(`Request Failed. Status Code: ${res.statusCode}`);
|
||||||
|
res.resume();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let data = '';
|
||||||
|
res.on('data', chunk => data += chunk);
|
||||||
|
res.on('end', () => {
|
||||||
|
fs.writeFile(output, data, (err) => {
|
||||||
|
if (err) {
|
||||||
|
console.error('Error writing file:', err);
|
||||||
|
} else {
|
||||||
|
console.log(`Saved latest OpenAPI JSON to ${output}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}).on('error', (e) => {
|
||||||
|
console.error(`Got error: ${e.message}`);
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user