Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gregamohorko/bluewsclient.net

.NET client library for BlueWS library.
https://github.com/gregamohorko/bluewsclient.net

async async-await asynchronous client-library csharp-library json rest web-service-client webservice

Last synced: 3 days ago
JSON representation

.NET client library for BlueWS library.

Awesome Lists containing this project

README

        

# BlueWSClient.NET
A client library in .NET for [BlueWS](https://github.com/GregaMohorko/BlueWS) library. Includes logic and utility for calling BlueWS web service actions.

[![Release](https://img.shields.io/github/release/GregaMohorko/BlueWSClient.NET.svg?style=flat-square)](https://github.com/GregaMohorko/BlueWSClient.NET/releases/latest)
[![NuGet](https://img.shields.io/nuget/v/BlueWS.svg?style=flat-square)](https://www.nuget.org/packages/BlueWS)

## Documentation & Tutorials
You can read the documentation and tutorials under the [Wiki](https://github.com/GregaMohorko/BlueWSClient.NET/wiki).

## Short examples
Creating a web service instance:
```C#
var webService = new WebService("https://www.myserver.com/", HttpMethod.Get);
```

Getting the response for an action *TestAction*:
```C#
var request = new Request(webService);
JObject response = request.Call("TestAction");
```

The above example was synchronous and blocked the calling thread.

The asynchronous call looks like this:
```C#
JObject response = await request.CallAsync(nameof(TestActionAsync));
```

To send parameters to the server, add them to the ```Parameter``` property of the request before calling:
```C#
request.Parameters.Add("TheAnswer",42);
JObject response = request.Call();
```

To get the response in your own type:
```C#
var request = new Request(webService);
YourClass response = request.Call("TestAction");
```

## Requirements
.NET Standard 2.0

## Author and License

Gregor Mohorko ([www.mohorko.info](https://www.mohorko.info))

Copyright (c) 2023 Gregor Mohorko

[Apache License 2.0](./LICENSE.md)