val response = client.newCall(request) .execute() .process<@FirstElementSet >,RestApiError.General>(moshi) { isSuccessful } fun Response.process( moshi: Moshi, predicate: Response.() -> Boolean ): R { val annotation = `How to get the @FirstElement annotation on the argument 'R'` return if (predicate()) processResponse(typeInfo(), moshi) else processError(moshi) }