Update client to support latest API behaviors / data; v0.5.0#7
Merged
Update client to support latest API behaviors / data; v0.5.0#7
Conversation
4081ca8 to
cea6c49
Compare
This change updates the package so that it continues to work with the ipdata.co API. This also introduces breaking changes in the interest of simplifying the code and reducing the API surface area. There were some changes made to the dara structure returned over the JSON API from ipdata.co, as well as how the authentication credentials are provided to the API itself. This change primarily was executed to support the new format and authentication mechanism. Specifically, some string fields were converted to Objects within the ipdata.co API to provide more rich data. Things like the timezone, the currency, and the risk/threats associated with that IP. The API also stopped accepted authentication tokens via HTTP headers, and now requires them via URL query parameters. In addition to that, the idea of using one struct type for the JSON communication and another for consumers of this package to use has been backed-out. The original implementation used a `RawIP` struct for communication to JSON, and then would convert it to an `IP` struct while doing things like parsing timestamps in to `time.Time`, timezones in to `*time.Location`, and converting URLs to `*url.URL`. Instead of assuming everyone would want the URL to be a `*url.URL`, or that they really need to parse the timestamp, we now only deal with the serialization and deserialization from the API. We leave it up to consumers to parse the data in to a different type if they choose to do so. So the `IP` struct was removed, and the `RawIP` struct was renamed to `IP`. Also, all of the `RawXXX` functions and methods were removed. Signed-off-by: Tim Heckman <t@heckman.io>
cea6c49 to
b14899b
Compare
theckman
added a commit
that referenced
this pull request
Feb 28, 2019
Update client to support latest API behaviors / data; v0.5.0 Signed-off-by: Tim Heckman <t@heckman.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change updates the package so that it continues to work with the ipdata.co
API. This also introduces breaking changes in the interest of simplifying the
code and reducing the API surface area.
There were some changes made to the dara structure returned over the JSON API
from ipdata.co, as well as how the authentication credentials are provided to
the API itself. This change primarily was executed to support the new format and
authentication mechanism.
Specifically, some string fields were converted to Objects within the ipdata.co
API to provide more rich data. Things like the timezone, the currency, and the
risk/threats associated with that IP. The API also stopped accepted
authentication tokens via HTTP headers, and now requires them via URL query
parameters.
In addition to that, the idea of using one struct type for the JSON
communication and another for consumers of this package to use has been
backed-out. The original implementation used a
RawIPstruct for communicationto JSON, and then would convert it to an
IPstruct while doing things likeparsing timestamps in to
time.Time, timezones in to*time.Location, andconverting URLs to
*url.URL.Instead of assuming everyone would want the URL to be a
*url.URL, or that theyreally need to parse the timestamp, we now only deal with the serialization and
deserialization from the API. We leave it up to consumers to parse the data in
to a different type if they choose to do so.
So the
IPstruct was removed, and theRawIPstruct was renamed toIP.Also, all of the
RawXXXfunctions and methods were removed.Signed-off-by: Tim Heckman t@heckman.io