originstamp-client-fetch
Version:
TypeScript Fetch client for the OriginStamp service
50 lines (39 loc) • 1.42 kB
Markdown
# WebhookApi example
## preparing
```bash
import { WebhookApi } from "../apis";
import { Configuration } from "../runtime"
import type { Notification } from "../models";
```
## getProofWebhookExample
```bash
try {
const config: Configuration = new Configuration({ apiKey: 'A valid API key' });
const api: WebhookApi = new WebhookApi(config);
const notification: Notification = {
target: "https://your-webhook-endpoint.tld/webhook"
};
const response = await api.getProofWebhookExample({ notification });
console.log("API called successfully. Returned data:", response);
} catch (error) {
console.error(error);
}
```
## getTreeWebhookExample
Test interface that simulates a verified tree webhook.
When called, it immediately returns a static example of a verified tree response and also triggers a webhook callback to
the target URL, if available.
This is useful for testing webhook integrations without waiting for actual blockchain verification.
```bash
try {
const config = new Configuration({ apiKey: 'A valid API key' });
const api = new WebhookApi(config);
const notification: Notification = {
target: "https://your-webhook-endpoint.tld/webhook"
};
const response = await api.getTreeWebhookExample({ notification });
console.log("API called successfully. Returned data:", response);
} catch (error) {
console.error(error);
}
```