Documentation
¶
Overview ¶
Package platform provides a Platform API client.
Package platform provides the Platform API client.
Index ¶
- type APIResponse
- type AddArtifactResponse
- type ArtifactUploadParameters
- type Client
- func (p *Client) AddArtifact(ctx context.Context, uploadParameters ArtifactUploadParameters) (string, error)
- func (p *Client) CheckPlatformToken(ctx context.Context, request TokenCheckRequest) (TokenCheckResponse, error)
- func (p *Client) CreatePlatformSession(ctx context.Context, session Session) (string, error)
- func (p *Client) DeregisterApplication(ctx context.Context, deregisterRequest DeregisterApplicationRequest) error
- func (p *Client) PostCommand(ctx context.Context, command *Command) (PostCommandResponse, error)
- func (p *Client) PostMessage(ctx context.Context, message PostMessage) (string, error)
- func (p *Client) RegisterApplication(ctx context.Context, registerRequest RegisterApplicationRequest) (uint64, error)
- type Command
- type CreateSessionResponse
- type DeregisterApplicationRequest
- type DeregisterApplicationResponse
- type PostCommandResponse
- type PostMessage
- type PostMessageResponse
- type RegisterApplicationRequest
- type RegisterApplicationResponse
- type Session
- type TokenCheckRequest
- type TokenCheckResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIResponse ¶
type APIResponse struct {
Hint string `json:"hint"`
Details string `json:"details"`
Code string `json:"code"`
Message string `json:"message"`
}
APIResponse represents common fields of an API response.
type AddArtifactResponse ¶
type AddArtifactResponse struct {
APIResponse
ArtifactID int `json:"artifact_id"`
ArtifactLink string `json:"artifact_link"`
}
AddArtifactResponse represents a response of an artifact uploading.
type ArtifactUploadParameters ¶
type ArtifactUploadParameters struct {
MessageID string `json:"message_id"`
Title string `json:"title"`
Content string `json:"content"`
}
ArtifactUploadParameters represents parameters to upload artifact to Platform.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides a Platform API client.
func (*Client) AddArtifact ¶
func (p *Client) AddArtifact(ctx context.Context, uploadParameters ArtifactUploadParameters) (string, error)
AddArtifact makes an HTTP request to upload an artifact to Platform.
func (*Client) CheckPlatformToken ¶
func (p *Client) CheckPlatformToken(ctx context.Context, request TokenCheckRequest) (TokenCheckResponse, error)
CheckPlatformToken makes an HTTP request to check the Platform Access Token.
func (*Client) CreatePlatformSession ¶
CreatePlatformSession makes an HTTP request to create a new Platform session.
func (*Client) DeregisterApplication ¶
func (p *Client) DeregisterApplication(ctx context.Context, deregisterRequest DeregisterApplicationRequest) error
DeregisterApplication deregister the application from the Platform.
func (*Client) PostCommand ¶
PostCommand makes an HTTP request to post a command to Platform.
func (*Client) PostMessage ¶
PostMessage makes an HTTP request to post a new message to Platform.
func (*Client) RegisterApplication ¶
func (p *Client) RegisterApplication(ctx context.Context, registerRequest RegisterApplicationRequest) (uint64, error)
RegisterApplication register the application on the Platform.
type Command ¶
type Command struct {
SessionID string `json:"session_id"`
Command string `json:"command"`
Query string `json:"query"`
Response string `json:"response"`
// Explain.
PlanText string `json:"plan_text"`
PlanJSON string `json:"plan_json"`
PlanExecText string `json:"plan_execution_text"`
PlanExecJSON string `json:"plan_execution_json"`
Recommendations string `json:"recommendations"`
Stats string `json:"stats"`
QueryLocks string `json:"query_locks"`
Error string `json:"error"`
Timestamp string `json:"timestamp"`
}
Command represents an incoming command and its results.
type CreateSessionResponse ¶
type CreateSessionResponse struct {
APIResponse
SessionID uint `json:"session_id"`
}
CreateSessionResponse represents a response of a session creating request.
type DeregisterApplicationRequest ¶
type DeregisterApplicationRequest struct {
InstanceID uint64 `json:"instance_id"`
}
DeregisterApplicationRequest represents a request of the application deregistration.
type DeregisterApplicationResponse ¶
type DeregisterApplicationResponse struct {
APIResponse
InstanceID uint64 `json:"result"`
}
DeregisterApplicationResponse represents a response of the application deregistration.
type PostCommandResponse ¶
type PostCommandResponse struct {
APIResponse
CommandID uint `json:"command_id"`
CommandLink string `json:"command_link"`
}
PostCommandResponse represents a response of a posting command request.
type PostMessage ¶
type PostMessage struct {
CommandID string `json:"command_id"`
MessageID string `json:"message_id"`
Text string `json:"text"`
Status string `json:"status"`
SessionID string `json:"session_id"`
}
PostMessage defines a message for a Platform posting.
type PostMessageResponse ¶
type PostMessageResponse struct {
APIResponse
MessageID string `json:"message_id"`
}
PostMessageResponse represents a response of a posting message request.
type RegisterApplicationRequest ¶
type RegisterApplicationRequest struct {
OrgID uint `json:"org_id"`
URL string `json:"url"`
Token string `json:"token"`
Project string `json:"project"`
SSHServerURL string `json:"ssh_server_url"`
UseTunnel bool `json:"use_tunnel"`
DryRun bool `json:"dry_run"`
}
RegisterApplicationRequest represents a request of the application registration.
type RegisterApplicationResponse ¶
type RegisterApplicationResponse struct {
APIResponse
InstanceID uint64 `json:"id"`
}
RegisterApplicationResponse represents a response of the application registration.
type Session ¶
type Session struct {
ProjectName string `json:"project_name"`
UserID string `json:"user_id"`
Username string `json:"user_name"`
ChannelID string `json:"channel_id"`
}
Session represent a Platform session.
type TokenCheckRequest ¶
type TokenCheckRequest struct {
Token string `json:"token"`
}
TokenCheckRequest represents a token checking request.
type TokenCheckResponse ¶
type TokenCheckResponse struct {
APIResponse
OrganizationID uint `json:"org_id"`
Personal bool `json:"is_personal"`
}
TokenCheckResponse represents response of a token checking request.