debian-mirror-gitlab/lib/api/helpers/graphql_helpers.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
584 B
Ruby
Raw Normal View History

2019-07-07 11:18:12 +05:30
# frozen_string_literal: true
module API
module Helpers
# GraphqlHelpers is used by the REST API when it is acting like a client
# against the graphql API. Helper code for the graphql server implementation
# should be in app/graphql/ or lib/gitlab/graphql/
module GraphqlHelpers
2021-04-29 21:17:54 +05:30
def run_graphql!(query:, context: {}, variables: nil, transform: nil)
result = GitlabSchema.execute(query, variables: variables, context: context)
2019-07-07 11:18:12 +05:30
if transform
transform.call(result)
else
result
end
end
end
end
end