GoodMemGoodMem
ReferenceClient SDKsRust

Spaces

Rust spaces API reference: typed methods, request options, return values, and resource models.

goodmem::api::Spaces

Access this service with client.spaces().

pub struct Spaces<'a> {
    /* private fields */
}

Methods

MethodHTTPPath
createPOST/v1/spaces
deleteDELETE/v1/spaces/{id}
getGET/v1/spaces/{id}
listGET/v1/spaces
list_pagesGET/v1/spaces
transfer_ownershipPOST/v1/spaces/{id}:transferOwnership
updatePUT/v1/spaces/{id}

Errors and cancellation

Calls return Result<T>. See Error for validation, HTTP, transport, decoding, and timeout failures. Stream items can also return errors after the call succeeds.

Pagination helpers fetch pages when polled. Drop a page or event stream to cancel further work.

Implementations

impl Spaces<'_>

create

pub async fn create(&self, body: &SpaceCreationRequest) -> Result<Space>

Create a new Space

Creates a new space with the provided name, labels, and embedder configuration. A space is a container for organizing related memories.

OWNER DEFAULTS: Owner defaults to the authenticated principal unless ownerId is provided; CREATE_SPACE is evaluated against the proposed space and owner.

EMBEDDER REQUIREMENTS: At least one embedder configuration must be specified. Every referenced embedder must exist, and the caller must have EXECUTE_EMBEDDER on each one.

DUPLICATE DETECTION: Returns ALREADY_EXISTS if another space exists with identical {ownerId, name} (case-sensitive). This operation is NOT idempotent.

Errors include local validation, HTTP failures, and malformed responses.

HTTP: POST /v1/spaces

delete

pub async fn delete(&self, id: impl std::fmt::Display) -> Result<()>

Delete a space

Permanently deletes a space and all associated content. This operation cannot be undone.

CASCADE DELETION: Removes the space record and cascades deletion to associated memories, chunks, and embedder associations. Requires DELETE_SPACE on the requested space. This operation is safe to retry and may return NOT_FOUND if the space was already deleted.

Errors include local validation, HTTP failures, and malformed responses.

HTTP: DELETE /v1/spaces/{id}

get

pub async fn get(&self, id: impl std::fmt::Display) -> Result<Space>

Get a space by ID

Retrieves a specific space by its unique identifier. Returns the complete space information, including name, labels, embedder configuration, and metadata. Requires READ_SPACE on the requested space. The service distinguishes a missing space from an existing space the caller cannot read. This is a read-only operation safe to retry.

Errors include local validation, HTTP failures, and malformed responses.

HTTP: GET /v1/spaces/{id}

list

pub async fn list(&self, options: &SpacesListOptions) -> Result<ListSpacesResponse>

List spaces

Retrieves a list of spaces accessible to the caller, with optional filtering by owner, labels, and name. Results are paginated with a maximum number of spaces per response.

LABEL FILTERS: Label filters accept either label.<key>=<value> or label[key]=value (for example, label.environment=production or label[environment]=production).

AUTHORIZATION: Requires LIST_SPACE on the GoodMem instance. Each returned space must also be visible through READ_SPACE; unauthorized spaces are filtered in PostgreSQL. The ownerId parameter filters that already-authorized result set and does not grant additional visibility.

DEFAULT SORT: Results ordered by created_at DESCENDING unless specified otherwise.

MAX_RESULTS CLAMPING: maxResults defaults to 50 and is clamped to [1, 1000] range.

Errors include local validation, HTTP failures, and malformed responses.

HTTP: GET /v1/spaces

list_pages

pub fn list_pages( &self, options: &SpacesListOptions, ) -> Result<EventStream<ListSpacesResponse>>

Lazily fetch pages for spaces.list. Drop the stream to cancel.

Retrieves a list of spaces accessible to the caller, with optional filtering by owner, labels, and name. Results are paginated with a maximum number of spaces per response.

LABEL FILTERS: Label filters accept either label.<key>=<value> or label[key]=value (for example, label.environment=production or label[environment]=production).

AUTHORIZATION: Requires LIST_SPACE on the GoodMem instance. Each returned space must also be visible through READ_SPACE; unauthorized spaces are filtered in PostgreSQL. The ownerId parameter filters that already-authorized result set and does not grant additional visibility.

DEFAULT SORT: Results ordered by created_at DESCENDING unless specified otherwise.

MAX_RESULTS CLAMPING: maxResults defaults to 50 and is clamped to [1, 1000] range.

HTTP: GET /v1/spaces

transfer_ownership

pub async fn transfer_ownership( &self, id: impl std::fmt::Display, body: &TransferOwnershipRequest, ) -> Result<TransferSpaceOwnershipResponse>

Transfer ownership of a space

Transfers an existing space to another active human or service principal. The current space owner, the GoodMem instance owner, or an instance administrator may transfer it; a space-scoped administrator cannot. Only owner and update-audit fields change. Memories, embedder associations, grants, and role assignments remain unchanged. This operation is not idempotent under response semantics: after an unknown outcome, read the space before retrying.

Errors include local validation, HTTP failures, and malformed responses.

HTTP: POST /v1/spaces/{id}:transferOwnership

update

pub async fn update( &self, id: impl std::fmt::Display, body: &UpdateSpaceRequest, ) -> Result<Space>

Update a space

Updates an existing space with new values for the specified fields. Only name and labels can be updated. Fields not included in the request remain unchanged.

IMMUTABLE FIELDS: space_embedders, default_chunking_config, and ownerId cannot be modified after creation.

NAME UNIQUENESS: Name must be unique per owner - returns ALREADY_EXISTS if name conflicts with an existing space. Requires UPDATE_SPACE on the requested space. This operation is idempotent.

Errors include local validation, HTTP failures, and malformed responses.

HTTP: PUT /v1/spaces/{id}

Types

Trait implementations

  • Clone (derived)
  • Copy (derived)
  • Debug (derived)

On this page