hyperspell

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 21 Imported by: 0

README

Hyperspell Go API Library

Go Reference

The Hyperspell Go library provides convenient access to the Hyperspell REST API from applications written in Go.

It is generated with Stainless.

MCP Server

Use the Hyperspell MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.

Add to Cursor Install in VS Code

Note: You may need to set environment variables in your MCP client.

Installation

import (
	"github.com/hyperspell/hyperspell-go" // imported as hyperspell
)

Or to pin the version:

go get -u 'github.com/hyperspell/hyperspell-go@v0.0.2'

Requirements

This library requires Go 1.22+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"
	"fmt"

	"github.com/hyperspell/hyperspell-go"
	"github.com/hyperspell/hyperspell-go/option"
)

func main() {
	client := hyperspell.NewClient(
		option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("HYPERSPELL_API_KEY")
	)
	memoryStatus, err := client.Memories.Add(context.TODO(), hyperspell.MemoryAddParams{
		Text: "text",
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", memoryStatus.ResourceID)
}

Request fields

The hyperspell library uses the omitzero semantics from the Go 1.24+ encoding/json release for request fields.

Required primitive fields (int64, string, etc.) feature the tag `api:"required"`. These fields are always serialized, even their zero values.

Optional primitive types are wrapped in a param.Opt[T]. These fields can be set with the provided constructors, hyperspell.String(string), hyperspell.Int(int64), etc.

Any param.Opt[T], map, slice, struct or string enum uses the tag `json:"...,omitzero"`. Its zero value is considered omitted.

The param.IsOmitted(any) function can confirm the presence of any omitzero field.

p := hyperspell.ExampleParams{
	ID:   "id_xxx",                 // required property
	Name: hyperspell.String("..."), // optional property

	Point: hyperspell.Point{
		X: 0,                 // required field will serialize as 0
		Y: hyperspell.Int(1), // optional field will serialize as 1
		// ... omitted non-required fields will not be serialized
	},

	Origin: hyperspell.Origin{}, // the zero value of [Origin] is considered omitted
}

To send null instead of a param.Opt[T], use param.Null[T](). To send null instead of a struct T, use param.NullStruct[T]().

p.Name = param.Null[string]()       // 'null' instead of string
p.Point = param.NullStruct[Point]() // 'null' instead of struct

param.IsNull(p.Name)  // true
param.IsNull(p.Point) // true

Request structs contain a .SetExtraFields(map[string]any) method which can send non-conforming fields in the request body. Extra fields overwrite any struct fields with a matching key. For security reasons, only use SetExtraFields with trusted data.

To send a custom value instead of a struct, use param.Override[T](value).

// In cases where the API specifies a given type,
// but you want to send something else, use [SetExtraFields]:
p.SetExtraFields(map[string]any{
	"x": 0.01, // send "x" as a float instead of int
})

// Send a number instead of an object
custom := param.Override[hyperspell.FooParams](12)
Request unions

Unions are represented as a struct with fields prefixed by "Of" for each of its variants, only one field can be non-zero. The non-zero field will be serialized.

Sub-properties of the union can be accessed via methods on the union struct. These methods return a mutable pointer to the underlying data, if present.

// Only one field can be non-zero, use param.IsOmitted() to check if a field is set
type AnimalUnionParam struct {
	OfCat *Cat `json:",omitzero,inline`
	OfDog *Dog `json:",omitzero,inline`
}

animal := AnimalUnionParam{
	OfCat: &Cat{
		Name: "Whiskers",
		Owner: PersonParam{
			Address: AddressParam{Street: "3333 Coyote Hill Rd", Zip: 0},
		},
	},
}

// Mutating a field
if address := animal.GetOwner().GetAddress(); address != nil {
	address.ZipCode = 94304
}
Response objects

All fields in response structs are ordinary value types (not pointers or wrappers). Response structs also include a special JSON field containing metadata about each property.

type Animal struct {
	Name   string `json:"name,nullable"`
	Owners int    `json:"owners"`
	Age    int    `json:"age"`
	JSON   struct {
		Name        respjson.Field
		Owner       respjson.Field
		Age         respjson.Field
		ExtraFields map[string]respjson.Field
	} `json:"-"`
}

To handle optional data, use the .Valid() method on the JSON field. .Valid() returns true if a field is not null, not present, or couldn't be marshaled.

If .Valid() is false, the corresponding field will simply be its zero value.

raw := `{"owners": 1, "name": null}`

var res Animal
json.Unmarshal([]byte(raw), &res)

// Accessing regular fields

res.Owners // 1
res.Name   // ""
res.Age    // 0

// Optional field checks

res.JSON.Owners.Valid() // true
res.JSON.Name.Valid()   // false
res.JSON.Age.Valid()    // false

// Raw JSON values

res.JSON.Owners.Raw()                  // "1"
res.JSON.Name.Raw() == "null"          // true
res.JSON.Name.Raw() == respjson.Null   // true
res.JSON.Age.Raw() == ""               // true
res.JSON.Age.Raw() == respjson.Omitted // true

These .JSON structs also include an ExtraFields map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
Response Unions

In responses, unions are represented by a flattened struct containing all possible fields from each of the object variants. To convert it to a variant use the .AsFooVariant() method or the .AsAny() method if present.

If a response value union contains primitive values, primitive fields will be alongside the properties but prefixed with Of and feature the tag json:"...,inline".

type AnimalUnion struct {
	// From variants [Dog], [Cat]
	Owner Person `json:"owner"`
	// From variant [Dog]
	DogBreed string `json:"dog_breed"`
	// From variant [Cat]
	CatBreed string `json:"cat_breed"`
	// ...

	JSON struct {
		Owner respjson.Field
		// ...
	} `json:"-"`
}

// If animal variant
if animal.Owner.Address.ZipCode == "" {
	panic("missing zip code")
}

// Switch on the variant
switch variant := animal.AsAny().(type) {
case Dog:
case Cat:
default:
	panic("unexpected type")
}
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := hyperspell.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.Memories.Add(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

The request option option.WithDebugLog(nil) may be helpful while debugging.

See the full list of request options.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

iter := client.Memories.ListAutoPaging(context.TODO(), hyperspell.MemoryListParams{})
// Automatically fetches more pages as needed.
for iter.Next() {
	resource := iter.Current()
	fmt.Printf("%+v\n", resource)
}
if err := iter.Err(); err != nil {
	panic(err.Error())
}

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

page, err := client.Memories.List(context.TODO(), hyperspell.MemoryListParams{})
for page != nil {
	for _, memory := range page.Items {
		fmt.Printf("%+v\n", memory)
	}
	page, err = page.GetNextPage()
}
if err != nil {
	panic(err.Error())
}
Errors

When the API returns a non-success status code, we return an error with type *hyperspell.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.Memories.Add(context.TODO(), hyperspell.MemoryAddParams{
	Text: "text",
})
if err != nil {
	var apierr *hyperspell.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/memories/add": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.Memories.Add(
	ctx,
	hyperspell.MemoryAddParams{
		Text: "text",
	},
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)
File uploads

Request parameters that correspond to file uploads in multipart requests are typed as io.Reader. The contents of the io.Reader will by default be sent as a multipart form part with the file name of "anonymous_file" and content-type of "application/octet-stream".

The file name and content-type can be customized by implementing Name() string or ContentType() string on the run-time type of io.Reader. Note that os.File implements Name() string, so a file returned by os.Open will be sent with the file name on disk.

We also provide a helper hyperspell.File(reader io.Reader, filename string, contentType string) which can be used to wrap any io.Reader with the appropriate file name and content type.

// A file from the file system
file, err := os.Open("/path/to/file")
hyperspell.MemoryUploadParams{
	File: file,
}

// A file from a string
hyperspell.MemoryUploadParams{
	File: strings.NewReader("my file contents"),
}

// With a custom filename and contentType
hyperspell.MemoryUploadParams{
	File: hyperspell.File(strings.NewReader(`{"hello": "foo"}`), "file.go", "application/json"),
}
Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := hyperspell.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Memories.Add(
	context.TODO(),
	hyperspell.MemoryAddParams{
		Text: "text",
	},
	option.WithMaxRetries(5),
)
Accessing raw response data (e.g. response headers)

You can access the raw HTTP response data by using the option.WithResponseInto() request option. This is useful when you need to examine response headers, status codes, or other details.

// Create a variable to store the HTTP response
var response *http.Response
memoryStatus, err := client.Memories.Add(
	context.TODO(),
	hyperspell.MemoryAddParams{
		Text: "text",
	},
	option.WithResponseInto(&response),
)
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", memoryStatus)

fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Undocumented endpoints

To make requests to undocumented endpoints, you can use client.Get, client.Post, and other HTTP verbs. RequestOptions on the client, such as retries, will be respected when making these requests.

var (
    // params can be an io.Reader, a []byte, an encoding/json serializable object,
    // or a "…Params" struct defined in this library.
    params map[string]any

    // result can be an []byte, *http.Response, a encoding/json deserializable object,
    // or a model defined in this library.
    result *http.Response
)
err := client.Post(context.Background(), "/unspecified", params, &result)
if err != nil {
    …
}
Undocumented request params

To make requests using undocumented parameters, you may use either the option.WithQuerySet() or the option.WithJSONSet() methods.

params := FooNewParams{
    ID:   "id_xxxx",
    Data: FooNewParamsData{
        FirstName: hyperspell.String("John"),
    },
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
Undocumented response properties

To access undocumented response properties, you may either access the raw JSON of the response as a string with result.JSON.RawJSON(), or get the raw JSON of a particular field on the result with result.JSON.Foo.Raw().

Any fields that are not present on the response struct will be saved and can be accessed by result.JSON.ExtraFields() which returns the extra fields as a map[string]Field.

Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := hyperspell.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals.)
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Contributing

See the contributing documentation.

Documentation

Index

Constants

View Source
const MetadataStatusCompleted = shared.MetadataStatusCompleted

Equals "completed"

View Source
const MetadataStatusFailed = shared.MetadataStatusFailed

Equals "failed"

View Source
const MetadataStatusPending = shared.MetadataStatusPending

Equals "pending"

View Source
const MetadataStatusPendingReview = shared.MetadataStatusPendingReview

Equals "pending_review"

View Source
const MetadataStatusProcessing = shared.MetadataStatusProcessing

Equals "processing"

View Source
const MetadataStatusSkipped = shared.MetadataStatusSkipped

Equals "skipped"

View Source
const NotificationTypeError = shared.NotificationTypeError

Equals "error"

View Source
const NotificationTypeInfo = shared.NotificationTypeInfo

Equals "info"

View Source
const NotificationTypeSuccess = shared.NotificationTypeSuccess

Equals "success"

View Source
const NotificationTypeWarning = shared.NotificationTypeWarning

Equals "warning"

View Source
const ResourceSourceBox = shared.ResourceSourceBox

Equals "box"

View Source
const ResourceSourceDropbox = shared.ResourceSourceDropbox

Equals "dropbox"

View Source
const ResourceSourceGitHub = shared.ResourceSourceGitHub

Equals "github"

View Source
const ResourceSourceGmailActions = shared.ResourceSourceGmailActions

Equals "gmail_actions"

View Source
const ResourceSourceGoogleCalendar = shared.ResourceSourceGoogleCalendar

Equals "google_calendar"

View Source
const ResourceSourceGoogleDrive = shared.ResourceSourceGoogleDrive

Equals "google_drive"

View Source
const ResourceSourceGoogleMail = shared.ResourceSourceGoogleMail

Equals "google_mail"

View Source
const ResourceSourceMicrosoftTeams = shared.ResourceSourceMicrosoftTeams

Equals "microsoft_teams"

View Source
const ResourceSourceNotion = shared.ResourceSourceNotion

Equals "notion"

View Source
const ResourceSourceReddit = shared.ResourceSourceReddit

Equals "reddit"

View Source
const ResourceSourceSlack = shared.ResourceSourceSlack

Equals "slack"

View Source
const ResourceSourceTrace = shared.ResourceSourceTrace

Equals "trace"

View Source
const ResourceSourceVault = shared.ResourceSourceVault

Equals "vault"

View Source
const ResourceSourceWebCrawler = shared.ResourceSourceWebCrawler

Equals "web_crawler"

Variables

This section is empty.

Functions

func Bool

func Bool(b bool) param.Opt[bool]

func BoolPtr

func BoolPtr(v bool) *bool

func DefaultClientOptions

func DefaultClientOptions() []option.RequestOption

DefaultClientOptions read from the environment (HYPERSPELL_API_KEY, HYPERSPELL_BASE_URL). This should be used to initialize new clients.

func File

func File(rdr io.Reader, filename string, contentType string) file

func Float

func Float(f float64) param.Opt[float64]

func FloatPtr

func FloatPtr(v float64) *float64

func Int

func Int(i int64) param.Opt[int64]

func IntPtr

func IntPtr(v int64) *int64

func Opt

func Opt[T comparable](v T) param.Opt[T]

func Ptr

func Ptr[T any](v T) *T

func String

func String(s string) param.Opt[string]

func StringPtr

func StringPtr(v string) *string

func Time

func Time(t time.Time) param.Opt[time.Time]

func TimePtr

func TimePtr(v time.Time) *time.Time

Types

type ActionAddReactionParams

type ActionAddReactionParams struct {
	// Channel ID containing the message
	Channel string `json:"channel" api:"required"`
	// Emoji name without colons (e.g., thumbsup)
	Name string `json:"name" api:"required"`
	// Integration provider (e.g., slack)
	//
	// Any of "reddit", "notion", "slack", "google_calendar", "google_mail", "box",
	// "dropbox", "google_drive", "github", "vault", "web_crawler", "trace",
	// "microsoft_teams", "gmail_actions".
	Provider ActionAddReactionParamsProvider `json:"provider,omitzero" api:"required"`
	// Message timestamp to react to
	Timestamp string `json:"timestamp" api:"required"`
	// Connection ID. If omitted, auto-resolved from provider + user.
	Connection param.Opt[string] `json:"connection,omitzero"`
	// contains filtered or unexported fields
}

func (ActionAddReactionParams) MarshalJSON

func (r ActionAddReactionParams) MarshalJSON() (data []byte, err error)

func (*ActionAddReactionParams) UnmarshalJSON

func (r *ActionAddReactionParams) UnmarshalJSON(data []byte) error

type ActionAddReactionParamsProvider

type ActionAddReactionParamsProvider string

Integration provider (e.g., slack)

const (
	ActionAddReactionParamsProviderReddit         ActionAddReactionParamsProvider = "reddit"
	ActionAddReactionParamsProviderNotion         ActionAddReactionParamsProvider = "notion"
	ActionAddReactionParamsProviderSlack          ActionAddReactionParamsProvider = "slack"
	ActionAddReactionParamsProviderGoogleCalendar ActionAddReactionParamsProvider = "google_calendar"
	ActionAddReactionParamsProviderGoogleMail     ActionAddReactionParamsProvider = "google_mail"
	ActionAddReactionParamsProviderBox            ActionAddReactionParamsProvider = "box"
	ActionAddReactionParamsProviderDropbox        ActionAddReactionParamsProvider = "dropbox"
	ActionAddReactionParamsProviderGoogleDrive    ActionAddReactionParamsProvider = "google_drive"
	ActionAddReactionParamsProviderGitHub         ActionAddReactionParamsProvider = "github"
	ActionAddReactionParamsProviderVault          ActionAddReactionParamsProvider = "vault"
	ActionAddReactionParamsProviderWebCrawler     ActionAddReactionParamsProvider = "web_crawler"
	ActionAddReactionParamsProviderTrace          ActionAddReactionParamsProvider = "trace"
	ActionAddReactionParamsProviderMicrosoftTeams ActionAddReactionParamsProvider = "microsoft_teams"
	ActionAddReactionParamsProviderGmailActions   ActionAddReactionParamsProvider = "gmail_actions"
)

type ActionAddReactionResponse

type ActionAddReactionResponse struct {
	Success          bool           `json:"success" api:"required"`
	Error            string         `json:"error" api:"nullable"`
	ProviderResponse map[string]any `json:"provider_response" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Success          respjson.Field
		Error            respjson.Field
		ProviderResponse respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Result from executing an integration action.

func (ActionAddReactionResponse) RawJSON

func (r ActionAddReactionResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ActionAddReactionResponse) UnmarshalJSON

func (r *ActionAddReactionResponse) UnmarshalJSON(data []byte) error

type ActionSendMessageParams

type ActionSendMessageParams struct {
	// Integration provider (e.g., slack)
	//
	// Any of "reddit", "notion", "slack", "google_calendar", "google_mail", "box",
	// "dropbox", "google_drive", "github", "vault", "web_crawler", "trace",
	// "microsoft_teams", "gmail_actions".
	Provider ActionSendMessageParamsProvider `json:"provider,omitzero" api:"required"`
	// Message text
	Text string `json:"text" api:"required"`
	// Channel ID (required for Slack)
	Channel param.Opt[string] `json:"channel,omitzero"`
	// Connection ID. If omitted, auto-resolved from provider + user.
	Connection param.Opt[string] `json:"connection,omitzero"`
	// Parent message ID for threading (thread_ts for Slack)
	Parent param.Opt[string] `json:"parent,omitzero"`
	// contains filtered or unexported fields
}

func (ActionSendMessageParams) MarshalJSON

func (r ActionSendMessageParams) MarshalJSON() (data []byte, err error)

func (*ActionSendMessageParams) UnmarshalJSON

func (r *ActionSendMessageParams) UnmarshalJSON(data []byte) error

type ActionSendMessageParamsProvider

type ActionSendMessageParamsProvider string

Integration provider (e.g., slack)

const (
	ActionSendMessageParamsProviderReddit         ActionSendMessageParamsProvider = "reddit"
	ActionSendMessageParamsProviderNotion         ActionSendMessageParamsProvider = "notion"
	ActionSendMessageParamsProviderSlack          ActionSendMessageParamsProvider = "slack"
	ActionSendMessageParamsProviderGoogleCalendar ActionSendMessageParamsProvider = "google_calendar"
	ActionSendMessageParamsProviderGoogleMail     ActionSendMessageParamsProvider = "google_mail"
	ActionSendMessageParamsProviderBox            ActionSendMessageParamsProvider = "box"
	ActionSendMessageParamsProviderDropbox        ActionSendMessageParamsProvider = "dropbox"
	ActionSendMessageParamsProviderGoogleDrive    ActionSendMessageParamsProvider = "google_drive"
	ActionSendMessageParamsProviderGitHub         ActionSendMessageParamsProvider = "github"
	ActionSendMessageParamsProviderVault          ActionSendMessageParamsProvider = "vault"
	ActionSendMessageParamsProviderWebCrawler     ActionSendMessageParamsProvider = "web_crawler"
	ActionSendMessageParamsProviderTrace          ActionSendMessageParamsProvider = "trace"
	ActionSendMessageParamsProviderMicrosoftTeams ActionSendMessageParamsProvider = "microsoft_teams"
	ActionSendMessageParamsProviderGmailActions   ActionSendMessageParamsProvider = "gmail_actions"
)

type ActionSendMessageResponse

type ActionSendMessageResponse struct {
	Success          bool           `json:"success" api:"required"`
	Error            string         `json:"error" api:"nullable"`
	ProviderResponse map[string]any `json:"provider_response" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Success          respjson.Field
		Error            respjson.Field
		ProviderResponse respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Result from executing an integration action.

func (ActionSendMessageResponse) RawJSON

func (r ActionSendMessageResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ActionSendMessageResponse) UnmarshalJSON

func (r *ActionSendMessageResponse) UnmarshalJSON(data []byte) error

type ActionService

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

ActionService contains methods and other services that help with interacting with the hyperspell API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewActionService method instead.

func NewActionService

func NewActionService(opts ...option.RequestOption) (r ActionService)

NewActionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ActionService) AddReaction

Add an emoji reaction to a message on a connected integration.

func (*ActionService) SendMessage

Send a message to a channel or conversation on a connected integration.

type AuthDeleteUserResponse

type AuthDeleteUserResponse struct {
	Message string `json:"message" api:"required"`
	Success bool   `json:"success" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Message     respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AuthDeleteUserResponse) RawJSON

func (r AuthDeleteUserResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*AuthDeleteUserResponse) UnmarshalJSON

func (r *AuthDeleteUserResponse) UnmarshalJSON(data []byte) error

type AuthMeResponse

type AuthMeResponse struct {
	// The user's id
	ID string `json:"id" api:"required"`
	// The Hyperspell app's id this user belongs to
	App AuthMeResponseApp `json:"app" api:"required"`
	// All integrations available for the app
	//
	// Any of "reddit", "notion", "slack", "google_calendar", "google_mail", "box",
	// "dropbox", "google_drive", "github", "vault", "web_crawler", "trace",
	// "microsoft_teams", "gmail_actions".
	AvailableIntegrations []string `json:"available_integrations" api:"required"`
	// All integrations installed for the user
	//
	// Any of "reddit", "notion", "slack", "google_calendar", "google_mail", "box",
	// "dropbox", "google_drive", "github", "vault", "web_crawler", "trace",
	// "microsoft_teams", "gmail_actions".
	InstalledIntegrations []string `json:"installed_integrations" api:"required"`
	// The expiration time of the user token used to make the request
	TokenExpiration time.Time `json:"token_expiration" api:"required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                    respjson.Field
		App                   respjson.Field
		AvailableIntegrations respjson.Field
		InstalledIntegrations respjson.Field
		TokenExpiration       respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AuthMeResponse) RawJSON

func (r AuthMeResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*AuthMeResponse) UnmarshalJSON

func (r *AuthMeResponse) UnmarshalJSON(data []byte) error

type AuthMeResponseApp

type AuthMeResponseApp struct {
	// The Hyperspell app's id this user belongs to
	ID string `json:"id" api:"required"`
	// The app's icon
	IconURL string `json:"icon_url" api:"required"`
	// The app's name
	Name string `json:"name" api:"required"`
	// The app's redirect URL
	RedirectURL string `json:"redirect_url" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		IconURL     respjson.Field
		Name        respjson.Field
		RedirectURL respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The Hyperspell app's id this user belongs to

func (AuthMeResponseApp) RawJSON

func (r AuthMeResponseApp) RawJSON() string

Returns the unmodified JSON received from the API

func (*AuthMeResponseApp) UnmarshalJSON

func (r *AuthMeResponseApp) UnmarshalJSON(data []byte) error

type AuthService

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

AuthService contains methods and other services that help with interacting with the hyperspell API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAuthService method instead.

func NewAuthService

func NewAuthService(opts ...option.RequestOption) (r AuthService)

NewAuthService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AuthService) DeleteUser

func (r *AuthService) DeleteUser(ctx context.Context, opts ...option.RequestOption) (res *AuthDeleteUserResponse, err error)

Endpoint to delete user.

func (*AuthService) Me

func (r *AuthService) Me(ctx context.Context, opts ...option.RequestOption) (res *AuthMeResponse, err error)

Endpoint to get basic user data.

func (*AuthService) UserToken

func (r *AuthService) UserToken(ctx context.Context, body AuthUserTokenParams, opts ...option.RequestOption) (res *Token, err error)

Use this endpoint to create a user token for a specific user. This token can be safely passed to your user-facing front-end.

type AuthUserTokenParams

type AuthUserTokenParams struct {
	UserID string `json:"user_id" api:"required"`
	// Token lifetime, e.g., '30m', '2h', '1d'. Defaults to 24 hours if not provided.
	ExpiresIn param.Opt[string] `json:"expires_in,omitzero"`
	// Origin of the request, used for CSRF protection. If set, the token will only be
	// valid for requests originating from this origin.
	Origin param.Opt[string] `json:"origin,omitzero"`
	// contains filtered or unexported fields
}

func (AuthUserTokenParams) MarshalJSON

func (r AuthUserTokenParams) MarshalJSON() (data []byte, err error)

func (*AuthUserTokenParams) UnmarshalJSON

func (r *AuthUserTokenParams) UnmarshalJSON(data []byte) error

type Calendar

type Calendar struct {
	Items []CalendarItem `json:"items" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Items       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Calendar) RawJSON

func (r Calendar) RawJSON() string

Returns the unmodified JSON received from the API

func (*Calendar) UnmarshalJSON

func (r *Calendar) UnmarshalJSON(data []byte) error

type CalendarItem

type CalendarItem struct {
	// The ID of the calendar
	ID string `json:"id" api:"required"`
	// The name of the calendar
	Name string `json:"name" api:"required"`
	// Whether the calendar is the primary calendar of the user
	Primary bool `json:"primary" api:"required"`
	// Default timezone of the calendar
	Timezone string `json:"timezone" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		Primary     respjson.Field
		Timezone    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CalendarItem) RawJSON

func (r CalendarItem) RawJSON() string

Returns the unmodified JSON received from the API

func (*CalendarItem) UnmarshalJSON

func (r *CalendarItem) UnmarshalJSON(data []byte) error

type Client

type Client struct {
	Connections  ConnectionService
	Folders      FolderService
	Integrations IntegrationService
	Memories     MemoryService
	Evaluate     EvaluateService
	Actions      ActionService
	Sessions     SessionService
	Vaults       VaultService
	Auth         AuthService
	// contains filtered or unexported fields
}

Client creates a struct with services and top level methods that help with interacting with the hyperspell API. You should not instantiate this client directly, and instead use the NewClient method instead.

func NewClient

func NewClient(opts ...option.RequestOption) (r Client)

NewClient generates a new client with the default option read from the environment (HYPERSPELL_API_KEY, HYPERSPELL_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.

func (*Client) Delete

func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Execute

func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error

Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.

If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.

The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.

If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.

Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.

The response body will be deserialized into the res variable, depending on its type:

  • A pointer to a *http.Response is populated by the raw response.
  • A pointer to a byte array will be populated with the contents of the request body.
  • A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
  • A nil value will not read the response body.

For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.

func (*Client) Get

func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Patch

func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Post

func (r *Client) Post(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Put

func (r *Client) Put(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

type ConnectionListResponse

type ConnectionListResponse struct {
	Connections []ConnectionListResponseConnection `json:"connections" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Connections respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConnectionListResponse) RawJSON

func (r ConnectionListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ConnectionListResponse) UnmarshalJSON

func (r *ConnectionListResponse) UnmarshalJSON(data []byte) error

type ConnectionListResponseConnection

type ConnectionListResponseConnection struct {
	// The connection's id
	ID string `json:"id" api:"required"`
	// The connection's integration id
	IntegrationID string `json:"integration_id" api:"required"`
	// The connection's label
	Label string `json:"label" api:"required"`
	// The connection's provider
	//
	// Any of "reddit", "notion", "slack", "google_calendar", "google_mail", "box",
	// "dropbox", "google_drive", "github", "vault", "web_crawler", "trace",
	// "microsoft_teams", "gmail_actions".
	Provider string `json:"provider" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID            respjson.Field
		IntegrationID respjson.Field
		Label         respjson.Field
		Provider      respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConnectionListResponseConnection) RawJSON

Returns the unmodified JSON received from the API

func (*ConnectionListResponseConnection) UnmarshalJSON

func (r *ConnectionListResponseConnection) UnmarshalJSON(data []byte) error

type ConnectionRevokeResponse

type ConnectionRevokeResponse struct {
	Message string `json:"message" api:"required"`
	Success bool   `json:"success" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Message     respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConnectionRevokeResponse) RawJSON

func (r ConnectionRevokeResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ConnectionRevokeResponse) UnmarshalJSON

func (r *ConnectionRevokeResponse) UnmarshalJSON(data []byte) error

type ConnectionService

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

ConnectionService contains methods and other services that help with interacting with the hyperspell API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewConnectionService method instead.

func NewConnectionService

func NewConnectionService(opts ...option.RequestOption) (r ConnectionService)

NewConnectionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ConnectionService) List

List all connections for the user.

func (*ConnectionService) Revoke

func (r *ConnectionService) Revoke(ctx context.Context, connectionID string, opts ...option.RequestOption) (res *ConnectionRevokeResponse, err error)

Revokes Hyperspell's access the given provider and deletes all stored credentials and indexed data.

type Error

type Error = apierror.Error

type EvaluateScoreHighlightParams

type EvaluateScoreHighlightParams struct {
	// Comment on the chunk
	Comment param.Opt[string] `json:"comment,omitzero"`
	// Rating of the chunk from -1 (bad) to +1 (good).
	Score param.Opt[float64] `json:"score,omitzero"`
	// contains filtered or unexported fields
}

func (EvaluateScoreHighlightParams) MarshalJSON

func (r EvaluateScoreHighlightParams) MarshalJSON() (data []byte, err error)

func (*EvaluateScoreHighlightParams) UnmarshalJSON

func (r *EvaluateScoreHighlightParams) UnmarshalJSON(data []byte) error

type EvaluateScoreHighlightResponse

type EvaluateScoreHighlightResponse struct {
	// A message describing the result.
	Message string `json:"message" api:"required"`
	// Whether the feedback was successfully saved.
	Success bool `json:"success" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Message     respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EvaluateScoreHighlightResponse) RawJSON

Returns the unmodified JSON received from the API

func (*EvaluateScoreHighlightResponse) UnmarshalJSON

func (r *EvaluateScoreHighlightResponse) UnmarshalJSON(data []byte) error

type EvaluateScoreQueryParams

type EvaluateScoreQueryParams struct {
	// Rating of the query result from -1 (bad) to +1 (good).
	Score param.Opt[float64] `json:"score,omitzero"`
	// contains filtered or unexported fields
}

func (EvaluateScoreQueryParams) MarshalJSON

func (r EvaluateScoreQueryParams) MarshalJSON() (data []byte, err error)

func (*EvaluateScoreQueryParams) UnmarshalJSON

func (r *EvaluateScoreQueryParams) UnmarshalJSON(data []byte) error

type EvaluateScoreQueryResponse

type EvaluateScoreQueryResponse struct {
	// A message describing the result.
	Message string `json:"message" api:"required"`
	// Whether the feedback was successfully saved.
	Success bool `json:"success" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Message     respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EvaluateScoreQueryResponse) RawJSON

func (r EvaluateScoreQueryResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EvaluateScoreQueryResponse) UnmarshalJSON

func (r *EvaluateScoreQueryResponse) UnmarshalJSON(data []byte) error

type EvaluateService

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

EvaluateService contains methods and other services that help with interacting with the hyperspell API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewEvaluateService method instead.

func NewEvaluateService

func NewEvaluateService(opts ...option.RequestOption) (r EvaluateService)

NewEvaluateService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*EvaluateService) GetQuery

func (r *EvaluateService) GetQuery(ctx context.Context, queryID string, opts ...option.RequestOption) (res *shared.QueryResult, err error)

Retrieve the result of a previous query.

func (*EvaluateService) ScoreHighlight

func (r *EvaluateService) ScoreHighlight(ctx context.Context, highlightID string, body EvaluateScoreHighlightParams, opts ...option.RequestOption) (res *EvaluateScoreHighlightResponse, err error)

Score an individual highlight.

func (*EvaluateService) ScoreQuery

Score the result of a query.

type FolderDeletePolicyParams

type FolderDeletePolicyParams struct {
	ConnectionID string `path:"connection_id" api:"required" format:"uuid" json:"-"`
	// contains filtered or unexported fields
}

type FolderDeletePolicyResponse

type FolderDeletePolicyResponse struct {
	// Whether the deletion was successful
	Success bool `json:"success" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FolderDeletePolicyResponse) RawJSON

func (r FolderDeletePolicyResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FolderDeletePolicyResponse) UnmarshalJSON

func (r *FolderDeletePolicyResponse) UnmarshalJSON(data []byte) error

type FolderListParams

type FolderListParams struct {
	// Parent folder ID. Omit for root-level folders.
	ParentID param.Opt[string] `query:"parent_id,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (FolderListParams) URLQuery

func (r FolderListParams) URLQuery() (v url.Values, err error)

URLQuery serializes FolderListParams's query parameters as `url.Values`.

type FolderListPoliciesResponse

type FolderListPoliciesResponse struct {
	// List of folder policies
	Policies []FolderListPoliciesResponsePolicy `json:"policies" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Policies    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FolderListPoliciesResponse) RawJSON

func (r FolderListPoliciesResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FolderListPoliciesResponse) UnmarshalJSON

func (r *FolderListPoliciesResponse) UnmarshalJSON(data []byte) error

type FolderListPoliciesResponsePolicy

type FolderListPoliciesResponsePolicy struct {
	// Unique policy ID
	ID string `json:"id" api:"required" format:"uuid"`
	// Folder ID from the source provider
	ProviderFolderID string `json:"provider_folder_id" api:"required"`
	// Sync mode for this folder
	//
	// Any of "sync", "skip", "manual".
	SyncMode string `json:"sync_mode" api:"required"`
	// Connection ID (null for integration defaults)
	ConnectionID string `json:"connection_id" api:"nullable" format:"uuid"`
	// Display name of the folder
	FolderName string `json:"folder_name" api:"nullable"`
	// Display path of the folder
	FolderPath string `json:"folder_path" api:"nullable"`
	// Parent folder's provider ID
	ParentFolderID string `json:"parent_folder_id" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID               respjson.Field
		ProviderFolderID respjson.Field
		SyncMode         respjson.Field
		ConnectionID     respjson.Field
		FolderName       respjson.Field
		FolderPath       respjson.Field
		ParentFolderID   respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FolderListPoliciesResponsePolicy) RawJSON

Returns the unmodified JSON received from the API

func (*FolderListPoliciesResponsePolicy) UnmarshalJSON

func (r *FolderListPoliciesResponsePolicy) UnmarshalJSON(data []byte) error

type FolderListResponse

type FolderListResponse struct {
	// Folders at this level
	Folders []FolderListResponseFolder `json:"folders" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Folders     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FolderListResponse) RawJSON

func (r FolderListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FolderListResponse) UnmarshalJSON

func (r *FolderListResponse) UnmarshalJSON(data []byte) error

type FolderListResponseFolder

type FolderListResponseFolder struct {
	// Whether this folder may have subfolders
	HasChildren bool `json:"has_children" api:"required"`
	// Display name of the folder
	Name string `json:"name" api:"required"`
	// Folder ID from the source provider
	ProviderFolderID string `json:"provider_folder_id" api:"required"`
	// Parent folder's provider ID
	ParentFolderID string `json:"parent_folder_id" api:"nullable"`
	// Explicit policy on this folder, or null if inheriting/default
	Policy FolderListResponseFolderPolicy `json:"policy" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		HasChildren      respjson.Field
		Name             respjson.Field
		ProviderFolderID respjson.Field
		ParentFolderID   respjson.Field
		Policy           respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FolderListResponseFolder) RawJSON

func (r FolderListResponseFolder) RawJSON() string

Returns the unmodified JSON received from the API

func (*FolderListResponseFolder) UnmarshalJSON

func (r *FolderListResponseFolder) UnmarshalJSON(data []byte) error

type FolderListResponseFolderPolicy

type FolderListResponseFolderPolicy struct {
	// Policy UUID
	ID string `json:"id" api:"required" format:"uuid"`
	// Sync mode set on this folder
	//
	// Any of "sync", "skip", "manual".
	SyncMode string `json:"sync_mode" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		SyncMode    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Explicit policy on this folder, or null if inheriting/default

func (FolderListResponseFolderPolicy) RawJSON

Returns the unmodified JSON received from the API

func (*FolderListResponseFolderPolicy) UnmarshalJSON

func (r *FolderListResponseFolderPolicy) UnmarshalJSON(data []byte) error

type FolderService

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

FolderService contains methods and other services that help with interacting with the hyperspell API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewFolderService method instead.

func NewFolderService

func NewFolderService(opts ...option.RequestOption) (r FolderService)

NewFolderService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*FolderService) DeletePolicy

func (r *FolderService) DeletePolicy(ctx context.Context, policyID string, body FolderDeletePolicyParams, opts ...option.RequestOption) (res *FolderDeletePolicyResponse, err error)

Delete a folder policy for a specific connection.

func (*FolderService) List

func (r *FolderService) List(ctx context.Context, connectionID string, query FolderListParams, opts ...option.RequestOption) (res *FolderListResponse, err error)

List one level of folders from the user's connected source.

Returns folders decorated with their explicit folder policy (if any). Use parent_id to drill into subfolders.

func (*FolderService) ListPolicies

func (r *FolderService) ListPolicies(ctx context.Context, connectionID string, opts ...option.RequestOption) (res *FolderListPoliciesResponse, err error)

List all folder policies for a specific connection.

func (*FolderService) SetPolicies

func (r *FolderService) SetPolicies(ctx context.Context, connectionID string, body FolderSetPoliciesParams, opts ...option.RequestOption) (res *FolderSetPoliciesResponse, err error)

Create or update a folder policy for a specific connection.

type FolderSetPoliciesParams

type FolderSetPoliciesParams struct {
	// Folder ID from the source provider
	ProviderFolderID string `json:"provider_folder_id" api:"required"`
	// Sync mode for this folder
	//
	// Any of "sync", "skip", "manual".
	SyncMode FolderSetPoliciesParamsSyncMode `json:"sync_mode,omitzero" api:"required"`
	// Display name of the folder
	FolderName param.Opt[string] `json:"folder_name,omitzero"`
	// Display path of the folder
	FolderPath param.Opt[string] `json:"folder_path,omitzero"`
	// Parent folder's provider ID for inheritance resolution
	ParentFolderID param.Opt[string] `json:"parent_folder_id,omitzero"`
	// contains filtered or unexported fields
}

func (FolderSetPoliciesParams) MarshalJSON

func (r FolderSetPoliciesParams) MarshalJSON() (data []byte, err error)

func (*FolderSetPoliciesParams) UnmarshalJSON

func (r *FolderSetPoliciesParams) UnmarshalJSON(data []byte) error

type FolderSetPoliciesParamsSyncMode

type FolderSetPoliciesParamsSyncMode string

Sync mode for this folder

const (
	FolderSetPoliciesParamsSyncModeSync   FolderSetPoliciesParamsSyncMode = "sync"
	FolderSetPoliciesParamsSyncModeSkip   FolderSetPoliciesParamsSyncMode = "skip"
	FolderSetPoliciesParamsSyncModeManual FolderSetPoliciesParamsSyncMode = "manual"
)

type FolderSetPoliciesResponse

type FolderSetPoliciesResponse struct {
	// Unique policy ID
	ID string `json:"id" api:"required" format:"uuid"`
	// Folder ID from the source provider
	ProviderFolderID string `json:"provider_folder_id" api:"required"`
	// Sync mode for this folder
	//
	// Any of "sync", "skip", "manual".
	SyncMode FolderSetPoliciesResponseSyncMode `json:"sync_mode" api:"required"`
	// Connection ID (null for integration defaults)
	ConnectionID string `json:"connection_id" api:"nullable" format:"uuid"`
	// Display name of the folder
	FolderName string `json:"folder_name" api:"nullable"`
	// Display path of the folder
	FolderPath string `json:"folder_path" api:"nullable"`
	// Parent folder's provider ID
	ParentFolderID string `json:"parent_folder_id" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID               respjson.Field
		ProviderFolderID respjson.Field
		SyncMode         respjson.Field
		ConnectionID     respjson.Field
		FolderName       respjson.Field
		FolderPath       respjson.Field
		ParentFolderID   respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FolderSetPoliciesResponse) RawJSON

func (r FolderSetPoliciesResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FolderSetPoliciesResponse) UnmarshalJSON

func (r *FolderSetPoliciesResponse) UnmarshalJSON(data []byte) error

type FolderSetPoliciesResponseSyncMode

type FolderSetPoliciesResponseSyncMode string

Sync mode for this folder

const (
	FolderSetPoliciesResponseSyncModeSync   FolderSetPoliciesResponseSyncMode = "sync"
	FolderSetPoliciesResponseSyncModeSkip   FolderSetPoliciesResponseSyncMode = "skip"
	FolderSetPoliciesResponseSyncModeManual FolderSetPoliciesResponseSyncMode = "manual"
)

type IntegrationConnectParams

type IntegrationConnectParams struct {
	RedirectURL param.Opt[string] `query:"redirect_url,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (IntegrationConnectParams) URLQuery

func (r IntegrationConnectParams) URLQuery() (v url.Values, err error)

URLQuery serializes IntegrationConnectParams's query parameters as `url.Values`.

type IntegrationConnectResponse

type IntegrationConnectResponse struct {
	ExpiresAt time.Time `json:"expires_at" api:"required" format:"date-time"`
	URL       string    `json:"url" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ExpiresAt   respjson.Field
		URL         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (IntegrationConnectResponse) RawJSON

func (r IntegrationConnectResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*IntegrationConnectResponse) UnmarshalJSON

func (r *IntegrationConnectResponse) UnmarshalJSON(data []byte) error

type IntegrationGoogleCalendarService

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

IntegrationGoogleCalendarService contains methods and other services that help with interacting with the hyperspell API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewIntegrationGoogleCalendarService method instead.

func NewIntegrationGoogleCalendarService

func NewIntegrationGoogleCalendarService(opts ...option.RequestOption) (r IntegrationGoogleCalendarService)

NewIntegrationGoogleCalendarService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*IntegrationGoogleCalendarService) List

List available calendars for a user. This can be used to ie. populate a dropdown for the user to select a calendar.

type IntegrationListResponse

type IntegrationListResponse struct {
	Integrations []IntegrationListResponseIntegration `json:"integrations" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Integrations respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (IntegrationListResponse) RawJSON

func (r IntegrationListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*IntegrationListResponse) UnmarshalJSON

func (r *IntegrationListResponse) UnmarshalJSON(data []byte) error

type IntegrationListResponseIntegration

type IntegrationListResponseIntegration struct {
	// The integration's id
	ID string `json:"id" api:"required"`
	// Whether the integration allows multiple connections
	AllowMultipleConnections bool `json:"allow_multiple_connections" api:"required"`
	// The integration's auth provider
	//
	// Any of "nango", "unified", "whitelabel".
	AuthProvider string `json:"auth_provider" api:"required"`
	// URL to the integration's icon
	Icon string `json:"icon" api:"required"`
	// The integration's display name
	Name string `json:"name" api:"required"`
	// The integration's provider
	//
	// Any of "reddit", "notion", "slack", "google_calendar", "google_mail", "box",
	// "dropbox", "google_drive", "github", "vault", "web_crawler", "trace",
	// "microsoft_teams", "gmail_actions".
	Provider string `json:"provider" api:"required"`
	// Whether this integration only supports write actions (no sync)
	ActionsOnly bool `json:"actions_only"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                       respjson.Field
		AllowMultipleConnections respjson.Field
		AuthProvider             respjson.Field
		Icon                     respjson.Field
		Name                     respjson.Field
		Provider                 respjson.Field
		ActionsOnly              respjson.Field
		ExtraFields              map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (IntegrationListResponseIntegration) RawJSON

Returns the unmodified JSON received from the API

func (*IntegrationListResponseIntegration) UnmarshalJSON

func (r *IntegrationListResponseIntegration) UnmarshalJSON(data []byte) error

type IntegrationService

type IntegrationService struct {
	GoogleCalendar IntegrationGoogleCalendarService
	WebCrawler     IntegrationWebCrawlerService
	Slack          IntegrationSlackService
	// contains filtered or unexported fields
}

IntegrationService contains methods and other services that help with interacting with the hyperspell API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewIntegrationService method instead.

func NewIntegrationService

func NewIntegrationService(opts ...option.RequestOption) (r IntegrationService)

NewIntegrationService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*IntegrationService) Connect

func (r *IntegrationService) Connect(ctx context.Context, integrationID string, query IntegrationConnectParams, opts ...option.RequestOption) (res *IntegrationConnectResponse, err error)

Redirects to the connect URL to link an integration.

func (*IntegrationService) List

List all integrations for the user.

type IntegrationSlackListParams

type IntegrationSlackListParams struct {
	// If set, pass 'exclude_archived' to Slack. If None, omit the param.
	ExcludeArchived param.Opt[bool] `query:"exclude_archived,omitzero" json:"-"`
	// Include direct messages (im) when listing conversations.
	IncludeDms param.Opt[bool] `query:"include_dms,omitzero" json:"-"`
	// Include group DMs (mpim) when listing conversations.
	IncludeGroupDms param.Opt[bool] `query:"include_group_dms,omitzero" json:"-"`
	// Include private channels when constructing Slack 'types'.
	IncludePrivate param.Opt[bool] `query:"include_private,omitzero" json:"-"`
	// List of Slack channels to include (by id, name, or #name).
	Channels []string `query:"channels,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (IntegrationSlackListParams) URLQuery

func (r IntegrationSlackListParams) URLQuery() (v url.Values, err error)

URLQuery serializes IntegrationSlackListParams's query parameters as `url.Values`.

type IntegrationSlackListResponse

type IntegrationSlackListResponse = any

type IntegrationSlackService

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

IntegrationSlackService contains methods and other services that help with interacting with the hyperspell API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewIntegrationSlackService method instead.

func NewIntegrationSlackService

func NewIntegrationSlackService(opts ...option.RequestOption) (r IntegrationSlackService)

NewIntegrationSlackService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*IntegrationSlackService) List

List Slack conversations accessible to the user via the live Nango connection.

Returns minimal channel metadata suitable for selection UIs. If required scopes are missing, Slack's error is propagated with details.

Supports filtering by channels, including/excluding private channels, DMs, group DMs, and archived channels based on the provided search options.

type IntegrationWebCrawlerIndexParams

type IntegrationWebCrawlerIndexParams struct {
	// The base URL of the website to crawl
	URL string `query:"url" api:"required" json:"-"`
	// Maximum number of pages to crawl in total
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Maximum depth of links to follow during crawling
	MaxDepth param.Opt[int64] `query:"max_depth,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (IntegrationWebCrawlerIndexParams) URLQuery

func (r IntegrationWebCrawlerIndexParams) URLQuery() (v url.Values, err error)

URLQuery serializes IntegrationWebCrawlerIndexParams's query parameters as `url.Values`.

type IntegrationWebCrawlerIndexResponse

type IntegrationWebCrawlerIndexResponse struct {
	ResourceID string `json:"resource_id" api:"required"`
	// Any of "reddit", "notion", "slack", "google_calendar", "google_mail", "box",
	// "dropbox", "google_drive", "github", "vault", "web_crawler", "trace",
	// "microsoft_teams", "gmail_actions".
	Source IntegrationWebCrawlerIndexResponseSource `json:"source" api:"required"`
	// Any of "pending", "processing", "completed", "failed", "pending_review",
	// "skipped".
	Status IntegrationWebCrawlerIndexResponseStatus `json:"status" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ResourceID  respjson.Field
		Source      respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (IntegrationWebCrawlerIndexResponse) RawJSON

Returns the unmodified JSON received from the API

func (*IntegrationWebCrawlerIndexResponse) UnmarshalJSON

func (r *IntegrationWebCrawlerIndexResponse) UnmarshalJSON(data []byte) error

type IntegrationWebCrawlerIndexResponseSource

type IntegrationWebCrawlerIndexResponseSource string
const (
	IntegrationWebCrawlerIndexResponseSourceReddit         IntegrationWebCrawlerIndexResponseSource = "reddit"
	IntegrationWebCrawlerIndexResponseSourceNotion         IntegrationWebCrawlerIndexResponseSource = "notion"
	IntegrationWebCrawlerIndexResponseSourceSlack          IntegrationWebCrawlerIndexResponseSource = "slack"
	IntegrationWebCrawlerIndexResponseSourceGoogleCalendar IntegrationWebCrawlerIndexResponseSource = "google_calendar"
	IntegrationWebCrawlerIndexResponseSourceGoogleMail     IntegrationWebCrawlerIndexResponseSource = "google_mail"
	IntegrationWebCrawlerIndexResponseSourceBox            IntegrationWebCrawlerIndexResponseSource = "box"
	IntegrationWebCrawlerIndexResponseSourceDropbox        IntegrationWebCrawlerIndexResponseSource = "dropbox"
	IntegrationWebCrawlerIndexResponseSourceGoogleDrive    IntegrationWebCrawlerIndexResponseSource = "google_drive"
	IntegrationWebCrawlerIndexResponseSourceGitHub         IntegrationWebCrawlerIndexResponseSource = "github"
	IntegrationWebCrawlerIndexResponseSourceVault          IntegrationWebCrawlerIndexResponseSource = "vault"
	IntegrationWebCrawlerIndexResponseSourceWebCrawler     IntegrationWebCrawlerIndexResponseSource = "web_crawler"
	IntegrationWebCrawlerIndexResponseSourceTrace          IntegrationWebCrawlerIndexResponseSource = "trace"
	IntegrationWebCrawlerIndexResponseSourceMicrosoftTeams IntegrationWebCrawlerIndexResponseSource = "microsoft_teams"
	IntegrationWebCrawlerIndexResponseSourceGmailActions   IntegrationWebCrawlerIndexResponseSource = "gmail_actions"
)

type IntegrationWebCrawlerIndexResponseStatus

type IntegrationWebCrawlerIndexResponseStatus string
const (
	IntegrationWebCrawlerIndexResponseStatusPending       IntegrationWebCrawlerIndexResponseStatus = "pending"
	IntegrationWebCrawlerIndexResponseStatusProcessing    IntegrationWebCrawlerIndexResponseStatus = "processing"
	IntegrationWebCrawlerIndexResponseStatusCompleted     IntegrationWebCrawlerIndexResponseStatus = "completed"
	IntegrationWebCrawlerIndexResponseStatusFailed        IntegrationWebCrawlerIndexResponseStatus = "failed"
	IntegrationWebCrawlerIndexResponseStatusPendingReview IntegrationWebCrawlerIndexResponseStatus = "pending_review"
	IntegrationWebCrawlerIndexResponseStatusSkipped       IntegrationWebCrawlerIndexResponseStatus = "skipped"
)

type IntegrationWebCrawlerService

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

IntegrationWebCrawlerService contains methods and other services that help with interacting with the hyperspell API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewIntegrationWebCrawlerService method instead.

func NewIntegrationWebCrawlerService

func NewIntegrationWebCrawlerService(opts ...option.RequestOption) (r IntegrationWebCrawlerService)

NewIntegrationWebCrawlerService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*IntegrationWebCrawlerService) Index

Recursively crawl a website to make it available for indexed search.

type Memory

type Memory struct {
	ResourceID string `json:"resource_id" api:"required"`
	// Any of "reddit", "notion", "slack", "google_calendar", "google_mail", "box",
	// "dropbox", "google_drive", "github", "vault", "web_crawler", "trace",
	// "microsoft_teams", "gmail_actions".
	Source MemorySource `json:"source" api:"required"`
	// The type of document (e.g. Document, Website, Email)
	Type string `json:"type" api:"required"`
	// The structured content of the document
	Data []any `json:"data" api:"nullable"`
	// Summaries of all memories extracted from this document
	Memories    []string        `json:"memories"`
	Metadata    shared.Metadata `json:"metadata"`
	Title       string          `json:"title" api:"nullable"`
	ExtraFields map[string]any  `json:"" api:"extrafields"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ResourceID  respjson.Field
		Source      respjson.Field
		Type        respjson.Field
		Data        respjson.Field
		Memories    respjson.Field
		Metadata    respjson.Field
		Title       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response model for the GET /memories/get endpoint.

func (Memory) RawJSON

func (r Memory) RawJSON() string

Returns the unmodified JSON received from the API

func (*Memory) UnmarshalJSON

func (r *Memory) UnmarshalJSON(data []byte) error

type MemoryAddBulkParams

type MemoryAddBulkParams struct {
	// List of memories to ingest. Maximum 100 items.
	Items []MemoryAddBulkParamsItem `json:"items,omitzero" api:"required"`
	// contains filtered or unexported fields
}

func (MemoryAddBulkParams) MarshalJSON

func (r MemoryAddBulkParams) MarshalJSON() (data []byte, err error)

func (*MemoryAddBulkParams) UnmarshalJSON

func (r *MemoryAddBulkParams) UnmarshalJSON(data []byte) error

type MemoryAddBulkParamsItem

type MemoryAddBulkParamsItem struct {
	// Full text of the document.
	Text string `json:"text" api:"required"`
	// The collection to add the document to — deprecated, set the collection using
	// metadata instead.
	//
	// Deprecated: deprecated
	Collection param.Opt[string] `json:"collection,omitzero"`
	// Title of the document.
	Title param.Opt[string] `json:"title,omitzero"`
	// Date of the document. Depending on the document, this could be the creation date
	// or date the document was last updated (eg. for a chat transcript, this would be
	// the date of the last message). This helps the ranking algorithm and allows you
	// to filter by date range.
	Date param.Opt[time.Time] `json:"date,omitzero" format:"date-time"`
	// The resource ID to add the document to. If not provided, a new resource ID will
	// be generated. If provided, the document will be updated if it already exists.
	ResourceID param.Opt[string] `json:"resource_id,omitzero"`
	// Custom metadata for filtering. Keys must be alphanumeric with underscores, max
	// 64 chars. Values must be string, number, boolean, or null.
	Metadata map[string]MemoryAddBulkParamsItemMetadataUnion `json:"metadata,omitzero"`
	// contains filtered or unexported fields
}

The property Text is required.

func (MemoryAddBulkParamsItem) MarshalJSON

func (r MemoryAddBulkParamsItem) MarshalJSON() (data []byte, err error)

func (*MemoryAddBulkParamsItem) UnmarshalJSON

func (r *MemoryAddBulkParamsItem) UnmarshalJSON(data []byte) error

type MemoryAddBulkParamsItemMetadataUnion

type MemoryAddBulkParamsItemMetadataUnion struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	OfBool   param.Opt[bool]    `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (MemoryAddBulkParamsItemMetadataUnion) MarshalJSON

func (u MemoryAddBulkParamsItemMetadataUnion) MarshalJSON() ([]byte, error)

func (*MemoryAddBulkParamsItemMetadataUnion) UnmarshalJSON

func (u *MemoryAddBulkParamsItemMetadataUnion) UnmarshalJSON(data []byte) error

type MemoryAddBulkResponse

type MemoryAddBulkResponse struct {
	// Number of items successfully processed
	Count int64 `json:"count" api:"required"`
	// Status of each ingested item
	Items   []MemoryStatus `json:"items" api:"required"`
	Success bool           `json:"success"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count       respjson.Field
		Items       respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response schema for successful bulk ingestion.

func (MemoryAddBulkResponse) RawJSON

func (r MemoryAddBulkResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*MemoryAddBulkResponse) UnmarshalJSON

func (r *MemoryAddBulkResponse) UnmarshalJSON(data []byte) error

type MemoryAddParams

type MemoryAddParams struct {
	// Full text of the document.
	Text string `json:"text" api:"required"`
	// The collection to add the document to — deprecated, set the collection using
	// metadata instead.
	Collection param.Opt[string] `json:"collection,omitzero"`
	// Title of the document.
	Title param.Opt[string] `json:"title,omitzero"`
	// Date of the document. Depending on the document, this could be the creation date
	// or date the document was last updated (eg. for a chat transcript, this would be
	// the date of the last message). This helps the ranking algorithm and allows you
	// to filter by date range.
	Date param.Opt[time.Time] `json:"date,omitzero" format:"date-time"`
	// The resource ID to add the document to. If not provided, a new resource ID will
	// be generated. If provided, the document will be updated if it already exists.
	ResourceID param.Opt[string] `json:"resource_id,omitzero"`
	// Custom metadata for filtering. Keys must be alphanumeric with underscores, max
	// 64 chars. Values must be string, number, boolean, or null.
	Metadata map[string]MemoryAddParamsMetadataUnion `json:"metadata,omitzero"`
	// contains filtered or unexported fields
}

func (MemoryAddParams) MarshalJSON

func (r MemoryAddParams) MarshalJSON() (data []byte, err error)

func (*MemoryAddParams) UnmarshalJSON

func (r *MemoryAddParams) UnmarshalJSON(data []byte) error

type MemoryAddParamsMetadataUnion

type MemoryAddParamsMetadataUnion struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	OfBool   param.Opt[bool]    `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (MemoryAddParamsMetadataUnion) MarshalJSON

func (u MemoryAddParamsMetadataUnion) MarshalJSON() ([]byte, error)

func (*MemoryAddParamsMetadataUnion) UnmarshalJSON

func (u *MemoryAddParamsMetadataUnion) UnmarshalJSON(data []byte) error

type MemoryDeleteParams

type MemoryDeleteParams struct {
	// Any of "reddit", "notion", "slack", "google_calendar", "google_mail", "box",
	// "dropbox", "google_drive", "github", "vault", "web_crawler", "trace",
	// "microsoft_teams", "gmail_actions".
	Source MemoryDeleteParamsSource `path:"source,omitzero" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type MemoryDeleteParamsSource

type MemoryDeleteParamsSource string
const (
	MemoryDeleteParamsSourceReddit         MemoryDeleteParamsSource = "reddit"
	MemoryDeleteParamsSourceNotion         MemoryDeleteParamsSource = "notion"
	MemoryDeleteParamsSourceSlack          MemoryDeleteParamsSource = "slack"
	MemoryDeleteParamsSourceGoogleCalendar MemoryDeleteParamsSource = "google_calendar"
	MemoryDeleteParamsSourceGoogleMail     MemoryDeleteParamsSource = "google_mail"
	MemoryDeleteParamsSourceBox            MemoryDeleteParamsSource = "box"
	MemoryDeleteParamsSourceDropbox        MemoryDeleteParamsSource = "dropbox"
	MemoryDeleteParamsSourceGoogleDrive    MemoryDeleteParamsSource = "google_drive"
	MemoryDeleteParamsSourceGitHub         MemoryDeleteParamsSource = "github"
	MemoryDeleteParamsSourceVault          MemoryDeleteParamsSource = "vault"
	MemoryDeleteParamsSourceWebCrawler     MemoryDeleteParamsSource = "web_crawler"
	MemoryDeleteParamsSourceTrace          MemoryDeleteParamsSource = "trace"
	MemoryDeleteParamsSourceMicrosoftTeams MemoryDeleteParamsSource = "microsoft_teams"
	MemoryDeleteParamsSourceGmailActions   MemoryDeleteParamsSource = "gmail_actions"
)

type MemoryDeleteResponse

type MemoryDeleteResponse struct {
	ChunksDeleted int64  `json:"chunks_deleted" api:"required"`
	Message       string `json:"message" api:"required"`
	ResourceID    string `json:"resource_id" api:"required"`
	// Any of "reddit", "notion", "slack", "google_calendar", "google_mail", "box",
	// "dropbox", "google_drive", "github", "vault", "web_crawler", "trace",
	// "microsoft_teams", "gmail_actions".
	Source  MemoryDeleteResponseSource `json:"source" api:"required"`
	Success bool                       `json:"success" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ChunksDeleted respjson.Field
		Message       respjson.Field
		ResourceID    respjson.Field
		Source        respjson.Field
		Success       respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (MemoryDeleteResponse) RawJSON

func (r MemoryDeleteResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*MemoryDeleteResponse) UnmarshalJSON

func (r *MemoryDeleteResponse) UnmarshalJSON(data []byte) error

type MemoryDeleteResponseSource

type MemoryDeleteResponseSource string
const (
	MemoryDeleteResponseSourceReddit         MemoryDeleteResponseSource = "reddit"
	MemoryDeleteResponseSourceNotion         MemoryDeleteResponseSource = "notion"
	MemoryDeleteResponseSourceSlack          MemoryDeleteResponseSource = "slack"
	MemoryDeleteResponseSourceGoogleCalendar MemoryDeleteResponseSource = "google_calendar"
	MemoryDeleteResponseSourceGoogleMail     MemoryDeleteResponseSource = "google_mail"
	MemoryDeleteResponseSourceBox            MemoryDeleteResponseSource = "box"
	MemoryDeleteResponseSourceDropbox        MemoryDeleteResponseSource = "dropbox"
	MemoryDeleteResponseSourceGoogleDrive    MemoryDeleteResponseSource = "google_drive"
	MemoryDeleteResponseSourceGitHub         MemoryDeleteResponseSource = "github"
	MemoryDeleteResponseSourceVault          MemoryDeleteResponseSource = "vault"
	MemoryDeleteResponseSourceWebCrawler     MemoryDeleteResponseSource = "web_crawler"
	MemoryDeleteResponseSourceTrace          MemoryDeleteResponseSource = "trace"
	MemoryDeleteResponseSourceMicrosoftTeams MemoryDeleteResponseSource = "microsoft_teams"
	MemoryDeleteResponseSourceGmailActions   MemoryDeleteResponseSource = "gmail_actions"
)

type MemoryGetParams

type MemoryGetParams struct {
	// Any of "reddit", "notion", "slack", "google_calendar", "google_mail", "box",
	// "dropbox", "google_drive", "github", "vault", "web_crawler", "trace",
	// "microsoft_teams", "gmail_actions".
	Source MemoryGetParamsSource `path:"source,omitzero" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type MemoryGetParamsSource

type MemoryGetParamsSource string
const (
	MemoryGetParamsSourceReddit         MemoryGetParamsSource = "reddit"
	MemoryGetParamsSourceNotion         MemoryGetParamsSource = "notion"
	MemoryGetParamsSourceSlack          MemoryGetParamsSource = "slack"
	MemoryGetParamsSourceGoogleCalendar MemoryGetParamsSource = "google_calendar"
	MemoryGetParamsSourceGoogleMail     MemoryGetParamsSource = "google_mail"
	MemoryGetParamsSourceBox            MemoryGetParamsSource = "box"
	MemoryGetParamsSourceDropbox        MemoryGetParamsSource = "dropbox"
	MemoryGetParamsSourceGoogleDrive    MemoryGetParamsSource = "google_drive"
	MemoryGetParamsSourceGitHub         MemoryGetParamsSource = "github"
	MemoryGetParamsSourceVault          MemoryGetParamsSource = "vault"
	MemoryGetParamsSourceWebCrawler     MemoryGetParamsSource = "web_crawler"
	MemoryGetParamsSourceTrace          MemoryGetParamsSource = "trace"
	MemoryGetParamsSourceMicrosoftTeams MemoryGetParamsSource = "microsoft_teams"
	MemoryGetParamsSourceGmailActions   MemoryGetParamsSource = "gmail_actions"
)

type MemoryListParams

type MemoryListParams struct {
	// Filter documents by collection.
	Collection param.Opt[string] `query:"collection,omitzero" json:"-"`
	Cursor     param.Opt[string] `query:"cursor,omitzero" json:"-"`
	// Filter documents by metadata using MongoDB-style operators. Example:
	// {"department": "engineering", "priority": {"$gt": 3}}
	Filter param.Opt[string] `query:"filter,omitzero" json:"-"`
	Size   param.Opt[int64]  `query:"size,omitzero" json:"-"`
	// Filter documents by source.
	//
	// Any of "reddit", "notion", "slack", "google_calendar", "google_mail", "box",
	// "dropbox", "google_drive", "github", "vault", "web_crawler", "trace",
	// "microsoft_teams", "gmail_actions".
	Source MemoryListParamsSource `query:"source,omitzero" json:"-"`
	// Filter documents by status.
	//
	// Any of "pending", "processing", "completed", "failed", "pending_review",
	// "skipped".
	Status MemoryListParamsStatus `query:"status,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (MemoryListParams) URLQuery

func (r MemoryListParams) URLQuery() (v url.Values, err error)

URLQuery serializes MemoryListParams's query parameters as `url.Values`.

type MemoryListParamsSource

type MemoryListParamsSource string

Filter documents by source.

const (
	MemoryListParamsSourceReddit         MemoryListParamsSource = "reddit"
	MemoryListParamsSourceNotion         MemoryListParamsSource = "notion"
	MemoryListParamsSourceSlack          MemoryListParamsSource = "slack"
	MemoryListParamsSourceGoogleCalendar MemoryListParamsSource = "google_calendar"
	MemoryListParamsSourceGoogleMail     MemoryListParamsSource = "google_mail"
	MemoryListParamsSourceBox            MemoryListParamsSource = "box"
	MemoryListParamsSourceDropbox        MemoryListParamsSource = "dropbox"
	MemoryListParamsSourceGoogleDrive    MemoryListParamsSource = "google_drive"
	MemoryListParamsSourceGitHub         MemoryListParamsSource = "github"
	MemoryListParamsSourceVault          MemoryListParamsSource = "vault"
	MemoryListParamsSourceWebCrawler     MemoryListParamsSource = "web_crawler"
	MemoryListParamsSourceTrace          MemoryListParamsSource = "trace"
	MemoryListParamsSourceMicrosoftTeams MemoryListParamsSource = "microsoft_teams"
	MemoryListParamsSourceGmailActions   MemoryListParamsSource = "gmail_actions"
)

type MemoryListParamsStatus

type MemoryListParamsStatus string

Filter documents by status.

const (
	MemoryListParamsStatusPending       MemoryListParamsStatus = "pending"
	MemoryListParamsStatusProcessing    MemoryListParamsStatus = "processing"
	MemoryListParamsStatusCompleted     MemoryListParamsStatus = "completed"
	MemoryListParamsStatusFailed        MemoryListParamsStatus = "failed"
	MemoryListParamsStatusPendingReview MemoryListParamsStatus = "pending_review"
	MemoryListParamsStatusSkipped       MemoryListParamsStatus = "skipped"
)

type MemorySearchParams

type MemorySearchParams struct {
	// Query to run.
	Query string `json:"query" api:"required"`
	// If true, the query will be answered along with matching source documents.
	Answer param.Opt[bool] `json:"answer,omitzero"`
	// Effort level. 0 = pass query through verbatim. 1 = LLM rewrites the query for
	// better retrieval and extracts date filters.
	Effort param.Opt[int64] `json:"effort,omitzero"`
	// Maximum number of results to return.
	MaxResults param.Opt[int64] `json:"max_results,omitzero"`
	// Search options for the query.
	Options MemorySearchParamsOptions `json:"options,omitzero"`
	// Only query documents from these sources.
	//
	// Any of "reddit", "notion", "slack", "google_calendar", "google_mail", "box",
	// "dropbox", "google_drive", "github", "vault", "web_crawler", "trace",
	// "microsoft_teams", "gmail_actions".
	Sources []string `json:"sources,omitzero"`
	// contains filtered or unexported fields
}

func (MemorySearchParams) MarshalJSON

func (r MemorySearchParams) MarshalJSON() (data []byte, err error)

func (*MemorySearchParams) UnmarshalJSON

func (r *MemorySearchParams) UnmarshalJSON(data []byte) error

type MemorySearchParamsOptions

type MemorySearchParamsOptions struct {
	// Only query documents created on or after this date.
	After param.Opt[time.Time] `json:"after,omitzero" format:"date-time"`
	// Only query documents created before this date.
	Before param.Opt[time.Time] `json:"before,omitzero" format:"date-time"`
	// Maximum number of results to return.
	MaxResults param.Opt[int64] `json:"max_results,omitzero"`
	// Metadata filters using MongoDB-style operators. Example: {'status': 'published',
	// 'priority': {'$gt': 3}}
	Filter map[string]any `json:"filter,omitzero"`
	// Only return results from these specific resource IDs. Useful for scoping
	// searches to specific documents (e.g., a specific email thread or uploaded file).
	ResourceIDs []string `json:"resource_ids,omitzero"`
	// Model to use for answer generation when answer=True
	//
	// Any of "llama-3.1", "gemma2", "qwen-qwq", "mistral-saba", "llama-4-scout",
	// "deepseek-r1", "gpt-oss-20b", "gpt-oss-120b".
	AnswerModel string `json:"answer_model,omitzero"`
	// Search options for Box
	Box MemorySearchParamsOptionsBox `json:"box,omitzero"`
	// Search options for Google Calendar
	GoogleCalendar MemorySearchParamsOptionsGoogleCalendar `json:"google_calendar,omitzero"`
	// Search options for Google Drive
	GoogleDrive MemorySearchParamsOptionsGoogleDrive `json:"google_drive,omitzero"`
	// Search options for Gmail
	GoogleMail MemorySearchParamsOptionsGoogleMail `json:"google_mail,omitzero"`
	// Filter by memory type. Defaults to generic memories only. Pass multiple types to
	// include procedures, etc.
	//
	// Any of "procedure", "memory", "mood".
	MemoryTypes []string `json:"memory_types,omitzero"`
	// Search options for Notion
	Notion MemorySearchParamsOptionsNotion `json:"notion,omitzero"`
	// Search options for Reddit
	Reddit MemorySearchParamsOptionsReddit `json:"reddit,omitzero"`
	// Search options for Slack
	Slack MemorySearchParamsOptionsSlack `json:"slack,omitzero"`
	// Search options for vault
	Vault MemorySearchParamsOptionsVault `json:"vault,omitzero"`
	// Search options for Web Crawler
	WebCrawler MemorySearchParamsOptionsWebCrawler `json:"web_crawler,omitzero"`
	// contains filtered or unexported fields
}

Search options for the query.

func (MemorySearchParamsOptions) MarshalJSON

func (r MemorySearchParamsOptions) MarshalJSON() (data []byte, err error)

func (*MemorySearchParamsOptions) UnmarshalJSON

func (r *MemorySearchParamsOptions) UnmarshalJSON(data []byte) error

type MemorySearchParamsOptionsBox

type MemorySearchParamsOptionsBox struct {
	// Weight of results from this source. A weight greater than 1.0 means more results
	// from this source will be returned, a weight less than 1.0 means fewer results
	// will be returned. This will only affect results if multiple sources are queried
	// at the same time.
	Weight param.Opt[float64] `json:"weight,omitzero"`
	// contains filtered or unexported fields
}

Search options for Box

func (MemorySearchParamsOptionsBox) MarshalJSON

func (r MemorySearchParamsOptionsBox) MarshalJSON() (data []byte, err error)

func (*MemorySearchParamsOptionsBox) UnmarshalJSON

func (r *MemorySearchParamsOptionsBox) UnmarshalJSON(data []byte) error

type MemorySearchParamsOptionsGoogleCalendar

type MemorySearchParamsOptionsGoogleCalendar struct {
	// The ID of the calendar to search. If not provided, it will use the ID of the
	// default calendar. You can get the list of calendars with the
	// `/integrations/google_calendar/list` endpoint.
	CalendarID param.Opt[string] `json:"calendar_id,omitzero"`
	// Weight of results from this source. A weight greater than 1.0 means more results
	// from this source will be returned, a weight less than 1.0 means fewer results
	// will be returned. This will only affect results if multiple sources are queried
	// at the same time.
	Weight param.Opt[float64] `json:"weight,omitzero"`
	// contains filtered or unexported fields
}

Search options for Google Calendar

func (MemorySearchParamsOptionsGoogleCalendar) MarshalJSON

func (r MemorySearchParamsOptionsGoogleCalendar) MarshalJSON() (data []byte, err error)

func (*MemorySearchParamsOptionsGoogleCalendar) UnmarshalJSON

func (r *MemorySearchParamsOptionsGoogleCalendar) UnmarshalJSON(data []byte) error

type MemorySearchParamsOptionsGoogleDrive

type MemorySearchParamsOptionsGoogleDrive struct {
	// Weight of results from this source. A weight greater than 1.0 means more results
	// from this source will be returned, a weight less than 1.0 means fewer results
	// will be returned. This will only affect results if multiple sources are queried
	// at the same time.
	Weight param.Opt[float64] `json:"weight,omitzero"`
	// contains filtered or unexported fields
}

Search options for Google Drive

func (MemorySearchParamsOptionsGoogleDrive) MarshalJSON

func (r MemorySearchParamsOptionsGoogleDrive) MarshalJSON() (data []byte, err error)

func (*MemorySearchParamsOptionsGoogleDrive) UnmarshalJSON

func (r *MemorySearchParamsOptionsGoogleDrive) UnmarshalJSON(data []byte) error

type MemorySearchParamsOptionsGoogleMail

type MemorySearchParamsOptionsGoogleMail struct {
	// Weight of results from this source. A weight greater than 1.0 means more results
	// from this source will be returned, a weight less than 1.0 means fewer results
	// will be returned. This will only affect results if multiple sources are queried
	// at the same time.
	Weight param.Opt[float64] `json:"weight,omitzero"`
	// List of label IDs to filter messages (e.g., ['INBOX', 'SENT', 'DRAFT']).
	// Multiple labels are combined with OR logic - messages matching ANY specified
	// label will be returned. If empty, no label filtering is applied (searches all
	// accessible messages).
	LabelIDs []string `json:"label_ids,omitzero"`
	// contains filtered or unexported fields
}

Search options for Gmail

func (MemorySearchParamsOptionsGoogleMail) MarshalJSON

func (r MemorySearchParamsOptionsGoogleMail) MarshalJSON() (data []byte, err error)

func (*MemorySearchParamsOptionsGoogleMail) UnmarshalJSON

func (r *MemorySearchParamsOptionsGoogleMail) UnmarshalJSON(data []byte) error

type MemorySearchParamsOptionsNotion

type MemorySearchParamsOptionsNotion struct {
	// Weight of results from this source. A weight greater than 1.0 means more results
	// from this source will be returned, a weight less than 1.0 means fewer results
	// will be returned. This will only affect results if multiple sources are queried
	// at the same time.
	Weight param.Opt[float64] `json:"weight,omitzero"`
	// List of Notion page IDs to search. If not provided, all pages in the workspace
	// will be searched.
	NotionPageIDs []string `json:"notion_page_ids,omitzero"`
	// contains filtered or unexported fields
}

Search options for Notion

func (MemorySearchParamsOptionsNotion) MarshalJSON

func (r MemorySearchParamsOptionsNotion) MarshalJSON() (data []byte, err error)

func (*MemorySearchParamsOptionsNotion) UnmarshalJSON

func (r *MemorySearchParamsOptionsNotion) UnmarshalJSON(data []byte) error

type MemorySearchParamsOptionsReddit

type MemorySearchParamsOptionsReddit struct {
	// The subreddit to search. If not provided, the query will be searched for in all
	// subreddits.
	Subreddit param.Opt[string] `json:"subreddit,omitzero"`
	// Weight of results from this source. A weight greater than 1.0 means more results
	// from this source will be returned, a weight less than 1.0 means fewer results
	// will be returned. This will only affect results if multiple sources are queried
	// at the same time.
	Weight param.Opt[float64] `json:"weight,omitzero"`
	// The time period to search. Defaults to 'month'.
	//
	// Any of "hour", "day", "week", "month", "year", "all".
	Period string `json:"period,omitzero"`
	// The sort order of the posts. Defaults to 'relevance'.
	//
	// Any of "relevance", "new", "hot", "top", "comments".
	Sort string `json:"sort,omitzero"`
	// contains filtered or unexported fields
}

Search options for Reddit

func (MemorySearchParamsOptionsReddit) MarshalJSON

func (r MemorySearchParamsOptionsReddit) MarshalJSON() (data []byte, err error)

func (*MemorySearchParamsOptionsReddit) UnmarshalJSON

func (r *MemorySearchParamsOptionsReddit) UnmarshalJSON(data []byte) error

type MemorySearchParamsOptionsSlack

type MemorySearchParamsOptionsSlack struct {
	// If set, pass 'exclude_archived' to Slack. If None, omit the param.
	ExcludeArchived param.Opt[bool] `json:"exclude_archived,omitzero"`
	// Include direct messages (im) when listing conversations.
	IncludeDms param.Opt[bool] `json:"include_dms,omitzero"`
	// Include group DMs (mpim) when listing conversations.
	IncludeGroupDms param.Opt[bool] `json:"include_group_dms,omitzero"`
	// Include private channels when constructing Slack 'types'. Defaults to False to
	// preserve existing cassette query params.
	IncludePrivate param.Opt[bool] `json:"include_private,omitzero"`
	// Weight of results from this source. A weight greater than 1.0 means more results
	// from this source will be returned, a weight less than 1.0 means fewer results
	// will be returned. This will only affect results if multiple sources are queried
	// at the same time.
	Weight param.Opt[float64] `json:"weight,omitzero"`
	// List of Slack channels to include (by id, name, or #name).
	Channels []string `json:"channels,omitzero"`
	// contains filtered or unexported fields
}

Search options for Slack

func (MemorySearchParamsOptionsSlack) MarshalJSON

func (r MemorySearchParamsOptionsSlack) MarshalJSON() (data []byte, err error)

func (*MemorySearchParamsOptionsSlack) UnmarshalJSON

func (r *MemorySearchParamsOptionsSlack) UnmarshalJSON(data []byte) error

type MemorySearchParamsOptionsVault

type MemorySearchParamsOptionsVault struct {
	// Weight of results from this source. A weight greater than 1.0 means more results
	// from this source will be returned, a weight less than 1.0 means fewer results
	// will be returned. This will only affect results if multiple sources are queried
	// at the same time.
	Weight param.Opt[float64] `json:"weight,omitzero"`
	// contains filtered or unexported fields
}

Search options for vault

func (MemorySearchParamsOptionsVault) MarshalJSON

func (r MemorySearchParamsOptionsVault) MarshalJSON() (data []byte, err error)

func (*MemorySearchParamsOptionsVault) UnmarshalJSON

func (r *MemorySearchParamsOptionsVault) UnmarshalJSON(data []byte) error

type MemorySearchParamsOptionsWebCrawler

type MemorySearchParamsOptionsWebCrawler struct {
	// The URL to crawl
	URL param.Opt[string] `json:"url,omitzero"`
	// Maximum depth to crawl from the starting URL
	MaxDepth param.Opt[int64] `json:"max_depth,omitzero"`
	// Weight of results from this source. A weight greater than 1.0 means more results
	// from this source will be returned, a weight less than 1.0 means fewer results
	// will be returned. This will only affect results if multiple sources are queried
	// at the same time.
	Weight param.Opt[float64] `json:"weight,omitzero"`
	// contains filtered or unexported fields
}

Search options for Web Crawler

func (MemorySearchParamsOptionsWebCrawler) MarshalJSON

func (r MemorySearchParamsOptionsWebCrawler) MarshalJSON() (data []byte, err error)

func (*MemorySearchParamsOptionsWebCrawler) UnmarshalJSON

func (r *MemorySearchParamsOptionsWebCrawler) UnmarshalJSON(data []byte) error

type MemoryService

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

MemoryService contains methods and other services that help with interacting with the hyperspell API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewMemoryService method instead.

func NewMemoryService

func NewMemoryService(opts ...option.RequestOption) (r MemoryService)

NewMemoryService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*MemoryService) Add

func (r *MemoryService) Add(ctx context.Context, body MemoryAddParams, opts ...option.RequestOption) (res *MemoryStatus, err error)

Adds an arbitrary document to the index. This can be any text, email, call transcript, etc. The document will be processed and made available for querying once the processing is complete.

func (*MemoryService) AddBulk

Adds multiple documents to the index in a single request.

All items are validated before any database operations occur. If any item fails validation, the entire batch is rejected with a 422 error detailing which items failed and why.

Maximum 100 items per request. Each item follows the same schema as the single-item /memories/add endpoint.

func (*MemoryService) Delete

func (r *MemoryService) Delete(ctx context.Context, resourceID string, body MemoryDeleteParams, opts ...option.RequestOption) (res *MemoryDeleteResponse, err error)

Delete a memory and its associated chunks from the index.

This removes the memory completely from the vector index and database. The operation deletes:

1. All chunks associated with the resource (including embeddings) 2. The resource record itself

Args: source: The document provider (e.g., gmail, notion, vault) resource_id: The unique identifier of the resource to delete api_token: Authentication token

Returns: MemoryDeletionResponse with deletion details

Raises: DocumentNotFound: If the resource doesn't exist or user doesn't have access

func (*MemoryService) Get

func (r *MemoryService) Get(ctx context.Context, resourceID string, query MemoryGetParams, opts ...option.RequestOption) (res *Memory, err error)

Retrieves a document by provider and resource_id.

func (*MemoryService) List

This endpoint allows you to paginate through all documents in the index. You can filter the documents by title, date, metadata, etc.

func (*MemoryService) ListAutoPaging

This endpoint allows you to paginate through all documents in the index. You can filter the documents by title, date, metadata, etc.

func (*MemoryService) Search

func (r *MemoryService) Search(ctx context.Context, body MemorySearchParams, opts ...option.RequestOption) (res *shared.QueryResult, err error)

Retrieves documents matching the query.

func (*MemoryService) Status

func (r *MemoryService) Status(ctx context.Context, opts ...option.RequestOption) (res *MemoryStatusResponse, err error)

This endpoint shows the indexing progress of documents, both by provider and total.

func (*MemoryService) Update

func (r *MemoryService) Update(ctx context.Context, resourceID string, params MemoryUpdateParams, opts ...option.RequestOption) (res *MemoryStatus, err error)

Updates an existing document in the index. You can update the text, collection, title, and metadata. The document must already exist or a 404 will be returned. This works for documents from any source (vault, slack, gmail, etc.).

To remove a collection, set it to null explicitly.

func (*MemoryService) Upload

func (r *MemoryService) Upload(ctx context.Context, body MemoryUploadParams, opts ...option.RequestOption) (res *MemoryStatus, err error)

This endpoint will upload a file to the index and return a resource_id. The file will be processed in the background and the memory will be available for querying once the processing is complete. You can use the `resource_id` to query the memory later, and check the status of the memory.

type MemorySource

type MemorySource string
const (
	MemorySourceReddit         MemorySource = "reddit"
	MemorySourceNotion         MemorySource = "notion"
	MemorySourceSlack          MemorySource = "slack"
	MemorySourceGoogleCalendar MemorySource = "google_calendar"
	MemorySourceGoogleMail     MemorySource = "google_mail"
	MemorySourceBox            MemorySource = "box"
	MemorySourceDropbox        MemorySource = "dropbox"
	MemorySourceGoogleDrive    MemorySource = "google_drive"
	MemorySourceGitHub         MemorySource = "github"
	MemorySourceVault          MemorySource = "vault"
	MemorySourceWebCrawler     MemorySource = "web_crawler"
	MemorySourceTrace          MemorySource = "trace"
	MemorySourceMicrosoftTeams MemorySource = "microsoft_teams"
	MemorySourceGmailActions   MemorySource = "gmail_actions"
)

type MemoryStatus

type MemoryStatus struct {
	ResourceID string `json:"resource_id" api:"required"`
	// Any of "reddit", "notion", "slack", "google_calendar", "google_mail", "box",
	// "dropbox", "google_drive", "github", "vault", "web_crawler", "trace",
	// "microsoft_teams", "gmail_actions".
	Source MemoryStatusSource `json:"source" api:"required"`
	// Any of "pending", "processing", "completed", "failed", "pending_review",
	// "skipped".
	Status MemoryStatusStatus `json:"status" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ResourceID  respjson.Field
		Source      respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (MemoryStatus) RawJSON

func (r MemoryStatus) RawJSON() string

Returns the unmodified JSON received from the API

func (*MemoryStatus) UnmarshalJSON

func (r *MemoryStatus) UnmarshalJSON(data []byte) error

type MemoryStatusResponse

type MemoryStatusResponse struct {
	Providers map[string]map[string]int64 `json:"providers" api:"required"`
	Total     map[string]int64            `json:"total" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Providers   respjson.Field
		Total       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (MemoryStatusResponse) RawJSON

func (r MemoryStatusResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*MemoryStatusResponse) UnmarshalJSON

func (r *MemoryStatusResponse) UnmarshalJSON(data []byte) error

type MemoryStatusSource

type MemoryStatusSource string
const (
	MemoryStatusSourceReddit         MemoryStatusSource = "reddit"
	MemoryStatusSourceNotion         MemoryStatusSource = "notion"
	MemoryStatusSourceSlack          MemoryStatusSource = "slack"
	MemoryStatusSourceGoogleCalendar MemoryStatusSource = "google_calendar"
	MemoryStatusSourceGoogleMail     MemoryStatusSource = "google_mail"
	MemoryStatusSourceBox            MemoryStatusSource = "box"
	MemoryStatusSourceDropbox        MemoryStatusSource = "dropbox"
	MemoryStatusSourceGoogleDrive    MemoryStatusSource = "google_drive"
	MemoryStatusSourceGitHub         MemoryStatusSource = "github"
	MemoryStatusSourceVault          MemoryStatusSource = "vault"
	MemoryStatusSourceWebCrawler     MemoryStatusSource = "web_crawler"
	MemoryStatusSourceTrace          MemoryStatusSource = "trace"
	MemoryStatusSourceMicrosoftTeams MemoryStatusSource = "microsoft_teams"
	MemoryStatusSourceGmailActions   MemoryStatusSource = "gmail_actions"
)

type MemoryStatusStatus

type MemoryStatusStatus string
const (
	MemoryStatusStatusPending       MemoryStatusStatus = "pending"
	MemoryStatusStatusProcessing    MemoryStatusStatus = "processing"
	MemoryStatusStatusCompleted     MemoryStatusStatus = "completed"
	MemoryStatusStatusFailed        MemoryStatusStatus = "failed"
	MemoryStatusStatusPendingReview MemoryStatusStatus = "pending_review"
	MemoryStatusStatusSkipped       MemoryStatusStatus = "skipped"
)

type MemoryUpdateParams

type MemoryUpdateParams struct {
	// Any of "reddit", "notion", "slack", "google_calendar", "google_mail", "box",
	// "dropbox", "google_drive", "github", "vault", "web_crawler", "trace",
	// "microsoft_teams", "gmail_actions".
	Source MemoryUpdateParamsSource `path:"source,omitzero" api:"required" json:"-"`
	// The collection to move the document to — deprecated, set the collection using
	// metadata instead.
	Collection any `json:"collection,omitzero"`
	// Custom metadata for filtering. Keys must be alphanumeric with underscores, max
	// 64 chars. Values must be string, number, boolean, or null. Will be merged with
	// existing metadata.
	Metadata map[string]MemoryUpdateParamsMetadataUnion `json:"metadata,omitzero"`
	// Full text of the document. If provided, the document will be re-indexed.
	Text any `json:"text,omitzero"`
	// Title of the document.
	Title any `json:"title,omitzero"`
	// contains filtered or unexported fields
}

func (MemoryUpdateParams) MarshalJSON

func (r MemoryUpdateParams) MarshalJSON() (data []byte, err error)

func (*MemoryUpdateParams) UnmarshalJSON

func (r *MemoryUpdateParams) UnmarshalJSON(data []byte) error

type MemoryUpdateParamsMetadataUnion

type MemoryUpdateParamsMetadataUnion struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	OfBool   param.Opt[bool]    `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (MemoryUpdateParamsMetadataUnion) MarshalJSON

func (u MemoryUpdateParamsMetadataUnion) MarshalJSON() ([]byte, error)

func (*MemoryUpdateParamsMetadataUnion) UnmarshalJSON

func (u *MemoryUpdateParamsMetadataUnion) UnmarshalJSON(data []byte) error

type MemoryUpdateParamsSource

type MemoryUpdateParamsSource string
const (
	MemoryUpdateParamsSourceReddit         MemoryUpdateParamsSource = "reddit"
	MemoryUpdateParamsSourceNotion         MemoryUpdateParamsSource = "notion"
	MemoryUpdateParamsSourceSlack          MemoryUpdateParamsSource = "slack"
	MemoryUpdateParamsSourceGoogleCalendar MemoryUpdateParamsSource = "google_calendar"
	MemoryUpdateParamsSourceGoogleMail     MemoryUpdateParamsSource = "google_mail"
	MemoryUpdateParamsSourceBox            MemoryUpdateParamsSource = "box"
	MemoryUpdateParamsSourceDropbox        MemoryUpdateParamsSource = "dropbox"
	MemoryUpdateParamsSourceGoogleDrive    MemoryUpdateParamsSource = "google_drive"
	MemoryUpdateParamsSourceGitHub         MemoryUpdateParamsSource = "github"
	MemoryUpdateParamsSourceVault          MemoryUpdateParamsSource = "vault"
	MemoryUpdateParamsSourceWebCrawler     MemoryUpdateParamsSource = "web_crawler"
	MemoryUpdateParamsSourceTrace          MemoryUpdateParamsSource = "trace"
	MemoryUpdateParamsSourceMicrosoftTeams MemoryUpdateParamsSource = "microsoft_teams"
	MemoryUpdateParamsSourceGmailActions   MemoryUpdateParamsSource = "gmail_actions"
)

type MemoryUploadParams

type MemoryUploadParams struct {
	// The file to ingest.
	File io.Reader `json:"file,omitzero" api:"required" format:"binary"`
	// The collection to add the document to — deprecated, set the collection using
	// metadata instead.
	Collection param.Opt[string] `json:"collection,omitzero"`
	// Custom metadata as JSON string for filtering. Keys must be alphanumeric with
	// underscores, max 64 chars. Values must be string, number, or boolean.
	Metadata param.Opt[string] `json:"metadata,omitzero"`
	// contains filtered or unexported fields
}

func (MemoryUploadParams) MarshalMultipart

func (r MemoryUploadParams) MarshalMultipart() (data []byte, contentType string, err error)

type Metadata

type Metadata = shared.Metadata

This is an alias to an internal type.

type MetadataStatus

type MetadataStatus = shared.MetadataStatus

This is an alias to an internal type.

type Notification

type Notification = shared.Notification

This is an alias to an internal type.

type NotificationType

type NotificationType = shared.NotificationType

This is an alias to an internal type.

type QueryResult

type QueryResult = shared.QueryResult

This is an alias to an internal type.

type Resource

type Resource = shared.Resource

This is an alias to an internal type.

type ResourceSource

type ResourceSource = shared.ResourceSource

This is an alias to an internal type.

type SessionAddParams

type SessionAddParams struct {
	// The trace history as a string. Can be a JSON array of Hyperdoc steps, a JSON
	// array of Vercel AI SDK steps, or OpenClaw JSONL.
	History string `json:"history" api:"required"`
	// Title of the trace
	Title param.Opt[string] `json:"title,omitzero"`
	// Date of the trace
	Date param.Opt[time.Time] `json:"date,omitzero" format:"date-time"`
	// Resource identifier for the trace.
	SessionID param.Opt[string] `json:"session_id,omitzero"`
	// Trace format: 'vercel', 'hyperdoc', or 'openclaw'. Auto-detected if not set.
	//
	// Any of "vercel", "hyperdoc", "openclaw".
	Format SessionAddParamsFormat `json:"format,omitzero"`
	// Custom metadata for filtering. Keys must be alphanumeric with underscores, max
	// 64 chars.
	Metadata map[string]SessionAddParamsMetadataUnion `json:"metadata,omitzero"`
	// What kind of memories to extract from the trace
	//
	// Any of "procedure", "memory", "mood".
	Extract []string `json:"extract,omitzero"`
	// contains filtered or unexported fields
}

func (SessionAddParams) MarshalJSON

func (r SessionAddParams) MarshalJSON() (data []byte, err error)

func (*SessionAddParams) UnmarshalJSON

func (r *SessionAddParams) UnmarshalJSON(data []byte) error

type SessionAddParamsFormat

type SessionAddParamsFormat string

Trace format: 'vercel', 'hyperdoc', or 'openclaw'. Auto-detected if not set.

const (
	SessionAddParamsFormatVercel   SessionAddParamsFormat = "vercel"
	SessionAddParamsFormatHyperdoc SessionAddParamsFormat = "hyperdoc"
	SessionAddParamsFormatOpenclaw SessionAddParamsFormat = "openclaw"
)

type SessionAddParamsMetadataUnion

type SessionAddParamsMetadataUnion struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	OfBool   param.Opt[bool]    `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (SessionAddParamsMetadataUnion) MarshalJSON

func (u SessionAddParamsMetadataUnion) MarshalJSON() ([]byte, error)

func (*SessionAddParamsMetadataUnion) UnmarshalJSON

func (u *SessionAddParamsMetadataUnion) UnmarshalJSON(data []byte) error

type SessionService

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

SessionService contains methods and other services that help with interacting with the hyperspell API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSessionService method instead.

func NewSessionService

func NewSessionService(opts ...option.RequestOption) (r SessionService)

NewSessionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*SessionService) Add

func (r *SessionService) Add(ctx context.Context, body SessionAddParams, opts ...option.RequestOption) (res *MemoryStatus, err error)

Add an agent trace/transcript to the index.

Accepts traces as a string in Hyperdoc format (native), Vercel AI SDK format, or OpenClaw JSONL format. The format is auto-detected if not specified.

**Hyperdoc format** (JSON array, snake_case with type discriminators):

```json

{
  "history": "[{\"type\": \"trace_message\", \"role\": \"user\", \"text\": \"Hello\"}]"
}

```

**Vercel AI SDK format** (JSON array, camelCase):

```json { "history": "[{\"role\": \"user\", \"content\": \"Hello\"}]" } ```

**OpenClaw JSONL format** (newline-delimited JSON):

```json

{
  "history": "{\"type\":\"session\",\"id\":\"abc\"}\n{\"type\":\"message\",\"message\":{\"role\":\"user\",...}}"
}

```

type Token

type Token struct {
	Token     string    `json:"token" api:"required"`
	ExpiresAt time.Time `json:"expires_at" api:"required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Token       respjson.Field
		ExpiresAt   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Token) RawJSON

func (r Token) RawJSON() string

Returns the unmodified JSON received from the API

func (*Token) UnmarshalJSON

func (r *Token) UnmarshalJSON(data []byte) error

type VaultListParams

type VaultListParams struct {
	Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
	Size   param.Opt[int64]  `query:"size,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (VaultListParams) URLQuery

func (r VaultListParams) URLQuery() (v url.Values, err error)

URLQuery serializes VaultListParams's query parameters as `url.Values`.

type VaultListResponse

type VaultListResponse struct {
	Collection    string `json:"collection" api:"required"`
	DocumentCount int64  `json:"document_count" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Collection    respjson.Field
		DocumentCount respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (VaultListResponse) RawJSON

func (r VaultListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*VaultListResponse) UnmarshalJSON

func (r *VaultListResponse) UnmarshalJSON(data []byte) error

type VaultService

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

VaultService contains methods and other services that help with interacting with the hyperspell API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewVaultService method instead.

func NewVaultService

func NewVaultService(opts ...option.RequestOption) (r VaultService)

NewVaultService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*VaultService) List deprecated

This endpoint lists all collections, and how many documents are in each collection. All documents that do not have a collection assigned are in the `null` collection.

Deprecated: This method will be removed in the future

func (*VaultService) ListAutoPaging deprecated

This endpoint lists all collections, and how many documents are in each collection. All documents that do not have a collection assigned are in the `null` collection.

Deprecated: This method will be removed in the future

Directories

Path Synopsis
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
Package json implements encoding and decoding of JSON as defined in RFC 7159.
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
packages

Jump to

Keyboard shortcuts

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