Skip to content

Latest commit

 

History

History
65 lines (48 loc) · 5.9 KB

File metadata and controls

65 lines (48 loc) · 5.9 KB

Client.Messages

Overview

Available Operations

Retrieve

Retrieves list of messages from messaging/chat datasources (e.g. Slack, Teams).

Example Usage

package main

import(
	"context"
	"os"
	apiclientgo "github.com/gleanwork/api-client-go"
	"github.com/gleanwork/api-client-go/models/components"
	"log"
)

func main() {
    ctx := context.Background()

    s := apiclientgo.New(
        apiclientgo.WithSecurity(os.Getenv("GLEAN_API_TOKEN")),
    )

    res, err := s.Client.Messages.Retrieve(ctx, components.MessagesRequest{
        IDType: components.IDTypeConversationID,
        ID: "<id>",
        Datasource: components.DatasourceGchat,
    }, nil)
    if err != nil {
        log.Fatal(err)
    }
    if res.MessagesResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
messagesRequest components.MessagesRequest ✔️ Includes request params such as the id for channel/message and direction.
locale *string The client's preferred locale in rfc5646 format (e.g. en, ja, pt-BR). If omitted, the Accept-Language will be used. If not present or not supported, defaults to the closest match or en.
opts []operations.Option The options for this request.

Response

*operations.MessagesResponse, error

Errors

Error Type Status Code Content Type
apierrors.APIError 4XX, 5XX */*