2020-01-22 12:08:40 +00:00
|
|
|
# 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
|
|
|
|
|
2020-02-12 18:09:21 +00:00
|
|
|
field :rich_data, GraphQL::STRING_TYPE,
|
2021-02-05 15:09:28 +00:00
|
|
|
description: 'Blob highlighted data.',
|
2020-01-22 12:08:40 +00:00
|
|
|
null: true
|
|
|
|
|
2020-02-12 18:09:21 +00:00
|
|
|
field :plain_data, GraphQL::STRING_TYPE,
|
2021-02-05 15:09:28 +00:00
|
|
|
description: 'Blob plain highlighted data.',
|
2020-05-04 18:10:20 +00:00
|
|
|
calls_gitaly: true,
|
2020-02-11 18:08:58 +00:00
|
|
|
null: true
|
|
|
|
|
2020-01-22 12:08:40 +00:00
|
|
|
field :raw_path, GraphQL::STRING_TYPE,
|
2021-02-05 15:09:28 +00:00
|
|
|
description: 'Blob raw content endpoint path.',
|
2020-01-22 12:08:40 +00:00
|
|
|
null: false
|
|
|
|
|
|
|
|
field :size, GraphQL::INT_TYPE,
|
2021-02-05 15:09:28 +00:00
|
|
|
description: 'Blob size.',
|
2020-01-22 12:08:40 +00:00
|
|
|
null: false
|
|
|
|
|
|
|
|
field :binary, GraphQL::BOOLEAN_TYPE,
|
2021-02-05 15:09:28 +00:00
|
|
|
description: 'Shows whether the blob is binary.',
|
2020-01-22 12:08:40 +00:00
|
|
|
method: :binary?,
|
|
|
|
null: false
|
|
|
|
|
|
|
|
field :name, GraphQL::STRING_TYPE,
|
2021-02-05 15:09:28 +00:00
|
|
|
description: 'Blob name.',
|
2020-01-22 12:08:40 +00:00
|
|
|
null: true
|
|
|
|
|
|
|
|
field :path, GraphQL::STRING_TYPE,
|
2021-02-05 15:09:28 +00:00
|
|
|
description: 'Blob path.',
|
2020-01-22 12:08:40 +00:00
|
|
|
null: true
|
|
|
|
|
|
|
|
field :simple_viewer, type: Types::Snippets::BlobViewerType,
|
2021-02-05 15:09:28 +00:00
|
|
|
description: 'Blob content simple viewer.',
|
2020-01-22 12:08:40 +00:00
|
|
|
null: false
|
|
|
|
|
|
|
|
field :rich_viewer, type: Types::Snippets::BlobViewerType,
|
2021-02-05 15:09:28 +00:00
|
|
|
description: 'Blob content rich viewer.',
|
2020-01-22 12:08:40 +00:00
|
|
|
null: true
|
2020-02-03 18:08:46 +00:00
|
|
|
|
|
|
|
field :mode, type: GraphQL::STRING_TYPE,
|
2021-02-05 15:09:28 +00:00
|
|
|
description: 'Blob mode.',
|
2020-02-03 18:08:46 +00:00
|
|
|
null: true
|
2020-05-13 09:08:37 +00:00
|
|
|
|
|
|
|
field :external_storage, type: GraphQL::STRING_TYPE,
|
2021-02-05 15:09:28 +00:00
|
|
|
description: 'Blob external storage.',
|
2020-05-13 09:08:37 +00:00
|
|
|
null: true
|
|
|
|
|
|
|
|
field :rendered_as_text, type: GraphQL::BOOLEAN_TYPE,
|
2021-02-05 15:09:28 +00:00
|
|
|
description: 'Shows whether the blob is rendered as text.',
|
2020-05-13 09:08:37 +00:00
|
|
|
method: :rendered_as_text?,
|
|
|
|
null: false
|
2020-01-22 12:08:40 +00:00
|
|
|
end
|
|
|
|
# rubocop: enable Graphql/AuthorizeTypes
|
|
|
|
end
|
|
|
|
end
|