svix
Version:
Svix webhooks API client and webhook verification library
66 lines • 4.16 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventType = void 0;
const eventTypeImportOpenApiIn_1 = require("../models/eventTypeImportOpenApiIn");
const eventTypeImportOpenApiOut_1 = require("../models/eventTypeImportOpenApiOut");
const eventTypeIn_1 = require("../models/eventTypeIn");
const eventTypeOut_1 = require("../models/eventTypeOut");
const eventTypePatch_1 = require("../models/eventTypePatch");
const eventTypeUpdate_1 = require("../models/eventTypeUpdate");
const listResponseEventTypeOut_1 = require("../models/listResponseEventTypeOut");
const request_1 = require("../request");
class EventType {
constructor(requestCtx) {
this.requestCtx = requestCtx;
}
list(options) {
const request = new request_1.SvixRequest(request_1.HttpMethod.GET, "/api/v1/event-type");
request.setQueryParams({
limit: options === null || options === void 0 ? void 0 : options.limit,
iterator: options === null || options === void 0 ? void 0 : options.iterator,
order: options === null || options === void 0 ? void 0 : options.order,
include_archived: options === null || options === void 0 ? void 0 : options.includeArchived,
with_content: options === null || options === void 0 ? void 0 : options.withContent,
});
return request.send(this.requestCtx, listResponseEventTypeOut_1.ListResponseEventTypeOutSerializer._fromJsonObject);
}
create(eventTypeIn, options) {
const request = new request_1.SvixRequest(request_1.HttpMethod.POST, "/api/v1/event-type");
request.setHeaderParam("idempotency-key", options === null || options === void 0 ? void 0 : options.idempotencyKey);
request.setBody(eventTypeIn_1.EventTypeInSerializer._toJsonObject(eventTypeIn));
return request.send(this.requestCtx, eventTypeOut_1.EventTypeOutSerializer._fromJsonObject);
}
importOpenapi(eventTypeImportOpenApiIn, options) {
const request = new request_1.SvixRequest(request_1.HttpMethod.POST, "/api/v1/event-type/import/openapi");
request.setHeaderParam("idempotency-key", options === null || options === void 0 ? void 0 : options.idempotencyKey);
request.setBody(eventTypeImportOpenApiIn_1.EventTypeImportOpenApiInSerializer._toJsonObject(eventTypeImportOpenApiIn));
return request.send(this.requestCtx, eventTypeImportOpenApiOut_1.EventTypeImportOpenApiOutSerializer._fromJsonObject);
}
get(eventTypeName) {
const request = new request_1.SvixRequest(request_1.HttpMethod.GET, "/api/v1/event-type/{event_type_name}");
request.setPathParam("event_type_name", eventTypeName);
return request.send(this.requestCtx, eventTypeOut_1.EventTypeOutSerializer._fromJsonObject);
}
update(eventTypeName, eventTypeUpdate) {
const request = new request_1.SvixRequest(request_1.HttpMethod.PUT, "/api/v1/event-type/{event_type_name}");
request.setPathParam("event_type_name", eventTypeName);
request.setBody(eventTypeUpdate_1.EventTypeUpdateSerializer._toJsonObject(eventTypeUpdate));
return request.send(this.requestCtx, eventTypeOut_1.EventTypeOutSerializer._fromJsonObject);
}
delete(eventTypeName, options) {
const request = new request_1.SvixRequest(request_1.HttpMethod.DELETE, "/api/v1/event-type/{event_type_name}");
request.setPathParam("event_type_name", eventTypeName);
request.setQueryParams({
expunge: options === null || options === void 0 ? void 0 : options.expunge,
});
return request.sendNoResponseBody(this.requestCtx);
}
patch(eventTypeName, eventTypePatch) {
const request = new request_1.SvixRequest(request_1.HttpMethod.PATCH, "/api/v1/event-type/{event_type_name}");
request.setPathParam("event_type_name", eventTypeName);
request.setBody(eventTypePatch_1.EventTypePatchSerializer._toJsonObject(eventTypePatch));
return request.send(this.requestCtx, eventTypeOut_1.EventTypeOutSerializer._fromJsonObject);
}
}
exports.EventType = EventType;
//# sourceMappingURL=eventType.js.map