@openmeter/sdk 1.0.0-beta.184 → 1.0.0-beta.185

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,20 @@
3
3
  * Do not make direct changes to the file.
4
4
  */
5
5
  export interface paths {
6
+ '/api/v1/customers': {
7
+ /** @description List customers. */
8
+ get: operations['listCustomers'];
9
+ /** @description Create a new customer. */
10
+ post: operations['createCustomer'];
11
+ };
12
+ '/api/v1/customers/{customerIdOrKey}': {
13
+ /** @description Get a customer by ID or key. */
14
+ get: operations['getCustomer'];
15
+ /** @description Update a customer by ID or key. */
16
+ put: operations['updateCustomer'];
17
+ /** @description Delete a customer by ID or key. */
18
+ delete: operations['deleteCustomer'];
19
+ };
6
20
  '/api/v1/events': {
7
21
  /**
8
22
  * List ingested events
@@ -374,6 +388,16 @@ export interface paths {
374
388
  export type webhooks = Record<string, never>;
375
389
  export interface components {
376
390
  schemas: {
391
+ /** @description Address */
392
+ Address: {
393
+ country?: components['schemas']['CountryCode'];
394
+ postalCode?: string;
395
+ state?: string;
396
+ city?: string;
397
+ line1?: string;
398
+ line2?: string;
399
+ phoneNumber?: string;
400
+ };
377
401
  /**
378
402
  * @description Metadata fields for all resources.
379
403
  * These fields are automatically populated by the system for managed entities. Their use and meaning is uniform across all resources.
@@ -494,6 +518,147 @@ export interface components {
494
518
  instance?: string;
495
519
  [key: string]: unknown;
496
520
  };
521
+ /**
522
+ * @description [ISO 3166-1](https://www.iso.org/iso-3166-country-codes.html) alpha-2 country code.
523
+ * Custom two-letter country codes are also supported for convenience.
524
+ * @example US
525
+ */
526
+ CountryCode: string;
527
+ /**
528
+ * @description Three-letter [ISO4217](https://www.iso.org/iso-4217-currency-codes.html) currency code.
529
+ * Custom three-letter currency codes are also supported for convenience.
530
+ * @example USD
531
+ */
532
+ CurrencyCode: string;
533
+ /**
534
+ * @description A customer object.
535
+ * @example {
536
+ * "id": "01G65Z755AFWAKHE12NY0CQ9FH",
537
+ * "key": "my_customer_key",
538
+ * "name": "ACME Inc.",
539
+ * "usageAttribution": {
540
+ * "subjectKeys": [
541
+ * "my_subject_key"
542
+ * ]
543
+ * },
544
+ * "taxProvider": "stripe_tax",
545
+ * "invoicingProvider": "stripe_invoicing",
546
+ * "paymentProvider": "stripe_payments",
547
+ * "external": {
548
+ * "stripeCustomerId": "cus_xxxxxxxxxxxxxx"
549
+ * }
550
+ * }
551
+ */
552
+ Customer: {
553
+ /**
554
+ * ID
555
+ * @description A unique identifier for the customer.
556
+ * @example 01G65Z755AFWAKHE12NY0CQ9FH
557
+ */
558
+ id: components['schemas']['ULID'];
559
+ /**
560
+ * Display name
561
+ * @description Human-readable name for the resource. Between 1 and 256 characters.
562
+ */
563
+ name: string;
564
+ /**
565
+ * Description
566
+ * @description Optional description of the resource. Maximum 1024 characters.
567
+ */
568
+ description?: string;
569
+ /**
570
+ * Metadata
571
+ * @description Additional metadata for the resource.
572
+ */
573
+ metadata?: components['schemas']['Metadata'];
574
+ /**
575
+ * Creation Time
576
+ * @description Timestamp of when the resource was created.
577
+ */
578
+ createdAt?: components['schemas']['DateTime'];
579
+ /**
580
+ * Last Update Time
581
+ * @description Timestamp of when the resource was last updated.
582
+ */
583
+ updatedAt?: components['schemas']['DateTime'];
584
+ /**
585
+ * Deletion Time
586
+ * @description Timestamp of when the resource was permanently deleted.
587
+ */
588
+ deletedAt?: components['schemas']['DateTime'];
589
+ /**
590
+ * Archival Time
591
+ * @description Timestamp of when the resource was archived.
592
+ */
593
+ archivedAt?: components['schemas']['DateTime'];
594
+ /**
595
+ * Usage Attribution
596
+ * @description Mapping to attribute metered usage to the customer
597
+ */
598
+ usageAttribution: components['schemas']['CustomerUsageAttribution'];
599
+ /**
600
+ * Primary Email
601
+ * @description The primary email address of the customer.
602
+ */
603
+ primaryEmail?: string;
604
+ /**
605
+ * Currency
606
+ * @description Currency of the customer.
607
+ * Used for billing, tax and invoicing.
608
+ */
609
+ currency?: components['schemas']['CurrencyCode'];
610
+ /**
611
+ * Timezone
612
+ * @description Timezone of the customer.
613
+ */
614
+ timezone?: string;
615
+ /**
616
+ * Billing Address
617
+ * @description The billing address of the customer.
618
+ * Used for tax and invoicing.
619
+ */
620
+ billingAddress?: components['schemas']['Address'];
621
+ /**
622
+ * External Mappings
623
+ * @description External mappings for the customer.
624
+ */
625
+ external?: components['schemas']['CustomerExternalMapping'];
626
+ };
627
+ /** @description A unique customer identifier. */
628
+ CustomerIdentifier: components['schemas']['ULID'] | components['schemas']['Key'];
629
+ /** @description External mappings for the customer. */
630
+ CustomerExternalMapping: {
631
+ /**
632
+ * Stripe Customer
633
+ * @description The Stripe customer ID.
634
+ * Mapping to a Stripe Customer object.
635
+ * Required to use Stripe as an invocing provider.
636
+ */
637
+ stripeCustomerId?: string;
638
+ };
639
+ /** @description A page of results. */
640
+ CustomerList: {
641
+ /** @description The page number. */
642
+ page: number;
643
+ /** @description The number of items in the page. */
644
+ pageSize: number;
645
+ /** @description The total number of items. */
646
+ totalCount: number;
647
+ /** @description The items in the page. */
648
+ items: components['schemas']['Customer'][];
649
+ };
650
+ /**
651
+ * @description Mapping to attribute metered usage to the customer.
652
+ * One customer can have multiple subjects,
653
+ * but one subject can only belong to one customer.
654
+ */
655
+ CustomerUsageAttribution: {
656
+ /**
657
+ * SubjectKeys
658
+ * @description The subjects that are attributed to the customer.
659
+ */
660
+ subjectKeys: string[];
661
+ };
497
662
  /**
498
663
  * @description CloudEvents Specification JSON Schema
499
664
  * @example {
@@ -602,6 +767,11 @@ export interface components {
602
767
  */
603
768
  readonly storedAt: string;
604
769
  };
770
+ /**
771
+ * @description A invoicing provider.
772
+ * @enum {string}
773
+ */
774
+ InvoicingProvider: 'openmeter_sandbox' | 'stripe_invoicing';
605
775
  /**
606
776
  * @description A feature is a feature or service offered to a customer.
607
777
  * For example: CPU-Hours, Tokens, API Calls, etc.
@@ -674,6 +844,12 @@ export interface components {
674
844
  */
675
845
  key: string;
676
846
  };
