Welcome to mirror list, hosted at ThFree Co, Russian Federation.

import_github_helpers.rb « helpers « api « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1634e064d73ac9d564e61d4140f7810354219a46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# frozen_string_literal: true

module API
  module Helpers
    module ImportGithubHelpers
      def client
        @client ||= Gitlab::GithubImport::Client.new(params[:personal_access_token], host: params[:github_hostname])
      end

      def access_params
        {
          github_access_token: params[:personal_access_token],
          additional_access_tokens: params[:additional_access_tokens]
        }
      end

      def provider
        :github
      end

      def provider_unauthorized
        error!("Access denied to your #{Gitlab::ImportSources.title(provider.to_s)} account.", 401)
      end

      def too_many_requests
        error!('Too Many Requests', 429)
      end
    end
  end
end