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

personal_access_token.rb « entities « api « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3ec91ca5fc96dfb35dab1485928334dfb96064e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

module API
  module Entities
    class PersonalAccessToken < Grape::Entity
      expose :id, documentation: { type: 'integer', example: 2 }
      expose :name, documentation: { type: 'string', example: 'John Doe' }
      expose :revoked, documentation: { type: 'boolean' }
      expose :created_at, documentation: { type: 'dateTime' }
      expose :scopes, documentation: { type: 'array', example: ['api'] }
      expose :user_id, documentation: { type: 'integer', example: 3 }
      expose :last_used_at, documentation: { type: 'dateTime', example: '2020-08-31T15:53:00.073Z' }
      expose :active?, as: :active, documentation: { type: 'boolean' }
      expose :expires_at, documentation:
        { type: 'dateTime', example: '2020-08-31T15:53:00.073Z' } do |personal_access_token|
        personal_access_token.expires_at ? personal_access_token.expires_at.strftime("%Y-%m-%d") : nil
      end
    end
  end
end