Skip to content
Merged
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
7 changes: 0 additions & 7 deletions libs/openchallenges/api-client-angular/README.md

This file was deleted.

6 changes: 2 additions & 4 deletions libs/openchallenges/api-client-angular/openapitools.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
"$schema": "../../../node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
"version": "6.1.0",
"version": "7.11.0",
"generators": {
"api-client-angular": {
"config": "templates/config.yaml",
"generatorName": "typescript-angular",
"inputSpec": "#{cwd}/../api-description/openapi/openapi.yaml",
"output": "#{cwd}/src/lib/",
"templateDir": "templates",
"additionalProperties": {
"ngVersion": "14.2.11"
"queryParamObjectFormat": "key"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions libs/openchallenges/api-client-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "@sagebionetworks/openchallenges-api-client-angular",
"version": "0.0.1",
"peerDependencies": {
"@angular/common": "^13.2.0",
"@angular/core": "^13.2.0"
"@angular/common": "^19.0.0",
"@angular/core": "^19.0.0"
},
"dependencies": {
"tslib": "2.4.1"
Expand Down
6 changes: 0 additions & 6 deletions libs/openchallenges/api-client-angular/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@
"jestConfig": "libs/openchallenges/api-client-angular/jest.config.ts"
}
},
"lint-fix": {
"executor": "@nx/eslint:lint",
"options": {
"fix": true
}
},
"generate": {
"executor": "nx:run-commands",
"options": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,25 @@ model/challengeCategory.ts
model/challengeContribution.ts
model/challengeContributionRole.ts
model/challengeContributionsPage.ts
model/challengeContributionsPageAllOf.ts
model/challengeDirection.ts
model/challengeIncentive.ts
model/challengeJsonLd.ts
model/challengeJsonLdAllOf.ts
model/challengePlatform.ts
model/challengePlatformDirection.ts
model/challengePlatformSearchQuery.ts
model/challengePlatformSort.ts
model/challengePlatformsPage.ts
model/challengePlatformsPageAllOf.ts
model/challengeSearchQuery.ts
model/challengeSort.ts
model/challengeStatus.ts
model/challengeSubmissionType.ts
model/challengesPage.ts
model/challengesPageAllOf.ts
model/challengesPerYear.ts
model/edamConcept.ts
model/edamConceptDirection.ts
model/edamConceptSearchQuery.ts
model/edamConceptSort.ts
model/edamConceptsPage.ts
model/edamConceptsPageAllOf.ts
model/edamSection.ts
model/image.ts
model/imageAspectRatio.ts
Expand All @@ -56,14 +51,12 @@ model/organizationDirection.ts
model/organizationSearchQuery.ts
model/organizationSort.ts
model/organizationsPage.ts
model/organizationsPageAllOf.ts
model/pageMetadata.ts
model/simpleChallengePlatform.ts
model/user.ts
model/userCreateRequest.ts
model/userCreateResponse.ts
model/userStatus.ts
model/usersPage.ts
model/usersPageAllOf.ts
param.ts
variables.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.1.0
7.11.0
135 changes: 66 additions & 69 deletions libs/openchallenges/api-client-angular/src/lib/README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
## @
# @

### Building
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

The version of the OpenAPI document: 1.0.0

## Building

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

```
```console
npm install
npm run build
```

### publishing
## Publishing

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

### consuming
## Consuming

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

_published:_

```
```console
npm install @ --save
```

_without publishing (not recommended):_

```
```console
npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save
```

Expand All @@ -35,106 +39,105 @@ _using `npm link`:_

In PATH_TO_GENERATED_PACKAGE/dist:

```
```console
npm link
```

In your project:

```
```console
npm link
```

**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.
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
### General usage

In your Angular project:

```
```typescript
// without configuring providers
import { ApiModule } from '';
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 ]
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 {}
```

```
```typescript
// configuring providers
import { ApiModule, Configuration, ConfigurationParameters } from '';

export function apiConfigFactory (): Configuration {
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 ]
imports: [ApiModule.forRoot(apiConfigFactory)],
declarations: [AppComponent],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
```

```
```typescript
// configuring providers with an authentication service that manages your access tokens
import { ApiModule, Configuration } from '';

@NgModule({
imports: [ ApiModule ],
declarations: [ AppComponent ],
providers: [
{
provide: Configuration,
useFactory: (authService: AuthService) => new Configuration(
{
basePath: environment.apiUrl,
accessToken: authService.getAccessToken.bind(authService)
}
),
deps: [AuthService],
multi: false
}
],
bootstrap: [ AppComponent ]
imports: [ApiModule],
declarations: [AppComponent],
providers: [
{
provide: Configuration,
useFactory: (authService: AuthService) =>
new Configuration({
basePath: environment.apiUrl,
accessToken: authService.getAccessToken.bind(authService),
}),
deps: [AuthService],
multi: false,
},
],
bootstrap: [AppComponent],
})
export class AppModule {}
```

```
```typescript
import { DefaultApi } from '';

export class AppComponent {
constructor(private apiGateway: DefaultApi) { }
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 OpenAPI files / APIs / ApiModules
### Using multiple OpenAPI files / APIs / ApiModules

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

```
```typescript
import { ApiModule } from 'my-api-path';
import { ApiModule as OtherApiModule } from 'my-other-api-path';
import { HttpClientModule } from '@angular/common/http';
Expand All @@ -145,29 +148,25 @@ import { HttpClientModule } from '@angular/common/http';
OtherApiModule,
// make sure to import the HttpClientModule in the AppModule only,
// see https://github.com/angular/angular/issues/20575
HttpClientModule
]
HttpClientModule,
],
})
export class AppModule {

}
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.

```
```typescript
import { BASE_PATH } from '';

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

or

```
```typescript
import { BASE_PATH } from '';

@NgModule({
Expand All @@ -179,32 +178,30 @@ import { BASE_PATH } from '';
export class AppModule {}
```

#### Using @angular/cli
### Using @angular/cli

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

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

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

```
```typescript
import { BASE_PATH } from '';
import { environment } from '../environments/environment';

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

### Customizing path parameter encoding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@ import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core
import { Configuration } from './configuration';
import { HttpClient } from '@angular/common/http';

import { ChallengeService } from './api/challenge.service';
import { ChallengeAnalyticsService } from './api/challengeAnalytics.service';
import { ChallengeContributionService } from './api/challengeContribution.service';
import { ChallengePlatformService } from './api/challengePlatform.service';
import { EdamConceptService } from './api/edamConcept.service';
import { ImageService } from './api/image.service';
import { OrganizationService } from './api/organization.service';
import { UserService } from './api/user.service';

@NgModule({
imports: [],
declarations: [],
Expand Down
Loading
Loading