Documentation
¶
Index ¶
- func Bool(b bool) param.Opt[bool]
- func BoolPtr(v bool) *bool
- func DefaultClientOptions() []option.RequestOption
- func File(rdr io.Reader, filename, contentType string) file
- func Float(f float64) param.Opt[float64]
- func FloatPtr(v float64) *float64
- func Int(i int64) param.Opt[int64]
- func IntPtr(v int64) *int64
- func Opt[T comparable](v T) param.Opt[T]
- func Ptr[T any](v T) *T
- func String(s string) param.Opt[string]
- func StringPtr(v string) *string
- func Time(t time.Time) param.Opt[time.Time]
- func TimePtr(v time.Time) *time.Time
- type AIGuardGetAsyncRequestResponse
- type AIGuardGuardChatCompletionsParams
- type AIGuardGuardChatCompletionsParamsEventType
- type AIGuardGuardChatCompletionsParamsExtraInfo
- type AIGuardGuardChatCompletionsParamsExtraInfoMcpTool
- type AIGuardGuardChatCompletionsResponse
- type AIGuardGuardChatCompletionsResponseResult
- type AIGuardGuardChatCompletionsResponseResultDetectors
- type AIGuardGuardChatCompletionsResponseResultDetectorsCode
- type AIGuardGuardChatCompletionsResponseResultDetectorsCodeData
- type AIGuardGuardChatCompletionsResponseResultDetectorsCompetitors
- type AIGuardGuardChatCompletionsResponseResultDetectorsCompetitorsData
- type AIGuardGuardChatCompletionsResponseResultDetectorsConfidentialAndPiiEntity
- type AIGuardGuardChatCompletionsResponseResultDetectorsConfidentialAndPiiEntityData
- type AIGuardGuardChatCompletionsResponseResultDetectorsConfidentialAndPiiEntityDataEntity
- type AIGuardGuardChatCompletionsResponseResultDetectorsCustomEntity
- type AIGuardGuardChatCompletionsResponseResultDetectorsCustomEntityData
- type AIGuardGuardChatCompletionsResponseResultDetectorsCustomEntityDataEntity
- type AIGuardGuardChatCompletionsResponseResultDetectorsLanguage
- type AIGuardGuardChatCompletionsResponseResultDetectorsLanguageData
- type AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousEntity
- type AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousEntityData
- type AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousEntityDataEntity
- type AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousPrompt
- type AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousPromptData
- type AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousPromptDataAnalyzerResponse
- type AIGuardGuardChatCompletionsResponseResultDetectorsSecretAndKeyEntity
- type AIGuardGuardChatCompletionsResponseResultDetectorsSecretAndKeyEntityData
- type AIGuardGuardChatCompletionsResponseResultDetectorsSecretAndKeyEntityDataEntity
- type AIGuardGuardChatCompletionsResponseResultDetectorsTopic
- type AIGuardGuardChatCompletionsResponseResultDetectorsTopicData
- type AIGuardGuardChatCompletionsResponseResultDetectorsTopicDataTopic
- type AIGuardGuardChatCompletionsResponseStatus
- type AIGuardService
- func (r *AIGuardService) GetAsyncRequest(ctx context.Context, requestID string, opts ...option.RequestOption) (res *AIGuardGetAsyncRequestResponse, err error)
- func (r *AIGuardService) GuardChatCompletions(ctx context.Context, body AIGuardGuardChatCompletionsParams, ...) (res *AIGuardGuardChatCompletionsResponse, err error)
- func (r *AIGuardService) Unredact(ctx context.Context, body AIGuardUnredactParams, opts ...option.RequestOption) (res *AIGuardUnredactResponse, err error)
- type AIGuardUnredactParams
- type AIGuardUnredactResponse
- type AIGuardUnredactResponseResult
- type Client
- func (r *Client) Delete(ctx context.Context, path string, params, res any, ...) error
- func (r *Client) Execute(ctx context.Context, method, path string, params, res any, ...) error
- func (r *Client) Get(ctx context.Context, path string, params, res any, ...) error
- func (r *Client) Patch(ctx context.Context, path string, params, res any, ...) error
- func (r *Client) Post(ctx context.Context, path string, params, res any, ...) error
- func (r *Client) Put(ctx context.Context, path string, params, res any, ...) error
- type Error
- type PangeaResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultClientOptions ¶
func DefaultClientOptions() []option.RequestOption
DefaultClientOptions read from the environment (AIDR_API_TOKEN, AIDR_BASE_URL_TEMPLATE). This should be used to initialize new clients.
func Opt ¶
func Opt[T comparable](v T) param.Opt[T]
Types ¶
type AIGuardGetAsyncRequestResponse ¶
type AIGuardGetAsyncRequestResponse struct {
// A unique identifier assigned to each request made to the API. It is used to
// track and identify a specific request and its associated data. The `request_id`
// can be helpful for troubleshooting, auditing, and tracing the flow of requests
// within the system. It allows users to reference and retrieve information related
// to a particular request, such as the response, parameters, and raw data
// associated with that specific request.
//
// “`
// "request_id":"prq_x6fdiizbon6j3bsdvnpmwxsz2aan7fqd"
// “`
RequestID string `json:"request_id,required"`
// The timestamp indicates the exact moment when a request is made to the API. It
// represents the date and time at which the request was initiated by the client.
// The `request_time` is useful for tracking and analyzing the timing of requests,
// measuring response times, and monitoring performance metrics. It allows users to
// determine the duration between the request initiation and the corresponding
// response, aiding in the assessment of API performance and latency.
//
// “`
// "request_time":"2022-09-21T17:24:33.105Z"
// “`
RequestTime time.Time `json:"request_time,required" format:"date-time"`
// Duration it takes for the API to process a request and generate a response. It
// represents the elapsed time from when the request is received by the API to when
// the corresponding response is returned to the client.
//
// “`
// "response_time":"2022-09-21T17:24:34.007Z"
// “`
ResponseTime time.Time `json:"response_time,required" format:"date-time"`
// It represents the status or outcome of the API request made for IP information.
// It indicates the current state or condition of the request and provides
// information on the success or failure of the request.
//
// “`
// "status":"success"
// “`
Status string `json:"status,required"`
Result any `json:"result"`
// Provides a concise and brief overview of the purpose or primary objective of the
// API endpoint. It serves as a high-level summary or description of the
// functionality or feature offered by the endpoint.
Summary string `json:"summary"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
RequestID respjson.Field
RequestTime respjson.Field
ResponseTime respjson.Field
Status respjson.Field
Result respjson.Field
Summary respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Pangea standard response schema
func (AIGuardGetAsyncRequestResponse) RawJSON ¶
func (r AIGuardGetAsyncRequestResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGetAsyncRequestResponse) UnmarshalJSON ¶
func (r *AIGuardGetAsyncRequestResponse) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsParams ¶
type AIGuardGuardChatCompletionsParams struct {
// 'messages' contains Prompt content and role array in JSON format. The `content`
// is the multimodel text or image input that will be analyzed. Additional
// properties such as 'tools' may be provided for analysis.
GuardInput any `json:"guard_input,omitzero,required"`
// Id of source application/agent
AppID param.Opt[string] `json:"app_id,omitzero"`
// (AIDR) collector instance id.
CollectorInstanceID param.Opt[string] `json:"collector_instance_id,omitzero"`
// Underlying LLM. Example: 'OpenAI'.
LlmProvider param.Opt[string] `json:"llm_provider,omitzero"`
// Model used to perform the event. Example: 'gpt'.
Model param.Opt[string] `json:"model,omitzero"`
// Model version used to perform the event. Example: '3.5'.
ModelVersion param.Opt[string] `json:"model_version,omitzero"`
// IP address of user or app or agent.
SourceIP param.Opt[string] `json:"source_ip,omitzero"`
// Location of user or app or agent.
SourceLocation param.Opt[string] `json:"source_location,omitzero"`
// For gateway-like integrations with multi-tenant support.
TenantID param.Opt[string] `json:"tenant_id,omitzero"`
// User/Service account id/service account
UserID param.Opt[string] `json:"user_id,omitzero"`
// (AIDR) Event Type.
//
// Any of "input", "output", "tool_input", "tool_output", "tool_listing".
EventType AIGuardGuardChatCompletionsParamsEventType `json:"event_type,omitzero"`
// (AIDR) Logging schema.
ExtraInfo AIGuardGuardChatCompletionsParamsExtraInfo `json:"extra_info,omitzero"`
// contains filtered or unexported fields
}
func (AIGuardGuardChatCompletionsParams) MarshalJSON ¶
func (r AIGuardGuardChatCompletionsParams) MarshalJSON() (data []byte, err error)
func (*AIGuardGuardChatCompletionsParams) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsParams) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsParamsEventType ¶
type AIGuardGuardChatCompletionsParamsEventType string
(AIDR) Event Type.
const ( AIGuardGuardChatCompletionsParamsEventTypeInput AIGuardGuardChatCompletionsParamsEventType = "input" AIGuardGuardChatCompletionsParamsEventTypeOutput AIGuardGuardChatCompletionsParamsEventType = "output" AIGuardGuardChatCompletionsParamsEventTypeToolInput AIGuardGuardChatCompletionsParamsEventType = "tool_input" AIGuardGuardChatCompletionsParamsEventTypeToolOutput AIGuardGuardChatCompletionsParamsEventType = "tool_output" AIGuardGuardChatCompletionsParamsEventTypeToolListing AIGuardGuardChatCompletionsParamsEventType = "tool_listing" )
type AIGuardGuardChatCompletionsParamsExtraInfo ¶
type AIGuardGuardChatCompletionsParamsExtraInfo struct {
// The group of subject actor.
ActorGroup param.Opt[string] `json:"actor_group,omitzero"`
// Name of subject actor/service account.
ActorName param.Opt[string] `json:"actor_name,omitzero"`
// The group of source application/agent.
AppGroup param.Opt[string] `json:"app_group,omitzero"`
// Name of source application/agent.
AppName param.Opt[string] `json:"app_name,omitzero"`
// Version of the source application/agent.
AppVersion param.Opt[string] `json:"app_version,omitzero"`
// Geographic region or data center.
SourceRegion param.Opt[string] `json:"source_region,omitzero"`
// Sub tenant of the user or organization
SubTenant param.Opt[string] `json:"sub_tenant,omitzero"`
// Each item groups tools for a given MCP server.
McpTools []AIGuardGuardChatCompletionsParamsExtraInfoMcpTool `json:"mcp_tools,omitzero"`
ExtraFields map[string]any `json:"-"`
// contains filtered or unexported fields
}
(AIDR) Logging schema.
func (AIGuardGuardChatCompletionsParamsExtraInfo) MarshalJSON ¶
func (r AIGuardGuardChatCompletionsParamsExtraInfo) MarshalJSON() (data []byte, err error)
func (*AIGuardGuardChatCompletionsParamsExtraInfo) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsParamsExtraInfo) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsParamsExtraInfoMcpTool ¶
type AIGuardGuardChatCompletionsParamsExtraInfoMcpTool struct {
// MCP server name
ServerName string `json:"server_name,required"`
Tools []string `json:"tools,omitzero,required"`
// contains filtered or unexported fields
}
The properties ServerName, Tools are required.
func (AIGuardGuardChatCompletionsParamsExtraInfoMcpTool) MarshalJSON ¶
func (r AIGuardGuardChatCompletionsParamsExtraInfoMcpTool) MarshalJSON() (data []byte, err error)
func (*AIGuardGuardChatCompletionsParamsExtraInfoMcpTool) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsParamsExtraInfoMcpTool) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponse ¶
type AIGuardGuardChatCompletionsResponse struct {
// A unique identifier assigned to each request made to the API. It is used to
// track and identify a specific request and its associated data. The `request_id`
// can be helpful for troubleshooting, auditing, and tracing the flow of requests
// within the system. It allows users to reference and retrieve information related
// to a particular request, such as the response, parameters, and raw data
// associated with that specific request.
//
// “`
// "request_id":"prq_x6fdiizbon6j3bsdvnpmwxsz2aan7fqd"
// “`
RequestID string `json:"request_id,required"`
// The timestamp indicates the exact moment when a request is made to the API. It
// represents the date and time at which the request was initiated by the client.
// The `request_time` is useful for tracking and analyzing the timing of requests,
// measuring response times, and monitoring performance metrics. It allows users to
// determine the duration between the request initiation and the corresponding
// response, aiding in the assessment of API performance and latency.
//
// “`
// "request_time":"2022-09-21T17:24:33.105Z"
// “`
RequestTime time.Time `json:"request_time,required" format:"date-time"`
// Duration it takes for the API to process a request and generate a response. It
// represents the elapsed time from when the request is received by the API to when
// the corresponding response is returned to the client.
//
// “`
// "response_time":"2022-09-21T17:24:34.007Z"
// “`
ResponseTime time.Time `json:"response_time,required" format:"date-time"`
Result AIGuardGuardChatCompletionsResponseResult `json:"result,required"`
// It represents the status or outcome of the API request made for IP information.
// It indicates the current state or condition of the request and provides
// information on the success or failure of the request.
//
// “`
// "status":"success"
// “`
//
// Any of "Success".
Status AIGuardGuardChatCompletionsResponseStatus `json:"status,required"`
// Provides a concise and brief overview of the purpose or primary objective of the
// API endpoint. It serves as a high-level summary or description of the
// functionality or feature offered by the endpoint.
Summary string `json:"summary"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
RequestID respjson.Field
RequestTime respjson.Field
ResponseTime respjson.Field
Result respjson.Field
Status respjson.Field
Summary respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AIGuardGuardChatCompletionsResponse) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponse) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponse) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseResult ¶
type AIGuardGuardChatCompletionsResponseResult struct {
// Result of the policy analyzing and input prompt.
Detectors AIGuardGuardChatCompletionsResponseResultDetectors `json:"detectors,required"`
// Result of the recipe evaluating configured rules
AccessRules any `json:"access_rules"`
// Whether or not the prompt triggered a block detection.
Blocked bool `json:"blocked"`
// If an FPE redaction method returned results, this will be the context passed to
// unredact.
FpeContext string `json:"fpe_context" format:"base64"`
// Updated structured prompt.
GuardOutput any `json:"guard_output"`
// The Policy that was used.
Policy string `json:"policy"`
// Whether or not the original input was transformed.
Transformed bool `json:"transformed"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Detectors respjson.Field
AccessRules respjson.Field
Blocked respjson.Field
FpeContext respjson.Field
GuardOutput respjson.Field
Policy respjson.Field
Transformed respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AIGuardGuardChatCompletionsResponseResult) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponseResult) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponseResult) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponseResult) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseResultDetectors ¶
type AIGuardGuardChatCompletionsResponseResultDetectors struct {
Code AIGuardGuardChatCompletionsResponseResultDetectorsCode `json:"code"`
Competitors AIGuardGuardChatCompletionsResponseResultDetectorsCompetitors `json:"competitors"`
ConfidentialAndPiiEntity AIGuardGuardChatCompletionsResponseResultDetectorsConfidentialAndPiiEntity `json:"confidential_and_pii_entity"`
CustomEntity AIGuardGuardChatCompletionsResponseResultDetectorsCustomEntity `json:"custom_entity"`
Language AIGuardGuardChatCompletionsResponseResultDetectorsLanguage `json:"language"`
MaliciousEntity AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousEntity `json:"malicious_entity"`
MaliciousPrompt AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousPrompt `json:"malicious_prompt"`
SecretAndKeyEntity AIGuardGuardChatCompletionsResponseResultDetectorsSecretAndKeyEntity `json:"secret_and_key_entity"`
Topic AIGuardGuardChatCompletionsResponseResultDetectorsTopic `json:"topic"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Code respjson.Field
Competitors respjson.Field
ConfidentialAndPiiEntity respjson.Field
CustomEntity respjson.Field
Language respjson.Field
MaliciousEntity respjson.Field
MaliciousPrompt respjson.Field
SecretAndKeyEntity respjson.Field
Topic respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Result of the policy analyzing and input prompt.
func (AIGuardGuardChatCompletionsResponseResultDetectors) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponseResultDetectors) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponseResultDetectors) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponseResultDetectors) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseResultDetectorsCode ¶
type AIGuardGuardChatCompletionsResponseResultDetectorsCode struct {
// Details about the detected code.
Data AIGuardGuardChatCompletionsResponseResultDetectorsCodeData `json:"data"`
// Whether or not the Code was detected.
Detected bool `json:"detected"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Detected respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AIGuardGuardChatCompletionsResponseResultDetectorsCode) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponseResultDetectorsCode) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponseResultDetectorsCode) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponseResultDetectorsCode) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseResultDetectorsCodeData ¶
type AIGuardGuardChatCompletionsResponseResultDetectorsCodeData struct {
// The action taken by this Detector
Action string `json:"action"`
Language string `json:"language"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Action respjson.Field
Language respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Details about the detected code.
func (AIGuardGuardChatCompletionsResponseResultDetectorsCodeData) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponseResultDetectorsCodeData) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponseResultDetectorsCodeData) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponseResultDetectorsCodeData) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseResultDetectorsCompetitors ¶
type AIGuardGuardChatCompletionsResponseResultDetectorsCompetitors struct {
// Details about the detected entities.
Data AIGuardGuardChatCompletionsResponseResultDetectorsCompetitorsData `json:"data"`
// Whether or not the Competitors were detected.
Detected bool `json:"detected"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Detected respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AIGuardGuardChatCompletionsResponseResultDetectorsCompetitors) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponseResultDetectorsCompetitors) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponseResultDetectorsCompetitors) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponseResultDetectorsCompetitors) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseResultDetectorsCompetitorsData ¶
type AIGuardGuardChatCompletionsResponseResultDetectorsCompetitorsData struct {
// The action taken by this Detector
Action string `json:"action"`
// Detected entities.
Entities []string `json:"entities"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Action respjson.Field
Entities respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Details about the detected entities.
func (AIGuardGuardChatCompletionsResponseResultDetectorsCompetitorsData) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponseResultDetectorsCompetitorsData) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponseResultDetectorsCompetitorsData) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponseResultDetectorsCompetitorsData) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseResultDetectorsConfidentialAndPiiEntity ¶
type AIGuardGuardChatCompletionsResponseResultDetectorsConfidentialAndPiiEntity struct {
// Details about the detected entities.
Data AIGuardGuardChatCompletionsResponseResultDetectorsConfidentialAndPiiEntityData `json:"data"`
// Whether or not the PII Entities were detected.
Detected bool `json:"detected"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Detected respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AIGuardGuardChatCompletionsResponseResultDetectorsConfidentialAndPiiEntity) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponseResultDetectorsConfidentialAndPiiEntity) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponseResultDetectorsConfidentialAndPiiEntity) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponseResultDetectorsConfidentialAndPiiEntity) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseResultDetectorsConfidentialAndPiiEntityData ¶
type AIGuardGuardChatCompletionsResponseResultDetectorsConfidentialAndPiiEntityData struct {
// Detected redaction rules.
Entities []AIGuardGuardChatCompletionsResponseResultDetectorsConfidentialAndPiiEntityDataEntity `json:"entities"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Entities respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Details about the detected entities.
func (AIGuardGuardChatCompletionsResponseResultDetectorsConfidentialAndPiiEntityData) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponseResultDetectorsConfidentialAndPiiEntityData) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponseResultDetectorsConfidentialAndPiiEntityData) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponseResultDetectorsConfidentialAndPiiEntityData) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseResultDetectorsConfidentialAndPiiEntityDataEntity ¶
type AIGuardGuardChatCompletionsResponseResultDetectorsConfidentialAndPiiEntityDataEntity struct {
// The action taken on this Entity
Action string `json:"action,required"`
Type string `json:"type,required"`
Value string `json:"value,required"`
StartPos int64 `json:"start_pos"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Action respjson.Field
Type respjson.Field
Value respjson.Field
StartPos respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AIGuardGuardChatCompletionsResponseResultDetectorsConfidentialAndPiiEntityDataEntity) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponseResultDetectorsConfidentialAndPiiEntityDataEntity) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponseResultDetectorsConfidentialAndPiiEntityDataEntity) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponseResultDetectorsConfidentialAndPiiEntityDataEntity) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseResultDetectorsCustomEntity ¶
type AIGuardGuardChatCompletionsResponseResultDetectorsCustomEntity struct {
// Details about the detected entities.
Data AIGuardGuardChatCompletionsResponseResultDetectorsCustomEntityData `json:"data"`
// Whether or not the Custom Entities were detected.
Detected bool `json:"detected"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Detected respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AIGuardGuardChatCompletionsResponseResultDetectorsCustomEntity) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponseResultDetectorsCustomEntity) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponseResultDetectorsCustomEntity) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponseResultDetectorsCustomEntity) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseResultDetectorsCustomEntityData ¶
type AIGuardGuardChatCompletionsResponseResultDetectorsCustomEntityData struct {
// Detected redaction rules.
Entities []AIGuardGuardChatCompletionsResponseResultDetectorsCustomEntityDataEntity `json:"entities"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Entities respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Details about the detected entities.
func (AIGuardGuardChatCompletionsResponseResultDetectorsCustomEntityData) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponseResultDetectorsCustomEntityData) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponseResultDetectorsCustomEntityData) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponseResultDetectorsCustomEntityData) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseResultDetectorsCustomEntityDataEntity ¶
type AIGuardGuardChatCompletionsResponseResultDetectorsCustomEntityDataEntity struct {
// The action taken on this Entity
Action string `json:"action,required"`
Type string `json:"type,required"`
Value string `json:"value,required"`
StartPos int64 `json:"start_pos"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Action respjson.Field
Type respjson.Field
Value respjson.Field
StartPos respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AIGuardGuardChatCompletionsResponseResultDetectorsCustomEntityDataEntity) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponseResultDetectorsCustomEntityDataEntity) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponseResultDetectorsCustomEntityDataEntity) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponseResultDetectorsCustomEntityDataEntity) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseResultDetectorsLanguage ¶
type AIGuardGuardChatCompletionsResponseResultDetectorsLanguage struct {
// Details about the detected languages.
Data AIGuardGuardChatCompletionsResponseResultDetectorsLanguageData `json:"data"`
// Whether or not the Languages were detected.
Detected bool `json:"detected"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Detected respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AIGuardGuardChatCompletionsResponseResultDetectorsLanguage) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponseResultDetectorsLanguage) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponseResultDetectorsLanguage) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponseResultDetectorsLanguage) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseResultDetectorsLanguageData ¶
type AIGuardGuardChatCompletionsResponseResultDetectorsLanguageData struct {
// The action taken by this Detector
Action string `json:"action"`
Language string `json:"language"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Action respjson.Field
Language respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Details about the detected languages.
func (AIGuardGuardChatCompletionsResponseResultDetectorsLanguageData) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponseResultDetectorsLanguageData) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponseResultDetectorsLanguageData) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponseResultDetectorsLanguageData) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousEntity ¶
type AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousEntity struct {
// Details about the detected entities.
Data AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousEntityData `json:"data"`
// Whether or not the Malicious Entities were detected.
Detected bool `json:"detected"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Detected respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousEntity) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousEntity) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousEntity) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousEntity) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousEntityData ¶
type AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousEntityData struct {
// Detected harmful items.
Entities []AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousEntityDataEntity `json:"entities"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Entities respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Details about the detected entities.
func (AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousEntityData) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousEntityData) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousEntityData) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousEntityData) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousEntityDataEntity ¶
type AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousEntityDataEntity struct {
Type string `json:"type,required"`
Value string `json:"value,required"`
Raw any `json:"raw"`
StartPos int64 `json:"start_pos"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
Value respjson.Field
Raw respjson.Field
StartPos respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousEntityDataEntity) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousEntityDataEntity) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousEntityDataEntity) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousEntityDataEntity) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousPrompt ¶
type AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousPrompt struct {
// Details about the analyzers.
Data AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousPromptData `json:"data"`
// Whether or not the Malicious Prompt was detected.
Detected bool `json:"detected"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Detected respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousPrompt) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousPrompt) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousPrompt) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousPrompt) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousPromptData ¶
type AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousPromptData struct {
// The action taken by this Detector
Action string `json:"action"`
// Triggered prompt injection analyzers.
AnalyzerResponses []AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousPromptDataAnalyzerResponse `json:"analyzer_responses"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Action respjson.Field
AnalyzerResponses respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Details about the analyzers.
func (AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousPromptData) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousPromptData) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousPromptData) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousPromptData) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousPromptDataAnalyzerResponse ¶
type AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousPromptDataAnalyzerResponse struct {
Analyzer string `json:"analyzer,required"`
Confidence float64 `json:"confidence,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Analyzer respjson.Field
Confidence respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousPromptDataAnalyzerResponse) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousPromptDataAnalyzerResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousPromptDataAnalyzerResponse) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponseResultDetectorsMaliciousPromptDataAnalyzerResponse) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseResultDetectorsSecretAndKeyEntity ¶
type AIGuardGuardChatCompletionsResponseResultDetectorsSecretAndKeyEntity struct {
// Details about the detected entities.
Data AIGuardGuardChatCompletionsResponseResultDetectorsSecretAndKeyEntityData `json:"data"`
// Whether or not the Secret Entities were detected.
Detected bool `json:"detected"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Detected respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AIGuardGuardChatCompletionsResponseResultDetectorsSecretAndKeyEntity) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponseResultDetectorsSecretAndKeyEntity) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponseResultDetectorsSecretAndKeyEntity) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponseResultDetectorsSecretAndKeyEntity) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseResultDetectorsSecretAndKeyEntityData ¶
type AIGuardGuardChatCompletionsResponseResultDetectorsSecretAndKeyEntityData struct {
// Detected redaction rules.
Entities []AIGuardGuardChatCompletionsResponseResultDetectorsSecretAndKeyEntityDataEntity `json:"entities"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Entities respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Details about the detected entities.
func (AIGuardGuardChatCompletionsResponseResultDetectorsSecretAndKeyEntityData) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponseResultDetectorsSecretAndKeyEntityData) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponseResultDetectorsSecretAndKeyEntityData) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponseResultDetectorsSecretAndKeyEntityData) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseResultDetectorsSecretAndKeyEntityDataEntity ¶
type AIGuardGuardChatCompletionsResponseResultDetectorsSecretAndKeyEntityDataEntity struct {
// The action taken on this Entity
Action string `json:"action,required"`
Type string `json:"type,required"`
Value string `json:"value,required"`
StartPos int64 `json:"start_pos"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Action respjson.Field
Type respjson.Field
Value respjson.Field
StartPos respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AIGuardGuardChatCompletionsResponseResultDetectorsSecretAndKeyEntityDataEntity) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponseResultDetectorsSecretAndKeyEntityDataEntity) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponseResultDetectorsSecretAndKeyEntityDataEntity) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponseResultDetectorsSecretAndKeyEntityDataEntity) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseResultDetectorsTopic ¶
type AIGuardGuardChatCompletionsResponseResultDetectorsTopic struct {
// Details about the detected topics.
Data AIGuardGuardChatCompletionsResponseResultDetectorsTopicData `json:"data"`
// Whether or not the Topics were detected.
Detected bool `json:"detected"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Detected respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AIGuardGuardChatCompletionsResponseResultDetectorsTopic) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponseResultDetectorsTopic) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponseResultDetectorsTopic) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponseResultDetectorsTopic) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseResultDetectorsTopicData ¶
type AIGuardGuardChatCompletionsResponseResultDetectorsTopicData struct {
// The action taken by this Detector
Action string `json:"action"`
// List of topics detected
Topics []AIGuardGuardChatCompletionsResponseResultDetectorsTopicDataTopic `json:"topics"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Action respjson.Field
Topics respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Details about the detected topics.
func (AIGuardGuardChatCompletionsResponseResultDetectorsTopicData) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponseResultDetectorsTopicData) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponseResultDetectorsTopicData) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponseResultDetectorsTopicData) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseResultDetectorsTopicDataTopic ¶
type AIGuardGuardChatCompletionsResponseResultDetectorsTopicDataTopic struct {
Confidence float64 `json:"confidence,required"`
Topic string `json:"topic,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Confidence respjson.Field
Topic respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AIGuardGuardChatCompletionsResponseResultDetectorsTopicDataTopic) RawJSON ¶
func (r AIGuardGuardChatCompletionsResponseResultDetectorsTopicDataTopic) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardGuardChatCompletionsResponseResultDetectorsTopicDataTopic) UnmarshalJSON ¶
func (r *AIGuardGuardChatCompletionsResponseResultDetectorsTopicDataTopic) UnmarshalJSON(data []byte) error
type AIGuardGuardChatCompletionsResponseStatus ¶
type AIGuardGuardChatCompletionsResponseStatus string
It represents the status or outcome of the API request made for IP information. It indicates the current state or condition of the request and provides information on the success or failure of the request.
``` "status":"success" ```
const (
AIGuardGuardChatCompletionsResponseStatusSuccess AIGuardGuardChatCompletionsResponseStatus = "Success"
)
type AIGuardService ¶
type AIGuardService struct {
Options []option.RequestOption
ServiceName string
}
AIGuardService contains methods and other services that help with interacting with the AIDR API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAIGuardService method instead.
func NewAIGuardService ¶
func NewAIGuardService(opts ...option.RequestOption) (r AIGuardService)
NewAIGuardService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*AIGuardService) GetAsyncRequest ¶
func (r *AIGuardService) GetAsyncRequest(ctx context.Context, requestID string, opts ...option.RequestOption) (res *AIGuardGetAsyncRequestResponse, err error)
Will retrieve the result, or will return 202 if the original request is still in progress
func (*AIGuardService) GuardChatCompletions ¶
func (r *AIGuardService) GuardChatCompletions(ctx context.Context, body AIGuardGuardChatCompletionsParams, opts ...option.RequestOption) (res *AIGuardGuardChatCompletionsResponse, err error)
Analyze and redact content to avoid manipulation of the model, addition of malicious content, and other undesirable data transfers.
func (*AIGuardService) Unredact ¶ added in v1.2.0
func (r *AIGuardService) Unredact(ctx context.Context, body AIGuardUnredactParams, opts ...option.RequestOption) (res *AIGuardUnredactResponse, err error)
Decrypt or unredact fpe redactions
type AIGuardUnredactParams ¶ added in v1.2.0
type AIGuardUnredactParams struct {
// FPE context used to decrypt and unredact data
FpeContext string `json:"fpe_context,required" format:"base64"`
// Data to unredact
RedactedData any `json:"redacted_data,omitzero,required"`
// contains filtered or unexported fields
}
func (AIGuardUnredactParams) MarshalJSON ¶ added in v1.2.0
func (r AIGuardUnredactParams) MarshalJSON() (data []byte, err error)
func (*AIGuardUnredactParams) UnmarshalJSON ¶ added in v1.2.0
func (r *AIGuardUnredactParams) UnmarshalJSON(data []byte) error
type AIGuardUnredactResponse ¶ added in v1.2.0
type AIGuardUnredactResponse struct {
Result AIGuardUnredactResponseResult `json:"result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Result respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
PangeaResponse
}
func (AIGuardUnredactResponse) RawJSON ¶ added in v1.2.0
func (r AIGuardUnredactResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardUnredactResponse) UnmarshalJSON ¶ added in v1.2.0
func (r *AIGuardUnredactResponse) UnmarshalJSON(data []byte) error
type AIGuardUnredactResponseResult ¶ added in v1.2.0
type AIGuardUnredactResponseResult struct {
// The unredacted data
Data any `json:"data,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AIGuardUnredactResponseResult) RawJSON ¶ added in v1.2.0
func (r AIGuardUnredactResponseResult) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIGuardUnredactResponseResult) UnmarshalJSON ¶ added in v1.2.0
func (r *AIGuardUnredactResponseResult) UnmarshalJSON(data []byte) error
type Client ¶
type Client struct {
Options []option.RequestOption
AIGuard AIGuardService
}
Client creates a struct with services and top level methods that help with interacting with the AIDR API. You should not instantiate this client directly, and instead use the NewClient method instead.
func NewClient ¶
func NewClient(opts ...option.RequestOption) (r Client)
NewClient generates a new client with the default option read from the environment (AIDR_API_TOKEN, AIDR_BASE_URL_TEMPLATE). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.
func (*Client) Delete ¶
func (r *Client) Delete(ctx context.Context, path string, params, res any, opts ...option.RequestOption) error
Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Execute ¶
func (r *Client) Execute(ctx context.Context, method, path string, params, res any, opts ...option.RequestOption) error
Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.
If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.
The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned [url.Values] will be used as query strings to the url.
If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.
Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.
The response body will be deserialized into the res variable, depending on its type:
- A pointer to a *http.Response is populated by the raw response.
- A pointer to a byte array will be populated with the contents of the request body.
- A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
- A nil value will not read the response body.
For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.
func (*Client) Get ¶
func (r *Client) Get(ctx context.Context, path string, params, res any, opts ...option.RequestOption) error
Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Patch ¶
func (r *Client) Patch(ctx context.Context, path string, params, res any, opts ...option.RequestOption) error
Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
type PangeaResponse ¶ added in v1.2.0
type PangeaResponse struct {
// A unique identifier assigned to each request made to the API. It is used to
// track and identify a specific request and its associated data. The `request_id`
// can be helpful for troubleshooting, auditing, and tracing the flow of requests
// within the system. It allows users to reference and retrieve information related
// to a particular request, such as the response, parameters, and raw data
// associated with that specific request.
//
// “`
// "request_id":"prq_x6fdiizbon6j3bsdvnpmwxsz2aan7fqd"
// “`
RequestID string `json:"request_id,required"`
// The timestamp indicates the exact moment when a request is made to the API. It
// represents the date and time at which the request was initiated by the client.
// The `request_time` is useful for tracking and analyzing the timing of requests,
// measuring response times, and monitoring performance metrics. It allows users to
// determine the duration between the request initiation and the corresponding
// response, aiding in the assessment of API performance and latency.
//
// “`
// "request_time":"2022-09-21T17:24:33.105Z"
// “`
RequestTime time.Time `json:"request_time,required" format:"date-time"`
// Duration it takes for the API to process a request and generate a response. It
// represents the elapsed time from when the request is received by the API to when
// the corresponding response is returned to the client.
//
// “`
// "response_time":"2022-09-21T17:24:34.007Z"
// “`
ResponseTime time.Time `json:"response_time,required" format:"date-time"`
// It represents the status or outcome of the API request made for IP information.
// It indicates the current state or condition of the request and provides
// information on the success or failure of the request.
//
// “`
// "status":"success"
// “`
Status string `json:"status,required"`
// Provides a concise and brief overview of the purpose or primary objective of the
// API endpoint. It serves as a high-level summary or description of the
// functionality or feature offered by the endpoint.
Summary string `json:"summary"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
RequestID respjson.Field
RequestTime respjson.Field
ResponseTime respjson.Field
Status respjson.Field
Summary respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Pangea standard response schema
func (PangeaResponse) RawJSON ¶ added in v1.2.0
func (r PangeaResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*PangeaResponse) UnmarshalJSON ¶ added in v1.2.0
func (r *PangeaResponse) UnmarshalJSON(data []byte) error
Directories
¶
| Path | Synopsis |
|---|---|
|
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
|
Package json implements encoding and decoding of JSON as defined in RFC 7159. |
|
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
|
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package. |
|
packages
|
|