CreatePrevalidation

Create Prevalidation

rpc CreatePrevalidation

webhook_api.v1.CreatePrevalidation

Create Prevalidation

requests CreatePrevalidationRequest

webhook_api.v1.CreatePrevalidationRequest

FieldTypeDescription
api_keystringAPI Key as a JWT
namestringName of the prevalidation.
trigger_typePrevalidationTriggerType enum
FieldNumberDescription
PREVALIDATION_TRIGGER_UNSPECIFIED0Type of trigger for the prevalidation.Prevalidation Trigger Unspecified.
PREVALIDATION_TRIGGER_CONSIDERING_CONTRACT1Type of trigger for the prevalidation.Prevalidation Trigger Considering Contract.
triggeroneof
FieldTypeDescription
considering_contract_prevalidationConsideringContractPrevalidation
resp, _ := webhookManagerService.CreatePrevalidation(ctx, &v1.CreatePrevalidationRequest{
  ApiKey: "API_KEY",
  Name: "NAME",
  TriggerType: 1,
  Trigger: &v1.CreatePrevalidationRequest_ConsideringContractPrevalidation{
    ConsideringContractPrevalidation:&v1.ConsideringContractPrevalidation{},
  },
})
fmt.Println(resp)
const consideringcontractprevalidation = new ConsideringContractPrevalidation();
const createprevalidationrequest = new CreatePrevalidationRequest();
createprevalidationrequest.setApiKey("API_KEY");
createprevalidationrequest.setName("NAME");
createprevalidationrequest.setTriggerType(1);
createprevalidationrequest.setConsideringContractPrevalidation(consideringcontractprevalidation);

service.createPrevalidation(createprevalidationrequest, (err, value:CreatePrevalidationResponse|null) => {
    const resp = JSON.stringify(err ? err : value);
    console.log("received ", resp);
})
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 consideringContractPrevalidation = new ConsideringContractPrevalidation{};
      var createPrevalidationRequest = new CreatePrevalidationRequest{
        ApiKey = "API_KEY",
        Name = "NAME",
        TriggerType = 1,
        ConsideringContractPrevalidation = consideringContractPrevalidation,
      };
      var reply = client.CreatePrevalidation(createPrevalidationRequest, headers);
      Console.WriteLine("Response: " + reply);
      channel.ShutdownAsync().Wait();
    }
  }
}
package demo;

import io.grpc.Channel;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import webhook_api.v1.Webhook.ConsideringContractPrevalidation;
import webhook_api.v1.Webhook.CreatePrevalidationRequest;
import webhook_api.v1.Webhook.CreatePrevalidationResponse;
import webhook_api.v1.WebhookManagerServiceGrpc;

public class App {
  public static void main(String[] args) {
    ManagedChannel channel = ManagedChannelBuilder
      .forAddress("YOUR_WEBHOOK_URL", 443)
      .usePlaintext()
      .build();
    WebhookManagerServiceGrpc.WebhookManagerServiceBlockingStub blockStub =
        WebhookManagerServiceGrpc.newBlockingStub(channel);
    
    ConsideringContractPrevalidation req_ConsideringContractPrevalidation =
        ConsideringContractPrevalidation.newBuilder()
          .build();
    CreatePrevalidationRequest req_CreatePrevalidationRequest =
        CreatePrevalidationRequest.newBuilder()
          .setApiKey("API_KEY")
          .setName("NAME")
          .setTriggerType(1)
          .setConsideringContractPrevalidation(req_ConsideringContractPrevalidation)
          .build();
    CreatePrevalidationResponse resp = blockStub.createPrevalidation(req_CreatePrevalidationRequest);
    System.out.println(resp);
    channel.shutdown();
  }
}
const consideringcontractprevalidation = new ConsideringContractPrevalidation();
const createprevalidationrequest = new CreatePrevalidationRequest();
createprevalidationrequest.setApiKey("API_KEY");
createprevalidationrequest.setName("NAME");
createprevalidationrequest.setTriggerType(1);
createprevalidationrequest.setConsideringContractPrevalidation(consideringcontractprevalidation);

service.createPrevalidation(createprevalidationrequest, (err, value) => {
    const resp = JSON.stringify(err ? err : value);
    console.log("received ", resp);
})
extern crate grpc-sdks;
use tonic::transport::Channel;

use grpc-sdks::webhook_api::v1::webhook_manager_service_client::WebhookManagerServiceClient;
use grpc-sdks::webhook_api::v1::ConsideringContractPrevalidation;
use grpc-sdks::webhook_api::v1::CreatePrevalidationRequest;

#[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(
    CreatePrevalidationRequest{
      api_key: String::from("API_KEY"),
      name: String::from("NAME"),
      trigger_type: 1,
      trigger: Some(ConsideringContractPrevalidation{
        condition: Vec::from([]),
        logical_base: None,
        outcome: None
      })
    });
// sending request and waiting for response
  let response = client.create_prevalidation(request).await?.into_inner();
  println!("RESPONSE={:?}", response);
  Ok(())
}
package app

import io.grpc.ManagedChannelBuilder
import webhook_api.v1.Webhook.ConsideringContractPrevalidation
import webhook_api.v1.Webhook.CreatePrevalidationRequest
import webhook_api.v1.Webhook.CreatePrevalidationResponse
import webhook_api.v1.WebhookManagerServiceGrpc

fun main() {
    val channel = ManagedChannelBuilder
            .forAddress("YOUR_WEBHOOK_URL", 443)
            .usePlaintext()
            .build()
    var blockStub = WebhookManagerServiceGrpc.newBlockingStub(channel)
    
    val req_ConsideringContractPrevalidation = ConsideringContractPrevalidation.newBuilder()
          .build()
    val req_CreatePrevalidationRequest = CreatePrevalidationRequest.newBuilder()
          .setApiKey("API_KEY")
          .setName("NAME")
          .setTriggerType(1)
          .setConsideringContractPrevalidation(req_ConsideringContractPrevalidation)
          .build()
    val resp = blockStub.createPrevalidation(req_CreatePrevalidationRequest)
    println(resp)
    channel.shutdown()
}


returns CreatePrevalidationResponse

webhook_api.v1.CreatePrevalidationResponse

FieldTypeDescription
prevalidationPrevalidationPrevalidation.
{
  "prevalidation": {
    "id": "PREVALIDATION_ID1",
    "name": "PREVALIDATION_NAME1",
    "trigger_type": 1,
    "trigger": {
      "considering_contract_prevalidation": {
        "condition": [
          {
            "target": 1,
            "operator": 2,
            "value": {
              "amount_value": {
                "currency_code": "USD",
                "amount": 100,
                "decimals": 2
              }
            }
          },
          {
            "target": 1,
            "operator": 4,
            "value": {
              "amount_value": {
                "currency_code": "USD",
                "amount": 1000,
                "decimals": 2
              }
            }
          }
        ],
        "outcome": 1,
        "logical_base": 1
      }
    }
  }
}