847
+ /**
848
+ * Format: date-time
849
+ * @description [RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.
850
+ * @example "2023-01-01T01:01:01.001Z"
851
+ */
852
+ DateTime: string;
677
853
  EntitlementCreateSharedFields: {
678
854
  /**
679
855
  * @description The feature the subject is entitled to use.
@@ -1175,6 +1351,16 @@ export interface components {
1175
1351
  * @enum {string}
1176
1352
  */
1177
1353
  MeterAggregation: 'SUM' | 'COUNT' | 'UNIQUE_COUNT' | 'AVG' | 'MIN' | 'MAX';
1354
+ /**
1355
+ * @description Set of key-value pairs.
1356
+ * Metadata can be used to store additional information about a resource.
1357
+ * @example {
1358
+ * "externalId": "019142cc-a016-796a-8113-1a942fecd26d"
1359
+ * }
1360
+ */
1361
+ Metadata: {
1362
+ [key: string]: string;
1363
+ };
1178
1364
  /**
1179
1365
  * @description Aggregation window size.
1180
1366
  * @example MINUTE
@@ -1724,6 +1910,66 @@ export interface components {
1724
1910
  */
1725
1911
  pageSize: number;
1726
1912
  };
1913
+ /**
1914
+ * @description A payment provider.
1915
+ * @enum {string}
1916
+ */
1917
+ PaymentProvider: 'openmeter_sandbox' | 'stripe_payments';
1918
+ /** @description Represents common fields of resources. */
1919
+ Resource: {
1920
+ /**
1921
+ * Key
1922
+ * @description A semi-unique identifier for the resource.
1923
+ */
1924
+ key: components['schemas']['Key'];
1925
+ /**
1926
+ * Display name
1927
+ * @description Human-readable name for the resource. Between 1 and 256 characters.
1928
+ */
1929
+ name: string;
1930
+ /**
1931
+ * Description
1932
+ * @description Optional description of the resource. Maximum 1024 characters.
1933
+ */
1934
+ description?: string;
1935
+ /**
1936
+ * Metadata
1937
+ * @description Additional metadata for the resource.
1938
+ */
1939
+ metadata?: components['schemas']['Metadata'];
1940
+ /**
1941
+ * Creation Time
1942
+ * @description Timestamp of when the resource was created.
1943
+ */
1944
+ createdAt?: components['schemas']['DateTime'];
1945
+ /**
1946
+ * Last Update Time
1947
+ * @description Timestamp of when the resource was last updated.
1948
+ */
1949
+ updatedAt?: components['schemas']['DateTime'];
1950
+ /**
1951
+ * Deletion Time
1952
+ * @description Timestamp of when the resource was permanently deleted.
1953
+ */
1954
+ deletedAt?: components['schemas']['DateTime'];
1955
+ /**
1956
+ * Archival Time
1957
+ * @description Timestamp of when the resource was archived.
1958
+ */
1959
+ archivedAt?: components['schemas']['DateTime'];
1960
+ };
1961
+ /**
1962
+ * @description A tax provider.
1963
+ * @enum {string}
1964
+ */
1965
+ TaxProvider: 'openmeter_sandbox' | 'stripe_tax';
1966
+ /** @description A key is a unique string that is used to identify a resource. */
1967
+ Key: string;
1968
+ /**
1969
+ * @description ULID (Universally Unique Lexicographically Sortable Identifier).
1970
+ * @example 01G65Z755AFWAKHE12NY0CQ9FH
1971
+ */
1972
+ ULID: string;
1727
1973
  };
