Documentation ¶
Overview ¶
Package clients defines API clients for interacting with select APIs.
Index ¶
- func RunEndToEnd(ctx context.Context, cfg *config.E2ERunnerConfig) error
- type APIServerClient
- func (c *APIServerClient) Certificate(ctx context.Context, in *api.VerificationCertificateRequest) (*api.VerificationCertificateResponse, error)
- func (c *APIServerClient) UserReport(ctx context.Context, in *api.UserReportRequest) (*api.UserReportResponse, error)
- func (c *APIServerClient) Verify(ctx context.Context, in *api.VerifyCodeRequest) (*api.VerifyCodeResponse, error)
- type AdminAPIServerClient
- func (c *AdminAPIServerClient) BatchIssueCode(ctx context.Context, in *api.BatchIssueCodeRequest) (*api.BatchIssueCodeResponse, error)
- func (c *AdminAPIServerClient) CheckCodeStatus(ctx context.Context, in *api.CheckCodeStatusRequest) (*api.CheckCodeStatusResponse, error)
- func (c *AdminAPIServerClient) IssueCode(ctx context.Context, in *api.IssueCodeRequest) (*api.IssueCodeResponse, error)
- type AppSyncClient
- type ENXRedirectClient
- func (c *ENXRedirectClient) AndroidAssetLinks(ctx context.Context) ([]*api.AndroidDataResponse, error)
- func (c *ENXRedirectClient) AppleSiteAssociation(ctx context.Context) (*api.IOSDataResponse, error)
- func (c *ENXRedirectClient) CheckRedirect(ctx context.Context, userAgent string) (*http.Response, error)
- func (c *ENXRedirectClient) RunE2E(ctx context.Context) error
- type ENXRedirectWebClient
- type KeyServerClient
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunEndToEnd ¶ added in v0.20.0
func RunEndToEnd(ctx context.Context, cfg *config.E2ERunnerConfig) error
RunEndToEnd - code that exercises the verification and key server, simulating a mobile device uploading TEKs.
Types ¶
type APIServerClient ¶
type APIServerClient struct {
// contains filtered or unexported fields
}
APIServerClient is a client that talks to a device API server.
func NewAPIServerClient ¶
func NewAPIServerClient(base, apiKey string, opts ...Option) (*APIServerClient, error)
NewAPIServerClient creates a new API server http client.
func (*APIServerClient) Certificate ¶
func (c *APIServerClient) Certificate(ctx context.Context, in *api.VerificationCertificateRequest) (*api.VerificationCertificateResponse, error)
Certificate calls the /certificate endpoint to exchange a token for a certificate.
func (*APIServerClient) UserReport ¶ added in v0.25.0
func (c *APIServerClient) UserReport(ctx context.Context, in *api.UserReportRequest) (*api.UserReportResponse, error)
UserReport calls the /user-report endpoint to request a verification code be created with a self-report type, with the code only dispatched via SMS.
func (*APIServerClient) Verify ¶
func (c *APIServerClient) Verify(ctx context.Context, in *api.VerifyCodeRequest) (*api.VerifyCodeResponse, error)
Verify calls the /verify endpoint to convert a code into a token.
type AdminAPIServerClient ¶
type AdminAPIServerClient struct {
// contains filtered or unexported fields
}
AdminAPIServerClient is a client that talks to an admin API server.
func NewAdminAPIServerClient ¶
func NewAdminAPIServerClient(base, apiKey string, opts ...Option) (*AdminAPIServerClient, error)
NewAdminAPIServerClient creates a new admin API server http client.
func (*AdminAPIServerClient) BatchIssueCode ¶
func (c *AdminAPIServerClient) BatchIssueCode(ctx context.Context, in *api.BatchIssueCodeRequest) (*api.BatchIssueCodeResponse, error)
BatchIssueCode calls the /batch-issue endpoint. Callers must check the HTTP response code.
func (*AdminAPIServerClient) CheckCodeStatus ¶
func (c *AdminAPIServerClient) CheckCodeStatus(ctx context.Context, in *api.CheckCodeStatusRequest) (*api.CheckCodeStatusResponse, error)
CheckCodeStatus uses the Admin API to retrieve the status of an OTP code.
func (*AdminAPIServerClient) IssueCode ¶
func (c *AdminAPIServerClient) IssueCode(ctx context.Context, in *api.IssueCodeRequest) (*api.IssueCodeResponse, error)
IssueCode calls the /issue endpoint. Callers must check the HTTP response code.
type AppSyncClient ¶
type AppSyncClient struct {
// contains filtered or unexported fields
}
AppSyncClient is a client that talks to the appsync service.
func NewAppSyncClient ¶
func NewAppSyncClient(base string, opts ...Option) (*AppSyncClient, error)
NewAppSyncClient creates a new app sync service http client.
func (*AppSyncClient) AppSync ¶
func (c *AppSyncClient) AppSync(ctx context.Context) (*appsync.AppsResponse, error)
AppSync triggers an application sync.
type ENXRedirectClient ¶ added in v0.20.0
type ENXRedirectClient struct {
// contains filtered or unexported fields
}
ENXRedirectClient is a client that talks to the enx-redirect service.
func NewENXRedirectClient ¶ added in v0.20.0
func NewENXRedirectClient(base string, opts ...Option) (*ENXRedirectClient, error)
NewENXRedirectClient creates a new enx-redirect service http client.
func (*ENXRedirectClient) AndroidAssetLinks ¶ added in v0.20.0
func (c *ENXRedirectClient) AndroidAssetLinks(ctx context.Context) ([]*api.AndroidDataResponse, error)
AndroidAssetLinks calls and parses the Android assetlinks file.
func (*ENXRedirectClient) AppleSiteAssociation ¶ added in v0.20.0
func (c *ENXRedirectClient) AppleSiteAssociation(ctx context.Context) (*api.IOSDataResponse, error)
AppleSiteAssociation calls and parses the Apple site association file.
func (*ENXRedirectClient) CheckRedirect ¶ added in v0.20.0
func (c *ENXRedirectClient) CheckRedirect(ctx context.Context, userAgent string) (*http.Response, error)
CheckRedirect processes the redirect. It returns the http response. It does not follow any redirects or check the response status.
type ENXRedirectWebClient ¶ added in v0.26.0
type ENXRedirectWebClient struct {
// contains filtered or unexported fields
}
ENXRedirectWebClient is a client that talks to the enx-redirect web components (user-report).
func NewENXRedirectWebClient ¶ added in v0.26.0
func NewENXRedirectWebClient(base string, apiKey string, opts ...Option) (*ENXRedirectWebClient, error)
NewENXRedirectWebClient creates a new enx-redirect service http client for user-report.
func (*ENXRedirectWebClient) SendUserReportIndex ¶ added in v0.26.0
func (c *ENXRedirectWebClient) SendUserReportIndex(ctx context.Context, useGet bool, nonce string) error
SendUserReportIndex request "/report" on the ENX Redirect server which is the landing page for a client embedded webview. This requires a client with an installed cookiejar to work correctly since this will create a session cookie that embeds the nonce provided in the header.
func (*ENXRedirectWebClient) SendUserReportIssue ¶ added in v0.26.0
func (c *ENXRedirectWebClient) SendUserReportIssue(ctx context.Context, testDate string, phone string, agree string) error
SendUserReportIssue issues a user-report verification code by posting the web form. Must be called from the same client
type KeyServerClient ¶ added in v0.21.0
type KeyServerClient struct {
// contains filtered or unexported fields
}
KeyServerClient is a client that talks to the key-server
func NewKeyServerClient ¶ added in v0.21.0
func NewKeyServerClient(base string, opts ...Option) (*KeyServerClient, error)
NewKeyServerClient creates a new key-server http client.
func (*KeyServerClient) Publish ¶ added in v0.23.0
func (c *KeyServerClient) Publish(ctx context.Context, in *keyserver.Publish) (*keyserver.PublishResponse, error)
Publish uploads TEKs to the key server
func (*KeyServerClient) Stats ¶ added in v0.21.0
func (c *KeyServerClient) Stats(ctx context.Context, in *keyserver.StatsRequest, authToken string) (*keyserver.StatsResponse, error)
Stats calls the /v1/stats endpoint to get key-server statistics.
type Option ¶
type Option func(c *client) *client
Option is a customization option for the client.
func WithCookieJar ¶ added in v0.26.0
WithCookieJar installs the specified cookier jar in the client. This is necessary if you are making successive requests that need to utilize cookies.
func WithCustomRequestHeaders ¶ added in v1.3.0
WithCustomRequestHeaders injects the given headers into the request. It can be called multiple times.
func WithHostOverride ¶ added in v0.21.0
WithHostOverride creates a new client that overrides the Host header.
func WithMaxBodySize ¶
WithMaxBodySize sets a custom max body size for each request. The default is 64kib.
func WithTimeout ¶
WithTimeout sets a custom timeout for each request. The default is 5s.
func WithUserAgent ¶ added in v0.26.0
WithUserAgent sets a custom User-Agent header