2019-08-26 17:43:38 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Resolvers
|
|
|
|
class EchoResolver < BaseResolver
|
2020-10-30 12:08:44 +00:00
|
|
|
type ::GraphQL::STRING_TYPE, null: false
|
2019-08-26 17:43:38 +00:00
|
|
|
description 'Testing endpoint to validate the API with'
|
|
|
|
|
2021-03-30 18:10:47 +00:00
|
|
|
argument :text,
|
|
|
|
type: GraphQL::STRING_TYPE,
|
|
|
|
required: true,
|
|
|
|
description: 'Text to echo back.'
|
2019-12-16 00:07:33 +00:00
|
|
|
|
2020-10-30 12:08:44 +00:00
|
|
|
def resolve(text:)
|
|
|
|
username = current_user&.username
|
2019-08-26 17:43:38 +00:00
|
|
|
|
2020-10-30 12:08:44 +00:00
|
|
|
"#{username.inspect} says: #{text}"
|
2019-08-26 17:43:38 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|