Using of CREDITS API in Visual C++ (demo)

Requirements

Windows x64

Download CREDITS API files: https://github.com/CREDITSCOM/thrift-interface-definitions

To install additional libraries use the package manager: https://github.com/Microsoft/vcpkg

Install additional libraries:

boost (windows): vcpkg install boost: x64-windows

thrift (windows): vcpkg install thrift: x64-windows

Create a console application in Visual Studio

CREDITS API Source Code Generation

Open the folder which you have used for download of Credits API from the GitHub, for example, in d: \ credits \ github \ CS-API \

Let's say thrift is installed in the folder: d: \ vcpkg \

execute commands:

D: \ vcpkg \ packages \ thrift_x64-windows \ tools \ thrift \ thrift.exe --gen cpp api.thrift

D: \ vcpkg \ packages \ thrift_x64-windows \ tools \ thrift \ thrift.exe --gen cpp variant.thrift

As the result you will get a folder with files: gen-cpp,

copy the files from the folder to the folder of our application, for example in: d: \ credits \ app \ app \

Add files to our project

Make changes to source files

Add line #define NOMINMAX to pch.h

add to all * .cpp files a line at the beginning of the file: #include “pch.h”

go to: https://developers.credits.com/en/Articles/a76

copy the snippet and paste it into the main function

Next, go to the address: https://developers.credits.com/en/Articles/a77, copy the snippet and paste instead of the line “// do something”

change the port 9090 to 9080

The result is shown on the codes:

C++
Copy

Due to a thrift generator error do the following

create a stub.

Check the performance. Call the GetBalance Method

As the result of the program we see the requested balance:

GitHub link: https://github.com/pvl1175/CreditsCPlusPlusDemo

Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard