Sha256: 4d2c6adab3ed4f0e7b5307d1147424fc29269e0a7073c998628c0e48e6025364
Contents?: true
Size: 1.89 KB
Versions: 1
Compression:
Stored size: 1.89 KB
Contents
# frozen_string_literal: true class Gitlab::Client # Defines methods related to project access tokens. # @see https://docs.gitlab.com/ee/api/project_access_tokens.html module ProjectAccessTokens # Gets a list of a projects access tokens. # # @example # Gitlab.project_access_tokens(5) # # @param [Integer, String] project The ID or name of a project. # @return [Array<Gitlab::ObjectifiedHash>] List of all access tokens of a project def project_access_tokens(project) get("/projects/#{url_encode project}/access_tokens") end # Gets an access token of a project. # # @example # Gitlab.project_access_token(5, 42) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] token_id The token ID. # @return [Gitlab::ObjectifiedHash] Information about the requested access token def project_access_token(project, token_id) get("/projects/#{url_encode project}/access_tokens/#{token_id}") end # Create a project access token. # # @example # Gitlab.create_project_access_token(5, { name: "test_token", scopes: ["api", "read_repository"], expires_at: "2021-01-01"}) # # @param [Integer, String] project The ID or name of a project. # @param [Hash] options A customizable set of options. # @option options [String] :name(required) Name of the token # @option options [List[String]] :scopes(required) List of api scopes # @option options [String] :expires_at(required) Expiration date in the format (YYYY-MM-DD) # @option options [String] :access_level(optional) Access level of the token (Defaults to 40 (maintainer access)) # @return [Gitlab::ObjectifiedHash] Information about the created project access token. def create_project_access_token(project, options = {}) post("/projects/#{url_encode project}/access_tokens", body: options) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fs-gitlab-4.19.3 | lib/gitlab/client/project_access_tokens.rb |