Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/OKTAYKIR/jsonapi-consumer
:package: Client framework for consuming JSONAPI services
https://github.com/OKTAYKIR/jsonapi-consumer
client-library consuming-jsonapi-services dotnet-core dotnet-standard dotnetcore framework json json-api jsonapi jsonapi-library jsonapiclient netstandard16 wrapper
Last synced: about 1 month ago
JSON representation
:package: Client framework for consuming JSONAPI services
- Host: GitHub
- URL: https://github.com/OKTAYKIR/jsonapi-consumer
- Owner: OKTAYKIR
- License: mit
- Created: 2018-02-11T12:12:03.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T18:40:05.000Z (about 2 years ago)
- Last Synced: 2024-04-01T05:23:03.265Z (9 months ago)
- Topics: client-library, consuming-jsonapi-services, dotnet-core, dotnet-standard, dotnetcore, framework, json, json-api, jsonapi, jsonapi-library, jsonapiclient, netstandard16, wrapper
- Language: C#
- Homepage:
- Size: 30.3 KB
- Stars: 6
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-json - jsonapi-consumer - Client framework for consuming JSONAPI based APIs on the [JSON API standard](https://jsonapi.org). (Libraries)
README
# JsonApi Client
![Hits](https://hitcounter.pythonanywhere.com/count/tag.svg?url=https://github.com/OKTAYKIR/jsonapi-consumer)
![GitHub issues](https://img.shields.io/github/issues/OKTAYKIR/jsonapi-consumer)
![Build Status](https://github.com/OKTAYKIR/jsonapi-consumer/workflows/CI/badge.svg?branch=master)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](#contributing)
[![nuget](https://img.shields.io/nuget/v/jsonapi-consumer)](https://www.nuget.org/packages/jsonapi-consumer/)Client framework for consuming JSONAPI web services based on the [JSON API standard](http://jsonapi.org/)
## :package: Installation
jsonapi-consumer is available on [NuGet](https://www.nuget.org/packages/jsonapi-consumer/).```sh
dotnet add package jsonapi-consumer
```## 🚀 Usage
#### Create HttpGet request with single response object
```c#
Response response = JsonApiConsumer.Get(
baseURI: ABSOLUTE_URL,
path: RELATIVE_URI,
query: new Dictionary() { { "FirstName", "Oktay" }, { "LastName", "Kır" } },
headers: new Dictionary() { { HEADER_API_KEY, HEADER_API_KEY_VALUE } } );
```#### Create HttpGet request with array response object
```c#
Response response = JsonApiConsumer.GetById(
id: "c833cbbf-7c81-4d30-b11a-88cf1c990b9c",
baseURI: ABSOLUTE_URL,
path: RELATIVE_URI,
query: new Dictionary() { { "FirstName", "Oktay" }, { "LastName", "Kır" } },
headers: new Dictionary() { { HEADER_API_KEY, HEADER_API_KEY_VALUE } } );
```#### Create HttpPost request
```c#
var user = new User()
{
id = "c833cbbf-7c81-4d30-b11a-88cf1c990b9c";
FirstName = "Oktay";
LastName="Kır";
}Response response = JsonApiConsumer.Create(
model: user,
baseURI: ABSOLUTE_URL,
path: RELATIVE_URI,
headers: new Dictionary() { { HEADER_API_KEY, HEADER_API_KEY_VALUE } } );
```#### Post a file
```c#
Response response = JsonApiConsumer.PostFile(
fileName: "filename",
data: new byte[],
baseURI: ABSOLUTE_URL,
path: RELATIVE_URI,
headers: new Dictionary() { { HEADER_API_KEY, HEADER_API_KEY_VALUE } } );
```#### Create HttpPut request
```c#
var user = new User()
{
FirstName = "Oktay";
LastName="Kır";
}Response response = JsonApiConsumer.Update(
id: "c833cbbf-7c81-4d30-b11a-88cf1c990b9c",
model: user,
baseURI: ABSOLUTE_URL,
path: RELATIVE_URI,
headers: new Dictionary() { { HEADER_API_KEY, HEADER_API_KEY_VALUE } } );
```#### Create HttpPatch request
```c#
var user = new User()
{
FirstName = "CC";
}Response response = JsonApiConsumer.Patch(
id: "c833cbbf-7c81-4d30-b11a-88cf1c990b9c",
model: user,
baseURI: ABSOLUTE_URL,
path: RELATIVE_URI,
headers: new Dictionary() { { HEADER_API_KEY, HEADER_API_KEY_VALUE } } );
```#### Create HttpDelete request
```c#
Response response = JsonApiConsumer.Delete(
id: "c833cbbf-7c81-4d30-b11a-88cf1c990b9c",
baseURI: ABSOLUTE_URL,
path: RELATIVE_URI,
headers: new Dictionary() { { HEADER_API_KEY, HEADER_API_KEY_VALUE } } );
```#### Response class definition
```c#
public class Response
{
public DocumentRoot documentRoot { get; internal set; }
public HttpStatusCode httpStatusCode { get; internal set; }
public Error error { get; set; }
public bool IsSuccess { get; internal set; }
}
```## ✨ Contributors
![GitHub Contributors Image](https://contrib.rocks/image?repo=OKTAYKIR/jsonapi-consumer)## 🤝 Contributing
1. Fork it ( https://github.com/OKTAYKIR/jsonapi-consumer/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request## Show your support
Please ⭐️ this repository if this project helped you!## 📝 License
MIT License