rest

package
v2.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package rest provides REST protocol constants and error handling for A2A.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeCancelTaskPath

func MakeCancelTaskPath(taskID string) string

MakeCancelTaskPath returns the REST path for cancelling a task.

func MakeCreatePushConfigPath

func MakeCreatePushConfigPath(taskID string) string

MakeCreatePushConfigPath returns the REST path for creating a push notification config for a task.

func MakeDeletePushConfigPath

func MakeDeletePushConfigPath(taskID, configID string) string

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

func MakeGetPushConfigPath(taskID, configID string) string

MakeGetPushConfigPath returns the REST path for getting a specific push notification config for a task.

func MakeGetTaskPath

func MakeGetTaskPath(taskID string) string

MakeGetTaskPath returns the REST path for getting a specific task.

func MakeListPushConfigsPath

func MakeListPushConfigsPath(taskID string) string

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

func MakeSubscribeTaskPath(taskID string) string

MakeSubscribeTaskPath returns the REST path for subscribing to task updates.

func ToA2AError

func ToA2AError(resp *http.Response) error

ToA2AError converts an HTTP error response in google.rpc.Status format to an a2a error.

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

func ToRESTError(err error, taskID a2a.TaskID) *Error

ToRESTError converts an error and a a2a.TaskID to a REST Error in google.rpc.Status format.

func (*Error) HTTPStatus

func (e *Error) HTTPStatus() int

HTTPStatus returns the HTTP status code for the error.

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 []any  `json:"details,omitempty"`
}

StatusError represents the inner error object in a google.rpc.Status response.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL