openapi

package
v1.26.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2025 License: MIT Imports: 6 Imported by: 0

README

Go API client for openapi

This is the public Twilio REST API.

Overview

This API client was generated by the OpenAPI Generator project from the OpenAPI specs located at twilio/twilio-oai. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import "./openapi"

Documentation for API Endpoints

All URIs are relative to https://knowledge.twilio.com

Class Method HTTP request Description
KnowledgeApi CreateKnowledge Post /v1/Knowledge Create knowledge
KnowledgeApi DeleteKnowledge Delete /v1/Knowledge/{id} Delete knowledge
KnowledgeApi FetchKnowledge Get /v1/Knowledge/{id} Get knowledge
KnowledgeApi ListKnowledge Get /v1/Knowledge List all knowledge
KnowledgeApi UpdateKnowledge Put /v1/Knowledge/{id} Update knowledge
KnowledgeChunksApi ListKnowledgeChunks Get /v1/Knowledge/{id}/Chunks List knowledge chunks
KnowledgeStatusApi FetchKnowledgeStatus Get /v1/Knowledge/{id}/Status Get knowledge status

Documentation For Models

Documentation For Authorization

accountSid_authToken

  • Type: HTTP basic authentication

Example

auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
    UserName: "username",
    Password: "password",
})
r, err := client.Service.Operation(auth, args)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiService

type ApiService struct {
	// contains filtered or unexported fields
}

func NewApiService

func NewApiService(requestHandler *twilio.RequestHandler) *ApiService

func NewApiServiceWithClient

func NewApiServiceWithClient(client twilio.BaseClient) *ApiService

func (*ApiService) CreateKnowledge

func (c *ApiService) CreateKnowledge(params *CreateKnowledgeParams) (*KnowledgeV1Knowledge, error)

Create knowledge

func (*ApiService) DeleteKnowledge

func (c *ApiService) DeleteKnowledge(Id string) error

Delete knowledge

func (*ApiService) FetchKnowledge

func (c *ApiService) FetchKnowledge(Id string) (*KnowledgeV1Knowledge, error)

Get knowledge

func (*ApiService) FetchKnowledgeStatus

func (c *ApiService) FetchKnowledgeStatus(Id string) (*KnowledgeV1KnowledgeStatus, error)

Get knowledge status

func (*ApiService) ListKnowledge

func (c *ApiService) ListKnowledge(params *ListKnowledgeParams) ([]ListKnowledgeResponseKnowledge, error)

Lists Knowledge records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning.

func (*ApiService) ListKnowledgeChunks

func (c *ApiService) ListKnowledgeChunks(Id string, params *ListKnowledgeChunksParams) ([]KnowledgeV1KnowledgeChunk, error)

Lists KnowledgeChunks records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning.

func (*ApiService) PageKnowledge

func (c *ApiService) PageKnowledge(params *ListKnowledgeParams, pageToken, pageNumber string) (*ListKnowledgeResponse, error)

Retrieve a single page of Knowledge records from the API. Request is executed immediately.

func (*ApiService) PageKnowledgeChunks

func (c *ApiService) PageKnowledgeChunks(Id string, params *ListKnowledgeChunksParams, pageToken, pageNumber string) (*ListKnowledgeChunksResponse, error)

Retrieve a single page of KnowledgeChunks records from the API. Request is executed immediately.

func (*ApiService) RequestHandler

func (c *ApiService) RequestHandler() *twilio.RequestHandler

func (*ApiService) StreamKnowledge

func (c *ApiService) StreamKnowledge(params *ListKnowledgeParams) (chan ListKnowledgeResponseKnowledge, chan error)

Streams Knowledge records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached.

func (*ApiService) StreamKnowledgeChunks

func (c *ApiService) StreamKnowledgeChunks(Id string, params *ListKnowledgeChunksParams) (chan KnowledgeV1KnowledgeChunk, chan error)

Streams KnowledgeChunks records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached.

func (*ApiService) UpdateKnowledge

func (c *ApiService) UpdateKnowledge(Id string, params *UpdateKnowledgeParams) (*KnowledgeV1Knowledge, error)

Update knowledge

type CreateKnowledgeParams

type CreateKnowledgeParams struct {
	//
	KnowledgeV1CreateKnowledgeRequest *KnowledgeV1CreateKnowledgeRequest `json:"KnowledgeV1CreateKnowledgeRequest,omitempty"`
}

Optional parameters for the method 'CreateKnowledge'

func (*CreateKnowledgeParams) SetKnowledgeV1CreateKnowledgeRequest

func (params *CreateKnowledgeParams) SetKnowledgeV1CreateKnowledgeRequest(KnowledgeV1CreateKnowledgeRequest KnowledgeV1CreateKnowledgeRequest) *CreateKnowledgeParams

type KnowledgeV1CreateKnowledgeRequest

type KnowledgeV1CreateKnowledgeRequest struct {
	// The description of the knowledge source.
	Description string `json:"description,omitempty"`
	// The details of the knowledge source based on the type.
	KnowledgeSourceDetails map[string]interface{} `json:"knowledge_source_details,omitempty"`
	// The name of the tool.
	Name   string                         `json:"name"`
	Policy KnowledgeV1CreatePolicyRequest `json:"policy,omitempty"`
	// The type of the knowledge source.
	Type string `json:"type"`
	// The embedding model to be used for the knowledge source. It's required for 'Database' type but disallowed for other types.
	EmbeddingModel string `json:"embedding_model,omitempty"`
}

KnowledgeV1CreateKnowledgeRequest struct for KnowledgeV1CreateKnowledgeRequest

type KnowledgeV1CreatePolicyRequest

type KnowledgeV1CreatePolicyRequest struct {
	// The description of the policy.
	Description string `json:"description,omitempty"`
	// The Policy ID.
	Id string `json:"id,omitempty"`
	// The name of the policy.
	Name          string       `json:"name,omitempty"`
	PolicyDetails *interface{} `json:"policy_details"`
	// The description of the policy.
	Type string `json:"type,omitempty"`
}

KnowledgeV1CreatePolicyRequest struct for KnowledgeV1CreatePolicyRequest

type KnowledgeV1Knowledge

type KnowledgeV1Knowledge struct {
	// The type of knowledge source.
	Description string `json:"description,omitempty"`
	// The description of knowledge.
	Id string `json:"id"`
	// The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource.
	AccountSid string `json:"account_sid,omitempty"`
	// The details of the knowledge source based on the type.
	KnowledgeSourceDetails map[string]interface{} `json:"knowledge_source_details,omitempty"`
	// The name of the knowledge source.
	Name string `json:"name"`
	// The status of processing the knowledge source ('QUEUED', 'PROCESSING', 'COMPLETED', 'FAILED')
	Status string `json:"status,omitempty"`
	// The type of knowledge source ('Web', 'Database', 'Text', 'File')
	Type string `json:"type"`
	// The url of the knowledge resource.
	Url string `json:"url,omitempty"`
	// The embedding model to be used for the knowledge source.
	EmbeddingModel string `json:"embedding_model,omitempty"`
	// The date and time in GMT when the Knowledge was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
	DateCreated time.Time `json:"date_created"`
	// The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
	DateUpdated time.Time `json:"date_updated"`
}

KnowledgeV1Knowledge struct for KnowledgeV1Knowledge

type KnowledgeV1KnowledgeChunk

type KnowledgeV1KnowledgeChunk struct {
	// The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource.
	AccountSid string `json:"account_sid,omitempty"`
	// The chunk content.
	Content string `json:"content,omitempty"`
	// The metadata of the chunk.
	Metadata map[string]interface{} `json:"metadata,omitempty"`
	// The date and time in GMT when the Chunk was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
	DateCreated time.Time `json:"date_created,omitempty"`
	// The date and time in GMT when the Chunk was updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
	DateUpdated time.Time `json:"date_updated,omitempty"`
}

KnowledgeV1KnowledgeChunk struct for KnowledgeV1KnowledgeChunk

type KnowledgeV1KnowledgeChunkWithScore

type KnowledgeV1KnowledgeChunkWithScore struct {
	// The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource.
	AccountSid string `json:"account_sid,omitempty"`
	// The chunk content.
	Content string `json:"content,omitempty"`
	// The metadata of the chunk.
	Metadata map[string]interface{} `json:"metadata,omitempty"`
	// The date and time in GMT when the Chunk was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
	DateCreated time.Time `json:"date_created,omitempty"`
	// The date and time in GMT when the Chunk was updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
	DateUpdated time.Time `json:"date_updated,omitempty"`
	// The score associated with the chunk.
	Score float32 `json:"score,omitempty"`
	// The knowledge ID associated with the chunk.
	KnowledgeId string `json:"knowledge_id,omitempty"`
}

KnowledgeV1KnowledgeChunkWithScore struct for KnowledgeV1KnowledgeChunkWithScore

func (*KnowledgeV1KnowledgeChunkWithScore) UnmarshalJSON

func (response *KnowledgeV1KnowledgeChunkWithScore) UnmarshalJSON(bytes []byte) (err error)

type KnowledgeV1KnowledgeStatus

type KnowledgeV1KnowledgeStatus struct {
	// The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource.
	AccountSid string `json:"account_sid,omitempty"`
	// The status of processing the knowledge source ('QUEUED', 'PROCESSING', 'COMPLETED', 'FAILED')
	Status string `json:"status"`
	// The last status of processing the knowledge source ('QUEUED', 'PROCESSING', 'COMPLETED', 'FAILED')
	LastStatus string `json:"last_status,omitempty"`
	// The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
	DateUpdated time.Time `json:"date_updated,omitempty"`
}

KnowledgeV1KnowledgeStatus struct for KnowledgeV1KnowledgeStatus

type KnowledgeV1UpdateKnowledgeRequest

