npm package: @smartobjx/smart.connectors
Description: swagger client for @smartobjx/smart.connectors
Author: smartObjx, LLC
Latest version: 0.0.2-205

## @smartobjx/smart.connectors@0.0.2-182

### Building

To build an compile the typescript sources to javascript use:
```
npm install
npm run build
```

### publishing

First build the package than run ```npm publish```

### consuming

navigate to the folder of your consuming project and run one of next commando's.

_published:_

```
npm install @smartobjx/smart.connectors@0.0.2-182 --save
```

_unPublished (not recommended):_

```
npm install PATH_TO_GENERATED_PACKAGE --save
```

_using `npm link`:_

In PATH_TO_GENERATED_PACKAGE:
```
npm link
```

In your project:
```
npm link @smartobjx/smart.connectors@0.0.2-182
```

In your Angular project:


```
// configuring providers Structures example
import { ApiModule } from '@smartobjx/smart.connectors';
import { StructuresService, StructuresServiceConfiguration } from 'smart.connectors';
import { StructuresServiceConfiguration } from 'smart.connectors';
import { AuthService } from './authentication/auth.service';
import { environment } from '../../environments/environment';
import { HttpClient as AngularHttpClient } from '@angular/common/http';

export function structuresConfigurationService() {
  return (http: AngularHttpClient ,token,povToken): StructuresServiceConfiguration => {
    return new StructuresServiceConfiguration({
      httpClient: http,
      basePath: environment.structureServiceBasePath,
      SubscriberToken: token,
      POVToken: povToken
    });
  };
}
export function StructuresFactoryService() {
  return (_structuresServiceConfiguration: StructuresServiceConfiguration): StructuresService => {
    return new StructuresService(_structuresServiceConfiguration);
  };
}

@NgModule({
    imports: [ ApiModule ],
    declarations: [ AppComponent ],
    providers: [    
    {
      provide: StructuresService,
      useFactory: StructuresFactoryService(),
      deps: [StructuresServiceConfiguration]
    },
    {
      provide: StructuresServiceConfiguration,
      useFactory: structuresConfigurationService(),
      deps: [AuthService]
    },
     {
      provide: StructuresAdmMediator,
      useFactory: StructuresAdmMediatorFactory(),
      deps: [StructuresService]
    }
    ],
    bootstrap: [ AppComponent ]
})
export class AppModule {}
```
Service Implementation

export function factory() {
  return (_server: StructuresService): Mediator => {
    return new Mediator(_server);
  };
}

@Injectable({
  providedIn: 'root'
})
export default class Mediator {
  constructor(_server: StructuresService) {
    this.server = _server;
  }
  private server: StructuresService;

  getPerspectives(): Observable<Perspective[]> {
    return this.server.getAllPerspectives();
  }

}

``


#### 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 '@smartobjx/smart.connectors';
import { environment } from '../environments/environment';

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