Module: BacklogKit::Client::Wiki

Included in:
BacklogKit::Client
Defined in:
lib/backlog_kit/client/wiki.rb

Overview

Methods for the Wiki API

Instance Method Summary collapse

Instance Method Details

#create_wiki(name, content, project_id, params = {}) ⇒ BacklogKit::Response

Create a new wiki page

Parameters:

  • name (String)

    Name of the page

  • content (String)

    Content of the page

  • project_id (Integer, String)

    Project id

  • params (Hash) (defaults to: {})

    Request parameters

Returns:



44
45
46
47
# File 'lib/backlog_kit/client/wiki.rb', line 44

def create_wiki(name, content, project_id, params = {})
  params.merge!(name: name, content: content, project_id: project_id)
  post('wikis', params)
end

#delete_wiki(wiki_id, params = {}) ⇒ BacklogKit::Response

Delete a wiki page

Parameters:

  • wiki_id (Integer, String)

    Wiki page id

  • params (Hash) (defaults to: {})

    Request parameters

Returns:



63
64
65
# File 'lib/backlog_kit/client/wiki.rb', line 63

def delete_wiki(wiki_id, params = {})
  delete("wikis/#{wiki_id}", params)
end

#get_wiki(wiki_id) ⇒ BacklogKit::Response

Get a wiki page

Parameters:

  • wiki_id (Integer, String)

    Wiki page id

Returns:



25
26
27
# File 'lib/backlog_kit/client/wiki.rb', line 25

def get_wiki(wiki_id)
  get("wikis/#{wiki_id}")
end

#get_wiki_count(project_id_or_key) ⇒ BacklogKit::Response

Get number of wiki pages

Parameters:

  • project_id_or_key (Integer, String)

    Project id or project key

Returns:



17
18
19
# File 'lib/backlog_kit/client/wiki.rb', line 17

def get_wiki_count(project_id_or_key)
  get('wikis/count', project_id_or_key: project_id_or_key)
end

#get_wiki_histories(wiki_id, params = {}) ⇒ BacklogKit::Response

Get list of wiki histories

Parameters:

  • wiki_id (Integer, String)

    Wiki page id

  • params (Hash) (defaults to: {})

    Request parameters

Returns:



98
99
100
# File 'lib/backlog_kit/client/wiki.rb', line 98

def get_wiki_histories(wiki_id, params = {})
  get("wikis/#{wiki_id}/history", params)
end

#get_wiki_shared_files(wiki_id) ⇒ BacklogKit::Response

Get list of shared files on wiki

Parameters:

  • wiki_id (Integer, String)

    Wiki page id

Returns:



71
72
73
# File 'lib/backlog_kit/client/wiki.rb', line 71

def get_wiki_shared_files(wiki_id)
  get("wikis/#{wiki_id}/sharedFiles")
end

#get_wiki_stars(wiki_id) ⇒ BacklogKit::Response

Get list of wiki stars

Parameters:

  • wiki_id (Integer, String)

    Wiki page id

Returns:



106
107
108
# File 'lib/backlog_kit/client/wiki.rb', line 106

def get_wiki_stars(wiki_id)
  get("wikis/#{wiki_id}/stars")
end

#get_wiki_tags(project_id_or_key) ⇒ BacklogKit::Response

Get list of wiki page tags

Parameters:

  • project_id_or_key (Integer, String)

    Project id or project key

Returns:



33
34
35
# File 'lib/backlog_kit/client/wiki.rb', line 33

def get_wiki_tags(project_id_or_key)
  get('wikis/tags', project_id_or_key: project_id_or_key)
end

#get_wikis(project_id_or_key) ⇒ BacklogKit::Response

Get list of wiki pages

Parameters:

  • project_id_or_key (Integer, String)

    Project id or project key

Returns:



9
10
11
# File 'lib/backlog_kit/client/wiki.rb', line 9

def get_wikis(project_id_or_key)
  get('wikis', project_id_or_key: project_id_or_key)
end

Link shared files to wiki

Parameters:

  • wiki_id (Integer, String)

    Wiki page id

  • file_ids (Array) (defaults to: [])

    List of file ids

Returns:



80
81
82
# File 'lib/backlog_kit/client/wiki.rb', line 80

def link_wiki_shared_files(wiki_id, file_ids = [])
  post("wikis/#{wiki_id}/sharedFiles", file_id: file_ids)
end

Unlink a shared file on wiki

Parameters:

  • wiki_id (Integer, String)

    Wiki page id

  • file_id (Integer, String)

    Shared file id

Returns:



89
90
91
# File 'lib/backlog_kit/client/wiki.rb', line 89

def unlink_wiki_shared_file(wiki_id, file_id)
  delete("wikis/#{wiki_id}/sharedFiles/#{file_id}")
end

#update_wiki(wiki_id, params = {}) ⇒ BacklogKit::Response

Update a wiki page

Parameters:

  • wiki_id (Integer, String)

    Wiki page id

  • params (Hash) (defaults to: {})

    Request parameters

Returns:



54
55
56
# File 'lib/backlog_kit/client/wiki.rb', line 54

def update_wiki(wiki_id, params = {})
  patch("wikis/#{wiki_id}", params)
end