summaryrefslogtreecommitdiff
path: root/app/graphql/types/snippets/blob_type.rb
blob: dcde1e5a73bfe37d3391a300011f65c06cebb89d (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# frozen_string_literal: true

module Types
  module Snippets
    # rubocop: disable Graphql/AuthorizeTypes
    class BlobType < BaseObject
      graphql_name 'SnippetBlob'
      description 'Represents the snippet blob'
      present_using SnippetBlobPresenter

      field :rich_data, GraphQL::STRING_TYPE,
            description: 'Blob highlighted data',
            null: true

      field :plain_data, GraphQL::STRING_TYPE,
            description: 'Blob plain highlighted data',
            calls_gitaly: true,
            null: true

      field :raw_path, GraphQL::STRING_TYPE,
            description: 'Blob raw content endpoint path',
            null: false

      field :size, GraphQL::INT_TYPE,
            description: 'Blob size',
            null: false

      field :binary, GraphQL::BOOLEAN_TYPE,
            description: 'Shows whether the blob is binary',
            method: :binary?,
            null: false

      field :name, GraphQL::STRING_TYPE,
            description: 'Blob name',
            null: true

      field :path, GraphQL::STRING_TYPE,
            description: 'Blob path',
            null: true

      field :simple_viewer, type: Types::Snippets::BlobViewerType,
            description: 'Blob content simple viewer',
            null: false

      field :rich_viewer, type: Types::Snippets::BlobViewerType,
            description: 'Blob content rich viewer',
            null: true

      field :mode, type: GraphQL::STRING_TYPE,
            description: 'Blob mode',
            null: true

      field :external_storage, type: GraphQL::STRING_TYPE,
            description: 'Blob external storage',
            null: true

      field :rendered_as_text, type: GraphQL::BOOLEAN_TYPE,
            description: 'Shows whether the blob is rendered as text',
            method: :rendered_as_text?,
            null: false
    end
    # rubocop: enable Graphql/AuthorizeTypes
  end
end