Skip to content

*UNMAINTAINED* An extensible base for a general PostgREST Client

License

Notifications You must be signed in to change notification settings

thejettdurham/postgrest-sharp-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PROJECT IS NOT MAINTAINED

While I'm honored to be featured in the PostgREST Ecosystem, sadly I don't have the resources to continue work on this project. It started out as an experiment that worked decently for narrow usages, but I've found that the abstractions break down quickly after deviating from those usages. In fact, PostgREST is still actively developed, so there's a good chance that a lot of this code no longer works as intended.

If you find this project useful and want to see it maintained, I encourage you to fork it.

PostgREST Sharp Client

An extensible implementation of a REST client tailored specific to REST endpoints served by PostgREST.

MIT License

Why?

PostgREST is an incredibly useful tool to generate a standards-compliant, high-performance REST API from an any Postgres database. Of course, client implementations are up to the developer, as it will always be. However, since the APIs generated by PostgREST adhere to HTTP standards and patterns, a general REST client to a PostgREST endpoint could be written to abstract away the more tedious aspects of implmenting a robust REST client.

The goal is not provide a plug-and-play REST client to an arbitrary API. Instead, PostgREST Sharp Client aims to provide a solid foundation upon which to easily and quickly build your API-specific client.

How?

Currently, PostgREST Sharp Client is built atop RestSharp. Most of the types provided by PostgREST Sharp Client extend from their corresponding RestSharp types, so a developer with RestSharp experience should find themselves at home with PostgREST Sharp Client.

Getting Started

TL;DR

  • Extend the abstract class PostgrestClient and provide getter implementations for AuthToken and BaseUri
  • Extend PostgrestModel to implement your data models (Highly recommended to generate these with a tool from the JSON Schema)
  • Build your request with an instance of PostgrestRequest.
  • Execute your request on your client with one of the execute methods:
    • ExecuteAndGetData(request) to validate the response and get back the data automatically deserialized as T.
    • ExecuteAndGetContent(request) to validate the response and get the response body as a string.
    • ExecuteAndValidate(request) to validate the response and return it
    • ExecuteRaw(request) return the response without sending it through the built-in validity checks.

About

*UNMAINTAINED* An extensible base for a general PostgREST Client

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages