0.4.60 • Published 7 days ago

@wizardcontrollerprerelease/horseless-contentapi-lib v0.4.60

Weekly downloads
-
License
-
Repository
-
Last release
7 days ago

Horseless Content API

This library was generated with Angular CLI version 13.2.0.

Originally anyway. There should be nearly exactly reproducable steps docuemented here.

INSTRUCTIONS FOR LIBRARY EXTENSION

Code scaffolding

Run ng generate component component-name --project horseless-contentapi-lib to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module --project horseless-contentapi-lib.

Note: Don't forget to add --project horseless-contentapi-lib or else it will be added to the default project in your angular.json file.

Build

Run ng build horseless-contentapi-lib to build the project. The build artifacts will be stored in the dist/ directory.

Publishing

After building your library with ng build horseless-contentapi-lib, go to the dist folder cd dist/horseless-contentapi-lib and run npm publish.

Running unit tests

Run ng test horseless-contentapi-lib to execute the unit tests via Karma.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI Overview and Command Reference page.

INSTRUCTIONS FOR LIBRARY INSTALLATION AND CONSUMPTION

@wizardcontrollerprerelease/horseless-contentapi-lib

Building

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

npm install
npm run build

publishing

First build the package then 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 @wizardcontrollerprerelease/horseless-contentapi-lib@v1 --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 @wizardcontrollerprerelease/horseless-contentapi-lib

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 '@wizardcontrollerprerelease/horseless-contentapi-lib';
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 '@wizardcontrollerprerelease/horseless-contentapi-lib';

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 {}
// configuring providers with an authentication service that manages your access tokens
import { ApiModule, Configuration } from '@wizardcontrollerprerelease/horseless-contentapi-lib';

@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 ]
})
export class AppModule {}
import { HorselessContentAPI } from '@wizardcontrollerprerelease/horseless-contentapi-lib';

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

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

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:

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 '@wizardcontrollerprerelease/horseless-contentapi-lib';

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

or

import { BASE_PATH } from '@wizardcontrollerprerelease/horseless-contentapi-lib';

@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 '@wizardcontrollerprerelease/horseless-contentapi-lib';
import { environment } from '../environments/environment';

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

7 days ago

0.4.58

14 days ago

0.4.56

19 days ago

0.4.54

1 month ago

0.4.52

1 month ago

0.4.50

1 month ago

0.4.49

2 months ago

0.4.46

3 months ago

0.4.44

3 months ago

0.4.45

3 months ago

0.4.42

3 months ago

0.4.31

3 months ago

0.4.33

3 months ago

0.4.27

3 months ago

0.4.25

3 months ago

0.4.20

3 months ago

0.4.19

3 months ago

0.4.17

3 months ago

0.4.5

3 months ago

0.4.3

3 months ago

0.4.2

3 months ago

0.3.170

7 months ago

0.3.172

7 months ago

0.3.173

7 months ago

0.3.175

7 months ago

0.3.161

10 months ago

0.3.160

10 months ago

0.3.162

9 months ago

0.3.165

8 months ago

0.3.167

8 months ago

0.3.169

7 months ago

0.3.168

8 months ago

0.3.150

11 months ago

0.3.154

10 months ago

0.3.153

11 months ago

0.3.156

10 months ago

0.3.155

10 months ago

0.3.157

10 months ago

0.3.159

10 months ago

0.3.149

11 months ago

0.3.148

11 months ago

0.3.141

12 months ago

0.3.143

12 months ago

0.3.144

12 months ago

0.3.147

11 months ago

0.3.146

11 months ago

0.3.132

1 year ago

0.3.134

1 year ago

0.3.138

1 year ago

0.3.137

1 year ago

0.3.125

1 year ago

0.3.124

1 year ago

0.3.127

1 year ago

0.3.126

1 year ago

0.3.129

1 year ago

0.3.75

1 year ago

0.3.74

1 year ago

0.3.73

1 year ago

0.3.71

1 year ago

0.3.70

1 year ago

0.3.100

1 year ago

0.3.103

1 year ago

0.3.102

1 year ago

0.3.105

1 year ago

0.3.79

1 year ago

0.3.104

1 year ago

0.3.68

1 year ago

0.3.67

1 year ago

0.3.97

1 year ago

0.3.95

1 year ago

0.3.94

1 year ago

0.3.92

1 year ago

0.3.91

1 year ago

0.3.90

1 year ago

0.3.123

1 year ago

0.3.98

1 year ago

0.3.86

1 year ago

0.3.85

1 year ago

0.3.110

1 year ago

0.3.80

1 year ago

0.3.112

1 year ago

0.3.111

1 year ago

0.3.113

1 year ago

0.3.115

1 year ago

0.3.89

1 year ago

0.3.118

1 year ago

0.3.88

1 year ago

0.3.87

1 year ago

0.3.66

1 year ago

0.3.65

1 year ago

0.3.64

1 year ago

0.3.63

1 year ago

0.3.55

1 year ago

0.3.51

1 year ago

0.3.50

1 year ago

0.3.48

1 year ago

0.3.46

1 year ago

0.3.45

1 year ago

0.3.43

1 year ago

0.3.42

1 year ago

0.3.40

1 year ago

0.3.38

1 year ago

0.3.35

1 year ago

0.3.32

1 year ago

0.3.31

1 year ago

0.3.29

1 year ago

0.3.27

1 year ago

0.3.25

1 year ago

0.3.23

1 year ago

0.3.21

1 year ago

0.3.19

1 year ago

0.3.17

1 year ago

0.3.15

1 year ago

0.3.11

1 year ago

0.3.9

1 year ago

0.3.4

1 year ago

0.3.1

2 years ago

0.2.5

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.1.62

2 years ago

0.1.58

2 years ago

0.1.55

2 years ago

0.1.53

2 years ago

0.1.50

2 years ago

0.1.48

2 years ago

0.1.46

2 years ago

0.1.45

2 years ago

0.1.44

2 years ago

0.1.43

2 years ago

0.1.42

2 years ago

0.1.41

2 years ago

0.1.40

2 years ago

0.1.39

2 years ago

0.1.38

2 years ago

0.1.37

2 years ago

0.1.36

2 years ago

0.1.35

2 years ago

0.1.34

2 years ago

0.1.32

2 years ago

0.1.31

2 years ago

0.1.26

2 years ago

0.1.21

2 years ago

0.1.11

2 years ago

0.1.4

2 years ago

0.1.1

2 years ago

0.0.59

2 years ago

0.0.57

2 years ago

0.0.56

2 years ago

0.0.55

2 years ago

0.0.54

2 years ago

0.0.53

2 years ago

0.0.50

2 years ago

0.0.49

2 years ago

0.0.48

2 years ago

0.0.47

2 years ago

0.0.46

2 years ago

0.0.45

2 years ago

0.0.44

2 years ago

0.0.43

2 years ago

0.0.42

2 years ago

0.0.41

2 years ago

0.0.40

2 years ago

0.0.39

2 years ago

0.0.38

2 years ago

0.0.37

2 years ago

0.0.36

2 years ago

0.0.35

2 years ago

0.0.34

2 years ago

0.0.33

2 years ago

0.0.31

2 years ago

0.0.30

2 years ago

0.0.29

2 years ago

0.0.28

2 years ago

0.0.27

2 years ago

0.0.26

2 years ago

0.0.25

2 years ago

0.0.24

2 years ago

0.0.23

2 years ago

0.0.22

2 years ago

0.0.21

2 years ago

0.0.20

2 years ago

0.0.19

2 years ago

0.0.18

2 years ago

0.0.17

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago