mirror of
https://github.com/hanzo-go/sdk.git
synced 2026-11-20 20:13:42 +00:00
978 lines
33 KiB
Go
978 lines
33 KiB
Go
/*
|
|
Hanzo Cloud API
|
|
|
|
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
|
|
|
|
API version: v1
|
|
*/
|
|
|
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|
|
|
package hanzoai
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
"io"
|
|
"net/http"
|
|
"net/url"
|
|
)
|
|
|
|
// LabelAPIService LabelAPI service
|
|
type LabelAPIService service
|
|
|
|
type LabelAPIRiskDisposeLabelsRequest struct {
|
|
ctx context.Context
|
|
ApiService *LabelAPIService
|
|
labelRiskDisposeIn *LabelRiskDisposeIn
|
|
}
|
|
|
|
func (r LabelAPIRiskDisposeLabelsRequest) LabelRiskDisposeIn(labelRiskDisposeIn LabelRiskDisposeIn) LabelAPIRiskDisposeLabelsRequest {
|
|
r.labelRiskDisposeIn = &labelRiskDisposeIn
|
|
return r
|
|
}
|
|
|
|
func (r LabelAPIRiskDisposeLabelsRequest) Execute() (*LabelRiskDisposeOut, *http.Response, error) {
|
|
return r.ApiService.RiskDisposeLabelsExecute(r)
|
|
}
|
|
|
|
/*
|
|
RiskDisposeLabels Dispose of this tenant's expired assertions, whole records only
|
|
|
|
Applies this tenant's retention, and only this tenant's.
|
|
|
|
It is bounded three ways, each a compliance property rather than a
|
|
convenience. It refuses a boundary younger than the platform floor, because a
|
|
label can be the input to an adverse action and five years is what the
|
|
retention ledger holds such a record for. It never touches a record under
|
|
litigation hold. And it disposes of whole records rather than redacting
|
|
fields.
|
|
|
|
It removes the derived columnar copy BEFORE the record, and refuses the whole
|
|
disposal if the warehouse cannot be reached. The other order would leave rows
|
|
in the warehouse that nothing can identify any more, which is a disposal that
|
|
did not happen and says it did.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return LabelAPIRiskDisposeLabelsRequest
|
|
*/
|
|
func (a *LabelAPIService) RiskDisposeLabels(ctx context.Context) LabelAPIRiskDisposeLabelsRequest {
|
|
return LabelAPIRiskDisposeLabelsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return LabelRiskDisposeOut
|
|
func (a *LabelAPIService) RiskDisposeLabelsExecute(r LabelAPIRiskDisposeLabelsRequest) (*LabelRiskDisposeOut, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *LabelRiskDisposeOut
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelAPIService.RiskDisposeLabels")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/label/dispose"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.labelRiskDisposeIn == nil {
|
|
return localVarReturnValue, nil, reportError("labelRiskDisposeIn is required and must be specified")
|
|
}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = r.labelRiskDisposeIn
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type LabelAPIRiskHoldLabelsRequest struct {
|
|
ctx context.Context
|
|
ApiService *LabelAPIService
|
|
labelRiskHoldIn *LabelRiskHoldIn
|
|
}
|
|
|
|
func (r LabelAPIRiskHoldLabelsRequest) LabelRiskHoldIn(labelRiskHoldIn LabelRiskHoldIn) LabelAPIRiskHoldLabelsRequest {
|
|
r.labelRiskHoldIn = &labelRiskHoldIn
|
|
return r
|
|
}
|
|
|
|
func (r LabelAPIRiskHoldLabelsRequest) Execute() (*LabelRiskHoldOut, *http.Response, error) {
|
|
return r.ApiService.RiskHoldLabelsExecute(r)
|
|
}
|
|
|
|
/*
|
|
RiskHoldLabels Place or release a litigation hold on named records
|
|
|
|
Places or releases a litigation hold on named records.
|
|
|
|
A hold is a fact about the RECORD, not about the world: it says retention may
|
|
not dispose of this row, and it asserts nothing about what happened. So it is
|
|
not a field on an assertion and it is not folded into the content digest —
|
|
carried there it was silently a no-op on any record that already existed, since
|
|
re-filing the same assertion with a hold flag produced the same digest, the
|
|
insert was ignored, and the caller was answered `duplicate` while the hold it
|
|
asked for was never placed. This op is the one way a hold moves, in either
|
|
direction, and the move is written to the audit log.
|
|
|
|
Every named id is this tenant's or is nothing. The statement runs against the
|
|
tenant's own file, which holds no other tenant's rows and has no column that
|
|
could name one.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return LabelAPIRiskHoldLabelsRequest
|
|
*/
|
|
func (a *LabelAPIService) RiskHoldLabels(ctx context.Context) LabelAPIRiskHoldLabelsRequest {
|
|
return LabelAPIRiskHoldLabelsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return LabelRiskHoldOut
|
|
func (a *LabelAPIService) RiskHoldLabelsExecute(r LabelAPIRiskHoldLabelsRequest) (*LabelRiskHoldOut, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *LabelRiskHoldOut
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelAPIService.RiskHoldLabels")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/label/hold"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.labelRiskHoldIn == nil {
|
|
return localVarReturnValue, nil, reportError("labelRiskHoldIn is required and must be specified")
|
|
}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = r.labelRiskHoldIn
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type LabelAPIRiskLabelRequest struct {
|
|
ctx context.Context
|
|
ApiService *LabelAPIService
|
|
labelRiskLabelIn *LabelRiskLabelIn
|
|
}
|
|
|
|
func (r LabelAPIRiskLabelRequest) LabelRiskLabelIn(labelRiskLabelIn LabelRiskLabelIn) LabelAPIRiskLabelRequest {
|
|
r.labelRiskLabelIn = &labelRiskLabelIn
|
|
return r
|
|
}
|
|
|
|
func (r LabelAPIRiskLabelRequest) Execute() (*LabelRiskLabelOut, *http.Response, error) {
|
|
return r.ApiService.RiskLabelExecute(r)
|
|
}
|
|
|
|
/*
|
|
RiskLabel Assert ground truth about events
|
|
|
|
Records a batch of ground truth against the entities it judges.
|
|
|
|
Each assertion carries TWO times — when the judged event happened, and when
|
|
the assertion became knowable — and both are required. The second is what
|
|
keeps a chargeback that landed in June out of a model that had to decide in
|
|
February.
|
|
|
|
It is idempotent on the CONTENT of an assertion, so a webhook that redelivers
|
|
is safe. It never overwrites: a source that corrects itself later files a NEW
|
|
assertion, which wins from the moment it became knowable and leaves every
|
|
earlier observation instant seeing exactly what it saw.
|
|
|
|
The asserter is stamped from the validated credential and is not a body field.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return LabelAPIRiskLabelRequest
|
|
*/
|
|
func (a *LabelAPIService) RiskLabel(ctx context.Context) LabelAPIRiskLabelRequest {
|
|
return LabelAPIRiskLabelRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return LabelRiskLabelOut
|
|
func (a *LabelAPIService) RiskLabelExecute(r LabelAPIRiskLabelRequest) (*LabelRiskLabelOut, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *LabelRiskLabelOut
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelAPIService.RiskLabel")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/label"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.labelRiskLabelIn == nil {
|
|
return localVarReturnValue, nil, reportError("labelRiskLabelIn is required and must be specified")
|
|
}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = r.labelRiskLabelIn
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type LabelAPIRiskLabelCoverageRequest struct {
|
|
ctx context.Context
|
|
ApiService *LabelAPIService
|
|
from *string
|
|
to *string
|
|
horizon *int64
|
|
}
|
|
|
|
// From and To bound the EVENT window, half-open, RFC 3339. Unstated, the window is the 90 days ENDING where maturity begins — `to` is the horizon ago, not now. A default window running to now under a default horizon could not contain one matured event, so every count below it would be zero however much ground truth the tenant held.
|
|
func (r LabelAPIRiskLabelCoverageRequest) From(from string) LabelAPIRiskLabelCoverageRequest {
|
|
r.from = &from
|
|
return r
|
|
}
|
|
|
|
func (r LabelAPIRiskLabelCoverageRequest) To(to string) LabelAPIRiskLabelCoverageRequest {
|
|
r.to = &to
|
|
return r
|
|
}
|
|
|
|
// Horizon is the maturity horizon in days the coverage is measured under. Unstated takes 120. It also moves the default window, which ends where maturity begins.
|
|
func (r LabelAPIRiskLabelCoverageRequest) Horizon(horizon int64) LabelAPIRiskLabelCoverageRequest {
|
|
r.horizon = &horizon
|
|
return r
|
|
}
|
|
|
|
func (r LabelAPIRiskLabelCoverageRequest) Execute() (*LabelRiskLabelCoverage, *http.Response, error) {
|
|
return r.ApiService.RiskLabelCoverageExecute(r)
|
|
}
|
|
|
|
/*
|
|
RiskLabelCoverage How much of the window has matured, and how much of that is judged
|
|
|
|
Reports how much of a window has matured and how much of that is
|
|
judged, per source.
|
|
|
|
It is the gate on training. A supervised fit over a window whose judged count
|
|
is near zero produces a number, and the number is meaningless; this op is what
|
|
lets that be stated before the fit rather than discovered after it.
|
|
|
|
It reads the RECORD plane and folds every assertion at that event's OWN as-of,
|
|
so the counts obey exactly the leakage rule a materialisation would. It counts
|
|
only what was ASSERTED: what share of the whole event STREAM carries a label is
|
|
a question about the feature plane's denominator and is not answerable here.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return LabelAPIRiskLabelCoverageRequest
|
|
*/
|
|
func (a *LabelAPIService) RiskLabelCoverage(ctx context.Context) LabelAPIRiskLabelCoverageRequest {
|
|
return LabelAPIRiskLabelCoverageRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return LabelRiskLabelCoverage
|
|
func (a *LabelAPIService) RiskLabelCoverageExecute(r LabelAPIRiskLabelCoverageRequest) (*LabelRiskLabelCoverage, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *LabelRiskLabelCoverage
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelAPIService.RiskLabelCoverage")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/label/coverage"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.from != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "from", r.from, "form", "")
|
|
}
|
|
if r.to != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "to", r.to, "form", "")
|
|
}
|
|
if r.horizon != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "horizon", r.horizon, "form", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type LabelAPIRiskLabelVocabularyRequest struct {
|
|
ctx context.Context
|
|
ApiService *LabelAPIService
|
|
}
|
|
|
|
func (r LabelAPIRiskLabelVocabularyRequest) Execute() (*LabelRiskLabelVocabulary, *http.Response, error) {
|
|
return r.ApiService.RiskLabelVocabularyExecute(r)
|
|
}
|
|
|
|
/*
|
|
RiskLabelVocabulary The closed vocabularies and the precedence rule that resolves a conflict
|
|
|
|
Publishes the closed vocabularies and the precedence rule that
|
|
resolves a conflict between two sources.
|
|
|
|
A precedence rule nobody can read is a rule nobody can audit or dispute, and
|
|
the whole defensibility of a contested label rests on being able to say why
|
|
one assertion beat another. The order returned here is derived from the same
|
|
declaration the resolver reads — it is not a description of it.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return LabelAPIRiskLabelVocabularyRequest
|
|
*/
|
|
func (a *LabelAPIService) RiskLabelVocabulary(ctx context.Context) LabelAPIRiskLabelVocabularyRequest {
|
|
return LabelAPIRiskLabelVocabularyRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return LabelRiskLabelVocabulary
|
|
func (a *LabelAPIService) RiskLabelVocabularyExecute(r LabelAPIRiskLabelVocabularyRequest) (*LabelRiskLabelVocabulary, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *LabelRiskLabelVocabulary
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelAPIService.RiskLabelVocabulary")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/label/vocabulary"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type LabelAPIRiskLabelsRequest struct {
|
|
ctx context.Context
|
|
ApiService *LabelAPIService
|
|
kind *string
|
|
subject *string
|
|
source *string
|
|
from *string
|
|
to *string
|
|
limit *int64
|
|
}
|
|
|
|
// Kind and Subject narrow to one entity.
|
|
func (r LabelAPIRiskLabelsRequest) Kind(kind string) LabelAPIRiskLabelsRequest {
|
|
r.kind = &kind
|
|
return r
|
|
}
|
|
|
|
func (r LabelAPIRiskLabelsRequest) Subject(subject string) LabelAPIRiskLabelsRequest {
|
|
r.subject = &subject
|
|
return r
|
|
}
|
|
|
|
// Source narrows to one asserter — the read that answers \"what has commerce told us\", separately from \"what has an analyst told us\".
|
|
func (r LabelAPIRiskLabelsRequest) Source(source string) LabelAPIRiskLabelsRequest {
|
|
r.source = &source
|
|
return r
|
|
}
|
|
|
|
// From and To bound the EVENT time, half-open, RFC 3339.
|
|
func (r LabelAPIRiskLabelsRequest) From(from string) LabelAPIRiskLabelsRequest {
|
|
r.from = &from
|
|
return r
|
|
}
|
|
|
|
func (r LabelAPIRiskLabelsRequest) To(to string) LabelAPIRiskLabelsRequest {
|
|
r.to = &to
|
|
return r
|
|
}
|
|
|
|
// Limit caps the page. Out of range takes the plane's own bound.
|
|
func (r LabelAPIRiskLabelsRequest) Limit(limit int64) LabelAPIRiskLabelsRequest {
|
|
r.limit = &limit
|
|
return r
|
|
}
|
|
|
|
func (r LabelAPIRiskLabelsRequest) Execute() (*LabelRiskLabelsOut, *http.Response, error) {
|
|
return r.ApiService.RiskLabelsExecute(r)
|
|
}
|
|
|
|
/*
|
|
RiskLabels Read the assertions this tenant has recorded
|
|
|
|
Reads the assertions this tenant has recorded, newest event first.
|
|
|
|
It reads the RECORD — the tenant's own store — and not the columnar copy, so
|
|
what it returns is what would be produced in an audit. Narrow it by entity, by
|
|
asserter, or by event window.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return LabelAPIRiskLabelsRequest
|
|
*/
|
|
func (a *LabelAPIService) RiskLabels(ctx context.Context) LabelAPIRiskLabelsRequest {
|
|
return LabelAPIRiskLabelsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return LabelRiskLabelsOut
|
|
func (a *LabelAPIService) RiskLabelsExecute(r LabelAPIRiskLabelsRequest) (*LabelRiskLabelsOut, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *LabelRiskLabelsOut
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelAPIService.RiskLabels")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/label"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.kind != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "kind", r.kind, "form", "")
|
|
}
|
|
if r.subject != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "subject", r.subject, "form", "")
|
|
}
|
|
if r.source != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "source", r.source, "form", "")
|
|
}
|
|
if r.from != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "from", r.from, "form", "")
|
|
}
|
|
if r.to != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "to", r.to, "form", "")
|
|
}
|
|
if r.limit != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type LabelAPIRiskResolveLabelsRequest struct {
|
|
ctx context.Context
|
|
ApiService *LabelAPIService
|
|
labelRiskResolveIn *LabelRiskResolveIn
|
|
}
|
|
|
|
func (r LabelAPIRiskResolveLabelsRequest) LabelRiskResolveIn(labelRiskResolveIn LabelRiskResolveIn) LabelAPIRiskResolveLabelsRequest {
|
|
r.labelRiskResolveIn = &labelRiskResolveIn
|
|
return r
|
|
}
|
|
|
|
func (r LabelAPIRiskResolveLabelsRequest) Execute() (*LabelRiskResolveOut, *http.Response, error) {
|
|
return r.ApiService.RiskResolveLabelsExecute(r)
|
|
}
|
|
|
|
/*
|
|
RiskResolveLabels Resolve the label in force for named events, as of each event's own horizon
|
|
|
|
Answers, for each named event, which assertion was in force AS OF that
|
|
event's own horizon — and what disagreed with it.
|
|
|
|
This is the join surface: the dataset materialiser calls it to attach ground
|
|
truth to training rows, and the evaluator calls it to score a past decision
|
|
against what was knowable when the decision had to be made. One mechanism for
|
|
both, so a model can never be trained under one leakage rule and scored under
|
|
another.
|
|
|
|
Three answers are distinct and all three are honest: a resolved label, an
|
|
event that has not matured, and a matured event nobody has judged. The last is
|
|
never reported as unproductive.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return LabelAPIRiskResolveLabelsRequest
|
|
*/
|
|
func (a *LabelAPIService) RiskResolveLabels(ctx context.Context) LabelAPIRiskResolveLabelsRequest {
|
|
return LabelAPIRiskResolveLabelsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return LabelRiskResolveOut
|
|
func (a *LabelAPIService) RiskResolveLabelsExecute(r LabelAPIRiskResolveLabelsRequest) (*LabelRiskResolveOut, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *LabelRiskResolveOut
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelAPIService.RiskResolveLabels")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/label/resolve"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.labelRiskResolveIn == nil {
|
|
return localVarReturnValue, nil, reportError("labelRiskResolveIn is required and must be specified")
|
|
}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = r.labelRiskResolveIn
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|