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

job_artifact_type.rb « ci « types « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2280fcd137065661b70ef77c26caf4c531563f1e (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
31
32
33
34
35
36
37
# frozen_string_literal: true

module Types
  module Ci
    # rubocop: disable Graphql/AuthorizeTypes
    class JobArtifactType < BaseObject
      graphql_name 'CiJobArtifact'

      field :id, Types::GlobalIDType[::Ci::JobArtifact], null: false,
                                                         description: 'ID of the artifact.'

      field :download_path, GraphQL::Types::String, null: true,
                                                    description: "URL for downloading the artifact's file."

      field :file_type, ::Types::Ci::JobArtifactFileTypeEnum, null: true,
                                                              description: 'File type of the artifact.'

      field :name, GraphQL::Types::String, null: true,
                                           description: 'File name of the artifact.',
                                           method: :filename

      field :size, GraphQL::Types::BigInt, null: false,
                                        description: 'Size of the artifact in bytes.'

      field :expire_at, Types::TimeType, null: true,
                                         description: 'Expiry date of the artifact.'

      def download_path
        ::Gitlab::Routing.url_helpers.download_project_job_artifacts_path(
          object.project,
          object.job,
          file_type: object.file_type
        )
      end
    end
  end
end