{"id":13733671,"url":"https://github.com/EvidentSolutions/apina","last_synced_at":"2025-05-08T09:32:46.227Z","repository":{"id":32422970,"uuid":"36000351","full_name":"EvidentSolutions/apina","owner":"EvidentSolutions","description":"Tool for creating client-side TypeScript code from server-side APIs","archived":false,"fork":false,"pushed_at":"2024-05-21T11:42:20.000Z","size":1368,"stargazers_count":27,"open_issues_count":9,"forks_count":7,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-05-21T13:04:43.923Z","etag":null,"topics":["gradle","jackson","java","json","kotlin","rest","spring","typescript"],"latest_commit_sha":null,"homepage":"https://apina.evident.fi","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EvidentSolutions.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-05-21T08:21:24.000Z","updated_at":"2024-05-28T07:20:34.003Z","dependencies_parsed_at":"2023-11-09T13:26:12.858Z","dependency_job_id":"b3c9ff4d-8e1f-4f96-ab46-4379de564a99","html_url":"https://github.com/EvidentSolutions/apina","commit_stats":null,"previous_names":[],"tags_count":90,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvidentSolutions%2Fapina","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvidentSolutions%2Fapina/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvidentSolutions%2Fapina/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvidentSolutions%2Fapina/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EvidentSolutions","download_url":"https://codeload.github.com/EvidentSolutions/apina/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":213758655,"owners_count":15634354,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gradle","jackson","java","json","kotlin","rest","spring","typescript"],"created_at":"2024-08-03T03:00:47.191Z","updated_at":"2025-05-08T09:32:46.217Z","avatar_url":"https://github.com/EvidentSolutions.png","language":"Kotlin","funding_links":[],"categories":["Plugins"],"sub_categories":["Web application development"],"readme":"# Apina\n\nApina creates client-side TypeScript code for either for Angular or Fetch API based on server-side APIs. Apina reads\nSpring Web MVC's `@RestController` annotated classes and their related Jackson classes and creates code for the data\nmodel and for executing HTTP-requests.\n\nRead [the manual](https://apina.evident.fi/) for details.\n\n## Quick start using Gradle\n\nInclude something like the following in your web application project:\n\n```kotlin\nplugins {\n    id(\"fi.evident.apina\") version \"0.25.0\"\n}\n\ntasks.apina {\n    // Set the name of the created TypeScript file. Default is 'build/apina/apina.ts'.\n    target.set(project(\":frontend\").layout.projectDirectory.file(\"app/apina-api.ts\"))\n\n    // Specify types that should not be generated, but are implemented manually\n    // and should be imported to the generated code. Keys are module paths, values\n    // are list of types imported from the module.\n    imports.set(mapOf(\n        \"./my-time-module\" to listOf(\"Instant\", \"LocalDate\"),\n        \"./other-module\" to listOf(\"Foo\", \"Bar\")\n    ))\n\n    // How Java enums are translated to TypeScript enums? (Default mode is 'default'.)\n    //  - 'default'      =\u003e enum MyEnum { FOO = \"FOO\", BAR = \"BAR\", BAZ = \"BAZ\" }\n    //  - 'int_enum'     =\u003e enum MyEnum { FOO, BAR, BAZ }\n    //  - 'string_union' =\u003e type MyEnum = \"FOO\" | \"BAR\" | \"BAZ\"\n    enumMode.set(EnumMode.DEFAULT)\n\n    // How nullables are translated to TypeScript interfaces? (Default mode is 'NULL'.)\n    //  - 'NULL'      =\u003e name: Type | null\n    //  - 'UNDEFINED' =\u003e name?: Type\n    optionalTypeMode.set(OptionalTypeMode.NULL)\n\n    // Which controllers to include when generating API? Defaults to everything.\n    endpoints.set(listOf(\"\"\"my\\.package\\.foo\\..+\"\"\"))\n\n    // If generated URLs would start with given prefix, removes it. Useful when configuring Apina\n    // to work behind reverse proxies. Defaults to empty string (URL is not modified).\n    removedUrlPrefix.set(\"/foo\")\n\n    // Code generation target (Default is 'angular')\n    // - 'angular' =\u003e Generate Angular module that uses Angular's HttpClient\n    // - 'es6' =\u003e Generate code that uses Fetch API and has no dependencies apart from ES6\n    platform.set(Platform.ANGULAR)\n}\n\n// Tell the frontend to run apina before setup\n// (the 'setup' task will probably be different for you)\ntasks.findByPath(\":frontend:setup\").dependsOn(tasks.apina)\n```\n\n## Using generated code\n\nMake your application dependent on Apina and HttpClient:\n\n```typescript\nimport { provideHttpClient } from \"@angular/common/http\";\nimport { provideApina } from 'apina';\n\nbootstrapApplication(AppComponent, {\n    providers: [\n        provideHttpClient(),\n        provideApina()\n    ]\n});\n```\n\nThen just inject the generated endpoint and use it:\n\n```typescript\nimport { DocumentsEndpoint } from 'apina';\n\n@Injectable({providedIn: 'root'})\nclass MyService {\n\n    constructor(private readonly documentsEndpoint: DocumentsEndpoint) { }\n\n    load() {\n        this.documentsEndpoint.findDocument(42).subscribe(doc =\u003e\n            console.log(\"loaded\", doc);\n        );\n    }\n}\n```\n\n## Modules\n\n  - `apina-core` main apina code\n  - `apina-cli` command line interface for running conversion\n  - `apina-gradle` plugin for Gradle\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEvidentSolutions%2Fapina","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FEvidentSolutions%2Fapina","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEvidentSolutions%2Fapina/lists"}