- RetrievePermissions - Read document permissions
- Retrieve - Read documents
- RetrieveByFacets - Read documents by facets
- Summarize - Summarize documents
Read the emails of all users who have access to the given document.
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.Documents.RetrievePermissions(ctx, components.GetDocPermissionsRequest{}, nil)
if err != nil {
log.Fatal(err)
}
if res.GetDocPermissionsResponse != nil {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
getDocPermissionsRequest |
components.GetDocPermissionsRequest | ✔️ | Document permissions request |
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. |
*operations.GetdocpermissionsResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.APIError | 4XX, 5XX | */* |
Read the documents including metadata (does not include enhanced metadata via /documentmetadata) for the given list of Glean Document IDs or URLs specified in the request.
package main
import(
"context"
"os"
apiclientgo "github.com/gleanwork/api-client-go"
"log"
)
func main() {
ctx := context.Background()
s := apiclientgo.New(
apiclientgo.WithSecurity(os.Getenv("GLEAN_API_TOKEN")),
)
res, err := s.Client.Documents.Retrieve(ctx, nil, nil)
if err != nil {
log.Fatal(err)
}
if res.GetDocumentsResponse != nil {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
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. |
getDocumentsRequest |
*components.GetDocumentsRequest | ➖ | Information about documents requested. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetdocumentsResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.APIError | 4XX, 5XX | */* |
Read the documents including metadata (does not include enhanced metadata via /documentmetadata) macthing the given facet conditions.
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.Documents.RetrieveByFacets(ctx, nil, &components.GetDocumentsByFacetsRequest{
FilterSets: []components.FacetFilterSet{
components.FacetFilterSet{
Filters: []components.FacetFilter{
components.FacetFilter{
FieldName: apiclientgo.Pointer("type"),
Values: []components.FacetFilterValue{
components.FacetFilterValue{
Value: apiclientgo.Pointer("Spreadsheet"),
RelationType: components.RelationTypeEquals.ToPointer(),
},
components.FacetFilterValue{
Value: apiclientgo.Pointer("Presentation"),
RelationType: components.RelationTypeEquals.ToPointer(),
},
},
},
},
},
components.FacetFilterSet{
Filters: []components.FacetFilter{
components.FacetFilter{
FieldName: apiclientgo.Pointer("type"),
Values: []components.FacetFilterValue{
components.FacetFilterValue{
Value: apiclientgo.Pointer("Spreadsheet"),
RelationType: components.RelationTypeEquals.ToPointer(),
},
components.FacetFilterValue{
Value: apiclientgo.Pointer("Presentation"),
RelationType: components.RelationTypeEquals.ToPointer(),
},
},
},
},
},
},
})
if err != nil {
log.Fatal(err)
}
if res.GetDocumentsByFacetsResponse != nil {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
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. |
getDocumentsByFacetsRequest |
*components.GetDocumentsByFacetsRequest | ➖ | Information about facet conditions for documents to be retrieved. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetdocumentsbyfacetsResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.APIError | 4XX, 5XX | */* |
Generate an AI summary of the requested documents.
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.Documents.Summarize(ctx, components.SummarizeRequest{
DocumentSpecs: []components.DocumentSpecUnion{
components.CreateDocumentSpecUnionDocumentSpec4(
components.DocumentSpec4{
UgcType: components.DocumentSpecUgcType2Chats,
UgcID: "<id>",
},
),
components.CreateDocumentSpecUnionDocumentSpec4(
components.DocumentSpec4{
UgcType: components.DocumentSpecUgcType2Chats,
UgcID: "<id>",
},
),
components.CreateDocumentSpecUnionDocumentSpec2(
components.DocumentSpec2{
ID: "<id>",
},
),
},
}, nil)
if err != nil {
log.Fatal(err)
}
if res.SummarizeResponse != nil {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
summarizeRequest |
components.SummarizeRequest | ✔️ | Includes request params such as the query and specs of the documents to summarize. |
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. |
*operations.SummarizeResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.APIError | 4XX, 5XX | */* |