Class: Cadenya::Resources::MemoryLayers::Entries

Inherits:
Object
  • Object
show all
Defined in:
lib/cadenya/resources/memory_layers/entries.rb

Overview

Manage memory layers and their entries. Layers are named containers that can be composed into an objective’s memory stack; entries are the keyed values within a layer. System-managed layers (e.g., episodic layers created by the runtime) cannot be mutated through this API.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Entries

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Entries.

Parameters:



215
216
217
# File 'lib/cadenya/resources/memory_layers/entries.rb', line 215

def initialize(client:)
  @client = client
end

Instance Method Details

#create(memory_layer_id, workspace_id:, metadata:, spec:, request_options: {}) ⇒ Cadenya::Models::MemoryLayers::MemoryEntryDetail

Some parameter documentations has been truncated, see Models::MemoryLayers::EntryCreateParams for more details.

Creates a new entry in a memory layer. Returns the detail view, including the resolved content body.

external_id:<val

Parameters:

Returns:

See Also:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/cadenya/resources/memory_layers/entries.rb', line 33

def create(memory_layer_id, params)
  parsed, options = Cadenya::MemoryLayers::EntryCreateParams.dump_request(params)
  workspace_id =
    parsed.delete(:workspace_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: ["v1/workspaces/%1$s/memory_layers/%2$s/entries", workspace_id, memory_layer_id],
    body: parsed,
    model: Cadenya::MemoryLayers::MemoryEntryDetail,
    options: options
  )
end

#delete(id, workspace_id:, memory_layer_id:, request_options: {}) ⇒ nil

Deletes a memory entry from a memory layer

Parameters:

  • id (String)
  • workspace_id (String)
  • memory_layer_id (String)

    Memory layer ID. Accepts canonical memlyr_… form or external_id:<value> form.

  • request_options (Cadenya::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/cadenya/resources/memory_layers/entries.rb', line 194

def delete(id, params)
  parsed, options = Cadenya::MemoryLayers::EntryDeleteParams.dump_request(params)
  workspace_id =
    parsed.delete(:workspace_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  memory_layer_id =
    parsed.delete(:memory_layer_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["v1/workspaces/%1$s/memory_layers/%2$s/entries/%3$s", workspace_id, memory_layer_id, id],
    model: NilClass,
    options: options
  )
end

#list(memory_layer_id, workspace_id:, bundle_key: nil, cursor: nil, include_info: nil, limit: nil, prefix: nil, query: nil, sort_order: nil, request_options: {}) ⇒ Cadenya::Internal::CursorPagination<Cadenya::Models::MemoryLayers::MemoryEntry>

Some parameter documentations has been truncated, see Models::MemoryLayers::EntryListParams for more details.

Lists all entries in a memory layer

external_id:<val

Parameters:

  • memory_layer_id (String)

    Path param: Memory layer ID. Accepts canonical memlyr_… form or

  • workspace_id (String)

    Path param

  • bundle_key (String)

    Query param: Filter by bundle_key — return only resources owned by this bundle.

  • cursor (String)

    Query param: Pagination cursor from previous response

  • include_info (Boolean)

    Query param: When set to true you may use more of your alloted API rate-limit

  • limit (Integer)

    Query param: Maximum number of results to return

  • prefix (String)

    Query param: Filter by key prefix (e.g., “skills/postmortem/” to list all entrie

  • query (String)

    Query param: Free-form search query

  • sort_order (String)

    Query param: Sort order for results (asc or desc by creation time)

  • request_options (Cadenya::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/cadenya/resources/memory_layers/entries.rb', line 158

def list(memory_layer_id, params)
  parsed, options = Cadenya::MemoryLayers::EntryListParams.dump_request(params)
  query = Cadenya::Internal::Util.encode_query_params(parsed)
  workspace_id =
    parsed.delete(:workspace_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["v1/workspaces/%1$s/memory_layers/%2$s/entries", workspace_id, memory_layer_id],
    query: query.transform_keys(
      bundle_key: "bundleKey",
      include_info: "includeInfo",
      sort_order: "sortOrder"
    ),
    page: Cadenya::Internal::CursorPagination,
    model: Cadenya::MemoryLayers::MemoryEntry,
    options: options
  )
end

#retrieve(id, workspace_id:, memory_layer_id:, request_options: {}) ⇒ Cadenya::Models::MemoryLayers::MemoryEntryDetail

Retrieves a memory entry by ID from a memory layer. Returns the detail view, including the content body.

Parameters:

  • id (String)
  • workspace_id (String)
  • memory_layer_id (String)

    Memory layer ID. Accepts canonical memlyr_… form or external_id:<value> form.

  • request_options (Cadenya::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/cadenya/resources/memory_layers/entries.rb', line 64

def retrieve(id, params)
  parsed, options = Cadenya::MemoryLayers::EntryRetrieveParams.dump_request(params)
  workspace_id =
    parsed.delete(:workspace_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  memory_layer_id =
    parsed.delete(:memory_layer_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["v1/workspaces/%1$s/memory_layers/%2$s/entries/%3$s", workspace_id, memory_layer_id, id],
    model: Cadenya::MemoryLayers::MemoryEntryDetail,
    options: options
  )
end

#update(id, workspace_id:, memory_layer_id:, metadata: nil, spec: nil, update_mask: nil, request_options: {}) ⇒ Cadenya::Models::MemoryLayers::MemoryEntryDetail

Some parameter documentations has been truncated, see Models::MemoryLayers::EntryUpdateParams for more details.

Updates a memory entry in a memory layer. Returns the detail view, including the resolved content body.

external_id:<val

Parameters:

Returns:

See Also:



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/cadenya/resources/memory_layers/entries.rb', line 108

def update(id, params)
  parsed, options = Cadenya::MemoryLayers::EntryUpdateParams.dump_request(params)
  workspace_id =
    parsed.delete(:workspace_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  memory_layer_id =
    parsed.delete(:memory_layer_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :patch,
    path: ["v1/workspaces/%1$s/memory_layers/%2$s/entries/%3$s", workspace_id, memory_layer_id, id],
    body: parsed,
    model: Cadenya::MemoryLayers::MemoryEntryDetail,
    options: options
  )
end