diff options
Diffstat (limited to 'app/graphql/types/repository/blob_type.rb')
-rw-r--r-- | app/graphql/types/repository/blob_type.rb | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/app/graphql/types/repository/blob_type.rb b/app/graphql/types/repository/blob_type.rb index 912fc5f643a..8ed97d7e663 100644 --- a/app/graphql/types/repository/blob_type.rb +++ b/app/graphql/types/repository/blob_type.rb @@ -32,6 +32,66 @@ module Types field :web_path, GraphQL::STRING_TYPE, null: true, description: 'Web path of the blob.' + field :ide_edit_path, GraphQL::STRING_TYPE, null: true, + description: 'Web path to edit this blob in the Web IDE.' + + field :fork_and_edit_path, GraphQL::STRING_TYPE, null: true, + description: 'Web path to edit this blob using a forked project.' + + field :ide_fork_and_edit_path, GraphQL::STRING_TYPE, null: true, + description: 'Web path to edit this blob in the Web IDE using a forked project.' + + field :size, GraphQL::INT_TYPE, null: true, + description: 'Size (in bytes) of the blob.' + + field :raw_size, GraphQL::INT_TYPE, null: true, + description: 'Size (in bytes) of the blob, or the blob target if stored externally.' + + field :raw_blob, GraphQL::STRING_TYPE, null: true, method: :data, + description: 'The raw content of the blob.' + + field :raw_text_blob, GraphQL::STRING_TYPE, null: true, method: :text_only_data, + description: 'The raw content of the blob, if the blob is text data.' + + field :stored_externally, GraphQL::BOOLEAN_TYPE, null: true, method: :stored_externally?, + description: "Whether the blob's content is stored externally (for instance, in LFS)." + + field :edit_blob_path, GraphQL::STRING_TYPE, null: true, + description: 'Web path to edit the blob in the old-style editor.' + + field :raw_path, GraphQL::STRING_TYPE, null: true, + description: 'Web path to download the raw blob.' + + field :external_storage_url, GraphQL::STRING_TYPE, null: true, + description: 'Web path to download the raw blob via external storage, if enabled.' + + field :replace_path, GraphQL::STRING_TYPE, null: true, + description: 'Web path to replace the blob content.' + + field :file_type, GraphQL::STRING_TYPE, null: true, + description: 'The expected format of the blob based on the extension.' + + field :simple_viewer, type: Types::BlobViewerType, + description: 'Blob content simple viewer.', + null: false + + field :rich_viewer, type: Types::BlobViewerType, + description: 'Blob content rich viewer.', + null: true + + field :plain_data, GraphQL::STRING_TYPE, + description: 'Blob plain highlighted data.', + null: true, + calls_gitaly: true + + field :can_modify_blob, GraphQL::BOOLEAN_TYPE, null: true, method: :can_modify_blob?, + calls_gitaly: true, + description: 'Whether the current user can modify the blob.' + + def raw_text_blob + object.data unless object.binary? + end + def lfs_oid Gitlab::Graphql::Loaders::BatchLfsOidLoader.new(object.repository, object.id).find end |