1728
1974
  responses: {
1729
1975
  /** @description Conflict */
@@ -1764,6 +2010,12 @@ export interface components {
1764
2010
  };
1765
2011
  };
1766
2012
  parameters: {
2013
+ /** @description The page number. */
2014
+ 'PaginatedQuery.page'?: number;
2015
+ /** @description The number of items in the page. */
2016
+ 'PaginatedQuery.pageSize'?: number;
2017
+ /** @description Include deleted customers. */
2018
+ queryCustomerList?: boolean;
1767
2019
  /** @description A unique identifier for the meter. */
1768
2020
  meterIdOrSlug: components['schemas']['IdOrSlug'];
1769
2021
  /** @description A unique identifier for a subject. */
@@ -1863,6 +2115,108 @@ export interface components {
1863
2115
  export type $defs = Record<string, never>;
1864
2116
  export type external = Record<string, never>;
1865
2117
  export interface operations {
2118
+ /** @description List customers. */
2119
+ listCustomers: {
2120
+ parameters: {
2121
+ query?: {
2122
+ includeDeleted?: components['parameters']['queryCustomerList'];
2123
+ page?: components['parameters']['PaginatedQuery.page'];
2124
+ pageSize?: components['parameters']['PaginatedQuery.pageSize'];
2125
+ };
2126
+ };
2127
+ responses: {
2128
+ /** @description The request has succeeded. */
2129
+ 200: {
2130
+ content: {
2131
+ 'application/json': components['schemas']['CustomerList'][];
2132
+ };
2133
+ };
2134
+ 400: components['responses']['BadRequestProblemResponse'];
2135
+ 401: components['responses']['UnauthorizedProblemResponse'];
2136
+ default: components['responses']['UnexpectedProblemResponse'];
2137
+ };
2138
+ };
2139
+ /** @description Create a new customer. */
2140
+ createCustomer: {
2141
+ requestBody: {
2142
+ content: {
2143
+ 'application/json': components['schemas']['Customer'];
2144
+ };
2145
+ };
2146
+ responses: {
2147
+ /** @description The request has succeeded. */
2148
+ 200: {
2149
+ content: {
2150
+ 'application/json': components['schemas']['Customer'];
2151
+ };
2152
+ };
2153
+ 400: components['responses']['BadRequestProblemResponse'];
2154
+ 401: components['responses']['UnauthorizedProblemResponse'];
2155
+ default: components['responses']['UnexpectedProblemResponse'];
2156
+ };
2157
+ };
2158
+ /** @description Get a customer by ID or key. */
2159
+ getCustomer: {
2160
+ parameters: {
2161
+ path: {
2162
+ customerIdOrKey: components['schemas']['CustomerIdentifier'];
2163
+ };
2164
+ };
2165
+ responses: {
2166
+ /** @description The request has succeeded. */
2167
+ 200: {
2168
+ content: {
2169
+ 'application/json': components['schemas']['Customer'];
2170
+ };
2171
+ };
2172
+ 400: components['responses']['BadRequestProblemResponse'];
2173
+ 401: components['responses']['UnauthorizedProblemResponse'];
2174
+ default: components['responses']['UnexpectedProblemResponse'];
2175
+ };
2176
+ };
2177
+ /** @description Update a customer by ID or key. */
2178
+ updateCustomer: {
2179
+ parameters: {
2180
+ path: {
2181
+ customerIdOrKey: components['schemas']['CustomerIdentifier'];
2182
+ };
2183
+ };
2184
+ requestBody: {
2185
+ content: {
2186
+ 'application/json': components['schemas']['Customer'];
2187
+ };
2188
+ };
2189
+ responses: {
2190
+ /** @description The request has succeeded. */
2191
+ 200: {
2192
+ content: {
2193
+ 'application/json': components['schemas']['Customer'];
2194
+ };
2195
+ };
2196
+ 400: components['responses']['BadRequestProblemResponse'];
2197
+ 401: components['responses']['UnauthorizedProblemResponse'];
2198
+ default: components['responses']['UnexpectedProblemResponse'];
2199
+ };
2200
+ };
2201
+ /** @description Delete a customer by ID or key. */
2202
+ deleteCustomer: {
2203
+ parameters: {
2204
+ path: {
2205
+ customerIdOrKey: components['schemas']['CustomerIdentifier'];
2206
+ };
2207
+ };
2208
+ responses: {
2209
+ /** @description The request has succeeded. */
2210
+ 200: {
2211
+ content: {
2212
+ 'application/json': components['schemas']['Customer'];
2213
+ };
2214
+ };
2215
+ 400: components['responses']['BadRequestProblemResponse'];
2216
+ 401: components['responses']['UnauthorizedProblemResponse'];
2217
+ default: components['responses']['UnexpectedProblemResponse'];
2218
+ };
2219
+ };
1866
2220
  /**
1867
2221
  * List ingested events
1868
2222
  * @description List ingested events within a time range.