diff --git a/bench_test.go b/bench_test.go index eaef6d6..642f086 100644 --- a/bench_test.go +++ b/bench_test.go @@ -7,8 +7,8 @@ import ( "testing" "github.com/amzn/ion-go/ion" - "github.com/danielgtaylor/restish/cli" - "github.com/danielgtaylor/restish/openapi" + "github.com/barbich/restish/cli" + "github.com/barbich/restish/openapi" "github.com/fxamacker/cbor/v2" "github.com/shamaton/msgpack/v2" "github.com/spf13/cobra" diff --git a/bulk/commands.go b/bulk/commands.go index 1ccbc83..bf68275 100644 --- a/bulk/commands.go +++ b/bulk/commands.go @@ -10,9 +10,9 @@ import ( "sort" "strings" + "github.com/barbich/restish/cli" + "github.com/barbich/restish/openapi" "github.com/danielgtaylor/mexpr" - "github.com/danielgtaylor/restish/cli" - "github.com/danielgtaylor/restish/openapi" "github.com/danielgtaylor/shorthand/v2" "github.com/hexops/gotextdiff" "github.com/hexops/gotextdiff/myers" diff --git a/bulk/commands_test.go b/bulk/commands_test.go index 2227d46..eacb0de 100644 --- a/bulk/commands_test.go +++ b/bulk/commands_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/danielgtaylor/restish/cli" + "github.com/barbich/restish/cli" "github.com/spf13/afero" "github.com/stretchr/testify/require" "gopkg.in/h2non/gock.v1" diff --git a/bulk/file.go b/bulk/file.go index 611ae3f..5cc4b35 100644 --- a/bulk/file.go +++ b/bulk/file.go @@ -10,7 +10,7 @@ import ( "path/filepath" "reflect" - "github.com/danielgtaylor/restish/cli" + "github.com/barbich/restish/cli" "github.com/spf13/afero" "github.com/zeebo/xxh3" ) diff --git a/bulk/metadata.go b/bulk/metadata.go index 71065a3..983f842 100644 --- a/bulk/metadata.go +++ b/bulk/metadata.go @@ -12,7 +12,7 @@ import ( "strings" "time" - "github.com/danielgtaylor/restish/cli" + "github.com/barbich/restish/cli" "github.com/danielgtaylor/shorthand/v2" "github.com/logrusorgru/aurora" "github.com/schollz/progressbar/v3" diff --git a/cli/links.go b/cli/links.go index 251aefc..7b8a386 100644 --- a/cli/links.go +++ b/cli/links.go @@ -20,7 +20,7 @@ type Links map[string][]*Link // LinkParser parses link relationships in a response. type LinkParser interface { - ParseLinks(resp *Response) error + ParseLinks(base *url.URL, resp *Response) error } var linkParsers = []LinkParser{} @@ -34,7 +34,7 @@ func AddLinkParser(parser LinkParser) { // ParseLinks uses all registered LinkParsers to parse links for a response. func ParseLinks(base *url.URL, resp *Response) error { for _, parser := range linkParsers { - if err := parser.ParseLinks(resp); err != nil { + if err := parser.ParseLinks(base, resp); err != nil { return err } } @@ -58,7 +58,7 @@ func ParseLinks(base *url.URL, resp *Response) error { type LinkHeaderParser struct{} // ParseLinks processes the links in a parsed response. -func (l LinkHeaderParser) ParseLinks(resp *Response) error { +func (l LinkHeaderParser) ParseLinks(base *url.URL, resp *Response) error { if resp.Headers["Link"] != "" { links, err := link.Parse(resp.Headers["Link"]) if err != nil { @@ -90,7 +90,7 @@ type halBody struct { type HALParser struct{} // ParseLinks processes the links in a parsed response. -func (h HALParser) ParseLinks(resp *Response) error { +func (h HALParser) ParseLinks(base *url.URL, resp *Response) error { entries := []interface{}{} if l, ok := resp.Body.([]interface{}); ok { entries = l @@ -122,7 +122,7 @@ func (h HALParser) ParseLinks(resp *Response) error { type TerrificallySimpleJSONParser struct{} // ParseLinks processes the links in a parsed response. -func (t TerrificallySimpleJSONParser) ParseLinks(resp *Response) error { +func (t TerrificallySimpleJSONParser) ParseLinks(base *url.URL, resp *Response) error { return t.walk(resp, "self", resp.Body) } @@ -181,7 +181,7 @@ type sirenBody struct { type SirenParser struct{} // ParseLinks processes the links in a parsed response. -func (s SirenParser) ParseLinks(resp *Response) error { +func (s SirenParser) ParseLinks(base *url.URL, resp *Response) error { siren := sirenBody{} if err := mapstructure.Decode(resp.Body, &siren); err == nil { for _, link := range siren.Links { @@ -230,7 +230,7 @@ func getJSONAPIlinks(links map[string]interface{}, resp *Response, isItem bool) type JSONAPIParser struct{} // ParseLinks processes the links in a parsed response. -func (j JSONAPIParser) ParseLinks(resp *Response) error { +func (j JSONAPIParser) ParseLinks(base *url.URL, resp *Response) error { if b, ok := resp.Body.(map[string]interface{}); ok { // Find top-level links if l, ok := b["links"].(map[string]interface{}); ok { diff --git a/cli/links_test.go b/cli/links_test.go index 716391a..b068c73 100644 --- a/cli/links_test.go +++ b/cli/links_test.go @@ -10,7 +10,9 @@ import ( type errorLinkParser struct{} -func (p errorLinkParser) ParseLinks(r *Response) error { +var base *url.URL + +func (p errorLinkParser) ParseLinks(base *url.URL, r *Response) error { return fmt.Errorf("error parsing links") } @@ -35,7 +37,7 @@ func TestLinkHeaderParser(t *testing.T) { } p := LinkHeaderParser{} - err := p.ParseLinks(r) + err := p.ParseLinks(base, r) assert.NoError(t, err) assert.Equal(t, r.Links["self"][0].URI, "/self") assert.Equal(t, r.Links["item"][0].URI, "/foo") @@ -43,7 +45,7 @@ func TestLinkHeaderParser(t *testing.T) { // Test a bad link header r.Headers["Link"] = "bad value" - err = p.ParseLinks(r) + err = p.ParseLinks(base, r) assert.Error(t, err) } @@ -64,7 +66,7 @@ func TestHALParser(t *testing.T) { } p := HALParser{} - err := p.ParseLinks(r) + err := p.ParseLinks(base, r) assert.NoError(t, err) assert.Equal(t, r.Links["self"][0].URI, "/self") assert.Equal(t, r.Links["item"][0].URI, "/item") @@ -92,7 +94,7 @@ func TestHALParserArray(t *testing.T) { } p := HALParser{} - err := p.ParseLinks(r) + err := p.ParseLinks(base, r) assert.NoError(t, err) assert.Equal(t, r.Links["self"][0].URI, "/one") assert.Equal(t, r.Links["self"][1].URI, "/two") @@ -129,7 +131,7 @@ func TestTerrificallySimpleJSONParser(t *testing.T) { } p := TerrificallySimpleJSONParser{} - err := p.ParseLinks(r) + err := p.ParseLinks(base, r) assert.NoError(t, err) assert.Equal(t, r.Links["self"][0].URI, "/self") assert.Equal(t, r.Links["things-item"][0].URI, "/foo") @@ -152,7 +154,7 @@ func TestSirenParser(t *testing.T) { } s := SirenParser{} - err := s.ParseLinks(r) + err := s.ParseLinks(base, r) assert.NoError(t, err) assert.Equal(t, r.Links["self"][0].URI, "/self") assert.Equal(t, r.Links["one"][0].URI, "/multi") @@ -179,7 +181,7 @@ func TestJSONAPIParser(t *testing.T) { } j := JSONAPIParser{} - err := j.ParseLinks(r) + err := j.ParseLinks(base, r) assert.NoError(t, err) assert.Equal(t, r.Links["self"][0].URI, "/self") assert.Equal(t, r.Links["item"][0].URI, "/item") diff --git a/go.mod b/go.mod index ef77d77..64a66c4 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,8 @@ -module github.com/danielgtaylor/restish +module github.com/barbich/restish -go 1.18 +go 1.21 + +toolchain go1.22.1 require ( github.com/AlecAivazis/survey/v2 v2.3.6 @@ -64,7 +66,7 @@ require ( github.com/magiconair/properties v1.8.6 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect - github.com/microcosm-cc/bluemonday v1.0.21 // indirect + github.com/microcosm-cc/bluemonday v1.0.26 // indirect github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect github.com/muesli/reflow v0.3.0 // indirect github.com/muesli/termenv v0.13.0 // indirect diff --git a/go.sum b/go.sum index 220dca9..a369546 100644 --- a/go.sum +++ b/go.sum @@ -95,6 +95,7 @@ github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5y github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= +github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= @@ -152,6 +153,7 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -208,9 +210,11 @@ github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa02 github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8= github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= @@ -233,8 +237,9 @@ github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= -github.com/microcosm-cc/bluemonday v1.0.21 h1:dNH3e4PSyE4vNX+KlRGHT5KrSvjeUkoNPwEORjffHJg= github.com/microcosm-cc/bluemonday v1.0.21/go.mod h1:ytNkv4RrDrLJ2pqlsSI46O6IVXmZOBBD4SaJyDwwTkM= +github.com/microcosm-cc/bluemonday v1.0.26 h1:xbqSvqzQMeEHCqMi64VAs4d8uy6Mequs3rQ0k/Khz58= +github.com/microcosm-cc/bluemonday v1.0.26/go.mod h1:JyzOCs9gkyQyjs+6h10UEVSe02CGwkhd72Xdqh78TWs= github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ= github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= @@ -283,6 +288,7 @@ github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw= github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/schollz/progressbar/v3 v3.12.2 h1:yLqqqpQNMxGxHY8uEshRihaHWwa0rf0yb7/Zrpgq2C0= github.com/schollz/progressbar/v3 v3.12.2/go.mod h1:HFJYIYQQJX32UJdyoigUl19xoV6aMwZt6iX/C30RWfg= @@ -337,6 +343,7 @@ github.com/yuin/goldmark v1.5.3/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5ta github.com/yuin/goldmark-emoji v1.0.1 h1:ctuWEyzGBwiucEqxzwe0SOYDXPAucOrE9NQC18Wa1os= github.com/yuin/goldmark-emoji v1.0.1/go.mod h1:2w1E6FEWLcDQkoTE+7HU6QF1F6SLlNGjRIBbIZQFqkQ= github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ= +github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= @@ -685,6 +692,7 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/h2non/gock.v1 v1.1.2 h1:jBbHXgGBK/AoPVfJh5x4r/WxIrElvbLel8TCZkkZJoY= diff --git a/main.go b/main.go index a5e6cd4..d2beac8 100644 --- a/main.go +++ b/main.go @@ -3,10 +3,10 @@ package main import ( "os" - "github.com/danielgtaylor/restish/bulk" - "github.com/danielgtaylor/restish/cli" - "github.com/danielgtaylor/restish/oauth" - "github.com/danielgtaylor/restish/openapi" + "github.com/barbich/restish/bulk" + "github.com/barbich/restish/cli" + "github.com/barbich/restish/oauth" + "github.com/barbich/restish/openapi" ) var version string = "dev" diff --git a/oauth/authcode.go b/oauth/authcode.go index c3c2a6f..d65e511 100644 --- a/oauth/authcode.go +++ b/oauth/authcode.go @@ -16,7 +16,7 @@ import ( "context" - "github.com/danielgtaylor/restish/cli" + "github.com/barbich/restish/cli" "github.com/mattn/go-isatty" "golang.org/x/oauth2" ) diff --git a/oauth/clientcreds.go b/oauth/clientcreds.go index 4d72925..c01f3d3 100644 --- a/oauth/clientcreds.go +++ b/oauth/clientcreds.go @@ -6,7 +6,7 @@ import ( "net/url" "strings" - "github.com/danielgtaylor/restish/cli" + "github.com/barbich/restish/cli" "golang.org/x/oauth2/clientcredentials" ) diff --git a/oauth/oauth.go b/oauth/oauth.go index 27a20bb..5378d3a 100644 --- a/oauth/oauth.go +++ b/oauth/oauth.go @@ -4,7 +4,7 @@ import ( "errors" "net/http" - "github.com/danielgtaylor/restish/cli" + "github.com/barbich/restish/cli" "golang.org/x/oauth2" ) diff --git a/oauth/refresh.go b/oauth/refresh.go index 9e944b6..8a01d6a 100644 --- a/oauth/refresh.go +++ b/oauth/refresh.go @@ -4,7 +4,7 @@ import ( "fmt" "net/url" - "github.com/danielgtaylor/restish/cli" + "github.com/barbich/restish/cli" "golang.org/x/oauth2" ) diff --git a/oauth/request.go b/oauth/request.go index 01648d3..8f38f1e 100644 --- a/oauth/request.go +++ b/oauth/request.go @@ -8,7 +8,7 @@ import ( "strings" "time" - "github.com/danielgtaylor/restish/cli" + "github.com/barbich/restish/cli" "golang.org/x/oauth2" ) diff --git a/openapi/openapi.go b/openapi/openapi.go index b52fdaa..22716de 100644 --- a/openapi/openapi.go +++ b/openapi/openapi.go @@ -13,8 +13,8 @@ import ( "sort" "strings" + "github.com/barbich/restish/cli" "github.com/danielgtaylor/casing" - "github.com/danielgtaylor/restish/cli" "github.com/danielgtaylor/shorthand/v2" "github.com/gosimple/slug" "github.com/pb33f/libopenapi" diff --git a/openapi/openapi_test.go b/openapi/openapi_test.go index 0486b0c..dd78385 100644 --- a/openapi/openapi_test.go +++ b/openapi/openapi_test.go @@ -13,7 +13,7 @@ import ( "testing" "testing/iotest" - "github.com/danielgtaylor/restish/cli" + "github.com/barbich/restish/cli" v3 "github.com/pb33f/libopenapi/datamodel/high/v3" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require"