-
Notifications
You must be signed in to change notification settings - Fork 11
/
client.go
45 lines (37 loc) · 1.04 KB
/
client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Package proxycheck provides the Proxy Checks API.
//
// Deprecated: The Proxy Checks API is deprecated and will be
// removed in future versions.
package proxycheck
import (
"context"
"net/http"
"github.com/clerk/clerk-sdk-go/v2"
)
//go:generate go run ../cmd/gen/main.go
const path = "/proxy_checks"
// Client is used to invoke the Proxy Checks API.
type Client struct {
Backend clerk.Backend
}
func NewClient(config *clerk.ClientConfig) *Client {
return &Client{
Backend: clerk.NewBackend(&config.BackendConfig),
}
}
type CreateParams struct {
clerk.APIParams
DomainID *string `json:"domain_id,omitempty"`
ProxyURL *string `json:"proxy_url,omitempty"`
}
// Create creates a proxy check.
//
// Deprecated: The operation is deprecated and will be removed in
// future versions.
func (c *Client) Create(ctx context.Context, params *CreateParams) (*clerk.ProxyCheck, error) {
req := clerk.NewAPIRequest(http.MethodPost, path)
req.SetParams(params)
resource := &clerk.ProxyCheck{}
err := c.Backend.Call(ctx, req, resource)
return resource, err
}