Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.45.0"
".": "0.46.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 104
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-20310988401243aa5c4a2e2ac6cba5dd90873fb7b83497a2d50c691352c0dd7b.yml
openapi_spec_hash: e19e650b4b2c8c8fde1f739c4aab6b33
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-f7024f4171c7c4ec558de1c27f338b1089ffddd0d2dbfdb9bb9f9c2abe8f47bf.yml
openapi_spec_hash: ced43682b49e73a2862f99b49abb4fcd
config_hash: 16e4457a0bb26e98a335a1c2a572290a
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 0.46.0 (2026-04-06)

Full Changelog: [v0.45.0...v0.46.0](https://github.com/kernel/kernel-go-sdk/compare/v0.45.0...v0.46.0)

### Features

* Add optional url parameter to proxy check endpoint ([084975a](https://github.com/kernel/kernel-go-sdk/commit/084975a54df1144592e3f61655ee423df3d38393))


### Bug Fixes

* fix issue with unmarshaling in some cases ([6f721ac](https://github.com/kernel/kernel-go-sdk/commit/6f721ac3da13678eb476f8231617510e8f0b9e34))

## 0.45.0 (2026-03-30)

Full Changelog: [v0.44.0...v0.45.0](https://github.com/kernel/kernel-go-sdk/compare/v0.44.0...v0.45.0)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/kernel/kernel-go-sdk@v0.45.0'
go get -u 'github.com/kernel/kernel-go-sdk@v0.46.0'
```

<!-- x-release-please-end -->
Expand Down
2 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ Methods:
- <code title="get /proxies/{id}">client.Proxies.<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk#ProxyService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>) (\*<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk#ProxyGetResponse">ProxyGetResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /proxies">client.Proxies.<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk#ProxyService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) (\*[]<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk#ProxyListResponse">ProxyListResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="delete /proxies/{id}">client.Proxies.<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk#ProxyService.Delete">Delete</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>) <a href="https://pkg.go.dev/builtin#error">error</a></code>
- <code title="post /proxies/{id}/check">client.Proxies.<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk#ProxyService.Check">Check</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>) (\*<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk#ProxyCheckResponse">ProxyCheckResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="post /proxies/{id}/check">client.Proxies.<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk#ProxyService.Check">Check</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk#ProxyCheckParams">ProxyCheckParams</a>) (\*<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/kernel/kernel-go-sdk#ProxyCheckResponse">ProxyCheckResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

# Extensions

Expand Down
6 changes: 3 additions & 3 deletions authconnection.go
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,7 @@ func (r AuthConnectionNewParams) MarshalJSON() (data []byte, err error) {
return shimjson.Marshal(r.ManagedAuthCreateRequest)
}
func (r *AuthConnectionNewParams) UnmarshalJSON(data []byte) error {
return json.Unmarshal(data, &r.ManagedAuthCreateRequest)
return apijson.UnmarshalRoot(data, r)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Untagged fields silently ignored during JSON unmarshaling

High Severity

The UnmarshalJSON methods were changed from json.Unmarshal(data, &r.InnerField) to apijson.UnmarshalRoot(data, r), but the inner fields (e.g. ManagedAuthCreateRequest, CreateCredentialRequest, SubmitFieldsRequest, etc.) have no JSON struct tags. The apijson struct decoder explicitly skips fields without JSON tags, so these primary data fields will never be populated during unmarshaling. The MarshalJSON still serializes the inner field's contents directly, making marshal/unmarshal asymmetric — data serialized by MarshalJSON cannot be recovered by UnmarshalJSON.

Additional Locations (2)
Fix in Cursor Fix in Web

}

type AuthConnectionUpdateParams struct {
Expand All @@ -1092,7 +1092,7 @@ func (r AuthConnectionUpdateParams) MarshalJSON() (data []byte, err error) {
return shimjson.Marshal(r.ManagedAuthUpdateRequest)
}
func (r *AuthConnectionUpdateParams) UnmarshalJSON(data []byte) error {
return json.Unmarshal(data, &r.ManagedAuthUpdateRequest)
return apijson.UnmarshalRoot(data, r)
}

type AuthConnectionListParams struct {
Expand Down Expand Up @@ -1161,5 +1161,5 @@ func (r AuthConnectionSubmitParams) MarshalJSON() (data []byte, err error) {
return shimjson.Marshal(r.SubmitFieldsRequest)
}
func (r *AuthConnectionSubmitParams) UnmarshalJSON(data []byte) error {
return json.Unmarshal(data, &r.SubmitFieldsRequest)
return apijson.UnmarshalRoot(data, r)
}
5 changes: 2 additions & 3 deletions credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package kernel

import (
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
Expand Down Expand Up @@ -260,7 +259,7 @@ func (r CredentialNewParams) MarshalJSON() (data []byte, err error) {
return shimjson.Marshal(r.CreateCredentialRequest)
}
func (r *CredentialNewParams) UnmarshalJSON(data []byte) error {
return json.Unmarshal(data, &r.CreateCredentialRequest)
return apijson.UnmarshalRoot(data, r)
}

type CredentialUpdateParams struct {
Expand All @@ -273,7 +272,7 @@ func (r CredentialUpdateParams) MarshalJSON() (data []byte, err error) {
return shimjson.Marshal(r.UpdateCredentialRequest)
}
func (r *CredentialUpdateParams) UnmarshalJSON(data []byte) error {
return json.Unmarshal(data, &r.UpdateCredentialRequest)
return apijson.UnmarshalRoot(data, r)
}

type CredentialListParams struct {
Expand Down
5 changes: 2 additions & 3 deletions credentialprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package kernel

import (
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
Expand Down Expand Up @@ -323,7 +322,7 @@ func (r CredentialProviderNewParams) MarshalJSON() (data []byte, err error) {
return shimjson.Marshal(r.CreateCredentialProviderRequest)
}
func (r *CredentialProviderNewParams) UnmarshalJSON(data []byte) error {
return json.Unmarshal(data, &r.CreateCredentialProviderRequest)
return apijson.UnmarshalRoot(data, r)
}

type CredentialProviderUpdateParams struct {
Expand All @@ -336,5 +335,5 @@ func (r CredentialProviderUpdateParams) MarshalJSON() (data []byte, err error) {
return shimjson.Marshal(r.UpdateCredentialProviderRequest)
}
func (r *CredentialProviderUpdateParams) UnmarshalJSON(data []byte) error {
return json.Unmarshal(data, &r.UpdateCredentialProviderRequest)
return apijson.UnmarshalRoot(data, r)
}
2 changes: 1 addition & 1 deletion internal/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

package internal

const PackageVersion = "0.45.0" // x-release-please-version
const PackageVersion = "0.46.0" // x-release-please-version
34 changes: 31 additions & 3 deletions proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,20 @@ func (r *ProxyService) Delete(ctx context.Context, id string, opts ...option.Req
return err
}

// Run a health check on the proxy to verify it's working.
func (r *ProxyService) Check(ctx context.Context, id string, opts ...option.RequestOption) (res *ProxyCheckResponse, err error) {
// Run a health check on the proxy to verify it's working. Optionally specify a URL
// to test reachability against a specific target. For ISP and datacenter proxies,
// this reliably tests whether the target site is reachable from the proxy's stable
// exit IP. For residential and mobile proxies, the exit node varies between
// requests, so this validates proxy configuration and connectivity rather than
// guaranteeing site-specific reachability.
func (r *ProxyService) Check(ctx context.Context, id string, body ProxyCheckParams, opts ...option.RequestOption) (res *ProxyCheckResponse, err error) {
opts = slices.Concat(r.Options, opts)
if id == "" {
err = errors.New("missing required id parameter")
return nil, err
}
path := fmt.Sprintf("proxies/%s/check", id)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}

Expand Down Expand Up @@ -1584,3 +1589,26 @@ const (
ProxyNewParamsProtocolHTTP ProxyNewParamsProtocol = "http"
ProxyNewParamsProtocolHTTPS ProxyNewParamsProtocol = "https"
)

type ProxyCheckParams struct {
// An optional URL to test reachability against. If provided, the proxy check will
// test connectivity to this URL instead of the default test URLs. Only HTTP and
// HTTPS schemes are allowed, and the URL must resolve to a public IP address. For
// ISP and datacenter proxies, the exit IP is stable, so a successful check
// reliably indicates that subsequent browser sessions will reach the target site
// with the same IP. For residential and mobile proxies, the exit node changes
// between requests, so a successful check validates proxy configuration but does
// not guarantee that a subsequent browser session will use the same exit IP or
// reach the same site — it is useful for verifying credentials and connectivity,
// not for predicting site-specific behavior.
URL param.Opt[string] `json:"url,omitzero"`
paramObj
}

func (r ProxyCheckParams) MarshalJSON() (data []byte, err error) {
type shadow ProxyCheckParams
return param.MarshalObject(r, (*shadow)(&r))
}
func (r *ProxyCheckParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
10 changes: 8 additions & 2 deletions proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func TestProxyDelete(t *testing.T) {
}
}

func TestProxyCheck(t *testing.T) {
func TestProxyCheckWithOptionalParams(t *testing.T) {
t.Skip("Mock server tests are disabled")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
Expand All @@ -128,7 +128,13 @@ func TestProxyCheck(t *testing.T) {
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
_, err := client.Proxies.Check(context.TODO(), "id")
_, err := client.Proxies.Check(
context.TODO(),
"id",
kernel.ProxyCheckParams{
URL: kernel.String("url"),
},
)
if err != nil {
var apierr *kernel.Error
if errors.As(err, &apierr) {
Expand Down
Loading