GithubHelp home page GithubHelp logo

markhazleton / google-maps Goto Github PK

View Code? Open in Web Editor NEW

This project forked from maximn/google-maps

0.0 0.0 0.0 2.16 MB

Google Maps Web Services API wrapper for .NET

License: BSD 2-Clause "Simplified" License

C# 85.82% HTML 14.18% Smalltalk 0.01%

google-maps's Introduction

Google Maps Web Services API Wrapper for .NET

Overview

This project is a fork of the original Google Maps Web Services API wrapper for .NET (https://github.com/maximn/google-maps), extended to include a minimal API using Fast Endpoints and a refactor of the HttpClient usage. By introducing a standalone project named HttpClientUtility, we've employed generics to decouple HttpClient management from the Google API mapping, enhancing modularity and maintainability.

Changes in this Fork

Minimal API with Fast Endpoints

Implemented a minimal API layer using Fast Endpoints to provide streamlined and efficient endpoint handling.

HttpClientUtility Refactor use of HttpClient

Introduced HttpClientUtility, a separate project to manage HttpClient instances using generics. This abstraction facilitates better resource management and simplifies interactions with the Google Maps API. The new HttpClientUtility introduces a structured way to handle HTTP requests and responses, encapsulating them in generic types for easier and more flexible management. It uses an HttpResponseContent class to represent responses, with generics allowing for various content types. The utility includes methods for different HTTP verbs like GET, POST, PUT, and DELETE, simplifying client-server communication. Moreover, it employs an IHttpClientFactory for creating HttpClient instances, promoting efficient resource usage and lifecycle management. This design separates concerns between HTTP client management and Google API mapping, enhancing code maintainability.

HttpResponseContent

HttpResponseContent: A generic class that serves as a container for the response from an HTTP request. It includes information about the success or failure of the request, the status code, any error messages, and the response content itself.

  • Purpose: Encapsulates the response from an HTTP request, including the status code, success status, content of the response, and any error messages.
  • Usage: Instances of this class are created through the Success and Failure static methods, representing successful and failed HTTP responses, respectively.

HttpClientService

Acts as a wrapper around HttpClient, simplifying the process of sending HTTP requests and handling responses. It abstracts away some of the complexities associated with HttpClient, such as instance management, request configuration, and response parsing.

  • Purpose: Provides a service for making HTTP requests using HttpClient, handling request execution, and processing responses.
  • Usage: After instantiation with the necessary dependencies (IHttpClientFactory and IStringConverter), it offers methods for sending HTTP requests (GetAsync, PostAsync, PutAsync, DeleteAsync) and customizing the request timeout.
  • Error Handling: Errors during request execution are captured and returned as part of the HttpResponseContent failure instance, including HTTP request exceptions, timeout exceptions, and other unexpected exceptions.

IStringConverter

An interface expected to provide methods for converting between strings and objects. It's used for serializing request payloads and deserializing response content. The actual implementation must be provided by the user of the HttpClientService.

google-maps's People

Contributors

allon-guralnek avatar dependabot[bot] avatar fr33fr0m avatar genbox avatar george-shaw avatar graham128 avatar juancri avatar jurijsk avatar jwkerley avatar kevbite avatar kzudin avatar leifershag avatar lucasfogliarini avatar lucasjans avatar markhazleton avatar maximn avatar mishani0x0ef avatar nicholashead avatar nilesh-shah avatar petelopez avatar peterdew avatar pirvudoru avatar rhwilburn avatar rossiter10 avatar rukeba avatar rvoroz avatar sevagd avatar solmead avatar the-chriss avatar tystol avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.