Class: LanggraphPlatform::Resources::Store

Inherits:
BaseResource show all
Defined in:
lib/langgraph_platform/resources/store.rb

Instance Method Summary collapse

Methods inherited from BaseResource

#initialize

Constructor Details

This class inherits a constructor from LanggraphPlatform::Resources::BaseResource

Instance Method Details

#batch_delete(**params) ⇒ Object

rubocop:disable Naming/PredicateMethod



48
49
50
51
52
# File 'lib/langgraph_platform/resources/store.rb', line 48

def batch_delete(**params) # rubocop:disable Naming/PredicateMethod
  body = compact_params(params)
  @client.delete('/store/batch', body)
  true
end

#batch_get(**params) ⇒ Object



36
37
38
39
40
# File 'lib/langgraph_platform/resources/store.rb', line 36

def batch_get(**params)
  body = compact_params(params)
  response = @client.post('/store/batch', body)
  response.map { |item_data| Models::StoreItem.new(item_data) }
end

#batch_put(**params) ⇒ Object



42
43
44
45
46
# File 'lib/langgraph_platform/resources/store.rb', line 42

def batch_put(**params)
  body = compact_params(params)
  response = @client.put('/store/batch', body)
  response.map { |item_data| Models::StoreItem.new(item_data) }
end

#delete(namespace, key) ⇒ Object

rubocop:disable Naming/PredicateMethod



15
16
17
18
# File 'lib/langgraph_platform/resources/store.rb', line 15

def delete(namespace, key) # rubocop:disable Naming/PredicateMethod
  @client.delete("/store/#{namespace}/#{key}")
  true
end

#get(namespace, key) ⇒ Object



4
5
6
7
# File 'lib/langgraph_platform/resources/store.rb', line 4

def get(namespace, key)
  response = @client.get("/store/#{namespace}/#{key}")
  Models::StoreItem.new(response)
end

#list(namespace, **params) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/langgraph_platform/resources/store.rb', line 20

def list(namespace, **params)
  params[:limit] ||= 10
  params[:offset] ||= 0
  query_params = compact_params(params)
  response = @client.get("/store/#{namespace}", query_params)
  response.map { |item_data| Models::StoreItem.new(item_data) }
end

#put(namespace, key, **params) ⇒ Object



9
10
11
12
13
# File 'lib/langgraph_platform/resources/store.rb', line 9

def put(namespace, key, **params)
  body = compact_params(params)
  response = @client.put("/store/#{namespace}/#{key}", body)
  Models::StoreItem.new(response)
end

#search(**params) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/langgraph_platform/resources/store.rb', line 28

def search(**params)
  params[:limit] ||= 10
  params[:offset] ||= 0
  body = compact_params(params)
  response = @client.post('/store/search', body)
  response.map { |item_data| Models::StoreItem.new(item_data) }
end