Class: Hivehook::Resources::BookmarkService

Inherits:
BaseService
  • Object
show all
Defined in:
lib/hivehook/resources/bookmark_service.rb

Constant Summary collapse

FRAGMENT =
"id eventId name notes createdAt"

Instance Method Summary collapse

Methods inherited from BaseService

#initialize

Constructor Details

This class inherits a constructor from Hivehook::Resources::BaseService

Instance Method Details

#create(input) ⇒ Object



18
19
20
21
# File 'lib/hivehook/resources/bookmark_service.rb', line 18

def create(input)
  query = "mutation($input: CreateBookmarkInput!) { createBookmark(input: $input) { #{FRAGMENT} } }"
  @transport.execute(query, { "input" => input })["createBookmark"]
end

#delete(id) ⇒ Object



23
24
25
26
# File 'lib/hivehook/resources/bookmark_service.rb', line 23

def delete(id)
  query = "mutation($id: UUID!) { deleteBookmark(id: $id) }"
  @transport.execute(query, { "id" => id })["deleteBookmark"]
end

#list(options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/hivehook/resources/bookmark_service.rb', line 8

def list(options = {})
  query = "query($eventId: UUID, $search: String, $limit: Int, $offset: Int, $after: String, $first: Int) {
    bookmarks(eventId: $eventId, search: $search, limit: $limit, offset: $offset, after: $after, first: $first) {
      nodes { #{FRAGMENT} }
      pageInfo { total limit offset endCursor hasNextPage }
    }
  }"
  @transport.execute(query, build_variables(options, %w[eventId search limit offset after first]))["bookmarks"]
end