| // Code generated by @openmeter/typespec-go. DO NOT EDIT. | |
| package openmeter | |
| import "time" | |
| // Customer reference. | |
| type CustomerReference struct { | |
| ID string `json:"id"` | |
| } | |
| // Metering event following the CloudEvents specification. | |
| type Event struct { | |
| // Identifies the event. | |
| ID string `json:"id"` | |
| // Identifies the context in which an event happened. | |
| Source string `json:"source"` | |
| // The version of the CloudEvents specification which the event uses. | |
| Specversion string `json:"specversion"` | |
| // Contains a value describing the type of event related to the originating | |
| // occurrence. | |
| Type string `json:"type"` | |
| // Content type of the CloudEvents data value. Only the value "application/json" is | |
| // allowed over HTTP. | |
| Datacontenttype Nullable[string] `json:"datacontenttype,omitempty"` | |
| // Identifies the schema that data adheres to. | |
| Dataschema Nullable[string] `json:"dataschema,omitempty"` | |
| // Describes the subject of the event in the context of the event producer | |
| // (identified by source). | |
| Subject string `json:"subject"` | |
| // Timestamp of when the occurrence happened. Must adhere to RFC 3339. | |
| Time Nullable[time.Time] `json:"time,omitempty"` | |
| // The event payload. Optional, if present it must be a JSON object. | |
| Data Nullable[map[string]any] `json:"data,omitempty"` | |
| } | |
| // Metering event following the CloudEvents specification. | |
| type EventInput struct { | |
| // Identifies the event. | |
| ID string `json:"id"` | |
| // Identifies the context in which an event happened. | |
| Source string `json:"source"` | |
| // The version of the CloudEvents specification which the event uses. | |
| Specversion *string `json:"specversion,omitempty"` | |
| // Contains a value describing the type of event related to the originating | |
| // occurrence. | |
| Type string `json:"type"` | |
| // Content type of the CloudEvents data value. Only the value "application/json" is | |
| // allowed over HTTP. | |
| Datacontenttype Nullable[string] `json:"datacontenttype,omitempty"` | |
| // Identifies the schema that data adheres to. | |
| Dataschema Nullable[string] `json:"dataschema,omitempty"` | |
| // Describes the subject of the event in the context of the event producer | |
| // (identified by source). | |
| Subject string `json:"subject"` | |
| // Timestamp of when the occurrence happened. Must adhere to RFC 3339. | |
| Time Nullable[time.Time] `json:"time,omitempty"` | |
| // The event payload. Optional, if present it must be a JSON object. | |
| Data Nullable[map[string]any] `json:"data,omitempty"` | |
| } | |
| // An ingested metering event with ingestion metadata. | |
| type IngestedEvent struct { | |
| // The original event ingested. | |
| Event Event `json:"event"` | |
| // The customer if the event is associated with a customer. | |
| Customer *CustomerReference `json:"customer,omitempty"` | |
| // The date and time the event was ingested and its processing started. | |
| IngestedAt time.Time `json:"ingested_at"` | |
| // The date and time the event was stored in the database. | |
| StoredAt time.Time `json:"stored_at"` | |
| // The validation errors of the ingested event. | |
| ValidationErrors []IngestedEventValidationError `json:"validation_errors,omitempty"` | |
| } | |
| // Cursor paginated response. | |
| type IngestedEventPaginatedResponse struct { | |
| Data []IngestedEvent `json:"data"` | |
| Meta CursorMeta `json:"meta"` | |
| } | |
| // Event validation errors. | |
| type IngestedEventValidationError struct { | |
| // The machine readable code of the error. | |
| Code string `json:"code"` | |
| // The human readable description of the error. | |
| Message string `json:"message"` | |
| // Additional attributes. | |
| Attributes map[string]any `json:"attributes,omitempty"` | |
| } | |