Sha256: 34a40d0fd1d910a782ce70a0e57c0e73258347614f439f8b10ba7c6338e4fb6f

Contents?: true

Size: 1.77 KB

Versions: 19

Compression:

Stored size: 1.77 KB

Contents

# frozen_string_literal: true

class Gitlab::Client
  # Defines methods related to issue links.
  # @see https://docs.gitlab.com/ee/api/issue_links.html
  module IssueLinks
    # Gets a list of links for a issue.
    #
    # @example
    #   Gitlab.issue_links(5, 10)
    #
    # @param [Integer] project The ID of a project.
    # @param [Integer] issue The ID of an issue.
    # @option options [Integer] :page The page number.
    # @option options [Integer] :per_page The number of results per page.
    # @return [Array<Gitlab::ObjectifiedHash>]
    def issue_links(project, issue, options = {})
      get("/projects/#{url_encode project}/issues/#{issue}/links", query: options)
    end

    # Creates a new issue link.
    #
    # @example
    #   Gitlab.create_issue_link(6, 1, 6, 2)
    #
    # @param  [Integer, String] project The ID or name of a project.
    # @param  [Integer] issue The ID of an issue.
    # @param  [Integer] target_project_id Project ID the target issue is located in.
    # @param  [Integer] target_issue_iid The ID of the target issue.
    # @return [Gitlab::ObjectifiedHash] Information about created link.
    def create_issue_link(project, issue, target_project_id, target_issue_iid)
      post("/projects/#{url_encode project}/issues/#{issue}/links", body: { target_project_id: target_project_id, target_issue_iid: target_issue_iid })
    end

    # Deletes an issue link.
    #
    # @example
    #   Gitlab.delete_issue_link(5, 10, 123)
    #
    # @param [Integer] project The ID of a project.
    # @param [Integer] issue The ID of an issue.
    # @param [Integer] id The ID of a link.
    # @return [Gitlab::ObjectifiedHash]
    def delete_issue_link(project, issue, id)
      delete("/projects/#{url_encode project}/issues/#{issue}/links/#{id}")
    end
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
gitlab-5.1.0 lib/gitlab/client/issue_links.rb
gitlab-5.0.0 lib/gitlab/client/issue_links.rb
gitlab-4.20.1 lib/gitlab/client/issue_links.rb
gitlab-4.20.0 lib/gitlab/client/issue_links.rb
fs-gitlab-4.19.3 lib/gitlab/client/issue_links.rb
fs-gitlab-4.19.2 lib/gitlab/client/issue_links.rb
fs-gitlab-4.19.1 lib/gitlab/client/issue_links.rb
gitlab-4.19.0 lib/gitlab/client/issue_links.rb
fs-gitlab-4.18.2 lib/gitlab/client/issue_links.rb
fs-gitlab-4.18.1 lib/gitlab/client/issue_links.rb
gitlab-4.18.0 lib/gitlab/client/issue_links.rb
gitlab-4.17.0 lib/gitlab/client/issue_links.rb
gitlab-4.16.1 lib/gitlab/client/issue_links.rb
gitlab-4.16.0 lib/gitlab/client/issue_links.rb
gitlab-4.15.0 lib/gitlab/client/issue_links.rb
gitlab-4.14.1 lib/gitlab/client/issue_links.rb
gitlab-4.14.0 lib/gitlab/client/issue_links.rb
gitlab-4.13.1 lib/gitlab/client/issue_links.rb
gitlab-4.13.0 lib/gitlab/client/issue_links.rb