2019-12-04 20:38:33 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Resolvers
|
|
|
|
class EchoResolver < BaseResolver
|
2021-01-29 00:20:46 +05:30
|
|
|
type ::GraphQL::STRING_TYPE, null: false
|
2019-12-04 20:38:33 +05:30
|
|
|
description 'Testing endpoint to validate the API with'
|
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
argument :text, GraphQL::STRING_TYPE, required: true,
|
|
|
|
description: 'Text to echo back'
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
def resolve(text:)
|
|
|
|
username = current_user&.username
|
2019-12-04 20:38:33 +05:30
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
"#{username.inspect} says: #{text}"
|
2019-12-04 20:38:33 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|