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