pip_services_applications 1.0.1 copy "pip_services_applications: ^1.0.1" to clipboard
pip_services_applications: ^1.0.1 copied to clipboard

Applications microservice for Pip.Services in Dart. It keeps a list of supported applications that are referenced from other content microservices.

example/README.md

Examples for Applications Microservice #

This is applications microservice from Pip.Services library. It keeps a list of supported applications that are referenced from other content microservices.

Define configuration parameters that match the configuration of the microservice's external API

// Service/Client configuration
var httpConfig = ConfigParams.fromTuples(
	"connection.protocol", "http",
	"connection.host", "localhost",
	"connection.port", 8080
);

Instantiate the service

persistence = ApplicationsMemoryPersistence();
persistence.configure(ConfigParams());

controller = ApplicationsController();
controller.configure(ConfigParams());

service = ApplicationsHttpServiceV1();
service.configure(httpConfig);

var references = References.fromTuples([
    Descriptor('pip-services-applications', 'persistence', 'memory',
        'default', '1.0'),
    persistence,
    Descriptor('pip-services-applications', 'controller', 'default',
        'default', '1.0'),
    controller,
    Descriptor(
        'pip-services-applications', 'service', 'http', 'default', '1.0'),
    service
]);

controller.setReferences(references);
service.setReferences(references);

await persistence.open(null);
await service.open(null);

Instantiate the client and open connection to the microservice

// Create the client instance
var client = ApplicationsHttpClientV1(config);

// Configure the client
client.configure(httpConfig);

// Connect to the microservice
try{
  await client.open(null)
}catch() {
  // Error handling...
}       
// Work with the microservice
// ...

Now the client is ready to perform operations

// Create a new application
final APPLICATION = ApplicationV1.fromMap({
    id: 'my_app',
    name: 'My Application',
    product: 'My Samples'
});

    // Create the application
    try {
      var application = await client.createApplication('123', APPLICATION);
      // Do something with the returned application...
    } catch(err) {
      // Error handling...     
    }
// Get the list of applications for 'My Samples' product
try {
var page = await client.getApplications(
    null,
    {
        product: 'My Samples'
    },
    {
        total: true,
        skip: 0,
        take: 10
    });
    // Do something with page...

    } catch(err) { // Error handling}

In the help for each class there is a general example of its use. Also one of the quality sources are the source code for the tests.

0
likes
30
pub points
0%
popularity

Publisher

verified publisherentinco.com

Applications microservice for Pip.Services in Dart. It keeps a list of supported applications that are referenced from other content microservices.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

angel_framework, http, pip_services3_commons, pip_services3_components, pip_services3_container, pip_services3_data, pip_services3_grpc, pip_services3_mongodb, pip_services3_rpc

More

Packages that depend on pip_services_applications