mirror of
https://github.com/hanzo-go/sdk.git
synced 2026-11-20 20:13:42 +00:00
7280 lines
264 KiB
Go
7280 lines
264 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"
|
|
"strings"
|
|
)
|
|
|
|
// AgentAPIService AgentAPI service
|
|
type AgentAPIService service
|
|
|
|
type AgentAPIDeleteAgentByRefRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
ref string
|
|
}
|
|
|
|
func (r AgentAPIDeleteAgentByRefRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.DeleteAgentByRefExecute(r)
|
|
}
|
|
|
|
/*
|
|
DeleteAgentByRef Removes an agent and every run recorded against it.
|
|
|
|
Removes an agent and every run recorded against it. Answers 204.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param ref Ref is the agent's public id (the agent_… handle create and list return) or its org-unique name, from the path. Either resolves the same agent.
|
|
@return AgentAPIDeleteAgentByRefRequest
|
|
*/
|
|
func (a *AgentAPIService) DeleteAgentByRef(ctx context.Context, ref string) AgentAPIDeleteAgentByRefRequest {
|
|
return AgentAPIDeleteAgentByRefRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
ref: ref,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *AgentAPIService) DeleteAgentByRefExecute(r AgentAPIDeleteAgentByRefRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodDelete
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.DeleteAgentByRef")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/{ref}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"ref"+"}", url.PathEscape(parameterValueToString(r.ref, "ref")), -1)
|
|
|
|
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/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 nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return 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 localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type AgentAPIDeleteAgentChatConversationsByIdRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
id string
|
|
}
|
|
|
|
func (r AgentAPIDeleteAgentChatConversationsByIdRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.DeleteAgentChatConversationsByIdExecute(r)
|
|
}
|
|
|
|
/*
|
|
DeleteAgentChatConversationsById Delete one of your conversations
|
|
|
|
Removes the conversation for good: every turn of it, and every link it was shared by, which stops opening and leaves the lists of the people it was open to. Only the member who opened it may delete it; anyone else is answered 404, as for one that is not there. Every delete is written to the audit trail.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id
|
|
@return AgentAPIDeleteAgentChatConversationsByIdRequest
|
|
*/
|
|
func (a *AgentAPIService) DeleteAgentChatConversationsById(ctx context.Context, id string) AgentAPIDeleteAgentChatConversationsByIdRequest {
|
|
return AgentAPIDeleteAgentChatConversationsByIdRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *AgentAPIService) DeleteAgentChatConversationsByIdExecute(r AgentAPIDeleteAgentChatConversationsByIdRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodDelete
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.DeleteAgentChatConversationsById")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/chat/conversations/{id}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
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{}
|
|
|
|
// 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 nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type AgentAPIDeleteAgentChatConversationsByIdSharesByShareRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
id string
|
|
share string
|
|
}
|
|
|
|
func (r AgentAPIDeleteAgentChatConversationsByIdSharesByShareRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.DeleteAgentChatConversationsByIdSharesByShareExecute(r)
|
|
}
|
|
|
|
/*
|
|
DeleteAgentChatConversationsByIdSharesByShare Revoke a link to one of your conversations
|
|
|
|
Ends one share of a conversation the caller owns, for every viewer: it leaves their lists, and its token opens nothing and reads exactly like a token that never existed. Every revoke is written to the audit trail.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id
|
|
@param share
|
|
@return AgentAPIDeleteAgentChatConversationsByIdSharesByShareRequest
|
|
*/
|
|
func (a *AgentAPIService) DeleteAgentChatConversationsByIdSharesByShare(ctx context.Context, id string, share string) AgentAPIDeleteAgentChatConversationsByIdSharesByShareRequest {
|
|
return AgentAPIDeleteAgentChatConversationsByIdSharesByShareRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
share: share,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *AgentAPIService) DeleteAgentChatConversationsByIdSharesByShareExecute(r AgentAPIDeleteAgentChatConversationsByIdSharesByShareRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodDelete
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.DeleteAgentChatConversationsByIdSharesByShare")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/chat/conversations/{id}/shares/{share}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
localVarPath = strings.Replace(localVarPath, "{"+"share"+"}", url.PathEscape(parameterValueToString(r.share, "share")), -1)
|
|
|
|
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{}
|
|
|
|
// 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 nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type AgentAPIDeleteAgentChatConversationsByIdSharesByShareViewersByViewerRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
id string
|
|
share string
|
|
viewer string
|
|
}
|
|
|
|
func (r AgentAPIDeleteAgentChatConversationsByIdSharesByShareViewersByViewerRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.DeleteAgentChatConversationsByIdSharesByShareViewersByViewerExecute(r)
|
|
}
|
|
|
|
/*
|
|
DeleteAgentChatConversationsByIdSharesByShareViewersByViewer Remove one viewer from a link
|
|
|
|
Closes one share of a conversation the caller owns to one viewer: it leaves their list, and the token no longer opens it for them. Everyone else the share is open to keeps it. Every removal is written to the audit trail.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id
|
|
@param share
|
|
@param viewer
|
|
@return AgentAPIDeleteAgentChatConversationsByIdSharesByShareViewersByViewerRequest
|
|
*/
|
|
func (a *AgentAPIService) DeleteAgentChatConversationsByIdSharesByShareViewersByViewer(ctx context.Context, id string, share string, viewer string) AgentAPIDeleteAgentChatConversationsByIdSharesByShareViewersByViewerRequest {
|
|
return AgentAPIDeleteAgentChatConversationsByIdSharesByShareViewersByViewerRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
share: share,
|
|
viewer: viewer,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *AgentAPIService) DeleteAgentChatConversationsByIdSharesByShareViewersByViewerExecute(r AgentAPIDeleteAgentChatConversationsByIdSharesByShareViewersByViewerRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodDelete
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.DeleteAgentChatConversationsByIdSharesByShareViewersByViewer")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/chat/conversations/{id}/shares/{share}/viewers/{viewer}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
localVarPath = strings.Replace(localVarPath, "{"+"share"+"}", url.PathEscape(parameterValueToString(r.share, "share")), -1)
|
|
localVarPath = strings.Replace(localVarPath, "{"+"viewer"+"}", url.PathEscape(parameterValueToString(r.viewer, "viewer")), -1)
|
|
|
|
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{}
|
|
|
|
// 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 nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type AgentAPIDeleteAgentChatSharesByShareRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
share string
|
|
}
|
|
|
|
func (r AgentAPIDeleteAgentChatSharesByShareRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.DeleteAgentChatSharesByShareExecute(r)
|
|
}
|
|
|
|
/*
|
|
DeleteAgentChatSharesByShare Revoke any link in your organization
|
|
|
|
For an admin of the caller's organization: ends one share made in it, for every viewer, exactly as its owner's revoke does. Anyone else is answered 403 (an admin of a held org included), and a share of another organization 404. Every revoke is written to the audit trail.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param share
|
|
@return AgentAPIDeleteAgentChatSharesByShareRequest
|
|
*/
|
|
func (a *AgentAPIService) DeleteAgentChatSharesByShare(ctx context.Context, share string) AgentAPIDeleteAgentChatSharesByShareRequest {
|
|
return AgentAPIDeleteAgentChatSharesByShareRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
share: share,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *AgentAPIService) DeleteAgentChatSharesByShareExecute(r AgentAPIDeleteAgentChatSharesByShareRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodDelete
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.DeleteAgentChatSharesByShare")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/chat/shares/{share}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"share"+"}", url.PathEscape(parameterValueToString(r.share, "share")), -1)
|
|
|
|
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{}
|
|
|
|
// 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 nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type AgentAPIDeleteAgentTargetsByIdRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
id string
|
|
}
|
|
|
|
func (r AgentAPIDeleteAgentTargetsByIdRequest) Execute() (*AgentTargetDeleted, *http.Response, error) {
|
|
return r.ApiService.DeleteAgentTargetsByIdExecute(r)
|
|
}
|
|
|
|
/*
|
|
DeleteAgentTargetsById Deregisters one machine.
|
|
|
|
Deregisters one machine. Only its owner, or an org admin, may
|
|
remove it; an unknown id, a cross-org id and a machine owned by someone else
|
|
all answer the same not-found, so a probe learns nothing about what exists.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the target to act on, from the path.
|
|
@return AgentAPIDeleteAgentTargetsByIdRequest
|
|
*/
|
|
func (a *AgentAPIService) DeleteAgentTargetsById(ctx context.Context, id string) AgentAPIDeleteAgentTargetsByIdRequest {
|
|
return AgentAPIDeleteAgentTargetsByIdRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentTargetDeleted
|
|
func (a *AgentAPIService) DeleteAgentTargetsByIdExecute(r AgentAPIDeleteAgentTargetsByIdRequest) (*AgentTargetDeleted, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodDelete
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentTargetDeleted
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.DeleteAgentTargetsById")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/targets/{id}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
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 AgentAPIGetAgentRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
}
|
|
|
|
func (r AgentAPIGetAgentRequest) Execute() (*AgentAgentList, *http.Response, error) {
|
|
return r.ApiService.GetAgentExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgent Returns every agent defined in the caller's org, each with the number of runs recorded against it.
|
|
|
|
Returns every agent defined in the caller's org, each with the
|
|
number of runs recorded against it. A retired built-in is left out.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return AgentAPIGetAgentRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgent(ctx context.Context) AgentAPIGetAgentRequest {
|
|
return AgentAPIGetAgentRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentAgentList
|
|
func (a *AgentAPIService) GetAgentExecute(r AgentAPIGetAgentRequest) (*AgentAgentList, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentAgentList
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgent")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent"
|
|
|
|
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 AgentAPIGetAgentActivityRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
}
|
|
|
|
func (r AgentAPIGetAgentActivityRequest) Execute() (*AgentActivityFeed, *http.Response, error) {
|
|
return r.ApiService.GetAgentActivityExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentActivity Serves the recent-activity feed.
|
|
|
|
Serves the recent-activity feed. Events are REAL: each of the
|
|
caller's own recorded runs is an invoked (ok) or failed (error) event; each of
|
|
the org's agents' create/update timestamps are created/updated events. Merged, newest first,
|
|
capped. Nothing is invented — an org with no agents and no runs gets [].
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return AgentAPIGetAgentActivityRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentActivity(ctx context.Context) AgentAPIGetAgentActivityRequest {
|
|
return AgentAPIGetAgentActivityRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentActivityFeed
|
|
func (a *AgentAPIService) GetAgentActivityExecute(r AgentAPIGetAgentActivityRequest) (*AgentActivityFeed, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentActivityFeed
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentActivity")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/activity"
|
|
|
|
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 AgentAPIGetAgentBuildsRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
limit *int64
|
|
}
|
|
|
|
// Limit caps the page. Absent, zero or over 500 reads as 100.
|
|
func (r AgentAPIGetAgentBuildsRequest) Limit(limit int64) AgentAPIGetAgentBuildsRequest {
|
|
r.limit = &limit
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIGetAgentBuildsRequest) Execute() (*AgentBuildList, *http.Response, error) {
|
|
return r.ApiService.GetAgentBuildsExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentBuilds Returns the public index of every published build, most recently updated first, so a gallery can link straight to the story behind each product.
|
|
|
|
Returns the public index of every published build, most recently
|
|
updated first, so a gallery can link straight to the story behind each product.
|
|
PUBLIC, no tenancy: publishing is the author's act, and only published root
|
|
sessions appear here.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return AgentAPIGetAgentBuildsRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentBuilds(ctx context.Context) AgentAPIGetAgentBuildsRequest {
|
|
return AgentAPIGetAgentBuildsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentBuildList
|
|
func (a *AgentAPIService) GetAgentBuildsExecute(r AgentAPIGetAgentBuildsRequest) (*AgentBuildList, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentBuildList
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentBuilds")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/builds"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
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 AgentAPIGetAgentBuildsByOrgByProjectRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
org string
|
|
project string
|
|
}
|
|
|
|
func (r AgentAPIGetAgentBuildsByOrgByProjectRequest) Execute() (*AgentBuildView, *http.Response, error) {
|
|
return r.ApiService.GetAgentBuildsByOrgByProjectExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentBuildsByOrgByProject Returns the readable build of one product: the agent session that produced it, turn by turn — the prompts, the reasoning, the commits each turn produced — plus the exact `git log` that re-derives every commit binding from git itself, so nothing here has to be taken on trust.
|
|
|
|
Returns the readable build of one product: the agent session that
|
|
produced it, turn by turn — the prompts, the reasoning, the commits each turn
|
|
produced — plus the exact `git log` that re-derives every commit binding from
|
|
git itself, so nothing here has to be taken on trust.
|
|
|
|
PUBLIC, no tenancy: it answers only for a session its author explicitly
|
|
published, which is what makes it safe to be anonymous. An unpublished session
|
|
is invisible here no matter who asks; its owner reads it through the org-scoped
|
|
/v1/agent/sessions routes, which need a validated principal.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param org Org is the org that published the build, from the path.
|
|
@param project Project is the product's slug, from the path.
|
|
@return AgentAPIGetAgentBuildsByOrgByProjectRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentBuildsByOrgByProject(ctx context.Context, org string, project string) AgentAPIGetAgentBuildsByOrgByProjectRequest {
|
|
return AgentAPIGetAgentBuildsByOrgByProjectRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
org: org,
|
|
project: project,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentBuildView
|
|
func (a *AgentAPIService) GetAgentBuildsByOrgByProjectExecute(r AgentAPIGetAgentBuildsByOrgByProjectRequest) (*AgentBuildView, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentBuildView
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentBuildsByOrgByProject")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/builds/{org}/{project}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"org"+"}", url.PathEscape(parameterValueToString(r.org, "org")), -1)
|
|
localVarPath = strings.Replace(localVarPath, "{"+"project"+"}", url.PathEscape(parameterValueToString(r.project, "project")), -1)
|
|
|
|
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 AgentAPIGetAgentByRefRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
ref string
|
|
}
|
|
|
|
func (r AgentAPIGetAgentByRefRequest) Execute() (*AgentAgentDetail, *http.Response, error) {
|
|
return r.ApiService.GetAgentByRefExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentByRef Returns one agent with its system prompt and the caller's own 20 most recent runs of it: a run's input and output are its person's.
|
|
|
|
Returns one agent with its system prompt and the caller's own 20 most
|
|
recent runs of it: a run's input and output are its person's.
|
|
The ref is the agent's public id or its org-unique name — a created agent is
|
|
immediately gettable by whatever create handed back.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param ref Ref is the agent's public id (the agent_… handle create and list return) or its org-unique name, from the path. Either resolves the same agent.
|
|
@return AgentAPIGetAgentByRefRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentByRef(ctx context.Context, ref string) AgentAPIGetAgentByRefRequest {
|
|
return AgentAPIGetAgentByRefRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
ref: ref,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentAgentDetail
|
|
func (a *AgentAPIService) GetAgentByRefExecute(r AgentAPIGetAgentByRefRequest) (*AgentAgentDetail, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentAgentDetail
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentByRef")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/{ref}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"ref"+"}", url.PathEscape(parameterValueToString(r.ref, "ref")), -1)
|
|
|
|
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 AgentAPIGetAgentByRefRunsRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
ref string
|
|
limit *int64
|
|
}
|
|
|
|
// Limit caps how many runs come back, newest first. Absent, zero or out of range (1..200) reads as 50.
|
|
func (r AgentAPIGetAgentByRefRunsRequest) Limit(limit int64) AgentAPIGetAgentByRefRunsRequest {
|
|
r.limit = &limit
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIGetAgentByRefRunsRequest) Execute() (*AgentRunList, *http.Response, error) {
|
|
return r.ApiService.GetAgentByRefRunsExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentByRefRuns Returns the caller's own runs of one agent, newest first — each run's input, its output or its error, and how long it took.
|
|
|
|
Returns the caller's own runs of one agent, newest first — each
|
|
run's input, its output or its error, and how long it took. A run is the
|
|
person's who asked for it, so another member's runs are not listed, nor an
|
|
org admin's view of them; a run no person asked for (a schedule) is listed to a
|
|
SuperAdmin alone. Every row is a run that actually happened.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param ref Ref is the agent's public id or its org-unique name, from the path.
|
|
@return AgentAPIGetAgentByRefRunsRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentByRefRuns(ctx context.Context, ref string) AgentAPIGetAgentByRefRunsRequest {
|
|
return AgentAPIGetAgentByRefRunsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
ref: ref,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentRunList
|
|
func (a *AgentAPIService) GetAgentByRefRunsExecute(r AgentAPIGetAgentByRefRunsRequest) (*AgentRunList, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentRunList
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentByRefRuns")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/{ref}/runs"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"ref"+"}", url.PathEscape(parameterValueToString(r.ref, "ref")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
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 AgentAPIGetAgentByRefSpendRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
ref string
|
|
by *string
|
|
}
|
|
|
|
// By groups the answer: \"component\" is the only grouping today.
|
|
func (r AgentAPIGetAgentByRefSpendRequest) By(by string) AgentAPIGetAgentByRefSpendRequest {
|
|
r.by = &by
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIGetAgentByRefSpendRequest) Execute() (*AgentSpendView, *http.Response, error) {
|
|
return r.ApiService.GetAgentByRefSpendExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentByRefSpend Answers what one of your org's agents has spent, in integer micro-USD.
|
|
|
|
Answers what one of your org's agents has spent, in integer micro-USD.
|
|
|
|
It answers the agent's budget — `cap_micro_usd` per `period`,
|
|
`max_task_micro_usd` per run — with what the current period has consumed,
|
|
what remains, and `by_component`: the spend attributed to `model` (every
|
|
completion the agent bought), `computer` (the runtime it was resident for)
|
|
and `tool`. A component with no spend is absent, not zero. Every amount is an
|
|
integer number of micro-USD (1,000,000 = $1); 11902000 is $11.902. Pass
|
|
`by=component` to ask for the breakdown by name — it is the one grouping, and
|
|
the default.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param ref Ref is the agent's public id or its org-unique name.
|
|
@return AgentAPIGetAgentByRefSpendRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentByRefSpend(ctx context.Context, ref string) AgentAPIGetAgentByRefSpendRequest {
|
|
return AgentAPIGetAgentByRefSpendRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
ref: ref,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentSpendView
|
|
func (a *AgentAPIService) GetAgentByRefSpendExecute(r AgentAPIGetAgentByRefSpendRequest) (*AgentSpendView, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentSpendView
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentByRefSpend")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/{ref}/spend"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"ref"+"}", url.PathEscape(parameterValueToString(r.ref, "ref")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.by != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "by", r.by, "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 AgentAPIGetAgentChatConversationsRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
}
|
|
|
|
func (r AgentAPIGetAgentChatConversationsRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.GetAgentChatConversationsExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentChatConversations List your own conversations
|
|
|
|
Returns a summary of each conversation the caller opened — id, title, when it was last appended to, and whether it is pinned or archived — for populating a thread list: pinned first, then most recent. Archived conversations are left out; `?archived=true` lists them alone.
|
|
|
|
A conversation is the person's who opened it, not the org's: another member of the same org lists none of it. Each org's conversations live in a store of its own, and inside it only the caller's are listed. One recorded before members were kept names nobody and is nobody's: `?memberless=true` lists those instead, for a SuperAdmin alone (403 for anyone else), and each such list is audited. A validated principal naming an org and a user the identity boundary attests no two people share is required: 401 without a principal, 403 without an org or such a user.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return AgentAPIGetAgentChatConversationsRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentChatConversations(ctx context.Context) AgentAPIGetAgentChatConversationsRequest {
|
|
return AgentAPIGetAgentChatConversationsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *AgentAPIService) GetAgentChatConversationsExecute(r AgentAPIGetAgentChatConversationsRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentChatConversations")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/chat/conversations"
|
|
|
|
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{}
|
|
|
|
// 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 nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type AgentAPIGetAgentChatConversationsByIdRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
id string
|
|
}
|
|
|
|
func (r AgentAPIGetAgentChatConversationsByIdRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.GetAgentChatConversationsByIdExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentChatConversationsById Read one agent thread in full
|
|
|
|
Returns every message of one of the caller's conversations in order — role, content, the assistant's tool calls where it made any, and each message's creation time — which is the transcript a client replays to resume a thread.
|
|
|
|
Another member's conversation, another org's, and one recorded with no member are answered 404, exactly as an id that never existed, so an id says nothing about whose it is (a SuperAdmin alone reads one with no member, and each read is audited). A turn sent under such an id opens a fresh conversation of the caller's. A validated principal naming an org and a user is required: 401 without a principal, 403 without an org or a user.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id
|
|
@return AgentAPIGetAgentChatConversationsByIdRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentChatConversationsById(ctx context.Context, id string) AgentAPIGetAgentChatConversationsByIdRequest {
|
|
return AgentAPIGetAgentChatConversationsByIdRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *AgentAPIService) GetAgentChatConversationsByIdExecute(r AgentAPIGetAgentChatConversationsByIdRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentChatConversationsById")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/chat/conversations/{id}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
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{}
|
|
|
|
// 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 nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type AgentAPIGetAgentChatConversationsByIdSharesRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
id string
|
|
}
|
|
|
|
func (r AgentAPIGetAgentChatConversationsByIdSharesRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.GetAgentChatConversationsByIdSharesExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentChatConversationsByIdShares List the live links to one of your conversations
|
|
|
|
Returns each unrevoked share of a conversation the caller owns: its id, its access (`read`), when it was made, and its `viewers` — each signed-in person who opened it, with the name they signed in with and when. Tokens are not in the list; they are returned only when a share is made.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id
|
|
@return AgentAPIGetAgentChatConversationsByIdSharesRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentChatConversationsByIdShares(ctx context.Context, id string) AgentAPIGetAgentChatConversationsByIdSharesRequest {
|
|
return AgentAPIGetAgentChatConversationsByIdSharesRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *AgentAPIService) GetAgentChatConversationsByIdSharesExecute(r AgentAPIGetAgentChatConversationsByIdSharesRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentChatConversationsByIdShares")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/chat/conversations/{id}/shares"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
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{}
|
|
|
|
// 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 nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type AgentAPIGetAgentChatPresetsRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
}
|
|
|
|
func (r AgentAPIGetAgentChatPresetsRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.GetAgentChatPresetsExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentChatPresets List the agent presets available to a caller
|
|
|
|
Returns the preset catalog: each entry's id, its description and whether it is server-executing — the flag that decides if a preset's tool calls run here or come back for the client to apply. The ids are what the round accepts in `preset`.
|
|
|
|
The catalog is compiled into the build, identical for every caller, and this is the one read in the group that needs no principal.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return AgentAPIGetAgentChatPresetsRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentChatPresets(ctx context.Context) AgentAPIGetAgentChatPresetsRequest {
|
|
return AgentAPIGetAgentChatPresetsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *AgentAPIService) GetAgentChatPresetsExecute(r AgentAPIGetAgentChatPresetsRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentChatPresets")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/chat/presets"
|
|
|
|
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{}
|
|
|
|
// 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 nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type AgentAPIGetAgentChatSharedRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
}
|
|
|
|
func (r AgentAPIGetAgentChatSharedRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.GetAgentChatSharedExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentChatShared List the chats shared with you
|
|
|
|
Returns each live share the caller opened signed in: its id, the conversation's title and when the caller first opened it, most recent first. A revoked share, or one its owner closed to the caller, is not in it. A signed-in person is required.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return AgentAPIGetAgentChatSharedRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentChatShared(ctx context.Context) AgentAPIGetAgentChatSharedRequest {
|
|
return AgentAPIGetAgentChatSharedRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *AgentAPIService) GetAgentChatSharedExecute(r AgentAPIGetAgentChatSharedRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentChatShared")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/chat/shared"
|
|
|
|
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{}
|
|
|
|
// 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 nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type AgentAPIGetAgentChatSharedByShareRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
share string
|
|
}
|
|
|
|
func (r AgentAPIGetAgentChatSharedByShareRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.GetAgentChatSharedByShareExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentChatSharedByShare Read a chat shared with you
|
|
|
|
Returns the snapshot of a share the caller is a viewer of, without its token, in the shape POST /shares/read answers a signed-in person. Anyone who is not one of its viewers is answered 404.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param share
|
|
@return AgentAPIGetAgentChatSharedByShareRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentChatSharedByShare(ctx context.Context, share string) AgentAPIGetAgentChatSharedByShareRequest {
|
|
return AgentAPIGetAgentChatSharedByShareRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
share: share,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *AgentAPIService) GetAgentChatSharedByShareExecute(r AgentAPIGetAgentChatSharedByShareRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentChatSharedByShare")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/chat/shared/{share}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"share"+"}", url.PathEscape(parameterValueToString(r.share, "share")), -1)
|
|
|
|
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{}
|
|
|
|
// 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 nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type AgentAPIGetAgentChatSharesRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
}
|
|
|
|
func (r AgentAPIGetAgentChatSharesRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.GetAgentChatSharesExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentChatShares List every live link in your organization
|
|
|
|
For an admin of the caller's organization: every unrevoked share made in it, with the conversation's id and title, the member who made it, when, and how many people it is open to. `?user=` narrows it to one member's. Anyone else is answered 403, and so is an admin of a held org such as hanzo, whose members are customers who are strangers to each other.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return AgentAPIGetAgentChatSharesRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentChatShares(ctx context.Context) AgentAPIGetAgentChatSharesRequest {
|
|
return AgentAPIGetAgentChatSharesRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *AgentAPIService) GetAgentChatSharesExecute(r AgentAPIGetAgentChatSharesRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentChatShares")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/chat/shares"
|
|
|
|
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{}
|
|
|
|
// 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 nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type AgentAPIGetAgentCodingBySessionArtifactsRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
session string
|
|
}
|
|
|
|
func (r AgentAPIGetAgentCodingBySessionArtifactsRequest) Execute() (*AgentCodingArtifacts, *http.Response, error) {
|
|
return r.ApiService.GetAgentCodingBySessionArtifactsExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentCodingBySessionArtifacts Lists what a coding run left, kept after its sandbox is gone: every file it added or changed and its whole change as `changes.patch`, stored beside the run; the ports it served, each a preview while its sandbox is kept; its pull request and where its work was published.
|
|
|
|
Lists what a coding run left, kept after its sandbox is gone: every file it
|
|
added or changed and its whole change as `changes.patch`, stored beside the run;
|
|
the ports it served, each a preview while its sandbox is kept; its pull request
|
|
and where its work was published. A run that is still working, or saved
|
|
nothing, answers an empty list.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param session Session is the run's handle — the sessionId POST /v1/agent/coding answered with — from the path.
|
|
@return AgentAPIGetAgentCodingBySessionArtifactsRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentCodingBySessionArtifacts(ctx context.Context, session string) AgentAPIGetAgentCodingBySessionArtifactsRequest {
|
|
return AgentAPIGetAgentCodingBySessionArtifactsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
session: session,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentCodingArtifacts
|
|
func (a *AgentAPIService) GetAgentCodingBySessionArtifactsExecute(r AgentAPIGetAgentCodingBySessionArtifactsRequest) (*AgentCodingArtifacts, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentCodingArtifacts
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentCodingBySessionArtifacts")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/coding/{session}/artifacts"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"session"+"}", url.PathEscape(parameterValueToString(r.session, "session")), -1)
|
|
|
|
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 AgentAPIGetAgentCodingBySessionBlobRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
session string
|
|
path *string
|
|
}
|
|
|
|
// Path is repo-relative, from the query. Empty is the repository's root.
|
|
func (r AgentAPIGetAgentCodingBySessionBlobRequest) Path(path string) AgentAPIGetAgentCodingBySessionBlobRequest {
|
|
r.path = &path
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIGetAgentCodingBySessionBlobRequest) Execute() (*AgentCodingBlob, *http.Response, error) {
|
|
return r.ApiService.GetAgentCodingBySessionBlobExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentCodingBySessionBlob Returns one file of a coding run's repository, read where the tree is read, in the shape GET /v1/git/repos/{name}/blob answers: text verbatim, anything else base64, and a file past the 1 MiB view cap marked truncated with no content.
|
|
|
|
Returns one file of a coding run's repository, read where the tree is read,
|
|
in the shape GET /v1/git/repos/{name}/blob answers: text verbatim, anything
|
|
else base64, and a file past the 1 MiB view cap marked truncated with no
|
|
content.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param session Session is the run's handle, from the path.
|
|
@return AgentAPIGetAgentCodingBySessionBlobRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentCodingBySessionBlob(ctx context.Context, session string) AgentAPIGetAgentCodingBySessionBlobRequest {
|
|
return AgentAPIGetAgentCodingBySessionBlobRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
session: session,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentCodingBlob
|
|
func (a *AgentAPIService) GetAgentCodingBySessionBlobExecute(r AgentAPIGetAgentCodingBySessionBlobRequest) (*AgentCodingBlob, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentCodingBlob
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentCodingBySessionBlob")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/coding/{session}/blob"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"session"+"}", url.PathEscape(parameterValueToString(r.session, "session")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.path != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "path", r.path, "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 AgentAPIGetAgentCodingBySessionChangesRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
session string
|
|
}
|
|
|
|
func (r AgentAPIGetAgentCodingBySessionChangesRequest) Execute() (*AgentCodingChanges, *http.Response, error) {
|
|
return r.ApiService.GetAgentCodingBySessionChangesExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentCodingBySessionChanges Returns what a coding run changed, read from the forge it pushed its branch to: the commits on its branch that the base does not have, newest first; the net change of the branch against its base, one entry per file with that file's patch; and its pull request with the reviews it has had, or null while it has none.
|
|
|
|
Returns what a coding run changed, read from the forge it pushed its branch
|
|
to: the commits on its branch that the base does not have, newest first; the
|
|
net change of the branch against its base, one entry per file with that file's
|
|
patch; and its pull request with the reviews it has had, or null while it has
|
|
none.
|
|
|
|
A run whose branch is not on the forge yet — still working, or finished with
|
|
nothing to change — answers with no commits, no files and no pull request.
|
|
Every read is made as the caller, so a repository they cannot open on the
|
|
forge is not found here either, whoever can see the run.
|
|
|
|
One answer is bounded, and says where it was cut rather than failing: the
|
|
newest 250 commits (`moreCommits` when there are more), the change up to 8 MiB
|
|
of diff or 3000 files (`moreFiles`, the last file marked truncated), and the
|
|
first 50 reviews (`moreReviews`), each body up to 16 KiB and 256 KiB across
|
|
them (`truncated` on a cut one). A caller has at most two of these reads in
|
|
flight and is answered 429 past that; two asking for the same change at once
|
|
share one read.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param session Session is the run's handle — the sessionId POST /v1/agent/coding answered with — from the path.
|
|
@return AgentAPIGetAgentCodingBySessionChangesRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentCodingBySessionChanges(ctx context.Context, session string) AgentAPIGetAgentCodingBySessionChangesRequest {
|
|
return AgentAPIGetAgentCodingBySessionChangesRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
session: session,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentCodingChanges
|
|
func (a *AgentAPIService) GetAgentCodingBySessionChangesExecute(r AgentAPIGetAgentCodingBySessionChangesRequest) (*AgentCodingChanges, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentCodingChanges
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentCodingBySessionChanges")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/coding/{session}/changes"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"session"+"}", url.PathEscape(parameterValueToString(r.session, "session")), -1)
|
|
|
|
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 AgentAPIGetAgentCodingBySessionTreeRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
session string
|
|
path *string
|
|
}
|
|
|
|
// Path is repo-relative, from the query. Empty is the repository's root.
|
|
func (r AgentAPIGetAgentCodingBySessionTreeRequest) Path(path string) AgentAPIGetAgentCodingBySessionTreeRequest {
|
|
r.path = &path
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIGetAgentCodingBySessionTreeRequest) Execute() (*AgentCodingTree, *http.Response, error) {
|
|
return r.ApiService.GetAgentCodingBySessionTreeExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentCodingBySessionTree Lists one directory of a coding run's repository, one level down with directories first: at the run's own branch once the forge holds it, and at the branch it started from until then — `ref` says which.
|
|
|
|
Lists one directory of a coding run's repository, one level down with
|
|
directories first: at the run's own branch once the forge holds it, and at the
|
|
branch it started from until then — `ref` says which. Walk down a level at a
|
|
time; an empty path is the root.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param session Session is the run's handle, from the path.
|
|
@return AgentAPIGetAgentCodingBySessionTreeRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentCodingBySessionTree(ctx context.Context, session string) AgentAPIGetAgentCodingBySessionTreeRequest {
|
|
return AgentAPIGetAgentCodingBySessionTreeRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
session: session,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentCodingTree
|
|
func (a *AgentAPIService) GetAgentCodingBySessionTreeExecute(r AgentAPIGetAgentCodingBySessionTreeRequest) (*AgentCodingTree, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentCodingTree
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentCodingBySessionTree")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/coding/{session}/tree"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"session"+"}", url.PathEscape(parameterValueToString(r.session, "session")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.path != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "path", r.path, "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 AgentAPIGetAgentMetricsRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
range_ *string
|
|
}
|
|
|
|
// Range is the window to bucket: 24H, 7D or 30D. Anything else reads as 30D.
|
|
func (r AgentAPIGetAgentMetricsRequest) Range_(range_ string) AgentAPIGetAgentMetricsRequest {
|
|
r.range_ = &range_
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIGetAgentMetricsRequest) Execute() (*AgentMetricsView, *http.Response, error) {
|
|
return r.ApiService.GetAgentMetricsExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentMetrics Serves the invocations-over-time histogram for the Agents dashboard, over the caller's own runs.
|
|
|
|
Serves the invocations-over-time histogram for the Agents
|
|
dashboard, over the caller's own runs. Every point is a REAL count of recorded
|
|
runs in that time bucket —
|
|
one series line per agent that ran in the window. The Resource Usage rollup is
|
|
all-null because this store meters no CPU/memory/storage/cost; the console
|
|
renders those as "—" rather than a fabricated figure. No runs => empty series
|
|
(an honest "not connected / no activity yet"), never a synthesized trend.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return AgentAPIGetAgentMetricsRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentMetrics(ctx context.Context) AgentAPIGetAgentMetricsRequest {
|
|
return AgentAPIGetAgentMetricsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentMetricsView
|
|
func (a *AgentAPIService) GetAgentMetricsExecute(r AgentAPIGetAgentMetricsRequest) (*AgentMetricsView, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentMetricsView
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentMetrics")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/metrics"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.range_ != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "range", r.range_, "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 AgentAPIGetAgentRunsRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
limit *int64
|
|
status *string
|
|
}
|
|
|
|
// Limit caps how many runs come back, newest first. Absent, zero or out of range (1..200) reads as 50.
|
|
func (r AgentAPIGetAgentRunsRequest) Limit(limit int64) AgentAPIGetAgentRunsRequest {
|
|
r.limit = &limit
|
|
return r
|
|
}
|
|
|
|
// Status keeps only runs with this outcome (\"ok\" or \"error\"). Empty keeps both. It is the filter an operator reaches for first — \"show me what broke\" — and answering it here rather than by paging the whole history client-side is the difference between a usable feed and a download.
|
|
func (r AgentAPIGetAgentRunsRequest) Status(status string) AgentAPIGetAgentRunsRequest {
|
|
r.status = &status
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIGetAgentRunsRequest) Execute() (*AgentRunList, *http.Response, error) {
|
|
return r.ApiService.GetAgentRunsExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentRuns Returns the caller's own agent runs across EVERY agent of the org, newest first — what ran, on which model, how long it took, and why it failed.
|
|
|
|
Returns the caller's own agent runs across EVERY agent of the org,
|
|
newest first — what ran, on which model, how long it took, and why it failed.
|
|
A run is the person's who asked for it: another member's never appears, and a
|
|
run no person asked for (a schedule) appears to a SuperAdmin alone.
|
|
|
|
It is the feed the per-agent history could not be: an operator asking "what is
|
|
this tenant's agent plane doing" does not start out knowing an agent ref, and
|
|
answering by listing the agents and then paging each one's history is N+1 round
|
|
trips to reconstruct one ordering the database already has (RunsSince, ordered
|
|
by created_at over the org index).
|
|
|
|
The org is the CALLER's, resolved from identity by tenantStore — never a
|
|
parameter. There is deliberately no org field on orgRunsQuery to forge: run
|
|
history is the tenant's own record, and the only tenant this can answer for is
|
|
the one asking.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return AgentAPIGetAgentRunsRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentRuns(ctx context.Context) AgentAPIGetAgentRunsRequest {
|
|
return AgentAPIGetAgentRunsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentRunList
|
|
func (a *AgentAPIService) GetAgentRunsExecute(r AgentAPIGetAgentRunsRequest) (*AgentRunList, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentRunList
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentRuns")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/runs"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.limit != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "")
|
|
}
|
|
if r.status != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "status", r.status, "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 AgentAPIGetAgentSessionsRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
root *string
|
|
parent *string
|
|
status *string
|
|
project *string
|
|
channel *string
|
|
kind *string
|
|
limit *int64
|
|
after *string
|
|
}
|
|
|
|
// Root scopes the page to one subagent tree (its root session id).
|
|
func (r AgentAPIGetAgentSessionsRequest) Root(root string) AgentAPIGetAgentSessionsRequest {
|
|
r.root = &root
|
|
return r
|
|
}
|
|
|
|
// Parent scopes the page to the direct children of one session. Ignored when root is set; with neither, only ROOT sessions come back.
|
|
func (r AgentAPIGetAgentSessionsRequest) Parent(parent string) AgentAPIGetAgentSessionsRequest {
|
|
r.parent = &parent
|
|
return r
|
|
}
|
|
|
|
// Status filters to running, paused, done or error.
|
|
func (r AgentAPIGetAgentSessionsRequest) Status(status string) AgentAPIGetAgentSessionsRequest {
|
|
r.status = &status
|
|
return r
|
|
}
|
|
|
|
// Project filters to the sessions tagged with one product slug.
|
|
func (r AgentAPIGetAgentSessionsRequest) Project(project string) AgentAPIGetAgentSessionsRequest {
|
|
r.project = &project
|
|
return r
|
|
}
|
|
|
|
// Channel filters to the sessions started in one collaborative channel — the query a space view runs to show what has been run in it.
|
|
func (r AgentAPIGetAgentSessionsRequest) Channel(channel string) AgentAPIGetAgentSessionsRequest {
|
|
r.channel = &channel
|
|
return r
|
|
}
|
|
|
|
// Kind filters to the sessions of one kind of run: \"coding\" lists coding runs, each carrying its repo, base, branch, environment and pull request.
|
|
func (r AgentAPIGetAgentSessionsRequest) Kind(kind string) AgentAPIGetAgentSessionsRequest {
|
|
r.kind = &kind
|
|
return r
|
|
}
|
|
|
|
// Limit caps the page. Absent, zero or over 500 reads as 100.
|
|
func (r AgentAPIGetAgentSessionsRequest) Limit(limit int64) AgentAPIGetAgentSessionsRequest {
|
|
r.limit = &limit
|
|
return r
|
|
}
|
|
|
|
// After is the `next` of the previous page. Absent starts at the newest.
|
|
func (r AgentAPIGetAgentSessionsRequest) After(after string) AgentAPIGetAgentSessionsRequest {
|
|
r.after = &after
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIGetAgentSessionsRequest) Execute() (*AgentSessionList, *http.Response, error) {
|
|
return r.ApiService.GetAgentSessionsExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentSessions Returns the caller org's live sessions, newest first — each with its event count, its direct-child count and a one-line preview of its latest event.
|
|
|
|
Returns the caller org's live sessions, newest first — each with
|
|
its event count, its direct-child count and a one-line preview of its latest
|
|
event. With no filter it returns ROOT sessions only, so a dashboard shows one
|
|
row per flow rather than one per subagent; ?root= or ?parent= descends.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return AgentAPIGetAgentSessionsRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentSessions(ctx context.Context) AgentAPIGetAgentSessionsRequest {
|
|
return AgentAPIGetAgentSessionsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentSessionList
|
|
func (a *AgentAPIService) GetAgentSessionsExecute(r AgentAPIGetAgentSessionsRequest) (*AgentSessionList, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentSessionList
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentSessions")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/sessions"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.root != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "root", r.root, "form", "")
|
|
}
|
|
if r.parent != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "parent", r.parent, "form", "")
|
|
}
|
|
if r.status != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "status", r.status, "form", "")
|
|
}
|
|
if r.project != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "project", r.project, "form", "")
|
|
}
|
|
if r.channel != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "channel", r.channel, "form", "")
|
|
}
|
|
if r.kind != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "kind", r.kind, "form", "")
|
|
}
|
|
if r.limit != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "")
|
|
}
|
|
if r.after != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "after", r.after, "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 AgentAPIGetAgentSessionsByIdRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
id string
|
|
}
|
|
|
|
func (r AgentAPIGetAgentSessionsByIdRequest) Execute() (*AgentSessionDetail, *http.Response, error) {
|
|
return r.ApiService.GetAgentSessionsByIdExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentSessionsById Returns one session with its direct child sessions and its 50 most recent events, oldest of those first.
|
|
|
|
Returns one session with its direct child sessions and its 50 most
|
|
recent events, oldest of those first. The children are those the caller may
|
|
see, by the rule the session itself is read by: a member's own, and every one
|
|
for an admin of the org. In a held org, where self-serve signups land beside
|
|
the platform's staff, a session is its person's alone.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the session to act on, from the path.
|
|
@return AgentAPIGetAgentSessionsByIdRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentSessionsById(ctx context.Context, id string) AgentAPIGetAgentSessionsByIdRequest {
|
|
return AgentAPIGetAgentSessionsByIdRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentSessionDetail
|
|
func (a *AgentAPIService) GetAgentSessionsByIdExecute(r AgentAPIGetAgentSessionsByIdRequest) (*AgentSessionDetail, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentSessionDetail
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentSessionsById")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/sessions/{id}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
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 AgentAPIGetAgentSessionsByIdControlRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
id string
|
|
after *int64
|
|
}
|
|
|
|
// After is the last seq this poller applied; only commands newer than it come back. Absent or negative reads as 0, which drains from the beginning.
|
|
func (r AgentAPIGetAgentSessionsByIdControlRequest) After(after int64) AgentAPIGetAgentSessionsByIdControlRequest {
|
|
r.after = &after
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIGetAgentSessionsByIdControlRequest) Execute() (*AgentControlDrain, *http.Response, error) {
|
|
return r.ApiService.GetAgentSessionsByIdControlExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentSessionsByIdControl Returns the steering commands (pause/resume/stop/message) recorded against the caller's own session that are newer than the cursor, oldest first, with the cursor to poll from next.
|
|
|
|
Returns the steering commands (pause/resume/stop/message)
|
|
recorded against the caller's own session that are newer than the cursor,
|
|
oldest first, with the cursor to poll from next. It is how a locally started
|
|
`hanzo code` session — which is not task-backed, so nothing forwards its
|
|
commands to an execution engine — consumes what the dashboard posted. Read-only
|
|
and bounded at 200 per poll, so a steady poll is cheap and an applied command is
|
|
never redelivered.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the session whose commands are being drained, from the path.
|
|
@return AgentAPIGetAgentSessionsByIdControlRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentSessionsByIdControl(ctx context.Context, id string) AgentAPIGetAgentSessionsByIdControlRequest {
|
|
return AgentAPIGetAgentSessionsByIdControlRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentControlDrain
|
|
func (a *AgentAPIService) GetAgentSessionsByIdControlExecute(r AgentAPIGetAgentSessionsByIdControlRequest) (*AgentControlDrain, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentControlDrain
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentSessionsByIdControl")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/sessions/{id}/control"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.after != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "after", r.after, "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 AgentAPIGetAgentSessionsByIdEventsRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
id string
|
|
after *int64
|
|
limit *int64
|
|
}
|
|
|
|
// After is the seq of the last event already read; the page starts after it. Absent or zero starts at the first event.
|
|
func (r AgentAPIGetAgentSessionsByIdEventsRequest) After(after int64) AgentAPIGetAgentSessionsByIdEventsRequest {
|
|
r.after = &after
|
|
return r
|
|
}
|
|
|
|
// Limit caps the page. Absent, zero or over 1000 reads as 200.
|
|
func (r AgentAPIGetAgentSessionsByIdEventsRequest) Limit(limit int64) AgentAPIGetAgentSessionsByIdEventsRequest {
|
|
r.limit = &limit
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIGetAgentSessionsByIdEventsRequest) Execute() (*AgentEventList, *http.Response, error) {
|
|
return r.ApiService.GetAgentSessionsByIdEventsExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentSessionsByIdEvents Reads a session's log in order, a page at a time: everything after the seq a reader last saw, so a poll resumes exactly where it stopped.
|
|
|
|
Reads a session's log in order, a page at a time: everything after the seq a
|
|
reader last saw, so a poll resumes exactly where it stopped. It is how to see
|
|
what a run did and why it ended — each model turn, tool call, status and log
|
|
line, as the run wrote them. A run whose process went away is ended first,
|
|
with its reason as the last event.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the session to read, from the path.
|
|
@return AgentAPIGetAgentSessionsByIdEventsRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentSessionsByIdEvents(ctx context.Context, id string) AgentAPIGetAgentSessionsByIdEventsRequest {
|
|
return AgentAPIGetAgentSessionsByIdEventsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentEventList
|
|
func (a *AgentAPIService) GetAgentSessionsByIdEventsExecute(r AgentAPIGetAgentSessionsByIdEventsRequest) (*AgentEventList, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentEventList
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentSessionsByIdEvents")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/sessions/{id}/events"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.after != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "after", r.after, "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 AgentAPIGetAgentSessionsByIdProgressRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
id string
|
|
}
|
|
|
|
func (r AgentAPIGetAgentSessionsByIdProgressRequest) Execute() (*AgentSessionProgress, *http.Response, error) {
|
|
return r.ApiService.GetAgentSessionsByIdProgressExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentSessionsByIdProgress Returns how far along one run is: the share of its goal that is done, whether it is running, blocked or finished, and a line saying what it is doing right now.
|
|
|
|
Returns how far along one run is: the share of its goal that
|
|
is done, whether it is running, blocked or finished, and a line saying what it
|
|
is doing right now.
|
|
|
|
It is a MODEL ESTIMATE read off the run's own transcript, not a measurement —
|
|
`estimated` says so on every answer, and a run whose progress cannot be told
|
|
reports phase "unknown" with no percentage rather than a zero it does not
|
|
mean. A session that has already finished answers from its own status instead,
|
|
and is marked not estimated.
|
|
|
|
The list and detail reads carry the same value; this address is the one that
|
|
WAITS. Where the stored estimate has gone stale it is remade before answering,
|
|
so a human deciding whether to step into a run gets a current reading rather
|
|
than the last poll's — which costs one small completion, charged to the same
|
|
wallet the session already names, at most once every thirty seconds per run.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the session to act on, from the path.
|
|
@return AgentAPIGetAgentSessionsByIdProgressRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentSessionsByIdProgress(ctx context.Context, id string) AgentAPIGetAgentSessionsByIdProgressRequest {
|
|
return AgentAPIGetAgentSessionsByIdProgressRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentSessionProgress
|
|
func (a *AgentAPIService) GetAgentSessionsByIdProgressExecute(r AgentAPIGetAgentSessionsByIdProgressRequest) (*AgentSessionProgress, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentSessionProgress
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentSessionsByIdProgress")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/sessions/{id}/progress"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
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 AgentAPIGetAgentSessionsByIdTreeRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
id string
|
|
}
|
|
|
|
func (r AgentAPIGetAgentSessionsByIdTreeRequest) Execute() (*AgentTreeNode, *http.Response, error) {
|
|
return r.ApiService.GetAgentSessionsByIdTreeExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentSessionsByIdTree Returns the subagent-flow graph rooted at this session: the session, its children, their children, each node carrying its own event count.
|
|
|
|
Returns the subagent-flow graph rooted at this session: the session,
|
|
its children, their children, each node carrying its own event count. One
|
|
indexed read pulls the whole flow (every node of a flow shares a root id), so
|
|
the shape is assembled in memory rather than by walking the store per node. It
|
|
holds the sessions the caller may see — a member's own, every one for an admin
|
|
of the org — and a session they may not see is absent with all beneath it.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the session to act on, from the path.
|
|
@return AgentAPIGetAgentSessionsByIdTreeRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentSessionsByIdTree(ctx context.Context, id string) AgentAPIGetAgentSessionsByIdTreeRequest {
|
|
return AgentAPIGetAgentSessionsByIdTreeRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentTreeNode
|
|
func (a *AgentAPIService) GetAgentSessionsByIdTreeExecute(r AgentAPIGetAgentSessionsByIdTreeRequest) (*AgentTreeNode, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentTreeNode
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentSessionsByIdTree")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/sessions/{id}/tree"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
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 AgentAPIGetAgentSessionsStreamRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
}
|
|
|
|
func (r AgentAPIGetAgentSessionsStreamRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.GetAgentSessionsStreamExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentSessionsStream Live session and event updates for the caller's org, as Server-Sent Events.
|
|
|
|
Holds the connection open as text/event-stream and pushes a frame each time the org's registry moves: an `event: session` frame carrying the same session shape the list and detail reads answer with (a registration, an update, or a login-manager revoke tearing a session down), and an `event: event` frame carrying one appended turn. Optional ?root=<session id> narrows the feed to a single subagent tree.
|
|
|
|
Requires a validated principal carrying an org: 401 without a principal, 403 without an org. Org-scoped fail-closed: the bus filters on tenant before it fans out, so a subscriber only ever receives its own org's updates, and ?root= narrows that further but can never widen it. Within the org a subscriber receives what GET /v1/agent/sessions/{id} would show them: a member the frames of the sessions they opened, an org admin or a SuperAdmin the org's.
|
|
|
|
Delivery is best-effort and the GET reads remain the source of truth. A subscriber that falls more than 256 frames behind is DROPPED — its channel is closed and the stream ends — so one stuck dashboard can never back-pressure a session write; the client reconnects and re-reads the session endpoints to resynchronise. A `: ping` comment every 25 seconds holds the connection open through proxies and is how a departed client is noticed.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return AgentAPIGetAgentSessionsStreamRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentSessionsStream(ctx context.Context) AgentAPIGetAgentSessionsStreamRequest {
|
|
return AgentAPIGetAgentSessionsStreamRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *AgentAPIService) GetAgentSessionsStreamExecute(r AgentAPIGetAgentSessionsStreamRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentSessionsStream")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/sessions/stream"
|
|
|
|
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{}
|
|
|
|
// 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 nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type AgentAPIGetAgentTargetsRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
}
|
|
|
|
func (r AgentAPIGetAgentTargetsRequest) Execute() (*AgentTargetList, *http.Response, error) {
|
|
return r.ApiService.GetAgentTargetsExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentTargets Returns every machine registered to the caller's org, newest first, each with its live session load.
|
|
|
|
Returns every machine registered to the caller's org, newest
|
|
first, each with its live session load. In a held org, where self-serve
|
|
signups land beside the platform's staff, it is only the caller's own.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return AgentAPIGetAgentTargetsRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentTargets(ctx context.Context) AgentAPIGetAgentTargetsRequest {
|
|
return AgentAPIGetAgentTargetsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentTargetList
|
|
func (a *AgentAPIService) GetAgentTargetsExecute(r AgentAPIGetAgentTargetsRequest) (*AgentTargetList, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentTargetList
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentTargets")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/targets"
|
|
|
|
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 AgentAPIGetAgentTargetsByIdRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
id string
|
|
}
|
|
|
|
func (r AgentAPIGetAgentTargetsByIdRequest) Execute() (*AgentTargetView, *http.Response, error) {
|
|
return r.ApiService.GetAgentTargetsByIdExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetAgentTargetsById Returns one registered machine, with its live session load.
|
|
|
|
Returns one registered machine, with its live session load.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the target to act on, from the path.
|
|
@return AgentAPIGetAgentTargetsByIdRequest
|
|
*/
|
|
func (a *AgentAPIService) GetAgentTargetsById(ctx context.Context, id string) AgentAPIGetAgentTargetsByIdRequest {
|
|
return AgentAPIGetAgentTargetsByIdRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentTargetView
|
|
func (a *AgentAPIService) GetAgentTargetsByIdExecute(r AgentAPIGetAgentTargetsByIdRequest) (*AgentTargetView, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentTargetView
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.GetAgentTargetsById")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/targets/{id}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
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 AgentAPIPatchAgentByRefRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
ref string
|
|
agentUpdateAgentIn *AgentUpdateAgentIn
|
|
}
|
|
|
|
func (r AgentAPIPatchAgentByRefRequest) AgentUpdateAgentIn(agentUpdateAgentIn AgentUpdateAgentIn) AgentAPIPatchAgentByRefRequest {
|
|
r.agentUpdateAgentIn = &agentUpdateAgentIn
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIPatchAgentByRefRequest) Execute() (*AgentAgentView, *http.Response, error) {
|
|
return r.ApiService.PatchAgentByRefExecute(r)
|
|
}
|
|
|
|
/*
|
|
PatchAgentByRef Changes an agent in place.
|
|
|
|
Changes an agent in place. Every field is optional; a field the
|
|
request omits keeps its stored value. The resulting mode+schedule are
|
|
re-validated together, so a partial update can never leave a long-running
|
|
agent without the cron the scheduler needs to fire it, and a transition INTO
|
|
long-running counts against the per-org cap on scheduled agents.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param ref Ref is the agent to update — its public id or org-unique name, from the path.
|
|
@return AgentAPIPatchAgentByRefRequest
|
|
*/
|
|
func (a *AgentAPIService) PatchAgentByRef(ctx context.Context, ref string) AgentAPIPatchAgentByRefRequest {
|
|
return AgentAPIPatchAgentByRefRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
ref: ref,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentAgentView
|
|
func (a *AgentAPIService) PatchAgentByRefExecute(r AgentAPIPatchAgentByRefRequest) (*AgentAgentView, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPatch
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentAgentView
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PatchAgentByRef")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/{ref}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"ref"+"}", url.PathEscape(parameterValueToString(r.ref, "ref")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.agentUpdateAgentIn == nil {
|
|
return localVarReturnValue, nil, reportError("agentUpdateAgentIn 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.agentUpdateAgentIn
|
|
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 AgentAPIPatchAgentChatConversationsByIdRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
id string
|
|
}
|
|
|
|
func (r AgentAPIPatchAgentChatConversationsByIdRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.PatchAgentChatConversationsByIdExecute(r)
|
|
}
|
|
|
|
/*
|
|
PatchAgentChatConversationsById Rename, pin or archive one of your conversations
|
|
|
|
Takes `{title?, pinned?, archived?}` and changes what it names, leaving the rest; a body naming none is refused 400, and so is an empty title. A title is cut to one line of at most 80 characters. Answers the conversation as the list does — id, title, updatedAt, pinned, archived — and the change does not move `updatedAt`, which stays when it was last spoken in.
|
|
|
|
The list puts pinned conversations first and leaves archived ones out; `?archived=true` lists those alone. Only the member who opened the conversation may change it; another member's, another org's, and one recorded with no member answer 404. Every change is written to the audit trail.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id
|
|
@return AgentAPIPatchAgentChatConversationsByIdRequest
|
|
*/
|
|
func (a *AgentAPIService) PatchAgentChatConversationsById(ctx context.Context, id string) AgentAPIPatchAgentChatConversationsByIdRequest {
|
|
return AgentAPIPatchAgentChatConversationsByIdRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *AgentAPIService) PatchAgentChatConversationsByIdExecute(r AgentAPIPatchAgentChatConversationsByIdRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPatch
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PatchAgentChatConversationsById")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/chat/conversations/{id}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
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{}
|
|
|
|
// 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 nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type AgentAPIPatchAgentSessionsByIdRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
id string
|
|
agentPatchSessionIn *AgentPatchSessionIn
|
|
}
|
|
|
|
func (r AgentAPIPatchAgentSessionsByIdRequest) AgentPatchSessionIn(agentPatchSessionIn AgentPatchSessionIn) AgentAPIPatchAgentSessionsByIdRequest {
|
|
r.agentPatchSessionIn = &agentPatchSessionIn
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIPatchAgentSessionsByIdRequest) Execute() (*AgentSessionView, *http.Response, error) {
|
|
return r.ApiService.PatchAgentSessionsByIdExecute(r)
|
|
}
|
|
|
|
/*
|
|
PatchAgentSessionsById Updates a session's surface-owned truth: its status, its title, the run-target it is dispatched to, and the product it built plus whether that build's story is public.
|
|
|
|
Updates a session's surface-owned truth: its status, its title,
|
|
the run-target it is dispatched to, and the product it built plus whether that
|
|
build's story is public. A FINISHED session stays finished — reopening a
|
|
done/error run would fabricate liveness — and publishing is refused unless the
|
|
session names the project it built, because the public build route is keyed on
|
|
(org, project).
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the session to update, from the path.
|
|
@return AgentAPIPatchAgentSessionsByIdRequest
|
|
*/
|
|
func (a *AgentAPIService) PatchAgentSessionsById(ctx context.Context, id string) AgentAPIPatchAgentSessionsByIdRequest {
|
|
return AgentAPIPatchAgentSessionsByIdRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentSessionView
|
|
func (a *AgentAPIService) PatchAgentSessionsByIdExecute(r AgentAPIPatchAgentSessionsByIdRequest) (*AgentSessionView, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPatch
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentSessionView
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PatchAgentSessionsById")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/sessions/{id}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.agentPatchSessionIn == nil {
|
|
return localVarReturnValue, nil, reportError("agentPatchSessionIn 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.agentPatchSessionIn
|
|
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 AgentAPIPatchAgentTargetsByIdRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
id string
|
|
agentPatchTargetIn *AgentPatchTargetIn
|
|
}
|
|
|
|
func (r AgentAPIPatchAgentTargetsByIdRequest) AgentPatchTargetIn(agentPatchTargetIn AgentPatchTargetIn) AgentAPIPatchAgentTargetsByIdRequest {
|
|
r.agentPatchTargetIn = &agentPatchTargetIn
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIPatchAgentTargetsByIdRequest) Execute() (*AgentTargetView, *http.Response, error) {
|
|
return r.ApiService.PatchAgentTargetsByIdExecute(r)
|
|
}
|
|
|
|
/*
|
|
PatchAgentTargetsById Updates one machine in place.
|
|
|
|
Updates one machine in place. Every field is optional; a field the
|
|
request omits is left alone. A metrics patch IS a heartbeat — the server stamps
|
|
its own clock, so a client can neither forge nor backdate staleness.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the target to update, from the path.
|
|
@return AgentAPIPatchAgentTargetsByIdRequest
|
|
*/
|
|
func (a *AgentAPIService) PatchAgentTargetsById(ctx context.Context, id string) AgentAPIPatchAgentTargetsByIdRequest {
|
|
return AgentAPIPatchAgentTargetsByIdRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentTargetView
|
|
func (a *AgentAPIService) PatchAgentTargetsByIdExecute(r AgentAPIPatchAgentTargetsByIdRequest) (*AgentTargetView, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPatch
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentTargetView
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PatchAgentTargetsById")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/targets/{id}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.agentPatchTargetIn == nil {
|
|
return localVarReturnValue, nil, reportError("agentPatchTargetIn 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.agentPatchTargetIn
|
|
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 AgentAPIPostAgentRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
agentCreateAgentIn *AgentCreateAgentIn
|
|
}
|
|
|
|
func (r AgentAPIPostAgentRequest) AgentCreateAgentIn(agentCreateAgentIn AgentCreateAgentIn) AgentAPIPostAgentRequest {
|
|
r.agentCreateAgentIn = &agentCreateAgentIn
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIPostAgentRequest) Execute() (*AgentAgentView, *http.Response, error) {
|
|
return r.ApiService.PostAgentExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostAgent Defines an agent in the caller's org: a model, a system prompt (instructions) and a set of tool names.
|
|
|
|
Defines an agent in the caller's org: a model, a system prompt
|
|
(instructions) and a set of tool names. The name must be unique in the org and
|
|
match ^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$. An omitted model takes the
|
|
deployment's configured default; a named one is checked against the gateway's
|
|
served catalog, so a model this deployment never serves is refused here rather
|
|
than failing at run time. A long-running agent must carry a 5-field cron
|
|
schedule (the scheduler would otherwise never fire it) and counts against a
|
|
per-org cap on scheduled agents. An agent spawned by another names it as its
|
|
parent; the parent must be an agent of the caller's org, and the new agent
|
|
carries its whole lineage.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return AgentAPIPostAgentRequest
|
|
*/
|
|
func (a *AgentAPIService) PostAgent(ctx context.Context) AgentAPIPostAgentRequest {
|
|
return AgentAPIPostAgentRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentAgentView
|
|
func (a *AgentAPIService) PostAgentExecute(r AgentAPIPostAgentRequest) (*AgentAgentView, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentAgentView
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PostAgent")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.agentCreateAgentIn == nil {
|
|
return localVarReturnValue, nil, reportError("agentCreateAgentIn 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.agentCreateAgentIn
|
|
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 AgentAPIPostAgentAskRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
}
|
|
|
|
func (r AgentAPIPostAgentAskRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.PostAgentAskExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostAgentAsk The MCP server a coding run's harness asks its person through.
|
|
|
|
Speaks MCP over streamable HTTP and serves one tool, ask_user: a question and 2 to 8 options, shown as buttons in the run's thread, answered by the person the run is for. The call waits for the answer, up to 30 minutes, streaming as text/event-stream with a comment every 15 seconds, and returns it as the tool's result, or says none came.
|
|
|
|
The caller is a coding run, not a tenant: the request carries the run's ticket in X-Hanzo-Run and no bearer. The ticket is minted for one run, opens this server and nothing else, names the run the question belongs to, and ends with the run. A request without a live ticket is 401, and any tool but ask_user is refused.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return AgentAPIPostAgentAskRequest
|
|
*/
|
|
func (a *AgentAPIService) PostAgentAsk(ctx context.Context) AgentAPIPostAgentAskRequest {
|
|
return AgentAPIPostAgentAskRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *AgentAPIService) PostAgentAskExecute(r AgentAPIPostAgentAskRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PostAgentAsk")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/ask"
|
|
|
|
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{}
|
|
|
|
// 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 nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type AgentAPIPostAgentByRefRunRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
ref string
|
|
}
|
|
|
|
func (r AgentAPIPostAgentByRefRunRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.PostAgentByRefRunExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostAgentByRefRun Run one of your org's agents and get the recorded run back.
|
|
|
|
Composes the agent's stored instructions with the caller's `input`, executes one real chat completion through the same in-process AI client the rest of the console uses, and answers with the run that was recorded: its id, status, model, output, duration and error. Every run this returns reflects an execution that actually happened — a model failure is recorded and reported, never hidden and never fabricated. A transient upstream failure (429, 5xx, empty choices) is retried up to three times with jittered backoff, and a configured failover model is tried before the run is called an error.
|
|
|
|
`ref` is the agent's public `agent_…` id or its org-unique name; either resolves the same agent, and it must belong to the caller's org, so an agent in another tenant is a 404 exactly like one that does not exist. A validated principal is required and the check is made twice on purpose: this route MOVES MONEY, so the debit's principal requirement is asserted where the money moves rather than inherited from the tenant lookup.
|
|
|
|
The org's balance is authorized BEFORE any inference, so an unfunded tenant gets 402 and no free compute, and a billing plane that cannot answer gets 503 rather than a free run. The flat per-run fee is an operator knob; setting it to zero makes runs free and removes the balance gate with them. Only a SUCCESSFUL run is billed, attributed to the model actually used — a failover run bills the model it fell over to, not the one it started on. A deployment with no inference wired answers 503 before any of this.
|
|
|
|
THE RULE A READER GETS WRONG: a failed run is a 502 whose body is the RUN, not an error envelope. The execution happened, the run was persisted to this agent's history, and its `error` field is the product — so a client that treats every non-2xx as an opaque failure throws away the only account of what went wrong. Each run also opens a root session in the live session registry, best-effort: a bookkeeping failure there never fails the run, because the run and its billing already happened.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param ref
|
|
@return AgentAPIPostAgentByRefRunRequest
|
|
*/
|
|
func (a *AgentAPIService) PostAgentByRefRun(ctx context.Context, ref string) AgentAPIPostAgentByRefRunRequest {
|
|
return AgentAPIPostAgentByRefRunRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
ref: ref,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *AgentAPIService) PostAgentByRefRunExecute(r AgentAPIPostAgentByRefRunRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PostAgentByRefRun")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/{ref}/run"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"ref"+"}", url.PathEscape(parameterValueToString(r.ref, "ref")), -1)
|
|
|
|
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{}
|
|
|
|
// 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 nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type AgentAPIPostAgentChatRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
}
|
|
|
|
func (r AgentAPIPostAgentChatRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.PostAgentChatExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostAgentChat Run one tool-calling round against your org's own tools
|
|
|
|
Answers one turn of a conversation with four things: the model's `reply`, the `actions` the server executed on the caller's behalf, the `ops` the client must apply itself, and the `conversationId` the turn was recorded under.
|
|
|
|
The split between actions and ops is the rule most easily got wrong. A tool call is executed HERE only when the chosen preset is server-executing AND the tool resolves in the caller's own scope; every other call is handed back as an op for the client to apply to its own graph or UI. A tool that fails still comes back as an action, carrying its error rather than failing the round.
|
|
|
|
`preset` selects the system prompt and the tool set (`capability` is a legacy alias for it); an unknown one is refused. `conversationId` continues an existing thread, and its absence starts one. A validated principal with a non-empty org is required — the org is the sole authority for both persistence and tool scope, and is NEVER read from the body.
|
|
|
|
A completion refused for the caller's own reason — 402 insufficient balance, 429, 403 — is relayed with its own status and body verbatim, so the real billing message reaches the client instead of an opaque gateway error. Only a genuine upstream fault becomes a 502.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return AgentAPIPostAgentChatRequest
|
|
*/
|
|
func (a *AgentAPIService) PostAgentChat(ctx context.Context) AgentAPIPostAgentChatRequest {
|
|
return AgentAPIPostAgentChatRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *AgentAPIService) PostAgentChatExecute(r AgentAPIPostAgentChatRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PostAgentChat")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/chat"
|
|
|
|
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{}
|
|
|
|
// 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 nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type AgentAPIPostAgentChatConversationsRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
}
|
|
|
|
func (r AgentAPIPostAgentChatConversationsRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.PostAgentChatConversationsExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostAgentChatConversations Record turns in a conversation
|
|
|
|
Writes turns to the caller's thread store without running a completion, and answers the `conversationId` they were written under. An absent `conversationId` opens a new thread; supplying one appends to it.
|
|
|
|
This is for a client that streams its own turn through /v1/chat/completions and still wants the conversation in its history — the round records what IT answers, and is otherwise the only writer. It takes the same store, the same per-org isolation and the same notion of a thread: what is recorded here reads back through the two GETs beside it and the round can continue it by id. A validated principal with a non-empty org is required: 401 without a principal, 403 without an org.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return AgentAPIPostAgentChatConversationsRequest
|
|
*/
|
|
func (a *AgentAPIService) PostAgentChatConversations(ctx context.Context) AgentAPIPostAgentChatConversationsRequest {
|
|
return AgentAPIPostAgentChatConversationsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *AgentAPIService) PostAgentChatConversationsExecute(r AgentAPIPostAgentChatConversationsRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PostAgentChatConversations")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/chat/conversations"
|
|
|
|
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{}
|
|
|
|
// 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 nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type AgentAPIPostAgentChatConversationsByIdSharesRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
id string
|
|
}
|
|
|
|
func (r AgentAPIPostAgentChatConversationsByIdSharesRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.PostAgentChatConversationsByIdSharesExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostAgentChatConversationsByIdShares Share one of your conversations by link
|
|
|
|
Makes a read-only link to a conversation the caller owns and answers the share and its `token`. The token is 256 random bits and is returned ONCE: the store keeps only its SHA-256, so a lost token is replaced by making another share, never read back. The token names the chat and authenticates nobody.
|
|
|
|
A share is a snapshot of the user and assistant turns up to the moment it was made. System turns, tool calls and tool results are never part of it, and turns added later need a new share. Only the member who opened the conversation may share it; anyone else — and anyone at all for a conversation recorded with no member — is answered 404. Every share made is written to the audit trail.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id
|
|
@return AgentAPIPostAgentChatConversationsByIdSharesRequest
|
|
*/
|
|
func (a *AgentAPIService) PostAgentChatConversationsByIdShares(ctx context.Context, id string) AgentAPIPostAgentChatConversationsByIdSharesRequest {
|
|
return AgentAPIPostAgentChatConversationsByIdSharesRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *AgentAPIService) PostAgentChatConversationsByIdSharesExecute(r AgentAPIPostAgentChatConversationsByIdSharesRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PostAgentChatConversationsByIdShares")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/chat/conversations/{id}/shares"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
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{}
|
|
|
|
// 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 nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type AgentAPIPostAgentChatSharesReadRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
}
|
|
|
|
func (r AgentAPIPostAgentChatSharesReadRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.PostAgentChatSharesReadExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostAgentChatSharesRead Open a conversation shared by link
|
|
|
|
Takes `{token}` in the body, so the token never sits in a URL a log keeps. A caller who is not a signed-in person gets the title and `full: false`, and no turn of the transcript — which is what a sign-in prompt shows. A signed-in person, of any org, is recorded as a viewer the owner can see, and reads the whole snapshot with the share's id; the reader's own org is neither read nor changed. An assistant turn carries `model` only when this server stored it from that model's completion. A token that does not open — malformed, unknown, revoked, or closed to this viewer — is answered 404 with one sentence for all.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return AgentAPIPostAgentChatSharesReadRequest
|
|
*/
|
|
func (a *AgentAPIService) PostAgentChatSharesRead(ctx context.Context) AgentAPIPostAgentChatSharesReadRequest {
|
|
return AgentAPIPostAgentChatSharesReadRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *AgentAPIService) PostAgentChatSharesReadExecute(r AgentAPIPostAgentChatSharesReadRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PostAgentChatSharesRead")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/chat/shares/read"
|
|
|
|
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{}
|
|
|
|
// 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 nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type AgentAPIPostAgentCodingRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
agentCodingStartIn *AgentCodingStartIn
|
|
}
|
|
|
|
func (r AgentAPIPostAgentCodingRequest) AgentCodingStartIn(agentCodingStartIn AgentCodingStartIn) AgentAPIPostAgentCodingRequest {
|
|
r.agentCodingStartIn = &agentCodingStartIn
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIPostAgentCodingRequest) Execute() (*AgentCodingStarted, *http.Response, error) {
|
|
return r.ApiService.PostAgentCodingExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostAgentCoding Start one autonomous coding run against a repo in the caller's org
|
|
|
|
Runs a coding task on a repository: clones it into a sandbox, lets a model read
|
|
and edit the code, run the tests, and push the work to a branch. Say the thing
|
|
you want done — "fix the failing auth test in hanzoai/cloud" — and the run
|
|
infers the repo, the branch and the plan. No prefix, no ceremony.
|
|
|
|
Name no repo and the run works in an empty workspace of its own: nothing is
|
|
cloned and nothing is pushed, and what it makes is kept in its sandbox and as
|
|
its artifacts. Name a repository the caller can read and not push to — a public
|
|
one — and it is cloned read-only, the same way.
|
|
|
|
It answers 202 with the run's handle the moment the run is ADMITTED — not when
|
|
it finishes. A coding run takes minutes; holding a request open for one would
|
|
tie a connection to a model loop and give the caller nothing it cannot get
|
|
better from the session stream.
|
|
|
|
The handle is a session id, and that is deliberate: the session is already the
|
|
run's durable record and its live stream (/v1/agent/sessions/stream?root=<id>), so
|
|
this op does not grow a progress endpoint, a status endpoint or a cancel
|
|
endpoint of its own. One way to watch a run, whoever started it.
|
|
|
|
It is also how work CONTINUES. Pass an earlier run's session as `after` and
|
|
this one starts from where that one stopped, so "now add tests for it" builds
|
|
on the branch already pushed instead of a fresh clone. The follow-up has its
|
|
own session and writes the same branch, so one piece of work is one branch and
|
|
one pull request however many instructions it takes.
|
|
|
|
Pass `branch` to name the branch the run writes (`agent/<name>`), and `pull`
|
|
as false to push it without opening a pull request.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return AgentAPIPostAgentCodingRequest
|
|
*/
|
|
func (a *AgentAPIService) PostAgentCoding(ctx context.Context) AgentAPIPostAgentCodingRequest {
|
|
return AgentAPIPostAgentCodingRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentCodingStarted
|
|
func (a *AgentAPIService) PostAgentCodingExecute(r AgentAPIPostAgentCodingRequest) (*AgentCodingStarted, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentCodingStarted
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PostAgentCoding")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/coding"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.agentCodingStartIn == nil {
|
|
return localVarReturnValue, nil, reportError("agentCodingStartIn 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.agentCodingStartIn
|
|
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 AgentAPIPostAgentCodingBySessionExtendRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
session string
|
|
agentCodingExtendIn *AgentCodingExtendIn
|
|
}
|
|
|
|
func (r AgentAPIPostAgentCodingBySessionExtendRequest) AgentCodingExtendIn(agentCodingExtendIn AgentCodingExtendIn) AgentAPIPostAgentCodingBySessionExtendRequest {
|
|
r.agentCodingExtendIn = &agentCodingExtendIn
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIPostAgentCodingBySessionExtendRequest) Execute() (*AgentCodingExtended, *http.Response, error) {
|
|
return r.ApiService.PostAgentCodingBySessionExtendExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostAgentCodingBySessionExtend Gives your running coding run more time.
|
|
|
|
Gives your running coding run more time. A run is held to the time it was asked
|
|
for (`timeoutSeconds`) and, when it is up, keeps its work on its branch and
|
|
ends; this moves that time later while the run works, so a task expected to
|
|
take five minutes that is nearly done is given two more rather than restarted.
|
|
`seconds` is added to the time the run has left, as far as the longest a run
|
|
may be given; the answer says when the run is up now, so asking for more than
|
|
that reads what you got.
|
|
|
|
The run must be yours and still working: a run that is paused or already out
|
|
of time is a conflict (start a new one with `after` set to its session), and
|
|
one that is not running is not found. A run sent to a machine of your own
|
|
keeps that machine's time and cannot be extended.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param session Session is the run's handle, from the path.
|
|
@return AgentAPIPostAgentCodingBySessionExtendRequest
|
|
*/
|
|
func (a *AgentAPIService) PostAgentCodingBySessionExtend(ctx context.Context, session string) AgentAPIPostAgentCodingBySessionExtendRequest {
|
|
return AgentAPIPostAgentCodingBySessionExtendRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
session: session,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentCodingExtended
|
|
func (a *AgentAPIService) PostAgentCodingBySessionExtendExecute(r AgentAPIPostAgentCodingBySessionExtendRequest) (*AgentCodingExtended, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentCodingExtended
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PostAgentCodingBySessionExtend")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/coding/{session}/extend"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"session"+"}", url.PathEscape(parameterValueToString(r.session, "session")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.agentCodingExtendIn == nil {
|
|
return localVarReturnValue, nil, reportError("agentCodingExtendIn 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.agentCodingExtendIn
|
|
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 AgentAPIPostAgentCodingBySessionMergeRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
session string
|
|
}
|
|
|
|
func (r AgentAPIPostAgentCodingBySessionMergeRequest) Execute() (*AgentCodingMerged, *http.Response, error) {
|
|
return r.ApiService.PostAgentCodingBySessionMergeExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostAgentCodingBySessionMerge Merges a coding run's pull request into the branch it proposes into, on the forge the run pushed to, and answers the pull request after.
|
|
|
|
Merges a coding run's pull request into the branch it proposes into, on the
|
|
forge the run pushed to, and answers the pull request after.
|
|
|
|
The caller must be able to read the run: its person, or an admin of its org.
|
|
What lands is the run's branch at the commit the forge holds when this asks —
|
|
a push after that is refused, not merged unseen — and nothing is forced: a
|
|
pull request that conflicts, was closed, or that a rule on its base keeps
|
|
from merging is 409 with the forge's reason. One already merged answers as
|
|
it is.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param session Session is the run's handle — the sessionId POST /v1/agent/coding answered with — from the path.
|
|
@return AgentAPIPostAgentCodingBySessionMergeRequest
|
|
*/
|
|
func (a *AgentAPIService) PostAgentCodingBySessionMerge(ctx context.Context, session string) AgentAPIPostAgentCodingBySessionMergeRequest {
|
|
return AgentAPIPostAgentCodingBySessionMergeRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
session: session,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentCodingMerged
|
|
func (a *AgentAPIService) PostAgentCodingBySessionMergeExecute(r AgentAPIPostAgentCodingBySessionMergeRequest) (*AgentCodingMerged, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentCodingMerged
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PostAgentCodingBySessionMerge")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/coding/{session}/merge"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"session"+"}", url.PathEscape(parameterValueToString(r.session, "session")), -1)
|
|
|
|
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 AgentAPIPostAgentCodingBySessionPullRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
session string
|
|
agentCodingPullIn *AgentCodingPullIn
|
|
}
|
|
|
|
func (r AgentAPIPostAgentCodingBySessionPullRequest) AgentCodingPullIn(agentCodingPullIn AgentCodingPullIn) AgentAPIPostAgentCodingBySessionPullRequest {
|
|
r.agentCodingPullIn = &agentCodingPullIn
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIPostAgentCodingBySessionPullRequest) Execute() (*AgentCodingPulled, *http.Response, error) {
|
|
return r.ApiService.PostAgentCodingBySessionPullExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostAgentCodingBySessionPull Opens the pull request for the branch a coding run pushed, as the run's person and with no agent run, and answers its number and address.
|
|
|
|
Opens the pull request for the branch a coding run pushed, as the run's person
|
|
and with no agent run, and answers its number and address.
|
|
|
|
A run pushes its branch and stops; the pull request is the step after, taken
|
|
when the work is ready. A run that already has an open pull request, or a
|
|
branch that has one on its host, answers with that one, so asking twice is
|
|
safe. Title, body, base and draft are optional: the title and body come from
|
|
the run's task, the base is the branch the run started from, and draft opens it
|
|
as one a reviewer cannot merge yet. The run's branch must be on its host: a run
|
|
that pushed nothing, or has not pushed yet, is 409. Who may is who may read the
|
|
run, and the pull request is read back at GET /v1/agent/coding/{session}/changes.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param session Session is the run's handle, from the path.
|
|
@return AgentAPIPostAgentCodingBySessionPullRequest
|
|
*/
|
|
func (a *AgentAPIService) PostAgentCodingBySessionPull(ctx context.Context, session string) AgentAPIPostAgentCodingBySessionPullRequest {
|
|
return AgentAPIPostAgentCodingBySessionPullRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
session: session,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentCodingPulled
|
|
func (a *AgentAPIService) PostAgentCodingBySessionPullExecute(r AgentAPIPostAgentCodingBySessionPullRequest) (*AgentCodingPulled, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentCodingPulled
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PostAgentCodingBySessionPull")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/coding/{session}/pull"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"session"+"}", url.PathEscape(parameterValueToString(r.session, "session")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.agentCodingPullIn == nil {
|
|
return localVarReturnValue, nil, reportError("agentCodingPullIn 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.agentCodingPullIn
|
|
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 AgentAPIPostAgentCodingBySessionSteerRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
session string
|
|
agentCodingInstruction *AgentCodingInstruction
|
|
}
|
|
|
|
func (r AgentAPIPostAgentCodingBySessionSteerRequest) AgentCodingInstruction(agentCodingInstruction AgentCodingInstruction) AgentAPIPostAgentCodingBySessionSteerRequest {
|
|
r.agentCodingInstruction = &agentCodingInstruction
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIPostAgentCodingBySessionSteerRequest) Execute() (*AgentCodingAck, *http.Response, error) {
|
|
return r.ApiService.PostAgentCodingBySessionSteerExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostAgentCodingBySessionSteer Redirect your running or paused coding session.
|
|
|
|
Redirect your running or paused coding session. The current run keeps its
|
|
work before starting a follow-up; its status events report the next session.
|
|
Ownership comes from the authenticated credential, never the request body.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param session Session identifies the running or paused coding session from the path.
|
|
@return AgentAPIPostAgentCodingBySessionSteerRequest
|
|
*/
|
|
func (a *AgentAPIService) PostAgentCodingBySessionSteer(ctx context.Context, session string) AgentAPIPostAgentCodingBySessionSteerRequest {
|
|
return AgentAPIPostAgentCodingBySessionSteerRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
session: session,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentCodingAck
|
|
func (a *AgentAPIService) PostAgentCodingBySessionSteerExecute(r AgentAPIPostAgentCodingBySessionSteerRequest) (*AgentCodingAck, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentCodingAck
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PostAgentCodingBySessionSteer")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/coding/{session}/steer"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"session"+"}", url.PathEscape(parameterValueToString(r.session, "session")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.agentCodingInstruction == nil {
|
|
return localVarReturnValue, nil, reportError("agentCodingInstruction 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.agentCodingInstruction
|
|
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 AgentAPIPostAgentMcpByServerRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
server string
|
|
}
|
|
|
|
func (r AgentAPIPostAgentMcpByServerRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.PostAgentMcpByServerExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostAgentMcpByServer The MCP address a coding run's harness reaches one of its org's MCP servers through.
|
|
|
|
Speaks MCP over streamable HTTP for one of the org's MCP servers, named by its id: tools/list answers the tools of it an admin of the org activated, and tools/call calls one. The server's address and credential never reach the run: the tool plane adds the credential and dials the server.
|
|
|
|
The caller is a coding run, not a tenant: the request carries the run's ticket in X-Hanzo-Run and no bearer. A request without a live ticket is 401, and a server the run's kit did not carry when it started is 403. A run has at most four requests in flight here and twenty in a burst, then one a second; a request past that is 429 with Retry-After.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param server
|
|
@return AgentAPIPostAgentMcpByServerRequest
|
|
*/
|
|
func (a *AgentAPIService) PostAgentMcpByServer(ctx context.Context, server string) AgentAPIPostAgentMcpByServerRequest {
|
|
return AgentAPIPostAgentMcpByServerRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
server: server,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *AgentAPIService) PostAgentMcpByServerExecute(r AgentAPIPostAgentMcpByServerRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PostAgentMcpByServer")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/mcp/{server}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"server"+"}", url.PathEscape(parameterValueToString(r.server, "server")), -1)
|
|
|
|
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{}
|
|
|
|
// 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 nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type AgentAPIPostAgentSessionsRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
agentRegisterReq *AgentRegisterReq
|
|
}
|
|
|
|
func (r AgentAPIPostAgentSessionsRequest) AgentRegisterReq(agentRegisterReq AgentRegisterReq) AgentAPIPostAgentSessionsRequest {
|
|
r.agentRegisterReq = &agentRegisterReq
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIPostAgentSessionsRequest) Execute() (*AgentSessionView, *http.Response, error) {
|
|
return r.ApiService.PostAgentSessionsExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostAgentSessions Opens a live agent session in the caller's org — the row every surface (the CLI's outer agent, hanzo.bot, the console, chat) hangs its activity off.
|
|
|
|
Opens a live agent session in the caller's org — the row every
|
|
surface (the CLI's outer agent, hanzo.bot, the console, chat) hangs its
|
|
activity off. A session with a parentSessionId becomes a subagent of that
|
|
session and inherits its root, so one flow is one tree; without one it is
|
|
itself a root. Registering with a terminal status records a session that has
|
|
already finished.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return AgentAPIPostAgentSessionsRequest
|
|
*/
|
|
func (a *AgentAPIService) PostAgentSessions(ctx context.Context) AgentAPIPostAgentSessionsRequest {
|
|
return AgentAPIPostAgentSessionsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentSessionView
|
|
func (a *AgentAPIService) PostAgentSessionsExecute(r AgentAPIPostAgentSessionsRequest) (*AgentSessionView, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentSessionView
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PostAgentSessions")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/sessions"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.agentRegisterReq == nil {
|
|
return localVarReturnValue, nil, reportError("agentRegisterReq 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.agentRegisterReq
|
|
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 AgentAPIPostAgentSessionsByIdBudgetRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
id string
|
|
agentSessionBudgetIn *AgentSessionBudgetIn
|
|
}
|
|
|
|
func (r AgentAPIPostAgentSessionsByIdBudgetRequest) AgentSessionBudgetIn(agentSessionBudgetIn AgentSessionBudgetIn) AgentAPIPostAgentSessionsByIdBudgetRequest {
|
|
r.agentSessionBudgetIn = &agentSessionBudgetIn
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIPostAgentSessionsByIdBudgetRequest) Execute() (*AgentSessionBudgetView, *http.Response, error) {
|
|
return r.ApiService.PostAgentSessionsByIdBudgetExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostAgentSessionsByIdBudget Sets, raises, or removes a session's cap.
|
|
|
|
Sets, raises, or removes a session's cap.
|
|
|
|
- a replacement must be strictly greater than what the session has consumed
|
|
|
|
- removal is one-way: a session whose cap was removed cannot take one again,
|
|
and a session created without one cannot be given one
|
|
|
|
- raising or removing the cap resumes work that paused at it
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the session, from the path.
|
|
@return AgentAPIPostAgentSessionsByIdBudgetRequest
|
|
*/
|
|
func (a *AgentAPIService) PostAgentSessionsByIdBudget(ctx context.Context, id string) AgentAPIPostAgentSessionsByIdBudgetRequest {
|
|
return AgentAPIPostAgentSessionsByIdBudgetRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentSessionBudgetView
|
|
func (a *AgentAPIService) PostAgentSessionsByIdBudgetExecute(r AgentAPIPostAgentSessionsByIdBudgetRequest) (*AgentSessionBudgetView, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentSessionBudgetView
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PostAgentSessionsByIdBudget")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/sessions/{id}/budget"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.agentSessionBudgetIn == nil {
|
|
return localVarReturnValue, nil, reportError("agentSessionBudgetIn 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.agentSessionBudgetIn
|
|
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 AgentAPIPostAgentSessionsByIdEventsRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
id string
|
|
agentEventIn *AgentEventIn
|
|
}
|
|
|
|
func (r AgentAPIPostAgentSessionsByIdEventsRequest) AgentEventIn(agentEventIn AgentEventIn) AgentAPIPostAgentSessionsByIdEventsRequest {
|
|
r.agentEventIn = &agentEventIn
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIPostAgentSessionsByIdEventsRequest) Execute() (*AgentEventView, *http.Response, error) {
|
|
return r.ApiService.PostAgentSessionsByIdEventsExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostAgentSessionsByIdEvents Records one turn of a session's transcript and answers 201 with it.
|
|
|
|
Records one turn of a session's transcript and answers 201 with it.
|
|
|
|
A `progress` turn additionally MOVES THE SESSION'S PROGRESS, marked as the run's
|
|
own word rather than an estimate, and pushes the updated session onto the live
|
|
stream — so a board's bar follows the run without polling and without a second
|
|
write path. See progress.go.
|
|
|
|
THE TURN IS SCANNED BEFORE IT IS STORED. The same engine the code-security
|
|
surface runs reads the payload at this boundary, and a credential in it refuses
|
|
the append with 422 rather than redacting it — a redacted transcript is one
|
|
that still had the secret in it once, and this way the author learns which
|
|
value to rotate. The refusal carries every finding: the rule, the severity, the
|
|
line, a MASKED preview and the fingerprint. The secret is never in the answer.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the session to append to, from the path.
|
|
@return AgentAPIPostAgentSessionsByIdEventsRequest
|
|
*/
|
|
func (a *AgentAPIService) PostAgentSessionsByIdEvents(ctx context.Context, id string) AgentAPIPostAgentSessionsByIdEventsRequest {
|
|
return AgentAPIPostAgentSessionsByIdEventsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentEventView
|
|
func (a *AgentAPIService) PostAgentSessionsByIdEventsExecute(r AgentAPIPostAgentSessionsByIdEventsRequest) (*AgentEventView, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentEventView
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PostAgentSessionsByIdEvents")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/sessions/{id}/events"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.agentEventIn == nil {
|
|
return localVarReturnValue, nil, reportError("agentEventIn 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.agentEventIn
|
|
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 AgentAPIPostAgentSessionsByIdMessageRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
id string
|
|
agentControlIn *AgentControlIn
|
|
}
|
|
|
|
func (r AgentAPIPostAgentSessionsByIdMessageRequest) AgentControlIn(agentControlIn AgentControlIn) AgentAPIPostAgentSessionsByIdMessageRequest {
|
|
r.agentControlIn = &agentControlIn
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIPostAgentSessionsByIdMessageRequest) Execute() (*AgentControlResult, *http.Response, error) {
|
|
return r.ApiService.PostAgentSessionsByIdMessageExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostAgentSessionsByIdMessage Sends a steering message to a running session — the endpoint a human or another agent interrupts through.
|
|
|
|
Sends a steering message to a running session — the endpoint a
|
|
human or another agent interrupts through. It requires a `message` or a
|
|
`payload`; the other three commands do not.
|
|
|
|
A chat turn's run READS it: the message is handed to the model as the person's
|
|
next words at its next step, and a message that arrives while the model is
|
|
writing its answer gets a step of its own before the answer stands. A turn that
|
|
has already answered takes no more and answers 409 — what is said after an
|
|
answer is a new turn.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the session to steer, from the path.
|
|
@return AgentAPIPostAgentSessionsByIdMessageRequest
|
|
*/
|
|
func (a *AgentAPIService) PostAgentSessionsByIdMessage(ctx context.Context, id string) AgentAPIPostAgentSessionsByIdMessageRequest {
|
|
return AgentAPIPostAgentSessionsByIdMessageRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentControlResult
|
|
func (a *AgentAPIService) PostAgentSessionsByIdMessageExecute(r AgentAPIPostAgentSessionsByIdMessageRequest) (*AgentControlResult, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentControlResult
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PostAgentSessionsByIdMessage")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/sessions/{id}/message"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.agentControlIn == nil {
|
|
return localVarReturnValue, nil, reportError("agentControlIn 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.agentControlIn
|
|
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 AgentAPIPostAgentSessionsByIdPauseRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
id string
|
|
agentControlIn *AgentControlIn
|
|
}
|
|
|
|
func (r AgentAPIPostAgentSessionsByIdPauseRequest) AgentControlIn(agentControlIn AgentControlIn) AgentAPIPostAgentSessionsByIdPauseRequest {
|
|
r.agentControlIn = &agentControlIn
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIPostAgentSessionsByIdPauseRequest) Execute() (*AgentControlResult, *http.Response, error) {
|
|
return r.ApiService.PostAgentSessionsByIdPauseExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostAgentSessionsByIdPause Asks a running session to pause.
|
|
|
|
Asks a running session to pause. Recorded durably, and forwarded
|
|
to the durable-execution engine when the session is task-backed.
|
|
|
|
A chat turn's run is paused where it runs: it stops, the session stays live as
|
|
`paused`, and its sandbox is PARKED — the pod stops and every file stays, with
|
|
nothing billed for compute — until a resume picks it up.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the session to steer, from the path.
|
|
@return AgentAPIPostAgentSessionsByIdPauseRequest
|
|
*/
|
|
func (a *AgentAPIService) PostAgentSessionsByIdPause(ctx context.Context, id string) AgentAPIPostAgentSessionsByIdPauseRequest {
|
|
return AgentAPIPostAgentSessionsByIdPauseRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentControlResult
|
|
func (a *AgentAPIService) PostAgentSessionsByIdPauseExecute(r AgentAPIPostAgentSessionsByIdPauseRequest) (*AgentControlResult, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentControlResult
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PostAgentSessionsByIdPause")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/sessions/{id}/pause"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.agentControlIn == nil {
|
|
return localVarReturnValue, nil, reportError("agentControlIn 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.agentControlIn
|
|
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 AgentAPIPostAgentSessionsByIdResumeRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
id string
|
|
agentControlIn *AgentControlIn
|
|
}
|
|
|
|
func (r AgentAPIPostAgentSessionsByIdResumeRequest) AgentControlIn(agentControlIn AgentControlIn) AgentAPIPostAgentSessionsByIdResumeRequest {
|
|
r.agentControlIn = &agentControlIn
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIPostAgentSessionsByIdResumeRequest) Execute() (*AgentControlResult, *http.Response, error) {
|
|
return r.ApiService.PostAgentSessionsByIdResumeExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostAgentSessionsByIdResume Asks a paused session to continue, on the same terms as a pause.
|
|
|
|
Asks a paused session to continue, on the same terms as a pause.
|
|
|
|
A chat turn that was paused or STOPPED runs again: the same session, in the same
|
|
sandbox with every file it had written, told `message` next ("Continue where you
|
|
left off." when there is none). Only the person whose turn it was may resume
|
|
it, since the agent runs as them.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the session to steer, from the path.
|
|
@return AgentAPIPostAgentSessionsByIdResumeRequest
|
|
*/
|
|
func (a *AgentAPIService) PostAgentSessionsByIdResume(ctx context.Context, id string) AgentAPIPostAgentSessionsByIdResumeRequest {
|
|
return AgentAPIPostAgentSessionsByIdResumeRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentControlResult
|
|
func (a *AgentAPIService) PostAgentSessionsByIdResumeExecute(r AgentAPIPostAgentSessionsByIdResumeRequest) (*AgentControlResult, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentControlResult
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PostAgentSessionsByIdResume")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/sessions/{id}/resume"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.agentControlIn == nil {
|
|
return localVarReturnValue, nil, reportError("agentControlIn 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.agentControlIn
|
|
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 AgentAPIPostAgentSessionsByIdStopRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
id string
|
|
agentControlIn *AgentControlIn
|
|
}
|
|
|
|
func (r AgentAPIPostAgentSessionsByIdStopRequest) AgentControlIn(agentControlIn AgentControlIn) AgentAPIPostAgentSessionsByIdStopRequest {
|
|
r.agentControlIn = &agentControlIn
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIPostAgentSessionsByIdStopRequest) Execute() (*AgentControlResult, *http.Response, error) {
|
|
return r.ApiService.PostAgentSessionsByIdStopExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostAgentSessionsByIdStop Ends a running session.
|
|
|
|
Ends a running session. `message` is recorded as the cancellation
|
|
reason, which is what a later reader of the transcript sees.
|
|
|
|
STOPPING IS NOT DELETING: the session, its transcript and anything it produced
|
|
stay readable. A session that has already finished is 409 rather than a second
|
|
stop.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the session to steer, from the path.
|
|
@return AgentAPIPostAgentSessionsByIdStopRequest
|
|
*/
|
|
func (a *AgentAPIService) PostAgentSessionsByIdStop(ctx context.Context, id string) AgentAPIPostAgentSessionsByIdStopRequest {
|
|
return AgentAPIPostAgentSessionsByIdStopRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentControlResult
|
|
func (a *AgentAPIService) PostAgentSessionsByIdStopExecute(r AgentAPIPostAgentSessionsByIdStopRequest) (*AgentControlResult, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentControlResult
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PostAgentSessionsByIdStop")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/sessions/{id}/stop"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.agentControlIn == nil {
|
|
return localVarReturnValue, nil, reportError("agentControlIn 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.agentControlIn
|
|
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 AgentAPIPostAgentTargetsRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
agentTargetReq *AgentTargetReq
|
|
}
|
|
|
|
func (r AgentAPIPostAgentTargetsRequest) AgentTargetReq(agentTargetReq AgentTargetReq) AgentAPIPostAgentTargetsRequest {
|
|
r.agentTargetReq = &agentTargetReq
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIPostAgentTargetsRequest) Execute() (*AgentTargetView, *http.Response, error) {
|
|
return r.ApiService.PostAgentTargetsExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostAgentTargets Registers a machine as an agent target, or re-links one that is already registered.
|
|
|
|
Registers a machine as an agent target, or re-links one that is
|
|
already registered. Re-linking is idempotent and keyed on org+host+owner, so a
|
|
machine that reconnects refreshes its own row rather than piling up duplicates;
|
|
it answers 200, while a first registration answers 201.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return AgentAPIPostAgentTargetsRequest
|
|
*/
|
|
func (a *AgentAPIService) PostAgentTargets(ctx context.Context) AgentAPIPostAgentTargetsRequest {
|
|
return AgentAPIPostAgentTargetsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentTargetView
|
|
func (a *AgentAPIService) PostAgentTargetsExecute(r AgentAPIPostAgentTargetsRequest) (*AgentTargetView, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentTargetView
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PostAgentTargets")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/targets"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.agentTargetReq == nil {
|
|
return localVarReturnValue, nil, reportError("agentTargetReq 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.agentTargetReq
|
|
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 AgentAPIPostAgentTargetsByIdClaimRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
id string
|
|
}
|
|
|
|
func (r AgentAPIPostAgentTargetsByIdClaimRequest) Execute() (*AgentRoutedRunOut, *http.Response, error) {
|
|
return r.ApiService.PostAgentTargetsByIdClaimExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostAgentTargetsByIdClaim ClaimRoutedRun is the machine's long poll for work: it authenticates the daemon, stamps the liveness the dispatch gate reads (the poll IS the proof a runner is listening), and waits up to 25 seconds for the next run addressed to THIS machine.
|
|
|
|
ClaimRoutedRun is the machine's long poll for work: it authenticates the
|
|
daemon, stamps the liveness the dispatch gate reads (the poll IS the proof a
|
|
runner is listening), and waits up to 25 seconds for the next run addressed to
|
|
THIS machine. It answers the run when one arrives and 204 with no body when the
|
|
window elapses, on which the daemon re-polls immediately.
|
|
|
|
TWO independent proofs are required and both fail closed to the same 403: the
|
|
caller must own this machine (or be an org admin) AND present its claim key in
|
|
X-Target-Key. A run offered to one machine is unreachable from another's claim.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the target to act on, from the path.
|
|
@return AgentAPIPostAgentTargetsByIdClaimRequest
|
|
*/
|
|
func (a *AgentAPIService) PostAgentTargetsByIdClaim(ctx context.Context, id string) AgentAPIPostAgentTargetsByIdClaimRequest {
|
|
return AgentAPIPostAgentTargetsByIdClaimRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentRoutedRunOut
|
|
func (a *AgentAPIService) PostAgentTargetsByIdClaimExecute(r AgentAPIPostAgentTargetsByIdClaimRequest) (*AgentRoutedRunOut, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentRoutedRunOut
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PostAgentTargetsByIdClaim")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/targets/{id}/claim"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
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 AgentAPIPostAgentTargetsByIdKeyRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
id string
|
|
}
|
|
|
|
func (r AgentAPIPostAgentTargetsByIdKeyRequest) Execute() (*AgentClaimKeyOut, *http.Response, error) {
|
|
return r.ApiService.PostAgentTargetsByIdKeyExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostAgentTargetsByIdKey Mints (or rotates) the claim key a `hanzo code --serve` daemon presents to claim work for this machine, and returns it ONCE: only its SHA-256 hash is stored.
|
|
|
|
Mints (or rotates) the claim key a `hanzo code --serve`
|
|
daemon presents to claim work for this machine, and returns it ONCE: only its
|
|
SHA-256 hash is stored. Rotating supersedes any prior daemon, so only the
|
|
machine's owner — or an org admin — may call it; every other caller gets the
|
|
same not-found an unknown id gets, and learns nothing about what exists.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the target to act on, from the path.
|
|
@return AgentAPIPostAgentTargetsByIdKeyRequest
|
|
*/
|
|
func (a *AgentAPIService) PostAgentTargetsByIdKey(ctx context.Context, id string) AgentAPIPostAgentTargetsByIdKeyRequest {
|
|
return AgentAPIPostAgentTargetsByIdKeyRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentClaimKeyOut
|
|
func (a *AgentAPIService) PostAgentTargetsByIdKeyExecute(r AgentAPIPostAgentTargetsByIdKeyRequest) (*AgentClaimKeyOut, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentClaimKeyOut
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PostAgentTargetsByIdKey")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/targets/{id}/key"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
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 AgentAPIPostAgentTargetsByIdRunsByRunidReportRequest struct {
|
|
ctx context.Context
|
|
ApiService *AgentAPIService
|
|
id string
|
|
runId string
|
|
agentReportRunIn *AgentReportRunIn
|
|
}
|
|
|
|
func (r AgentAPIPostAgentTargetsByIdRunsByRunidReportRequest) AgentReportRunIn(agentReportRunIn AgentReportRunIn) AgentAPIPostAgentTargetsByIdRunsByRunidReportRequest {
|
|
r.agentReportRunIn = &agentReportRunIn
|
|
return r
|
|
}
|
|
|
|
func (r AgentAPIPostAgentTargetsByIdRunsByRunidReportRequest) Execute() (*AgentReportOut, *http.Response, error) {
|
|
return r.ApiService.PostAgentTargetsByIdRunsByRunidReportExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostAgentTargetsByIdRunsByRunidReport Completes a claimed run: it delivers the terminal result to the run's durable owner, which is what lets that workflow finish.
|
|
|
|
Completes a claimed run: it delivers the terminal result to the
|
|
run's durable owner, which is what lets that workflow finish. Scoped to (org,
|
|
target, run) and claim-key authenticated, so a machine can only ever report a
|
|
run it legitimately holds. Idempotent — a report for an unknown or
|
|
already-finished run answers delivered:false rather than failing, because the
|
|
session's terminal state was already set by the machine's own stream.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the machine reporting, from the path.
|
|
@param runId RunID is the routed run being completed, from the path.
|
|
@return AgentAPIPostAgentTargetsByIdRunsByRunidReportRequest
|
|
*/
|
|
func (a *AgentAPIService) PostAgentTargetsByIdRunsByRunidReport(ctx context.Context, id string, runId string) AgentAPIPostAgentTargetsByIdRunsByRunidReportRequest {
|
|
return AgentAPIPostAgentTargetsByIdRunsByRunidReportRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
runId: runId,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return AgentReportOut
|
|
func (a *AgentAPIService) PostAgentTargetsByIdRunsByRunidReportExecute(r AgentAPIPostAgentTargetsByIdRunsByRunidReportRequest) (*AgentReportOut, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *AgentReportOut
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AgentAPIService.PostAgentTargetsByIdRunsByRunidReport")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/agent/targets/{id}/runs/{runId}/report"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.agentReportRunIn == nil {
|
|
return localVarReturnValue, nil, reportError("agentReportRunIn 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.agentReportRunIn
|
|
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
|
|
}
|