writeas / go-writeas

Go client for the Write.as API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Overriding base URL

abhinav opened this issue · comments

Overview

The library has 3 hard-coded URLs for the API service. It should probably
support changing the URL for testing and to allow users to point the client to
their own instance of WriteFreely.

Implementation

Rather than add another parameter to the constructors (thus breaking the API),
I propose adding a NewClientWith(Config) *Client constructor where Config
is a struct with a bunch of optional fields. This will also allow adding other
new optional parameters for client configuration in the future without
breaking the API.

Great idea. I started on a library a while ago that might be able to do just this today, and would work for future libraries (e.g. go-snapas, go-jotas, etc.)

Resolved by #9.