Gemini/GeminiIntents/GetBodyIntentHandler.swift

23 lines
622 B
Swift

//
// GetBodyIntenHandler.swift
// GeminiIntents
//
// Created by Shadowfacts on 10/1/21.
//
import Intents
class GetBodyIntentHandler: NSObject, GetBodyIntentHandling {
func handle(intent: GetBodyIntent, completion: @escaping (GetBodyIntentResponse) -> Void) {
guard let response = intent.response else {
completion(GetBodyIntentResponse(code: .failure, userActivity: nil))
return
}
let intentResp = GetBodyIntentResponse(code: .success, userActivity: nil)
intentResp.text = response.body
completion(intentResp)
}
}