@geosanja/geosanja-frontend-api

中文文档
4.16.0-build-1发布于 2026/11/14UnlicenseTypeScriptES Module近 30 天下载 2400

swagger client for @geosanja/geosanja-frontend-api

原始使用文档
文档目录5 节
  1. @geosanja/[email protected]
  2. Building
  3. publishing
  4. consuming
  5. Set service base path

@geosanja/[email protected]

Building

To install the required dependencies and to build the typescript sources run:

npm install
npm run build

publishing

First build the package than run npm publish dist (don't forget to specify the dist folder!)

consuming

Navigate to the folder of your consuming project and run one of next commands.

published:

npm install @geosanja/[email protected] --save

without publishing (not recommended):

npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save

It's important to take the tgz file, otherwise you'll get trouble with links on windows.

using npm link:

In PATH_TO_GENERATED_PACKAGE/dist:

npm link

In your project:

npm link @geosanja/geosanja-frontend-api

Note for Windows users: The Angular CLI has troubles to use linked npm packages. Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround. Published packages are not effected by this issue.

General usage

In your Angular project:

// without configuring providers
import { ApiModule } from '@geosanja/geosanja-frontend-api';
import { HttpClientModule } from '@angular/common/http';


@NgModule({
    imports: [
        ApiModule,
        // make sure to import the HttpClientModule in the AppModule only,
        // see https://github.com/angular/angular/issues/20575
        HttpClientModule
    ],
    declarations: [ AppComponent ],
    providers: [],
    bootstrap: [ AppComponent ]
})
export class AppModule {}
// configuring providers
import { ApiModule, Configuration, ConfigurationParameters } from '@geosanja/geosanja-frontend-api';

export function apiConfigFactory (): Configuration => {
  const params: ConfigurationParameters = {
    // set configuration parameters here.
  }
  return new Configuration(params);
}

@NgModule({
    imports: [ ApiModule.forRoot(apiConfigFactory) ],
    declarations: [ AppComponent ],
    providers: [],
    bootstrap: [ AppComponent ]
})
export class AppModule {}
import { DefaultApi } from '@geosanja/geosanja-frontend-api';

export class AppComponent {
     constructor(private apiGateway: DefaultApi) { }
}

Note: The ApiModule is restricted to being instantiated once app wide. This is to ensure that all services are treated as singletons.

Using multiple swagger files / APIs / ApiModules

In order to use multiple ApiModules generated from different swagger files, you can create an alias name when importing the modules in order to avoid naming conflicts:

import { ApiModule } from 'my-api-path';
import { ApiModule as OtherApiModule } from 'my-other-api-path';
import { HttpClientModule } from '@angular/common/http';


@NgModule({
  imports: [
    ApiModule,
    OtherApiModule,
    // make sure to import the HttpClientModule in the AppModule only,
    // see https://github.com/angular/angular/issues/20575
    HttpClientModule
  ]
})
export class AppModule {

}

Set service base path

If different than the generated base path, during app bootstrap, you can provide the base path to your service.

import { BASE_PATH } from '@geosanja/geosanja-frontend-api';

bootstrap(AppComponent, [
    { provide: BASE_PATH, useValue: 'https://your-web-service.com' },
]);

or

import { BASE_PATH } from '@geosanja/geosanja-frontend-api';

@NgModule({
    imports: [],
    declarations: [ AppComponent ],
    providers: [ provide: BASE_PATH, useValue: 'https://your-web-service.com' ],
    bootstrap: [ AppComponent ]
})
export class AppModule {}

Using @angular/cli

First extend your src/environments/*.ts files by adding the corresponding base path:

export const environment = {
  production: false,
  API_BASE_PATH: 'http://127.0.0.1:8080'
};

In the src/app/app.module.ts:

import { BASE_PATH } from '@geosanja/geosanja-frontend-api';
import { environment } from '../environments/environment';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [ ],
  providers: [{ provide: BASE_PATH, useValue: environment.API_BASE_PATH }],
  bootstrap: [ AppComponent ]
})
export class AppModule { }

版本与发布记录

@geosanja/geosanja-frontend-api 共发布 184 个版本,首次发布于 2025/04/02;过去 12 个月发布了 99 个版本。

版本发布日期距今
4.16.0-build-1latest2026/11/142 天前
4.15.0-build-102026/11/123 天前
4.15.0-build-92026/11/123 天前
4.15.0-build-82026/11/124 天前
4.15.0-build-72026/11/079 天前
4.15.0-build-62026/11/0511 天前

关于 @geosanja/geosanja-frontend-api 的常见问题

@geosanja/geosanja-frontend-api 是什么?

swagger client for @geosanja/geosanja-frontend-api

如何安装 @geosanja/geosanja-frontend-api?

在项目目录运行 npm install @geosanja/geosanja-frontend-api,或使用 pnpm add / yarn add / bun add。

@geosanja/geosanja-frontend-api 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@geosanja/geosanja-frontend-api 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@geosanja/geosanja-frontend-api 可以商用吗?

@geosanja/geosanja-frontend-api 使用 Unlicense 许可。作者将代码贡献到公共领域,可不受限制地使用。以上为概括,不构成法律意见,请以许可原文为准。

@geosanja/geosanja-frontend-api 的下载量有多少?

根据 npm 官方下载统计,@geosanja/geosanja-frontend-api 在 2026/10/16 – 2026/11/14 这 30 天内被下载 2,400 次,日均约 80 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@geosanja/geosanja-frontend-api 还在维护吗?

最新版本 4.16.0-build-1 发布于 2026/11/14(2 天前);至今共发布 184 个版本,其中过去 12 个月发布了 99 个;首次发布于 2025/04/02。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。