summaryrefslogtreecommitdiff
path: root/app/graphql/types/snippets/blob_type.rb
blob: feff5d208745ca67606d17e799e923732301c805 (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
# 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',
            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
    end
    # rubocop: enable Graphql/AuthorizeTypes
  end
end