SiddiqSoft.restcl 0.5.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package SiddiqSoft.restcl --version 0.5.2
NuGet\Install-Package SiddiqSoft.restcl -Version 0.5.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SiddiqSoft.restcl" Version="0.5.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SiddiqSoft.restcl --version 0.5.2
#r "nuget: SiddiqSoft.restcl, 0.5.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SiddiqSoft.restcl as a Cake Addin
#addin nuget:?package=SiddiqSoft.restcl&version=0.5.2

// Install SiddiqSoft.restcl as a Cake Tool
#tool nuget:?package=SiddiqSoft.restcl&version=0.5.2

restcl : A focused REST Client for Modern C++

CodeQL Build Status alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Objective

Design a library where JSON is a first-class API metaphor for interacting with RESTful servers.

  • Focused on REST interactions with JSON. Limiting allows us to simplify the usage and make it feel very C++ instead of the C-like API of Win32 or OpenSSL.
  • Modern C++ features: C++20 is required!
  • Header only
  • Use native implementations for the actual IO: Windows support uses WinHttp library.
    • Initial implementation is for Windows using WinHTTP.
    • Alternate implementation using OpenSSL tbd.
  • Support for literals to allow _GET, _DELETE, etc.
  • Support for std::format and concepts.
  • Be instructional and use as little code as necessary.
  • The focus is on the interface to the end user.
  • Performance is not the objective.
  • Simplicity (hide the underlying implementation)
      #include "siddiqsoft/restcl.hpp"
      #include "siddiqsoft/restcl_winhttp.hpp"
      ...
      using namespace siddiqsoft;
      using namespace siddiqsoft::literals;
    
      WinHttpRESTClient wrc("my-user-agent-string"); // optional UA; defaults to siddiqsoft.restcl/version
    
      // Create a simple GET request from the endpoint string
      // Send the request and invoke the callback.
      wrc.send( "https://google.com"_GET,
                [](const auto& req, const auto& resp) {
                   if(resp.success())
                      doSomething();
                });
       ...
       ...
      // Create a POST request by parsing out the string
      auto myPost= "https://server:999/path?q=hello-world"_POST;
      // Add custom header
      myPost["headers"]["X-MyHeader"]= "my-header-value";
      // Adds the content with supplied json object and sets the 
      // headers Content-Length and Content-Type
      myPost.setContent( {{"foo", "bar"}, {"goto", 99}} );
      // Send the request and invoke the callback
      wrc.send( std::move(myReq), [](auto& req, auto& resp){
                                     if(resp.success())
                                        doSomething();
                                     else
                                        logError(resp.error());
                                  });
    

Usage

Requirements

  • C++20 with support for concepts, format
  • The library nlohmann.json is used as the primary interface
  • The build and tests are for Visual Studio 2019 under x64.

Examples

<p align="right"> © 2021 Siddiq Software LLC. All rights reserved. </p>

Product Compatible and additional computed target framework versions.
native native is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on SiddiqSoft.restcl:

Package Downloads
SiddiqSoft.CosmosClient

Azure Cosmos REST-API Client for Modern C++

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.10.7 321 12/22/2021
0.10.6 227 12/21/2021
0.10.5 260 12/16/2021
0.10.4 507 11/20/2021
0.10.1 380 10/11/2021
0.10.0 7,443 10/8/2021
0.9.5 320 10/7/2021
0.9.4 1,287 10/7/2021
0.9.2 352 9/19/2021
0.9.1 6,440 9/18/2021
0.8.0 3,783 9/11/2021
0.7.4 315 9/8/2021
0.7.2 401 9/3/2021
0.7.1 400 9/3/2021
0.6.1 6,915 8/30/2021
0.6.0 450 8/29/2021
0.5.6 432 8/28/2021
0.5.5 436 8/18/2021
0.5.4 448 8/18/2021
0.5.3 405 8/17/2021
0.5.2 407 8/16/2021
0.5.1 479 8/15/2021
0.5.0 458 8/14/2021
0.4.2 413 8/13/2021
0.3.0 442 8/12/2021
0.2.2 434 8/11/2021
0.2.1 430 8/11/2021