Documentation
¶
Overview ¶
Package rest provides REST protocol constants and error handling for A2A.
Index ¶
- func ConvertErrorBody(body *ErrorBodyJSON) error
- func FromRESTError(resp *http.Response) error
- func MakeCancelTaskPath(taskID string) string
- func MakeCreatePushConfigPath(taskID string) string
- func MakeDeletePushConfigPath(taskID, configID string) string
- func MakeGetExtendedAgentCardPath() string
- func MakeGetPushConfigPath(taskID, configID string) string
- func MakeGetTaskPath(taskID string) string
- func MakeListPushConfigsPath(taskID string) string
- func MakeListTasksPath() string
- func MakeSendMessagePath() string
- func MakeStreamMessagePath() string
- func MakeSubscribeTaskPath(taskID string) string
- func ParseStreamResponse(data []byte) (a2a.Event, error)
- type Error
- type ErrorBodyJSON
- type ErrorInfo
- type StatusError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertErrorBody ¶ added in v2.2.1
func ConvertErrorBody(body *ErrorBodyJSON) error
ConvertErrorBody converts a parsed google.rpc.Status error body into an a2a error.
func FromRESTError ¶ added in v2.2.1
FromRESTError converts an HTTP error response in google.rpc.Status format to an a2a error.
func MakeCancelTaskPath ¶
MakeCancelTaskPath returns the REST path for cancelling a task.
func MakeCreatePushConfigPath ¶
MakeCreatePushConfigPath returns the REST path for creating a push notification config for a task.
func MakeDeletePushConfigPath ¶
MakeDeletePushConfigPath returns the REST path for deleting a push notification config for a task.
func MakeGetExtendedAgentCardPath ¶
func MakeGetExtendedAgentCardPath() string
MakeGetExtendedAgentCardPath returns the REST path for getting an extended agent card.
func MakeGetPushConfigPath ¶
MakeGetPushConfigPath returns the REST path for getting a specific push notification config for a task.
func MakeGetTaskPath ¶
MakeGetTaskPath returns the REST path for getting a specific task.
func MakeListPushConfigsPath ¶
MakeListPushConfigsPath returns the REST path for listing push notification configs for a task.
func MakeListTasksPath ¶
func MakeListTasksPath() string
MakeListTasksPath returns the REST path for listing tasks.
func MakeSendMessagePath ¶
func MakeSendMessagePath() string
MakeSendMessagePath returns the REST path for sending a message.
func MakeStreamMessagePath ¶
func MakeStreamMessagePath() string
MakeStreamMessagePath returns the REST path for streaming messages.
func MakeSubscribeTaskPath ¶
MakeSubscribeTaskPath returns the REST path for subscribing to task updates.
Types ¶
type Error ¶
type Error struct {
Err StatusError `json:"error"`
// contains filtered or unexported fields
}
Error represents a google.rpc.Status error response per AIP-193.
func ToRESTError ¶
ToRESTError converts an error and a a2a.TaskID to a REST Error in google.rpc.Status format.
func (*Error) HTTPStatus ¶
HTTPStatus returns the HTTP status code for the error.
type ErrorBodyJSON ¶ added in v2.2.1
type ErrorBodyJSON struct {
Code int `json:"code"`
Status string `json:"status"`
Message string `json:"message"`
Details []json.RawMessage `json:"details"`
}
ErrorBodyJSON is the JSON shape of the inner error object in a google.rpc.Status response.
type ErrorInfo ¶
type ErrorInfo struct {
Type string `json:"@type"`
Reason string `json:"reason"`
Domain string `json:"domain"`
Metadata map[string]string `json:"metadata,omitempty"`
}
ErrorInfo represents a google.rpc.ErrorInfo message in the details array.
type StatusError ¶
type StatusError struct {
Code int `json:"code"`
Status string `json:"status"`
Message string `json:"message"`
Details []*errordetails.Typed `json:"details,omitempty"`
}
StatusError represents the inner error object in a google.rpc.Status response.