diff --git a/client.gen.go b/client.gen.go index 73626f9..7e7cd55 100644 --- a/client.gen.go +++ b/client.gen.go @@ -318,6 +318,9 @@ type ClientInterface interface { AIOnboardingChat(ctx context.Context, teamName string, body AIOnboardingChatJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // AIOnboardingEndConversation request + AIOnboardingEndConversation(ctx context.Context, teamName string, reqEditors ...RequestEditorFn) (*http.Response, error) + // AIOnboardingNewConversationWithBody request with any body AIOnboardingNewConversationWithBody(ctx context.Context, teamName string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1709,6 +1712,18 @@ func (c *Client) AIOnboardingChat(ctx context.Context, teamName string, body AIO return c.Client.Do(req) } +func (c *Client) AIOnboardingEndConversation(ctx context.Context, teamName string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewAIOnboardingEndConversationRequest(c.Server, teamName) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) AIOnboardingNewConversationWithBody(ctx context.Context, teamName string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewAIOnboardingNewConversationRequestWithBody(c.Server, teamName, contentType, body) if err != nil { @@ -7038,6 +7053,40 @@ func NewAIOnboardingChatRequestWithBody(server string, teamName string, contentT return req, nil } +// NewAIOnboardingEndConversationRequest generates requests for AIOnboardingEndConversation +func NewAIOnboardingEndConversationRequest(server string, teamName string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "team_name", runtime.ParamLocationPath, teamName) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/teams/%s/ai-onboarding/conversations", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + // NewAIOnboardingNewConversationRequest calls the generic AIOnboardingNewConversation builder with application/json body func NewAIOnboardingNewConversationRequest(server string, teamName string, body AIOnboardingNewConversationJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader @@ -12693,6 +12742,9 @@ type ClientWithResponsesInterface interface { AIOnboardingChatWithResponse(ctx context.Context, teamName string, body AIOnboardingChatJSONRequestBody, reqEditors ...RequestEditorFn) (*AIOnboardingChatResponse, error) + // AIOnboardingEndConversationWithResponse request + AIOnboardingEndConversationWithResponse(ctx context.Context, teamName string, reqEditors ...RequestEditorFn) (*AIOnboardingEndConversationResponse, error) + // AIOnboardingNewConversationWithBodyWithResponse request with any body AIOnboardingNewConversationWithBodyWithResponse(ctx context.Context, teamName string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AIOnboardingNewConversationResponse, error) @@ -14619,6 +14671,34 @@ func (r AIOnboardingChatResponse) StatusCode() int { return 0 } +type AIOnboardingEndConversationResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *AIOnboardingEndConversation200Response + JSON400 *BadRequest + JSON401 *RequiresAuthentication + JSON403 *Forbidden + JSON404 *NotFound + JSON405 *MethodNotAllowed + JSON500 *InternalError +} + +// Status returns HTTPResponse.Status +func (r AIOnboardingEndConversationResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r AIOnboardingEndConversationResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type AIOnboardingNewConversationResponse struct { Body []byte HTTPResponse *http.Response @@ -18073,6 +18153,15 @@ func (c *ClientWithResponses) AIOnboardingChatWithResponse(ctx context.Context, return ParseAIOnboardingChatResponse(rsp) } +// AIOnboardingEndConversationWithResponse request returning *AIOnboardingEndConversationResponse +func (c *ClientWithResponses) AIOnboardingEndConversationWithResponse(ctx context.Context, teamName string, reqEditors ...RequestEditorFn) (*AIOnboardingEndConversationResponse, error) { + rsp, err := c.AIOnboardingEndConversation(ctx, teamName, reqEditors...) + if err != nil { + return nil, err + } + return ParseAIOnboardingEndConversationResponse(rsp) +} + // AIOnboardingNewConversationWithBodyWithResponse request with arbitrary body returning *AIOnboardingNewConversationResponse func (c *ClientWithResponses) AIOnboardingNewConversationWithBodyWithResponse(ctx context.Context, teamName string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AIOnboardingNewConversationResponse, error) { rsp, err := c.AIOnboardingNewConversationWithBody(ctx, teamName, contentType, body, reqEditors...) @@ -22499,6 +22588,74 @@ func ParseAIOnboardingChatResponse(rsp *http.Response) (*AIOnboardingChatRespons return response, nil } +// ParseAIOnboardingEndConversationResponse parses an HTTP response from a AIOnboardingEndConversationWithResponse call +func ParseAIOnboardingEndConversationResponse(rsp *http.Response) (*AIOnboardingEndConversationResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &AIOnboardingEndConversationResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest AIOnboardingEndConversation200Response + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest BadRequest + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest RequiresAuthentication + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 405: + var dest MethodNotAllowed + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON405 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest InternalError + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + // ParseAIOnboardingNewConversationResponse parses an HTTP response from a AIOnboardingNewConversationWithResponse call func ParseAIOnboardingNewConversationResponse(rsp *http.Response) (*AIOnboardingNewConversationResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) diff --git a/models.gen.go b/models.gen.go index 9945d89..92f8b7d 100644 --- a/models.gen.go +++ b/models.gen.go @@ -345,6 +345,13 @@ type AIOnboardingChatRequest struct { AdditionalProperties map[string]interface{} `json:"-"` } +// AIOnboardingEndConversation200Response defines model for AIOnboardingEndConversation_200_response. +type AIOnboardingEndConversation200Response struct { + // Success Whether the conversation was ended successfully + Success *interface{} `json:"success,omitempty"` + AdditionalProperties map[string]interface{} `json:"-"` +} + // AIOnboardingNewConversation200Response defines model for AIOnboardingNewConversation_200_response. type AIOnboardingNewConversation200Response struct { // ConversationID The ID of the new conversation @@ -4044,6 +4051,74 @@ func (a AIOnboardingChatRequest) MarshalJSON() ([]byte, error) { return json.Marshal(object) } +// Getter for additional properties for AIOnboardingEndConversation200Response. Returns the specified +// element and whether it was found +func (a AIOnboardingEndConversation200Response) Get(fieldName string) (value interface{}, found bool) { + if a.AdditionalProperties != nil { + value, found = a.AdditionalProperties[fieldName] + } + return +} + +// Setter for additional properties for AIOnboardingEndConversation200Response +func (a *AIOnboardingEndConversation200Response) Set(fieldName string, value interface{}) { + if a.AdditionalProperties == nil { + a.AdditionalProperties = make(map[string]interface{}) + } + a.AdditionalProperties[fieldName] = value +} + +// Override default JSON handling for AIOnboardingEndConversation200Response to handle AdditionalProperties +func (a *AIOnboardingEndConversation200Response) UnmarshalJSON(b []byte) error { + object := make(map[string]json.RawMessage) + err := json.Unmarshal(b, &object) + if err != nil { + return err + } + + if raw, found := object["success"]; found { + err = json.Unmarshal(raw, &a.Success) + if err != nil { + return fmt.Errorf("error reading 'success': %w", err) + } + delete(object, "success") + } + + if len(object) != 0 { + a.AdditionalProperties = make(map[string]interface{}) + for fieldName, fieldBuf := range object { + var fieldVal interface{} + err := json.Unmarshal(fieldBuf, &fieldVal) + if err != nil { + return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) + } + a.AdditionalProperties[fieldName] = fieldVal + } + } + return nil +} + +// Override default JSON handling for AIOnboardingEndConversation200Response to handle AdditionalProperties +func (a AIOnboardingEndConversation200Response) MarshalJSON() ([]byte, error) { + var err error + object := make(map[string]json.RawMessage) + + if a.Success != nil { + object["success"], err = json.Marshal(a.Success) + if err != nil { + return nil, fmt.Errorf("error marshaling 'success': %w", err) + } + } + + for fieldName, field := range a.AdditionalProperties { + object[fieldName], err = json.Marshal(field) + if err != nil { + return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) + } + } + return json.Marshal(object) +} + // Getter for additional properties for AIOnboardingNewConversation200Response. Returns the specified // element and whether it was found func (a AIOnboardingNewConversation200Response) Get(fieldName string) (value interface{}, found bool) { diff --git a/spec.json b/spec.json index c48e500..5b5d39b 100644 --- a/spec.json +++ b/spec.json @@ -6922,6 +6922,52 @@ } }, "/teams/{team_name}/ai-onboarding/conversations" : { + "delete" : { + "description" : "End the current AI onboarding conversation", + "operationId" : "AIOnboardingEndConversation", + "parameters" : [ { + "explode" : false, + "in" : "path", + "name" : "team_name", + "required" : true, + "schema" : { + "type" : "string" + }, + "style" : "simple", + "x-go-name" : "TeamName" + } ], + "responses" : { + "200" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/AIOnboardingEndConversation_200_response" + } + } + }, + "description" : "Conversation ended successfully" + }, + "400" : { + "$ref" : "#/components/responses/BadRequest" + }, + "401" : { + "$ref" : "#/components/responses/RequiresAuthentication" + }, + "403" : { + "$ref" : "#/components/responses/Forbidden" + }, + "404" : { + "$ref" : "#/components/responses/NotFound" + }, + "405" : { + "$ref" : "#/components/responses/MethodNotAllowed" + }, + "500" : { + "$ref" : "#/components/responses/InternalError" + } + }, + "tags" : [ "ai-onboarding" ] + }, "post" : { "description" : "Start a new conversation with the AI onboarding assistant", "operationId" : "AIOnboardingNewConversation", @@ -12102,6 +12148,15 @@ }, "required" : [ "conversation_id" ] }, + "AIOnboardingEndConversation_200_response" : { + "additionalProperties" : { }, + "properties" : { + "success" : { + "description" : "Whether the conversation was ended successfully", + "x-go-name" : "Success" + } + } + }, "UsageIncrease_tables_inner" : { "properties" : { "name" : {