Coder Social home page Coder Social logo

kamilgregorczyk / accountapi-client Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 45 KB

Client for Form3 Organisation/Account entity

Home Page: https://api-docs.form3.tech/api.html#organisation-accounts-resource

Go 99.63% Dockerfile 0.29% Shell 0.08%
form3

accountapi-client's Introduction

Build Docker-Compose

Author: Kamil Gregorczyk

Dear reviewers, thanks for looking into my home task. I'm new to Go (I come from java & python world) but I tried to not make a lot of rookie mistakes.

What I did:

  • Implemented two clients. The http oriented one exists in case there's a need to reuse that http client for other domain oriented clients, the second one is Account orriented.

  • For resilience I implemented retries with exponential backoff.

  • I'm also requiring a timeout to be defined from the client as I noticed that builtin go client doesn't have any

  • Every call in account.Client has the ability to pass context. I initially though about populating trace/span ids for distributed tracing but then I realised that Go doesn't have any generic interface for that and some monitoring tools could be not compatible with that one. So it's up to the caller to populate context with its own tracing tools or do different deadlines for calls.

  • I added healthcheck & wait to accountapi in docker-compose to avoid restarts of accountapi in case postgres is not yet ready

  • I tried to keep number of testing libs low therefore I (somewhat) did BDD style tests with go's built in logs, it's not the nicest way of doing it but it resembles BDD to some degree.

  • I added basic validation of requests, like checking if ID is actually UUID V1 to avoid pointless requests

What I would have done more/differently:

  • If infra doesn't support it, I would have also add circuit breaker, I didn't add it as it's more complicated than doing simple retries and on a prod ready solution I would have used a 3rd party lib.

  • Use some simple BDD framework for tests

  • Since the documentation of form3 domains is very accurate (at least with accountapi) I'd probably generate such clients

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.