chat

package
v0.0.0-...-4ae6852 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2025 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const APIName = "gram"

APIName is the name of the API as defined in the design.

View Source
const APIVersion = "0.0.1"

APIVersion is the version of the API as defined in the design.

View Source
const ServiceName = "chat"

ServiceName is the name of the service as defined in the design. This is the same value that is set in the endpoint request contexts under the ServiceKey key.

Variables

View Source
var MethodNames = [3]string{"listChats", "loadChat", "creditUsage"}

MethodNames lists the service method names as defined in the design. These are the same values that are set in the endpoint request contexts under the MethodKey key.

Functions

func MakeBadRequest

func MakeBadRequest(err error) *goa.ServiceError

MakeBadRequest builds a goa.ServiceError from an error.

func MakeConflict

func MakeConflict(err error) *goa.ServiceError

MakeConflict builds a goa.ServiceError from an error.

func MakeForbidden

func MakeForbidden(err error) *goa.ServiceError

MakeForbidden builds a goa.ServiceError from an error.

func MakeGatewayError

func MakeGatewayError(err error) *goa.ServiceError

MakeGatewayError builds a goa.ServiceError from an error.

func MakeInvalid

func MakeInvalid(err error) *goa.ServiceError

MakeInvalid builds a goa.ServiceError from an error.

func MakeInvariantViolation

func MakeInvariantViolation(err error) *goa.ServiceError

MakeInvariantViolation builds a goa.ServiceError from an error.

func MakeNotFound

func MakeNotFound(err error) *goa.ServiceError

MakeNotFound builds a goa.ServiceError from an error.

func MakeUnauthorized

func MakeUnauthorized(err error) *goa.ServiceError

MakeUnauthorized builds a goa.ServiceError from an error.

func MakeUnexpected

func MakeUnexpected(err error) *goa.ServiceError

MakeUnexpected builds a goa.ServiceError from an error.

func MakeUnsupportedMedia

func MakeUnsupportedMedia(err error) *goa.ServiceError

MakeUnsupportedMedia builds a goa.ServiceError from an error.

func NewCreditUsageEndpoint

func NewCreditUsageEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewCreditUsageEndpoint returns an endpoint function that calls the method "creditUsage" of service "chat".

func NewListChatsEndpoint

func NewListChatsEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewListChatsEndpoint returns an endpoint function that calls the method "listChats" of service "chat".

func NewLoadChatEndpoint

func NewLoadChatEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewLoadChatEndpoint returns an endpoint function that calls the method "loadChat" of service "chat".

Types

type Auther

type Auther interface {
	// APIKeyAuth implements the authorization logic for the APIKey security scheme.
	APIKeyAuth(ctx context.Context, key string, schema *security.APIKeyScheme) (context.Context, error)
}

Auther defines the authorization functions to be implemented by the service.

type Chat

type Chat struct {
	// The list of messages in the chat
	Messages []*ChatMessage
	// The ID of the chat
	ID string
	// The title of the chat
	Title string
	// The ID of the user who created the chat
	UserID string
	// The number of messages in the chat
	NumMessages int
	// When the chat was created.
	CreatedAt string
	// When the chat was last updated.
	UpdatedAt string
}

Chat is the result type of the chat service loadChat method.

type ChatMessage

type ChatMessage struct {
	// The ID of the message
	ID string
	// The role of the message
	Role string
	// The content of the message
	Content *string
	// The model that generated the message
	Model string
	// The tool call ID of the message
	ToolCallID *string
	// The tool calls in the message as a JSON blob
	ToolCalls *string
	// The finish reason of the message
	FinishReason *string
	// The ID of the user who created the message
	UserID *string
	// When the message was created.
	CreatedAt string
}

type ChatOverview

type ChatOverview struct {
	// The ID of the chat
	ID string
	// The title of the chat
	Title string
	// The ID of the user who created the chat
	UserID string
	// The number of messages in the chat
	NumMessages int
	// When the chat was created.
	CreatedAt string
	// When the chat was last updated.
	UpdatedAt string
}

type Client

type Client struct {
	ListChatsEndpoint   goa.Endpoint
	LoadChatEndpoint    goa.Endpoint
	CreditUsageEndpoint goa.Endpoint
}

Client is the "chat" service client.

func NewClient

func NewClient(listChats, loadChat, creditUsage goa.Endpoint) *Client

NewClient initializes a "chat" service client given the endpoints.

