@beredo/ngx-ion-client
v18.3.6
Published
This Angular library simplifies API communication with Infor M3 and Infor ION, providing utility methods for managing transactions, user context, and CSRF tokens. It abstracts common functionalities such as parameter handling, context management, and erro
Readme
Angular HTTP Library for Infor M3/Infor ION
This Angular library simplifies API communication with Infor M3 and Infor ION, providing utility methods for managing transactions, user context, and CSRF tokens. It abstracts common functionalities such as parameter handling, context management, and error handling to streamline API integrations.
Features
- M3 V2 API: Supports M3 v2 endpoints.
- M3 Bulk API: M3 Bulk API support.
- Drop in replacement for odin: The project has a goal that migration from odin should be as simple as possible.
Installation
To install the library, add it to your Angular project:
npm install @beredo/ngx-ion-clientGetting started
Add HttpClientModule to providers
If using stand alone components, this can also be configured in the component.
Either in your app.module.ts
...
import { HttpClientModule } from '@angular/common/http';
...
@NgModule({
...
providers: [
...
HttpClientModule
...
]
...Or in your app.config.ts
...
import { provideHttpClient } from '@angular/common/http';
export const appConfig: ApplicationConfig = {
providers: [
....
provideHttpClient(),
...
],
};
Import the library
import { HttpClientModule } from '@angular/common/http';
import { MIService, UserService } from '@beredo/ngx-ion-client';
@NgModule({
imports: [
HttpClientModule,
// Other imports
],
providers: [MIService, UserService],
})
export class AppModule {}Using the library
Making a basic m3 call
To make a simple API call, import the service and use the execute or executeV2 methods
import { Component } from '@angular/core';
import { MIService } from "@beredo/ngx-ion-client";
@Component({
selector: 'app-transaction',
template: `<pre>{{ transactionResult | json }}</pre>`,
})
export class TransactionComponent {
transactionResult: any;
constructor(private miService: MIService) {
this.miService
.execute({
program: 'MMS001MI',
transaction: 'LstItems',
record: { ITNO: 'ITEM001' },
})
.subscribe(
(result) => {
this.transactionResult = result;
},
(error) => {
console.error('Transaction error', error);
}
);
}
}Or with V2 API
import { Component } from '@angular/core';
import { MIService } from "@beredo/ngx-ion-client";
@Component({
selector: 'app-transaction',
template: `<pre>{{ transactionResult | json }}</pre>`,
})
export class TransactionComponent {
transactionResult: any;
constructor(private miService: MIService) {
return this.miService.executeV2<
GetHeadInputs,
GetHeadOutputs
>({
program: "OIS100MI",
transaction: "GetHead",
records: params,
});
}
}
User context
User context uses MNS150MI when developing locally.
import { Component, OnInit } from '@angular/core';
import { UserService, UserContext } from "@beredo/ngx-ion-client";
@Component({
selector: 'app-user-context',
template: `<pre>{{ userContext | json }}</pre>`,
})
export class UserContextComponent implements OnInit {
userContext: UserContext | undefined;
constructor(private userService: UserService) {}
ngOnInit() {
this.userService.getUserContext().subscribe((context) => {
this.userContext = context;
});
}
}Licensing
This library is only for non-commercial use. If you want to use this in a commercial project you can contact us to discuss licensing.
