2021-04-12 14:12:15 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Resolvers
|
|
|
|
class RepositoryBranchNamesResolver < BaseResolver
|
2021-07-22 08:10:04 -04:00
|
|
|
type ::GraphQL::Types::String, null: false
|
2021-04-12 14:12:15 -04:00
|
|
|
|
|
|
|
calls_gitaly!
|
|
|
|
|
2021-07-22 08:10:04 -04:00
|
|
|
argument :search_pattern, GraphQL::Types::String,
|
2021-04-12 14:12:15 -04:00
|
|
|
required: true,
|
2021-08-19 14:10:32 -04:00
|
|
|
description: 'Pattern to search for branch names by.'
|
2021-04-12 14:12:15 -04:00
|
|
|
|
2021-07-22 08:10:04 -04:00
|
|
|
argument :offset, GraphQL::Types::Int,
|
2021-05-07 14:10:21 -04:00
|
|
|
required: true,
|
2021-08-19 14:10:32 -04:00
|
|
|
description: 'Number of branch names to skip.'
|
2021-05-07 14:10:21 -04:00
|
|
|
|
2021-07-22 08:10:04 -04:00
|
|
|
argument :limit, GraphQL::Types::Int,
|
2021-05-07 14:10:21 -04:00
|
|
|
required: true,
|
2021-08-19 14:10:32 -04:00
|
|
|
description: 'Number of branch names to return.'
|
2021-05-07 14:10:21 -04:00
|
|
|
|
|
|
|
def resolve(search_pattern:, offset:, limit:)
|
|
|
|
Repositories::BranchNamesFinder.new(object, offset: offset, limit: limit, search: search_pattern).execute
|
2021-04-12 14:12:15 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|