55#include " netlicensing/netlicensing.h"
66
77int main (int argc, char * argv[]) {
8- using netlicensing::Product;
9- std::string licensee_number = " I2C3VN7NA-DEMO" ;
8+ using namespace netlicensing ;
9+
10+ std::string licensee_number = " I5-DEMO" ;
1011 if (argc > 1 ) {
1112 licensee_number = argv[1 ];
1213 }
@@ -18,43 +19,39 @@ int main(int argc, char* argv[]) {
1819 std::string productNumber = ss.str ();
1920
2021 std::cout << " Hello, this is NetLicensing demo client\n " ;
21- std::cout << " Product endpoint " << netlicensing:: endpoint<Product>() << std::endl;
22+ std::cout << " Product endpoint " << endpoint<Product>() << std::endl;
2223 std::cout << " Product test number " << productNumber << std::endl;
2324
24- using netlicensing::Context;
2525 try {
2626 Context ctx;
2727 ctx.set_base_url (" https://go.netlicensing.io/core/v2/rest/" );
2828 ctx.set_username (" demo" );
2929 ctx.set_password (" demo" );
3030
3131 // product section
32- netlicensing:: Product p;
32+ Product p;
3333 p.setName (" Test name" );
3434 p.setNumber (productNumber);
35- netlicensing:: Product newp = netlicensing:: ProductService::create (ctx, p);
35+ Product newp = ProductService::create (ctx, p);
3636
3737 newp.setName (" Updated name" );
38- netlicensing:: Product newp2 = netlicensing:: ProductService::update (ctx, newp.getNumber (), newp);
38+ Product newp2 = ProductService::update (ctx, newp.getNumber (), newp);
3939
40- std::list<netlicensing:: Product> products = netlicensing:: ProductService::list (ctx, " " );
40+ std::list<Product> products = ProductService::list (ctx, " " );
4141 std::cout << " before delete products count " << products.size () << std::endl;
4242
43- netlicensing:: ProductService::del (ctx, newp2.getNumber (), false );
43+ ProductService::del (ctx, newp2.getNumber (), false );
4444
45- products = netlicensing:: ProductService::list (ctx, " " );
45+ products = ProductService::list (ctx, " " );
4646 std::cout << " after delete products count " << products.size () << std::endl;
4747
4848 if (!licensee_number.empty ()) {
4949 std::cout << " start validation for " << licensee_number << std::endl;
50- std::list<netlicensing::ValidationResult> vres = netlicensing::ValidationService::validate (ctx, licensee_number);
51- std::cout << " got validation results: " << vres.size () << std::endl;
52- for (auto val_res : vres) {
53- std::cout << val_res.to_string () << std::endl;
54- }
50+ ValidationResult vres = LicenseeService::validate (ctx, licensee_number);
51+ std::cout << " got validation results:\n " << vres.toString () << std::endl;
5552 }
5653 }
57- catch (const netlicensing:: RestException& e) {
54+ catch (const RestException& e) {
5855 std::cerr << e.what () << " code " << e.http_code () << std::endl;
5956 for (auto det : e.get_details ()) {
6057 std::cerr << det.to_string () << std::endl;
0 commit comments