Copy
grpcurl \
-d '
{
"id": {
"value": "my_unique_subscription_id_here",
"tenant": {
"name": "my_tenant_name_here"
}
},
"productId": "my_product_id_here"
}' \
sandbox.api.shamrock.wgtwo.com:443 \
wgtwo.consents.v0.ConsentService/CreateConsentForSubscription
Copy
package com.example.consents
import com.wgtwo.api.v0.common.TypesProto
import com.wgtwo.api.v0.consent.ConsentServiceGrpc
import com.wgtwo.api.v0.consent.ConsentsProto.CreateConsentForSubscriptionRequest
import io.grpc.ManagedChannelBuilder
private val channel = ManagedChannelBuilder.forTarget("sandbox.api.shamrock.wgtwo.com:443").build()
private val stub = ConsentServiceGrpc.newBlockingStub(channel)
fun main(vararg args: String) {
val subscriptionId = "my_unique_subscription_id_here"
val tenant = "my_tenant_name_here"
val productId = "my_product_id"
val request = CreateConsentForSubscriptionRequest.newBuilder().apply {
this.id = TypesProto.SubscriptionIdentifier.newBuilder().apply {
this.value = subscriptionId
this.tenant = TypesProto.Tenant.newBuilder().apply {
this.name = tenant
}.build()
}.build()
this.productId = productId
}.build()
println("Request:
$request")
val response = stub.createConsentForSubscription(request)
println("Response:
$response")
channel.shutdownNow()
}