func (*Client) CreditUsage

func (c *Client) CreditUsage(ctx context.Context, p *CreditUsagePayload) (res *CreditUsageResult, err error)

CreditUsage calls the "creditUsage" endpoint of the "chat" service. CreditUsage may return the following errors:

  • "unauthorized" (type *goa.ServiceError): unauthorized access
  • "forbidden" (type *goa.ServiceError): permission denied
  • "bad_request" (type *goa.ServiceError): request is invalid
  • "not_found" (type *goa.ServiceError): resource not found
  • "conflict" (type *goa.ServiceError): resource already exists
  • "unsupported_media" (type *goa.ServiceError): unsupported media type
  • "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
  • "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
  • "unexpected" (type *goa.ServiceError): an unexpected error occurred
  • "gateway_error" (type *goa.ServiceError): an unexpected error occurred
  • error: internal error

func (*Client) ListChats

func (c *Client) ListChats(ctx context.Context, p *ListChatsPayload) (res *ListChatsResult, err error)

ListChats calls the "listChats" endpoint of the "chat" service. ListChats may return the following errors:

  • "unauthorized" (type *goa.ServiceError): unauthorized access
  • "forbidden" (type *goa.ServiceError): permission denied
  • "bad_request" (type *goa.ServiceError): request is invalid
  • "not_found" (type *goa.ServiceError): resource not found
  • "conflict" (type *goa.ServiceError): resource already exists
  • "unsupported_media" (type *goa.ServiceError): unsupported media type
  • "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
  • "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
  • "unexpected" (type *goa.ServiceError): an unexpected error occurred
  • "gateway_error" (type *goa.ServiceError): an unexpected error occurred
  • error: internal error

func (*Client) LoadChat

func (c *Client) LoadChat(ctx context.Context, p *LoadChatPayload) (res *Chat, err error)

LoadChat calls the "loadChat" endpoint of the "chat" service. LoadChat may return the following errors:

  • "unauthorized" (type *goa.ServiceError): unauthorized access
  • "forbidden" (type *goa.ServiceError): permission denied
  • "bad_request" (type *goa.ServiceError): request is invalid
  • "not_found" (type *goa.ServiceError): resource not found
  • "conflict" (type *goa.ServiceError): resource already exists
  • "unsupported_media" (type *goa.ServiceError): unsupported media type
  • "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
  • "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
  • "unexpected" (type *goa.ServiceError): an unexpected error occurred
  • "gateway_error" (type *goa.ServiceError): an unexpected error occurred
  • error: internal error

type CreditUsagePayload

type CreditUsagePayload struct {
	SessionToken     *string
	ProjectSlugInput *string
}

CreditUsagePayload is the payload type of the chat service creditUsage method.

type CreditUsageResult

type CreditUsageResult struct {
	// The number of credits remaining
	CreditsUsed float64
	// The number of monthly credits
	MonthlyCredits int
}

CreditUsageResult is the result type of the chat service creditUsage method.

type Endpoints

type Endpoints struct {
	ListChats   goa.Endpoint
	LoadChat    goa.Endpoint
	CreditUsage goa.Endpoint
}

Endpoints wraps the "chat" service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

NewEndpoints wraps the methods of the "chat" service with endpoints.

func (*Endpoints) Use

func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint)

Use applies the given middleware to all the "chat" service endpoints.

type ListChatsPayload

type ListChatsPayload struct {
	SessionToken     *string
	ProjectSlugInput *string
}

ListChatsPayload is the payload type of the chat service listChats method.

type ListChatsResult

type ListChatsResult struct {
	// The list of chats
	Chats []*ChatOverview
}

ListChatsResult is the result type of the chat service listChats method.

type LoadChatPayload

type LoadChatPayload struct {
	SessionToken     *string
	ProjectSlugInput *string
	// The ID of the chat
	ID string
}

LoadChatPayload is the payload type of the chat service loadChat method.

type Service

type Service interface {
	// List all chats for a project
	ListChats(context.Context, *ListChatsPayload) (res *ListChatsResult, err error)
	// Load a chat by its ID
	LoadChat(context.Context, *LoadChatPayload) (res *Chat, err error)
	// Load a chat by its ID
	CreditUsage(context.Context, *CreditUsagePayload) (res *CreditUsageResult, err error)
}

Managed chats for gram AI consumers.

Jump to

Keyboard shortcuts

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