diff --git a/api/spec/src/cloud/main.tsp b/api/spec/src/cloud/main.tsp index df1797b8a..aa6cccd2a 100644 --- a/api/spec/src/cloud/main.tsp +++ b/api/spec/src/cloud/main.tsp @@ -142,3 +142,7 @@ namespace OpenMeterCloud.Entitlements { @tag("Entitlements (Experimental)") interface Subjects extends OpenMeter.Entitlements.Subjects {} } + +@route("/api/v1/customers") +@tag("Customers") +interface Customers extends OpenMeter.Customers {} diff --git a/api/spec/src/cloud/subjects.tsp b/api/spec/src/cloud/subjects.tsp index cc4a30a44..74989bc02 100644 --- a/api/spec/src/cloud/subjects.tsp +++ b/api/spec/src/cloud/subjects.tsp @@ -32,8 +32,15 @@ interface Subjects { * If the subject exists, it will be partially updated with the provided fields. */ @post - @operationId("listSubjects") + @operationId("upsertSubject") upsert(@body subject: Subject[]): Subject[] | OpenMeter.CommonErrors; + + /** + * Delete subject by ID or key. + */ + @delete + @operationId("deleteSubject") + delete(@path subjectIdOrKey: string): void | OpenMeter.CommonErrors; } /** diff --git a/api/spec/src/entitlements/subjects.tsp b/api/spec/src/entitlements/subjects.tsp index b0d3c9fb6..7f5991502 100644 --- a/api/spec/src/entitlements/subjects.tsp +++ b/api/spec/src/entitlements/subjects.tsp @@ -155,7 +155,7 @@ interface Subjects { /** * Windowsize */ - @query windowSize?: OpenMeter.WindowSize, + @query windowSize: OpenMeter.WindowSize, /** * The timezone used when calculating the windows. diff --git a/api/spec/src/events.tsp b/api/spec/src/events.tsp index d335ab0de..89eabfeeb 100644 --- a/api/spec/src/events.tsp +++ b/api/spec/src/events.tsp @@ -27,7 +27,7 @@ interface Events { */ @query @example(utcDateTime.fromISO("2023-01-01T00:00:00Z")) - ingestedAtFrom: utcDateTime, + ingestedAtFrom?: utcDateTime, /** * End date-time in RFC 3339 format. @@ -36,7 +36,7 @@ interface Events { */ @query @example(utcDateTime.fromISO("2023-01-01T00:00:00Z")) - ingestedAtTo: utcDateTime, + ingestedAtTo?: utcDateTime, /** * If not provided lists all events. @@ -47,7 +47,7 @@ interface Events { */ @query @example(false) - hasError: boolean, + hasError?: boolean, /** * The event ID. @@ -56,7 +56,7 @@ interface Events { */ @query @example("my-event-id") - id: string, + id?: string, /** * The event subject. @@ -65,7 +65,7 @@ interface Events { */ @query @example("customer-1") - subject: string, + subject?: string, /** * Start date-time in RFC 3339 format. @@ -74,7 +74,7 @@ interface Events { */ @query @example(utcDateTime.fromISO("2023-01-01T00:00:00Z")) - from: utcDateTime, + from?: utcDateTime, /** * End date-time in RFC 3339 format. @@ -83,7 +83,7 @@ interface Events { */ @query @example(utcDateTime.fromISO("2023-01-01T00:00:00Z")) - to: utcDateTime, + to?: utcDateTime, /** * Number of events to return. @@ -92,7 +92,7 @@ interface Events { @minValue(1) @maxValue(100) @example(100) - limit: integer = 100, + limit?: integer = 100, ): IngestedEvent[] | CommonErrors; @post diff --git a/api/spec/src/notification/rule.tsp b/api/spec/src/notification/rule.tsp index cd11dcf72..90faa6449 100644 --- a/api/spec/src/notification/rule.tsp +++ b/api/spec/src/notification/rule.tsp @@ -223,7 +223,7 @@ interface Rules { */ @query @example(true) - includeDeleted?: boolean, + includeDeleted?: boolean = false, /** * Include disabled notification rules in response. @@ -232,7 +232,7 @@ interface Rules { */ @query @example(false) - includeDisabled?: boolean, + includeDisabled?: boolean = false, // TODO(chrisgacsal): figure out if there is a way to use union type for attribute like this // where the code generation results a less complicated/more idiomatic code. diff --git a/api/spec/src/portal.tsp b/api/spec/src/portal.tsp index 652c8fd38..9b0ea90f1 100644 --- a/api/spec/src/portal.tsp +++ b/api/spec/src/portal.tsp @@ -77,7 +77,11 @@ interface Meters { @route("/{meterSlug}/query") @operationId("queryPortalMeter") @sharedRoute - queryJson(@path meterSlug: Key, ...OpenMeter.MeterQuery, @header accept?: "application/json" = "application/json"): { + queryJson( + @path meterSlug: Key, + ...OmitProperties, + @header accept?: "application/json" = "application/json", + ): { @header contentType: "application/json"; @body _: MeterQueryResult; } | NotFoundError | CommonErrors; @@ -89,7 +93,7 @@ interface Meters { @route("/{meterSlug}/query") @operationId("queryPortalMeter") @sharedRoute - queryCsv(@path meterSlug: Key, ...OpenMeter.MeterQuery, @header accept?: "text/csv"): { + queryCsv(@path meterSlug: Key, ...OmitProperties, @header accept?: "text/csv"): { @header contentType: "text/csv"; @body