Class: Slk::Api::Saved

Inherits:
Object
  • Object
show all
Defined in:
lib/slk/api/saved.rb

Overview

Thin wrapper for the Slack saved.list API endpoint Used to fetch “Save for Later” items

Instance Method Summary collapse

Constructor Details

#initialize(api_client, workspace) ⇒ Saved

Returns a new instance of Saved.



8
9
10
11
# File 'lib/slk/api/saved.rb', line 8

def initialize(api_client, workspace)
  @api = api_client
  @workspace = workspace
end

Instance Method Details

#list(filter: 'saved', limit: 15, cursor: nil) ⇒ Hash

List saved items

Parameters:

  • filter (String) (defaults to: 'saved')

    Filter type: ‘saved’, ‘in_progress’, ‘completed’, ‘archived’

  • limit (Integer) (defaults to: 15)

    Number of items to return (default: 15)

  • cursor (String, nil) (defaults to: nil)

    Pagination cursor

Returns:

  • (Hash)

    API response with ‘ok’ and ‘saved_items’ keys

Raises:

  • (ApiError)

    if the API call fails (network error, auth error, etc.)



19
20
21
22
23
# File 'lib/slk/api/saved.rb', line 19

def list(filter: 'saved', limit: 15, cursor: nil)
  params = { filter: filter, limit: limit.to_s }
  params[:cursor] = cursor if cursor
  @api.post_form(@workspace, 'saved.list', params)
end