events.d.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import { Any } from "./google/protobuf/any";
  2. export interface CloudEvent {
  3. /** Required Attributes */
  4. id: string;
  5. /** URI-reference */
  6. source: string;
  7. specVersion: string;
  8. type: string;
  9. /** Optional & Extension Attributes */
  10. attributes: {
  11. [key: string]: CloudEvent_CloudEventAttributeValue;
  12. };
  13. /** -- CloudEvent Data (Bytes, Text, or Proto) */
  14. data?: {
  15. $case: "binaryData";
  16. binaryData: Buffer;
  17. } | {
  18. $case: "textData";
  19. textData: string;
  20. } | {
  21. $case: "protoData";
  22. protoData: Any;
  23. } | undefined;
  24. }
  25. export interface CloudEvent_AttributesEntry {
  26. key: string;
  27. value: CloudEvent_CloudEventAttributeValue | undefined;
  28. }
  29. export interface CloudEvent_CloudEventAttributeValue {
  30. attr?: {
  31. $case: "ceBoolean";
  32. ceBoolean: boolean;
  33. } | {
  34. $case: "ceInteger";
  35. ceInteger: number;
  36. } | {
  37. $case: "ceString";
  38. ceString: string;
  39. } | {
  40. $case: "ceBytes";
  41. ceBytes: Buffer;
  42. } | {
  43. $case: "ceUri";
  44. ceUri: string;
  45. } | {
  46. $case: "ceUriRef";
  47. ceUriRef: string;
  48. } | {
  49. $case: "ceTimestamp";
  50. ceTimestamp: Date;
  51. } | undefined;
  52. }
  53. export interface CloudEventBatch {
  54. events: CloudEvent[];
  55. }
  56. export declare const CloudEvent: MessageFns<CloudEvent>;
  57. export declare const CloudEvent_AttributesEntry: MessageFns<CloudEvent_AttributesEntry>;
  58. export declare const CloudEvent_CloudEventAttributeValue: MessageFns<CloudEvent_CloudEventAttributeValue>;
  59. export declare const CloudEventBatch: MessageFns<CloudEventBatch>;
  60. interface MessageFns<T> {
  61. fromJSON(object: any): T;
  62. toJSON(message: T): unknown;
  63. }
  64. export {};