Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/node_modules
/dist
/openapitools.json
/openapitools.json
.env
17 changes: 17 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { Config } from "jest";

const config: Config = {
verbose: true,
moduleFileExtensions: ["js", "json", "ts"],
rootDir: "test",
testRegex: ".*\\.spec\\.ts$",
transform: {
"^.+\\.(t|j)s$": "ts-jest",
},
collectCoverageFrom: ["**/*.(t|j)s"],
coverageDirectory: "../coverage",
testEnvironment: "node",
moduleNameMapper: { "src/(.*)": "<rootDir>/$1" },
};

export default config;
24 changes: 16 additions & 8 deletions lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { AxiosInstance } from "axios";
import { GolemioApi } from "./sdk-main";
import { GolemioPublicTransportApi } from "./sdk-vp";

Expand All @@ -7,20 +8,27 @@ export type { GolemioPublicTransportApi } from "./sdk-vp";
export interface GolemioClientOptions {
token: string;
server?: string;
axios?: AxiosInstance;
}

export class GolemioClient extends GolemioApi {
PublicTransport: GolemioPublicTransportApi;

constructor(options: GolemioClientOptions) {
super({
basePath: options.server || "https://api.golemio.cz",
apiKey: options.token,
});
super(
{
basePath: options.server || "https://api.golemio.cz",
apiKey: options.token,
},
options.axios
);

this.PublicTransport = new GolemioPublicTransportApi({
basePath: options.server || "https://api.golemio.cz",
apiKey: options.token,
});
this.PublicTransport = new GolemioPublicTransportApi(
{
basePath: options.server || "https://api.golemio.cz",
apiKey: options.token,
},
options.axios
);
}
}
Loading