Skip to content

Commit

Permalink
Generate typescript bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
booxter committed Jul 6, 2024
1 parent 0d25d06 commit 007a918
Show file tree
Hide file tree
Showing 19 changed files with 1,165 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ repos:
exclude: |
(?x)^(
letsrolld-api-client/.*|
js/.*
js/.*|
ts/.*
)$
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DIRECTORS_FILE?=directors.csv
RUN_LOG?=run.log
RUN_LOG_CMD?=ts | tee -a $(RUN_LOG)

.PHONY: install lint mypy test populate run-update-directors run-update-films run-update-offers run-cleanup run-all run-db-upgrade webapp ui swagger swagger-py swagger-js swagger-all get-dirs get-films
.PHONY: install lint mypy test populate run-update-directors run-update-films run-update-offers run-cleanup run-all run-db-upgrade webapp ui swagger swagger-py swagger-js swagger-ts swagger-all get-dirs get-films

install:
pdm install -vd
Expand Down Expand Up @@ -56,7 +56,11 @@ swagger-js: swagger
rm -rf js
openapi-generator-cli generate -i swagger.json -g javascript -o js

swagger-all: swagger-py swagger-js
swagger-ts: swagger
rm -rf ts
openapi-generator-cli generate -i swagger.json -g typescript-node -o ts

swagger-all: swagger-py swagger-js swagger-ts

ui:
cd ui && http-server --port 8081 -c-1 -o
Expand Down
4 changes: 4 additions & 0 deletions ts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
wwwroot/*.js
node_modules
typings
dist
23 changes: 23 additions & 0 deletions ts/.openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
15 changes: 15 additions & 0 deletions ts/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.gitignore
.openapi-generator-ignore
api.ts
api/apis.ts
api/defaultApi.ts
git_push.sh
model/arrayOfDirectors.ts
model/arrayOfFilms.ts
model/director.ts
model/directorFilmsInner.ts
model/directorFilmsInnerCountriesInner.ts
model/directorFilmsInnerOffersInner.ts
model/directorInfo.ts
model/film.ts
model/models.ts
1 change: 1 addition & 0 deletions ts/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.0.1
3 changes: 3 additions & 0 deletions ts/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// This is the entrypoint for the package
export * from './api/apis';
export * from './model/models';
14 changes: 14 additions & 0 deletions ts/api/apis.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export * from './defaultApi';
import { DefaultApi } from './defaultApi';
import * as http from 'http';

export class HttpError extends Error {
constructor (public response: http.IncomingMessage, public body: any, public statusCode?: number) {
super('HTTP request failed');
this.name = 'HttpError';
}
}

export { RequestFile } from '../model/models';

export const APIS = [DefaultApi];
Loading

0 comments on commit 007a918

Please sign in to comment.