using System;
using Grpc.Core;
using WebhookApi.V1;
namespace main
{
class Program
{
static void Main(string[] args)
{
Channel channel = new Channel("YOUR_WEBHOOK_URL:443", ChannelCredentials.Insecure);
var client = new WebhookManagerService.WebhookManagerServiceClient(channel);
var headers = new Metadata();
var createWebhookRequest = new CreateWebhookRequest{
ApiKey = "API_KEY",
DeliveryMethod = DeliveryMethodType.Delivery_method_type_unspecified,
Name = "NAME",
WebhookUrl = "WEBHOOK_URL",
SupportedEvents = {EventType.Event_type_unspecified, EventType.Event_type_wallet_created, EventType.Event_type_promissory_received},
};
var reply = client.CreateWebhook(createWebhookRequest, headers);
Console.WriteLine("Response: " + reply);
channel.ShutdownAsync().Wait();
}
}
}
extern crate grpc-sdks;
use tonic::transport::Channel;
use grpc-sdks::webhook_api::v1::CreateWebhookRequest;
use grpc-sdks::webhook_api::v1::webhook_manager_service_client::WebhookManagerServiceClient;
use grpc-sdks::webhook_api::v1::DeliveryMethodType;
use grpc-sdks::webhook_api::v1::EventType;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let channel = Channel::from_static("YOUR_WEBHOOK_URL")
.connect()
.await?;
let mut client = WebhookManagerServiceClient::new(channel);
let request = tonic::Request::new(
CreateWebhookRequest{
api_key: String::from("API_KEY"),
delivery_method: DeliveryMethodType::DeliveryMethodTypeUnspecified as i32,
name: String::from("NAME"),
supported_events: Vec::from([EventType::EventTypeUnspecified as i32, EventType::EventTypeWalletCreated as i32, EventType::EventTypePromissoryReceived as i32]),
webhook_url: String::from("WEBHOOK_URL")
});
// sending request and waiting for response
let response = client.create_webhook(request).await?.into_inner();
println!("RESPONSE={:?}", response);
Ok(())
}
package app
import io.grpc.ManagedChannelBuilder
import webhook_api.v1.Webhook.CreateWebhookRequest
import webhook_api.v1.Webhook.CreateWebhookResponse
import webhook_api.v1.Webhook.DeliveryMethodType
import webhook_api.v1.Webhook.EventType
import webhook_api.v1.WebhookManagerServiceGrpc
fun main() {
val channel = ManagedChannelBuilder
.forAddress("YOUR_WEBHOOK_URL", 443)
.usePlaintext()
.build()
var blockStub = WebhookManagerServiceGrpc.newBlockingStub(channel)
val req_CreateWebhookRequest = CreateWebhookRequest.newBuilder()
.setApiKey("API_KEY")
.setDeliveryMethod(DeliveryMethodType.DELIVERY_METHOD_TYPE_UNSPECIFIED)
.setName("NAME")
.setWebhookUrl("WEBHOOK_URL")
.addSupportedEvents(EventType.EVENT_TYPE_UNSPECIFIED)
.addSupportedEvents(EventType.EVENT_TYPE_WALLET_CREATED)
.addSupportedEvents(EventType.EVENT_TYPE_PROMISSORY_RECEIVED)
.build()
val resp = blockStub.createWebhook(req_CreateWebhookRequest)
println(resp)
channel.shutdown()
}