type KnowledgeV1UpdateKnowledgeRequest struct {
	// The description of the knowledge source.
	Description string `json:"description,omitempty"`
	// The details of the knowledge source based on the type.
	KnowledgeSourceDetails map[string]interface{} `json:"knowledge_source_details,omitempty"`
	// The name of the knowledge source.
	Name   string                         `json:"name,omitempty"`
	Policy KnowledgeV1CreatePolicyRequest `json:"policy,omitempty"`
	// The description of the knowledge source.
	Type string `json:"type,omitempty"`
	// The embedding model to be used for the knowledge source. It's only applicable to 'Database' type.
	EmbeddingModel string `json:"embedding_model,omitempty"`
}

KnowledgeV1UpdateKnowledgeRequest struct for KnowledgeV1UpdateKnowledgeRequest

type ListKnowledgeChunksParams

type ListKnowledgeChunksParams struct {
	// How many resources to return in each list page. The default is 50, and the maximum is 1000.
	PageSize *int `json:"PageSize,omitempty"`
	// Max number of records to return.
	Limit *int `json:"limit,omitempty"`
}

Optional parameters for the method 'ListKnowledgeChunks'

func (*ListKnowledgeChunksParams) SetLimit

func (params *ListKnowledgeChunksParams) SetLimit(Limit int) *ListKnowledgeChunksParams

func (*ListKnowledgeChunksParams) SetPageSize

func (params *ListKnowledgeChunksParams) SetPageSize(PageSize int) *ListKnowledgeChunksParams

type ListKnowledgeChunksResponse

type ListKnowledgeChunksResponse struct {
	Chunks []KnowledgeV1KnowledgeChunk `json:"chunks,omitempty"`
	Meta   ListKnowledgeResponseMeta   `json:"meta,omitempty"`
}

ListKnowledgeChunksResponse struct for ListKnowledgeChunksResponse

type ListKnowledgeParams

type ListKnowledgeParams struct {
	// How many resources to return in each list page. The default is 50, and the maximum is 1000.
	PageSize *int `json:"PageSize,omitempty"`
	// Max number of records to return.
	Limit *int `json:"limit,omitempty"`
}

Optional parameters for the method 'ListKnowledge'

func (*ListKnowledgeParams) SetLimit

func (params *ListKnowledgeParams) SetLimit(Limit int) *ListKnowledgeParams

func (*ListKnowledgeParams) SetPageSize

func (params *ListKnowledgeParams) SetPageSize(PageSize int) *ListKnowledgeParams

type ListKnowledgeResponse

type ListKnowledgeResponse struct {
	Knowledge []ListKnowledgeResponseKnowledge `json:"knowledge,omitempty"`
	Meta      ListKnowledgeResponseMeta        `json:"meta,omitempty"`
}

ListKnowledgeResponse struct for ListKnowledgeResponse

type ListKnowledgeResponseKnowledge

type ListKnowledgeResponseKnowledge struct {
	// The type of knowledge source.
	Description string `json:"description,omitempty"`
	// The description of knowledge.
	Id string `json:"id"`
	// The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource.
	AccountSid string `json:"account_sid,omitempty"`
	// The details of the knowledge source based on the type.
	KnowledgeSourceDetails map[string]interface{} `json:"knowledge_source_details,omitempty"`
	// The name of the knowledge source.
	Name string `json:"name"`
	// The status of processing the knowledge source ('QUEUED', 'PROCESSING', 'COMPLETED', 'FAILED')
	Status string `json:"status,omitempty"`
	// The type of knowledge source ('Web', 'Database', 'Text', 'File')
	Type string `json:"type"`
	// The url of the knowledge resource.
	Url string `json:"url,omitempty"`
	// The embedding model to be used for the knowledge source.
	EmbeddingModel string `json:"embedding_model,omitempty"`
	// The date and time in GMT when the Knowledge was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
	DateCreated time.Time `json:"date_created"`
	// The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
	DateUpdated time.Time `json:"date_updated"`
}

ListKnowledgeResponseKnowledge struct for ListKnowledgeResponseKnowledge

type ListKnowledgeResponseMeta

type ListKnowledgeResponseMeta struct {
	FirstPageUrl    string  `json:"first_page_url,omitempty"`
	Key             string  `json:"key,omitempty"`
	NextPageUrl     *string `json:"next_page_url,omitempty"`
	Page            int     `json:"page,omitempty"`
	PageSize        int     `json:"page_size,omitempty"`
	PreviousPageUrl *string `json:"previous_page_url,omitempty"`
	Url             string  `json:"url,omitempty"`
}

ListKnowledgeResponseMeta struct for ListKnowledgeResponseMeta

type UpdateKnowledgeParams

type UpdateKnowledgeParams struct {
	//
	KnowledgeV1UpdateKnowledgeRequest *KnowledgeV1UpdateKnowledgeRequest `json:"KnowledgeV1UpdateKnowledgeRequest,omitempty"`
}

Optional parameters for the method 'UpdateKnowledge'

func (*UpdateKnowledgeParams) SetKnowledgeV1UpdateKnowledgeRequest

func (params *UpdateKnowledgeParams) SetKnowledgeV1UpdateKnowledgeRequest(KnowledgeV1UpdateKnowledgeRequest KnowledgeV1UpdateKnowledgeRequest) *UpdateKnowledgeParams

Jump to

Keyboard shortcuts

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