openmeter 1.0.0b185__py3-none-any.whl → 1.0.0b188__py3-none-any.whl

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.

Potentially problematic release.


This version of openmeter might be problematic. Click here for more details.

@@ -37,6 +37,108 @@ _SERIALIZER = Serializer()
37
37
  _SERIALIZER.client_side_validation = False
38
38
 
39
39
 
40
+ def build_create_customer_request(**kwargs: Any) -> HttpRequest:
41
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
42
+
43
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
44
+ accept = _headers.pop("Accept", "application/json, application/problem+json")
45
+
46
+ # Construct URL
47
+ _url = "/api/v1/customers"
48
+
49
+ # Construct headers
50
+ if content_type is not None:
51
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
52
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
53
+
54
+ return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
55
+
56
+
57
+ def build_list_customers_request(
58
+ *, include_deleted: bool = False, page: int = 1, page_size: int = 100, **kwargs: Any
59
+ ) -> HttpRequest:
60
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
61
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
62
+
63
+ accept = _headers.pop("Accept", "application/json, application/problem+json")
64
+
65
+ # Construct URL
66
+ _url = "/api/v1/customers"
67
+
68
+ # Construct parameters
69
+ if include_deleted is not None:
70
+ _params["includeDeleted"] = _SERIALIZER.query("include_deleted", include_deleted, "bool")
71
+ if page is not None:
72
+ _params["page"] = _SERIALIZER.query("page", page, "int")
73
+ if page_size is not None:
74
+ _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int")
75
+
76
+ # Construct headers
77
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
78
+
79
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
80
+
81
+
82
+ def build_get_customer_request(customer_id_or_key: Any, **kwargs: Any) -> HttpRequest:
83
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
84
+
85
+ accept = _headers.pop("Accept", "application/json, application/problem+json")
86
+
87
+ # Construct URL
88
+ _url = "/api/v1/customers/{customerIdOrKey}"
89
+ path_format_arguments = {
90
+ "customerIdOrKey": _SERIALIZER.url("customer_id_or_key", customer_id_or_key, "object"),
91
+ }
92
+
93
+ _url: str = _url.format(**path_format_arguments) # type: ignore
94
+
95
+ # Construct headers
96
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
97
+
98
+ return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
99
+
100
+
101
+ def build_update_customer_request(customer_id_or_key: Any, **kwargs: Any) -> HttpRequest:
102
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
103
+
104
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
105
+ accept = _headers.pop("Accept", "application/json, application/problem+json")
106
+
107
+ # Construct URL
108
+ _url = "/api/v1/customers/{customerIdOrKey}"
109
+ path_format_arguments = {
110
+ "customerIdOrKey": _SERIALIZER.url("customer_id_or_key", customer_id_or_key, "object"),
111
+ }
112
+
113
+ _url: str = _url.format(**path_format_arguments) # type: ignore
114
+
115
+ # Construct headers
116
+ if content_type is not None:
117
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
118
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
119
+
120
+ return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs)
121
+
122
+
123
+ def build_delete_customer_request(customer_id_or_key: Any, **kwargs: Any) -> HttpRequest:
124
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
125
+
126
+ accept = _headers.pop("Accept", "application/json, application/problem+json")
127
+
128
+ # Construct URL
129
+ _url = "/api/v1/customers/{customerIdOrKey}"
130
+ path_format_arguments = {
131
+ "customerIdOrKey": _SERIALIZER.url("customer_id_or_key", customer_id_or_key, "object"),
132
+ }
133
+
134
+ _url: str = _url.format(**path_format_arguments) # type: ignore
135
+
136
+ # Construct headers
137
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
138
+
139
+ return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs)
140
+
141
+
40
142
  def build_list_events_request(
41
143
  *,
42
144
  from_parameter: Optional[datetime.datetime] = None,
@@ -1135,134 +1237,1176 @@ def build_delete_notification_rule_request(rule_id: str, **kwargs: Any) -> HttpR
1135
1237
  return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs)
1136
1238
 
1137
1239
 
1138
- def build_update_notification_rule_request(rule_id: str, **kwargs: Any) -> HttpRequest:
1139
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
1240
+ def build_update_notification_rule_request(rule_id: str, **kwargs: Any) -> HttpRequest:
1241
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
1242
+
1243
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
1244
+ accept = _headers.pop("Accept", "application/json, application/problem+json")
1245
+
1246
+ # Construct URL
1247
+ _url = "/api/v1/notification/rules/{ruleId}"
1248
+ path_format_arguments = {
1249
+ "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"),
1250
+ }
1251
+
1252
+ _url: str = _url.format(**path_format_arguments) # type: ignore
1253
+
1254
+ # Construct headers
1255
+ if content_type is not None:
1256
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
1257
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
1258
+
1259
+ return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs)
1260
+
1261
+
1262
+ def build_test_notification_rule_request(rule_id: str, **kwargs: Any) -> HttpRequest:
1263
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
1264
+
1265
+ accept = _headers.pop("Accept", "application/json, application/problem+json")
1266
+
1267
+ # Construct URL
1268
+ _url = "/api/v1/notification/rules/{ruleId}/test"
1269
+ path_format_arguments = {
1270
+ "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"),
1271
+ }
1272
+
1273
+ _url: str = _url.format(**path_format_arguments) # type: ignore
1274
+
1275
+ # Construct headers
1276
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
1277
+
1278
+ return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
1279
+
1280
+
1281
+ def build_list_notification_events_request(
1282
+ *,
1283
+ page: int = 1,
1284
+ page_size: int = 100,
1285
+ order_by: str = "createdAt",
1286
+ order: str = "ASC",
1287
+ from_parameter: Optional[datetime.datetime] = None,
1288
+ to: Optional[datetime.datetime] = None,
1289
+ feature: Optional[List[str]] = None,
1290
+ subject: Optional[List[str]] = None,
1291
+ rule: Optional[List[str]] = None,
1292
+ channel: Optional[List[str]] = None,
1293
+ **kwargs: Any
1294
+ ) -> HttpRequest:
1295
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
1296
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
1297
+
1298
+ accept = _headers.pop("Accept", "application/json, application/problem+json")
1299
+
1300
+ # Construct URL
1301
+ _url = "/api/v1/notification/events"
1302
+
1303
+ # Construct parameters
1304
+ if page is not None:
1305
+ _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1)
1306
+ if page_size is not None:
1307
+ _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int", maximum=1000, minimum=1)
1308
+ if order_by is not None:
1309
+ _params["orderBy"] = _SERIALIZER.query("order_by", order_by, "str")
1310
+ if order is not None:
1311
+ _params["order"] = _SERIALIZER.query("order", order, "str")
1312
+ if from_parameter is not None:
1313
+ _params["from"] = _SERIALIZER.query("from_parameter", from_parameter, "iso-8601")
1314
+ if to is not None:
1315
+ _params["to"] = _SERIALIZER.query("to", to, "iso-8601")
1316
+ if feature is not None:
1317
+ _params["feature"] = _SERIALIZER.query("feature", feature, "[str]")
1318
+ if subject is not None:
1319
+ _params["subject"] = _SERIALIZER.query("subject", subject, "[str]")
1320
+ if rule is not None:
1321
+ _params["rule"] = _SERIALIZER.query("rule", rule, "[str]")
1322
+ if channel is not None:
1323
+ _params["channel"] = _SERIALIZER.query("channel", channel, "[str]")
1324
+
1325
+ # Construct headers
1326
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
1327
+
1328
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
1329
+
1330
+
1331
+ def build_get_notification_event_request(event_id: str, **kwargs: Any) -> HttpRequest:
1332
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
1333
+
1334
+ accept = _headers.pop("Accept", "application/json, application/problem+json")
1335
+
1336
+ # Construct URL
1337
+ _url = "/api/v1/notification/events/{eventId}"
1338
+ path_format_arguments = {
1339
+ "eventId": _SERIALIZER.url("event_id", event_id, "str"),
1340
+ }
1341
+
1342
+ _url: str = _url.format(**path_format_arguments) # type: ignore
1343
+
1344
+ # Construct headers
1345
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
1346
+
1347
+ return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
1348
+
1349
+
1350
+ def build_receive_svix_operational_event_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long
1351
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
1352
+
1353
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
1354
+ accept = _headers.pop("Accept", "application/problem+json")
1355
+
1356
+ # Construct URL
1357
+ _url = "/api/v1/notification/webhook/svix"
1358
+
1359
+ # Construct headers
1360
+ if content_type is not None:
1361
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
1362
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
1363
+
1364
+ return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
1365
+
1366
+
1367
+ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-methods
1368
+ @overload
1369
+ def create_customer(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> JSON:
1370
+ # pylint: disable=line-too-long
1371
+ """Create a new customer.
1372
+
1373
+ :param body: Required.
1374
+ :type body: JSON
1375
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
1376
+ Default value is "application/json".
1377
+ :paramtype content_type: str
1378
+ :return: JSON object
1379
+ :rtype: JSON
1380
+ :raises ~azure.core.exceptions.HttpResponseError:
1381
+
1382
+ Example:
1383
+ .. code-block:: python
1384
+
1385
+ # JSON input template you can fill out and use as your body input.
1386
+ body = {
1387
+ "id": {}, # A unique identifier for the customer. Required.
1388
+ "name": "str", # Human-readable name for the resource. Between 1 and 256
1389
+ characters. Required.
1390
+ "usageAttribution": {
1391
+ "subjectKeys": [
1392
+ "str" # The subjects that are attributed to the customer.
1393
+ Required.
1394
+ ]
1395
+ },
1396
+ "archivedAt": {}, # Optional. Timestamp of when the resource was archived.
1397
+ "billingAddress": {
1398
+ "city": "str", # Optional. The billing address of the customer. Used
1399
+ for tax and invoicing.
1400
+ "country": "str", # Optional. `ISO 3166-1
1401
+ <https://www.iso.org/iso-3166-country-codes.html>`_ alpha-2 country code.
1402
+ Custom two-letter country codes are also supported for convenience.
1403
+ "line1": "str", # Optional. The billing address of the customer.
1404
+ Used for tax and invoicing.
1405
+ "line2": "str", # Optional. The billing address of the customer.
1406
+ Used for tax and invoicing.
1407
+ "phoneNumber": "str", # Optional. The billing address of the
1408
+ customer. Used for tax and invoicing.
1409
+ "postalCode": "str", # Optional. The billing address of the
1410
+ customer. Used for tax and invoicing.
1411
+ "state": "str" # Optional. The billing address of the customer. Used
1412
+ for tax and invoicing.
1413
+ },
1414
+ "createdAt": {}, # Optional. Timestamp of when the resource was created.
1415
+ "currency": {}, # Optional. Currency of the customer. Used for billing, tax
1416
+ and invoicing.
1417
+ "deletedAt": {}, # Optional. Timestamp of when the resource was permanently
1418
+ deleted.
1419
+ "description": "str", # Optional. Optional description of the resource.
1420
+ Maximum 1024 characters.
1421
+ "external": {
1422
+ "stripeCustomerId": "str" # Optional. The Stripe customer ID.
1423
+ Mapping to a Stripe Customer object. Required to use Stripe as an invocing
1424
+ provider.
1425
+ },
1426
+ "metadata": {},
1427
+ "primaryEmail": "str", # Optional. The primary email address of the
1428
+ customer.
1429
+ "timezone": "str", # Optional. Timezone of the customer.
1430
+ "updatedAt": {} # Optional. Timestamp of when the resource was last updated.
1431
+ }
1432
+
1433
+ # response body for status code(s): 200
1434
+ response == {
1435
+ "id": {}, # A unique identifier for the customer. Required.
1436
+ "name": "str", # Human-readable name for the resource. Between 1 and 256
1437
+ characters. Required.
1438
+ "usageAttribution": {
1439
+ "subjectKeys": [
1440
+ "str" # The subjects that are attributed to the customer.
1441
+ Required.
1442
+ ]
1443
+ },
1444
+ "archivedAt": {}, # Optional. Timestamp of when the resource was archived.
1445
+ "billingAddress": {
1446
+ "city": "str", # Optional. The billing address of the customer. Used
1447
+ for tax and invoicing.
1448
+ "country": "str", # Optional. `ISO 3166-1
1449
+ <https://www.iso.org/iso-3166-country-codes.html>`_ alpha-2 country code.
1450
+ Custom two-letter country codes are also supported for convenience.
1451
+ "line1": "str", # Optional. The billing address of the customer.
1452
+ Used for tax and invoicing.
1453
+ "line2": "str", # Optional. The billing address of the customer.
1454
+ Used for tax and invoicing.
1455
+ "phoneNumber": "str", # Optional. The billing address of the
1456
+ customer. Used for tax and invoicing.
1457
+ "postalCode": "str", # Optional. The billing address of the
1458
+ customer. Used for tax and invoicing.
1459
+ "state": "str" # Optional. The billing address of the customer. Used
1460
+ for tax and invoicing.
1461
+ },
1462
+ "createdAt": {}, # Optional. Timestamp of when the resource was created.
1463
+ "currency": {}, # Optional. Currency of the customer. Used for billing, tax
1464
+ and invoicing.
1465
+ "deletedAt": {}, # Optional. Timestamp of when the resource was permanently
1466
+ deleted.
1467
+ "description": "str", # Optional. Optional description of the resource.
1468
+ Maximum 1024 characters.
1469
+ "external": {
1470
+ "stripeCustomerId": "str" # Optional. The Stripe customer ID.
1471
+ Mapping to a Stripe Customer object. Required to use Stripe as an invocing
1472
+ provider.
1473
+ },
1474
+ "metadata": {},
1475
+ "primaryEmail": "str", # Optional. The primary email address of the
1476
+ customer.
1477
+ "timezone": "str", # Optional. Timezone of the customer.
1478
+ "updatedAt": {} # Optional. Timestamp of when the resource was last updated.
1479
+ }
1480
+ """
1481
+
1482
+ @overload
1483
+ def create_customer(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> JSON:
1484
+ # pylint: disable=line-too-long
1485
+ """Create a new customer.
1486
+
1487
+ :param body: Required.
1488
+ :type body: IO[bytes]
1489
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
1490
+ Default value is "application/json".
1491
+ :paramtype content_type: str
1492
+ :return: JSON object
1493
+ :rtype: JSON
1494
+ :raises ~azure.core.exceptions.HttpResponseError:
1495
+
1496
+ Example:
1497
+ .. code-block:: python
1498
+
1499
+ # response body for status code(s): 200
1500
+ response == {
1501
+ "id": {}, # A unique identifier for the customer. Required.
1502
+ "name": "str", # Human-readable name for the resource. Between 1 and 256
1503
+ characters. Required.
1504
+ "usageAttribution": {
1505
+ "subjectKeys": [
1506
+ "str" # The subjects that are attributed to the customer.
1507
+ Required.
1508
+ ]
1509
+ },
1510
+ "archivedAt": {}, # Optional. Timestamp of when the resource was archived.
1511
+ "billingAddress": {
1512
+ "city": "str", # Optional. The billing address of the customer. Used
1513
+ for tax and invoicing.
1514
+ "country": "str", # Optional. `ISO 3166-1
1515
+ <https://www.iso.org/iso-3166-country-codes.html>`_ alpha-2 country code.
1516
+ Custom two-letter country codes are also supported for convenience.
1517
+ "line1": "str", # Optional. The billing address of the customer.
1518
+ Used for tax and invoicing.
1519
+ "line2": "str", # Optional. The billing address of the customer.
1520
+ Used for tax and invoicing.
1521
+ "phoneNumber": "str", # Optional. The billing address of the
1522
+ customer. Used for tax and invoicing.
1523
+ "postalCode": "str", # Optional. The billing address of the
1524
+ customer. Used for tax and invoicing.
1525
+ "state": "str" # Optional. The billing address of the customer. Used
1526
+ for tax and invoicing.
1527
+ },
1528
+ "createdAt": {}, # Optional. Timestamp of when the resource was created.
1529
+ "currency": {}, # Optional. Currency of the customer. Used for billing, tax
1530
+ and invoicing.
1531
+ "deletedAt": {}, # Optional. Timestamp of when the resource was permanently
1532
+ deleted.
1533
+ "description": "str", # Optional. Optional description of the resource.
1534
+ Maximum 1024 characters.
1535
+ "external": {
1536
+ "stripeCustomerId": "str" # Optional. The Stripe customer ID.
1537
+ Mapping to a Stripe Customer object. Required to use Stripe as an invocing
1538
+ provider.
1539
+ },
1540
+ "metadata": {},
1541
+ "primaryEmail": "str", # Optional. The primary email address of the
1542
+ customer.
1543
+ "timezone": "str", # Optional. Timezone of the customer.
1544
+ "updatedAt": {} # Optional. Timestamp of when the resource was last updated.
1545
+ }
1546
+ """
1547
+
1548
+ @distributed_trace
1549
+ def create_customer(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
1550
+ # pylint: disable=line-too-long
1551
+ """Create a new customer.
1552
+
1553
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
1554
+ :type body: JSON or IO[bytes]
1555
+ :return: JSON object
1556
+ :rtype: JSON
1557
+ :raises ~azure.core.exceptions.HttpResponseError:
1558
+
1559
+ Example:
1560
+ .. code-block:: python
1561
+
1562
+ # JSON input template you can fill out and use as your body input.
1563
+ body = {
1564
+ "id": {}, # A unique identifier for the customer. Required.
1565
+ "name": "str", # Human-readable name for the resource. Between 1 and 256
1566
+ characters. Required.
1567
+ "usageAttribution": {
1568
+ "subjectKeys": [
1569
+ "str" # The subjects that are attributed to the customer.
1570
+ Required.
1571
+ ]
1572
+ },
1573
+ "archivedAt": {}, # Optional. Timestamp of when the resource was archived.
1574
+ "billingAddress": {
1575
+ "city": "str", # Optional. The billing address of the customer. Used
1576
+ for tax and invoicing.
1577
+ "country": "str", # Optional. `ISO 3166-1
1578
+ <https://www.iso.org/iso-3166-country-codes.html>`_ alpha-2 country code.
1579
+ Custom two-letter country codes are also supported for convenience.
1580
+ "line1": "str", # Optional. The billing address of the customer.
1581
+ Used for tax and invoicing.
1582
+ "line2": "str", # Optional. The billing address of the customer.
1583
+ Used for tax and invoicing.
1584
+ "phoneNumber": "str", # Optional. The billing address of the
1585
+ customer. Used for tax and invoicing.
1586
+ "postalCode": "str", # Optional. The billing address of the
1587
+ customer. Used for tax and invoicing.
1588
+ "state": "str" # Optional. The billing address of the customer. Used
1589
+ for tax and invoicing.
1590
+ },
1591
+ "createdAt": {}, # Optional. Timestamp of when the resource was created.
1592
+ "currency": {}, # Optional. Currency of the customer. Used for billing, tax
1593
+ and invoicing.
1594
+ "deletedAt": {}, # Optional. Timestamp of when the resource was permanently
1595
+ deleted.
1596
+ "description": "str", # Optional. Optional description of the resource.
1597
+ Maximum 1024 characters.
1598
+ "external": {
1599
+ "stripeCustomerId": "str" # Optional. The Stripe customer ID.
1600
+ Mapping to a Stripe Customer object. Required to use Stripe as an invocing
1601
+ provider.
1602
+ },
1603
+ "metadata": {},
1604
+ "primaryEmail": "str", # Optional. The primary email address of the
1605
+ customer.
1606
+ "timezone": "str", # Optional. Timezone of the customer.
1607
+ "updatedAt": {} # Optional. Timestamp of when the resource was last updated.
1608
+ }
1609
+
1610
+ # response body for status code(s): 200
1611
+ response == {
1612
+ "id": {}, # A unique identifier for the customer. Required.
1613
+ "name": "str", # Human-readable name for the resource. Between 1 and 256
1614
+ characters. Required.
1615
+ "usageAttribution": {
1616
+ "subjectKeys": [
1617
+ "str" # The subjects that are attributed to the customer.
1618
+ Required.
1619
+ ]
1620
+ },
1621
+ "archivedAt": {}, # Optional. Timestamp of when the resource was archived.
1622
+ "billingAddress": {
1623
+ "city": "str", # Optional. The billing address of the customer. Used
1624
+ for tax and invoicing.
1625
+ "country": "str", # Optional. `ISO 3166-1
1626
+ <https://www.iso.org/iso-3166-country-codes.html>`_ alpha-2 country code.
1627
+ Custom two-letter country codes are also supported for convenience.
1628
+ "line1": "str", # Optional. The billing address of the customer.
1629
+ Used for tax and invoicing.
1630
+ "line2": "str", # Optional. The billing address of the customer.
1631
+ Used for tax and invoicing.
1632
+ "phoneNumber": "str", # Optional. The billing address of the
1633
+ customer. Used for tax and invoicing.
1634
+ "postalCode": "str", # Optional. The billing address of the
1635
+ customer. Used for tax and invoicing.
1636
+ "state": "str" # Optional. The billing address of the customer. Used
1637
+ for tax and invoicing.
1638
+ },
1639
+ "createdAt": {}, # Optional. Timestamp of when the resource was created.
1640
+ "currency": {}, # Optional. Currency of the customer. Used for billing, tax
1641
+ and invoicing.
1642
+ "deletedAt": {}, # Optional. Timestamp of when the resource was permanently
1643
+ deleted.
1644
+ "description": "str", # Optional. Optional description of the resource.
1645
+ Maximum 1024 characters.
1646
+ "external": {
1647
+ "stripeCustomerId": "str" # Optional. The Stripe customer ID.
1648
+ Mapping to a Stripe Customer object. Required to use Stripe as an invocing
1649
+ provider.
1650
+ },
1651
+ "metadata": {},
1652
+ "primaryEmail": "str", # Optional. The primary email address of the
1653
+ customer.
1654
+ "timezone": "str", # Optional. Timezone of the customer.
1655
+ "updatedAt": {} # Optional. Timestamp of when the resource was last updated.
1656
+ }
1657
+ """
1658
+ error_map = {
1659
+ 404: ResourceNotFoundError,
1660
+ 409: ResourceExistsError,
1661
+ 304: ResourceNotModifiedError,
1662
+ 400: HttpResponseError,
1663
+ 401: lambda response: ClientAuthenticationError(response=response),
1664
+ }
1665
+ error_map.update(kwargs.pop("error_map", {}) or {})
1666
+
1667
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
1668
+ _params = kwargs.pop("params", {}) or {}
1669
+
1670
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
1671
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
1672
+
1673
+ content_type = content_type or "application/json"
1674
+ _json = None
1675
+ _content = None
1676
+ if isinstance(body, (IOBase, bytes)):
1677
+ _content = body
1678
+ else:
1679
+ _json = body
1680
+
1681
+ _request = build_create_customer_request(
1682
+ content_type=content_type,
1683
+ json=_json,
1684
+ content=_content,
1685
+ headers=_headers,
1686
+ params=_params,
1687
+ )
1688
+ _request.url = self._client.format_url(_request.url)
1689
+
1690
+ _stream = False
1691
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
1692
+ _request, stream=_stream, **kwargs
1693
+ )
1694
+
1695
+ response = pipeline_response.http_response
1696
+
1697
+ if response.status_code not in [200]:
1698
+ if _stream:
1699
+ response.read() # Load the body in memory and close the socket
1700
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
1701
+ raise HttpResponseError(response=response)
1702
+
1703
+ if response.content:
1704
+ deserialized = response.json()
1705
+ else:
1706
+ deserialized = None
1707
+
1708
+ if cls:
1709
+ return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
1710
+
1711
+ return cast(JSON, deserialized) # type: ignore
1712
+
1713
+ @distributed_trace
1714
+ def list_customers(
1715
+ self, *, include_deleted: bool = False, page: int = 1, page_size: int = 100, **kwargs: Any
1716
+ ) -> List[JSON]:
1717
+ # pylint: disable=line-too-long
1718
+ """List customers.
1719
+
1720
+ :keyword include_deleted: Include deleted customers. Default value is False.
1721
+ :paramtype include_deleted: bool
1722
+ :keyword page: The page number. Default value is 1.
1723
+ :paramtype page: int
1724
+ :keyword page_size: The number of items in the page. Default value is 100.
1725
+ :paramtype page_size: int
1726
+ :return: list of JSON object
1727
+ :rtype: list[JSON]
1728
+ :raises ~azure.core.exceptions.HttpResponseError:
1729
+
1730
+ Example:
1731
+ .. code-block:: python
1732
+
1733
+ # response body for status code(s): 200
1734
+ response == [
1735
+ {
1736
+ "items": [
1737
+ {
1738
+ "id": {}, # A unique identifier for the customer.
1739
+ Required.
1740
+ "name": "str", # Human-readable name for the
1741
+ resource. Between 1 and 256 characters. Required.
1742
+ "usageAttribution": {
1743
+ "subjectKeys": [
1744
+ "str" # The subjects that are
1745
+ attributed to the customer. Required.
1746
+ ]
1747
+ },
1748
+ "archivedAt": {}, # Optional. Timestamp of when the
1749
+ resource was archived.
1750
+ "billingAddress": {
1751
+ "city": "str", # Optional. The billing
1752
+ address of the customer. Used for tax and invoicing.
1753
+ "country": "str", # Optional. `ISO 3166-1
1754
+ <https://www.iso.org/iso-3166-country-codes.html>`_ alpha-2
1755
+ country code. Custom two-letter country codes are also supported
1756
+ for convenience.
1757
+ "line1": "str", # Optional. The billing
1758
+ address of the customer. Used for tax and invoicing.
1759
+ "line2": "str", # Optional. The billing
1760
+ address of the customer. Used for tax and invoicing.
1761
+ "phoneNumber": "str", # Optional. The
1762
+ billing address of the customer. Used for tax and invoicing.
1763
+ "postalCode": "str", # Optional. The billing
1764
+ address of the customer. Used for tax and invoicing.
1765
+ "state": "str" # Optional. The billing
1766
+ address of the customer. Used for tax and invoicing.
1767
+ },
1768
+ "createdAt": {}, # Optional. Timestamp of when the
1769
+ resource was created.
1770
+ "currency": {}, # Optional. Currency of the
1771
+ customer. Used for billing, tax and invoicing.
1772
+ "deletedAt": {}, # Optional. Timestamp of when the
1773
+ resource was permanently deleted.
1774
+ "description": "str", # Optional. Optional
1775
+ description of the resource. Maximum 1024 characters.
1776
+ "external": {
1777
+ "stripeCustomerId": "str" # Optional. The
1778
+ Stripe customer ID. Mapping to a Stripe Customer object. Required
1779
+ to use Stripe as an invocing provider.
1780
+ },
1781
+ "metadata": {},
1782
+ "primaryEmail": "str", # Optional. The primary email
1783
+ address of the customer.
1784
+ "timezone": "str", # Optional. Timezone of the
1785
+ customer.
1786
+ "updatedAt": {} # Optional. Timestamp of when the
1787
+ resource was last updated.
1788
+ }
1789
+ ],
1790
+ "page": 0, # The page number. Required.
1791
+ "pageSize": 0, # The number of items in the page. Required.
1792
+ "totalCount": 0 # The total number of items. Required.
1793
+ }
1794
+ ]
1795
+ """
1796
+ error_map = {
1797
+ 404: ResourceNotFoundError,
1798
+ 409: ResourceExistsError,
1799
+ 304: ResourceNotModifiedError,
1800
+ 400: HttpResponseError,
1801
+ 401: lambda response: ClientAuthenticationError(response=response),
1802
+ }
1803
+ error_map.update(kwargs.pop("error_map", {}) or {})
1804
+
1805
+ _headers = kwargs.pop("headers", {}) or {}
1806
+ _params = kwargs.pop("params", {}) or {}
1807
+
1808
+ cls: ClsType[List[JSON]] = kwargs.pop("cls", None)
1809
+
1810
+ _request = build_list_customers_request(
1811
+ include_deleted=include_deleted,
1812
+ page=page,
1813
+ page_size=page_size,
1814
+ headers=_headers,
1815
+ params=_params,
1816
+ )
1817
+ _request.url = self._client.format_url(_request.url)
1818
+
1819
+ _stream = False
1820
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
1821
+ _request, stream=_stream, **kwargs
1822
+ )
1823
+
1824
+ response = pipeline_response.http_response
1825
+
1826
+ if response.status_code not in [200]:
1827
+ if _stream:
1828
+ response.read() # Load the body in memory and close the socket
1829
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
1830
+ raise HttpResponseError(response=response)
1831
+
1832
+ if response.content:
1833
+ deserialized = response.json()
1834
+ else:
1835
+ deserialized = None
1836
+
1837
+ if cls:
1838
+ return cls(pipeline_response, cast(List[JSON], deserialized), {}) # type: ignore
1839
+
1840
+ return cast(List[JSON], deserialized) # type: ignore
1841
+
1842
+ @distributed_trace
1843
+ def get_customer(self, customer_id_or_key: Any, **kwargs: Any) -> JSON:
1844
+ # pylint: disable=line-too-long
1845
+ """Get a customer by ID or key.
1846
+
1847
+ :param customer_id_or_key: Required.
1848
+ :type customer_id_or_key: any
1849
+ :return: JSON object
1850
+ :rtype: JSON
1851
+ :raises ~azure.core.exceptions.HttpResponseError:
1852
+
1853
+ Example:
1854
+ .. code-block:: python
1855
+
1856
+ # response body for status code(s): 200
1857
+ response == {
1858
+ "id": {}, # A unique identifier for the customer. Required.
1859
+ "name": "str", # Human-readable name for the resource. Between 1 and 256
1860
+ characters. Required.
1861
+ "usageAttribution": {
1862
+ "subjectKeys": [
1863
+ "str" # The subjects that are attributed to the customer.
1864
+ Required.
1865
+ ]
1866
+ },
1867
+ "archivedAt": {}, # Optional. Timestamp of when the resource was archived.
1868
+ "billingAddress": {
1869
+ "city": "str", # Optional. The billing address of the customer. Used
1870
+ for tax and invoicing.
1871
+ "country": "str", # Optional. `ISO 3166-1
1872
+ <https://www.iso.org/iso-3166-country-codes.html>`_ alpha-2 country code.
1873
+ Custom two-letter country codes are also supported for convenience.
1874
+ "line1": "str", # Optional. The billing address of the customer.
1875
+ Used for tax and invoicing.
1876
+ "line2": "str", # Optional. The billing address of the customer.
1877
+ Used for tax and invoicing.
1878
+ "phoneNumber": "str", # Optional. The billing address of the
1879
+ customer. Used for tax and invoicing.
1880
+ "postalCode": "str", # Optional. The billing address of the
1881
+ customer. Used for tax and invoicing.
1882
+ "state": "str" # Optional. The billing address of the customer. Used
1883
+ for tax and invoicing.
1884
+ },
1885
+ "createdAt": {}, # Optional. Timestamp of when the resource was created.
1886
+ "currency": {}, # Optional. Currency of the customer. Used for billing, tax
1887
+ and invoicing.
1888
+ "deletedAt": {}, # Optional. Timestamp of when the resource was permanently
1889
+ deleted.
1890
+ "description": "str", # Optional. Optional description of the resource.
1891
+ Maximum 1024 characters.
1892
+ "external": {
1893
+ "stripeCustomerId": "str" # Optional. The Stripe customer ID.
1894
+ Mapping to a Stripe Customer object. Required to use Stripe as an invocing
1895
+ provider.
1896
+ },
1897
+ "metadata": {},
1898
+ "primaryEmail": "str", # Optional. The primary email address of the
1899
+ customer.
1900
+ "timezone": "str", # Optional. Timezone of the customer.
1901
+ "updatedAt": {} # Optional. Timestamp of when the resource was last updated.
1902
+ }
1903
+ """
1904
+ error_map = {
1905
+ 404: ResourceNotFoundError,
1906
+ 409: ResourceExistsError,
1907
+ 304: ResourceNotModifiedError,
1908
+ 400: HttpResponseError,
1909
+ 401: lambda response: ClientAuthenticationError(response=response),
1910
+ }
1911
+ error_map.update(kwargs.pop("error_map", {}) or {})
1912
+
1913
+ _headers = kwargs.pop("headers", {}) or {}
1914
+ _params = kwargs.pop("params", {}) or {}
1915
+
1916
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
1917
+
1918
+ _request = build_get_customer_request(
1919
+ customer_id_or_key=customer_id_or_key,
1920
+ headers=_headers,
1921
+ params=_params,
1922
+ )
1923
+ _request.url = self._client.format_url(_request.url)
1924
+
1925
+ _stream = False
1926
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
1927
+ _request, stream=_stream, **kwargs
1928
+ )
1929
+
1930
+ response = pipeline_response.http_response
1931
+
1932
+ if response.status_code not in [200]:
1933
+ if _stream:
1934
+ response.read() # Load the body in memory and close the socket
1935
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
1936
+ raise HttpResponseError(response=response)
1937
+
1938
+ if response.content:
1939
+ deserialized = response.json()
1940
+ else:
1941
+ deserialized = None
1942
+
1943
+ if cls:
1944
+ return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
1945
+
1946
+ return cast(JSON, deserialized) # type: ignore
1947
+
1948
+ @overload
1949
+ def update_customer(
1950
+ self, customer_id_or_key: Any, body: JSON, *, content_type: str = "application/json", **kwargs: Any
1951
+ ) -> JSON:
1952
+ # pylint: disable=line-too-long
1953
+ """Update a customer by ID or key.
1954
+
1955
+ :param customer_id_or_key: Required.
1956
+ :type customer_id_or_key: any
1957
+ :param body: Required.
1958
+ :type body: JSON
1959
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
1960
+ Default value is "application/json".
1961
+ :paramtype content_type: str
1962
+ :return: JSON object
1963
+ :rtype: JSON
1964
+ :raises ~azure.core.exceptions.HttpResponseError:
1965
+
1966
+ Example:
1967
+ .. code-block:: python
1968
+
1969
+ # JSON input template you can fill out and use as your body input.
1970
+ body = {
1971
+ "id": {}, # A unique identifier for the customer. Required.
1972
+ "name": "str", # Human-readable name for the resource. Between 1 and 256
1973
+ characters. Required.
1974
+ "usageAttribution": {
1975
+ "subjectKeys": [
1976
+ "str" # The subjects that are attributed to the customer.
1977
+ Required.
1978
+ ]
1979
+ },
1980
+ "archivedAt": {}, # Optional. Timestamp of when the resource was archived.
1981
+ "billingAddress": {
1982
+ "city": "str", # Optional. The billing address of the customer. Used
1983
+ for tax and invoicing.
1984
+ "country": "str", # Optional. `ISO 3166-1
1985
+ <https://www.iso.org/iso-3166-country-codes.html>`_ alpha-2 country code.
1986
+ Custom two-letter country codes are also supported for convenience.
1987
+ "line1": "str", # Optional. The billing address of the customer.
1988
+ Used for tax and invoicing.
1989
+ "line2": "str", # Optional. The billing address of the customer.
1990
+ Used for tax and invoicing.
1991
+ "phoneNumber": "str", # Optional. The billing address of the
1992
+ customer. Used for tax and invoicing.
1993
+ "postalCode": "str", # Optional. The billing address of the
1994
+ customer. Used for tax and invoicing.
1995
+ "state": "str" # Optional. The billing address of the customer. Used
1996
+ for tax and invoicing.
1997
+ },
1998
+ "createdAt": {}, # Optional. Timestamp of when the resource was created.
1999
+ "currency": {}, # Optional. Currency of the customer. Used for billing, tax
2000
+ and invoicing.
2001
+ "deletedAt": {}, # Optional. Timestamp of when the resource was permanently
2002
+ deleted.
2003
+ "description": "str", # Optional. Optional description of the resource.
2004
+ Maximum 1024 characters.
2005
+ "external": {
2006
+ "stripeCustomerId": "str" # Optional. The Stripe customer ID.
2007
+ Mapping to a Stripe Customer object. Required to use Stripe as an invocing
2008
+ provider.
2009
+ },
2010
+ "metadata": {},
2011
+ "primaryEmail": "str", # Optional. The primary email address of the
2012
+ customer.
2013
+ "timezone": "str", # Optional. Timezone of the customer.
2014
+ "updatedAt": {} # Optional. Timestamp of when the resource was last updated.
2015
+ }
1140
2016
 
1141
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
1142
- accept = _headers.pop("Accept", "application/json, application/problem+json")
2017
+ # response body for status code(s): 200
2018
+ response == {
2019
+ "id": {}, # A unique identifier for the customer. Required.
2020
+ "name": "str", # Human-readable name for the resource. Between 1 and 256
2021
+ characters. Required.
2022
+ "usageAttribution": {
2023
+ "subjectKeys": [
2024
+ "str" # The subjects that are attributed to the customer.
2025
+ Required.
2026
+ ]
2027
+ },
2028
+ "archivedAt": {}, # Optional. Timestamp of when the resource was archived.
2029
+ "billingAddress": {
2030
+ "city": "str", # Optional. The billing address of the customer. Used
2031
+ for tax and invoicing.
2032
+ "country": "str", # Optional. `ISO 3166-1
2033
+ <https://www.iso.org/iso-3166-country-codes.html>`_ alpha-2 country code.
2034
+ Custom two-letter country codes are also supported for convenience.
2035
+ "line1": "str", # Optional. The billing address of the customer.
2036
+ Used for tax and invoicing.
2037
+ "line2": "str", # Optional. The billing address of the customer.
2038
+ Used for tax and invoicing.
2039
+ "phoneNumber": "str", # Optional. The billing address of the
2040
+ customer. Used for tax and invoicing.
2041
+ "postalCode": "str", # Optional. The billing address of the
2042
+ customer. Used for tax and invoicing.
2043
+ "state": "str" # Optional. The billing address of the customer. Used
2044
+ for tax and invoicing.
2045
+ },
2046
+ "createdAt": {}, # Optional. Timestamp of when the resource was created.
2047
+ "currency": {}, # Optional. Currency of the customer. Used for billing, tax
2048
+ and invoicing.
2049
+ "deletedAt": {}, # Optional. Timestamp of when the resource was permanently
2050
+ deleted.
2051
+ "description": "str", # Optional. Optional description of the resource.
2052
+ Maximum 1024 characters.
2053
+ "external": {
2054
+ "stripeCustomerId": "str" # Optional. The Stripe customer ID.
2055
+ Mapping to a Stripe Customer object. Required to use Stripe as an invocing
2056
+ provider.
2057
+ },
2058
+ "metadata": {},
2059
+ "primaryEmail": "str", # Optional. The primary email address of the
2060
+ customer.
2061
+ "timezone": "str", # Optional. Timezone of the customer.
2062
+ "updatedAt": {} # Optional. Timestamp of when the resource was last updated.
2063
+ }
2064
+ """
1143
2065
 
1144
- # Construct URL
1145
- _url = "/api/v1/notification/rules/{ruleId}"
1146
- path_format_arguments = {
1147
- "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"),
1148
- }
2066
+ @overload
2067
+ def update_customer(
2068
+ self, customer_id_or_key: Any, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
2069
+ ) -> JSON:
2070
+ # pylint: disable=line-too-long
2071
+ """Update a customer by ID or key.
1149
2072
 
1150
- _url: str = _url.format(**path_format_arguments) # type: ignore
2073
+ :param customer_id_or_key: Required.
2074
+ :type customer_id_or_key: any
2075
+ :param body: Required.
2076
+ :type body: IO[bytes]
2077
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
2078
+ Default value is "application/json".
2079
+ :paramtype content_type: str
2080
+ :return: JSON object
2081
+ :rtype: JSON
2082
+ :raises ~azure.core.exceptions.HttpResponseError:
1151
2083
 
1152
- # Construct headers
1153
- if content_type is not None:
1154
- _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
1155
- _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
2084
+ Example:
2085
+ .. code-block:: python
1156
2086
 
1157
- return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs)
2087
+ # response body for status code(s): 200
2088
+ response == {
2089
+ "id": {}, # A unique identifier for the customer. Required.
2090
+ "name": "str", # Human-readable name for the resource. Between 1 and 256
2091
+ characters. Required.
2092
+ "usageAttribution": {
2093
+ "subjectKeys": [
2094
+ "str" # The subjects that are attributed to the customer.
2095
+ Required.
2096
+ ]
2097
+ },
2098
+ "archivedAt": {}, # Optional. Timestamp of when the resource was archived.
2099
+ "billingAddress": {
2100
+ "city": "str", # Optional. The billing address of the customer. Used
2101
+ for tax and invoicing.
2102
+ "country": "str", # Optional. `ISO 3166-1
2103
+ <https://www.iso.org/iso-3166-country-codes.html>`_ alpha-2 country code.
2104
+ Custom two-letter country codes are also supported for convenience.
2105
+ "line1": "str", # Optional. The billing address of the customer.
2106
+ Used for tax and invoicing.
2107
+ "line2": "str", # Optional. The billing address of the customer.
2108
+ Used for tax and invoicing.
2109
+ "phoneNumber": "str", # Optional. The billing address of the
2110
+ customer. Used for tax and invoicing.
2111
+ "postalCode": "str", # Optional. The billing address of the
2112
+ customer. Used for tax and invoicing.
2113
+ "state": "str" # Optional. The billing address of the customer. Used
2114
+ for tax and invoicing.
2115
+ },
2116
+ "createdAt": {}, # Optional. Timestamp of when the resource was created.
2117
+ "currency": {}, # Optional. Currency of the customer. Used for billing, tax
2118
+ and invoicing.
2119
+ "deletedAt": {}, # Optional. Timestamp of when the resource was permanently
2120
+ deleted.
2121
+ "description": "str", # Optional. Optional description of the resource.
2122
+ Maximum 1024 characters.
2123
+ "external": {
2124
+ "stripeCustomerId": "str" # Optional. The Stripe customer ID.
2125
+ Mapping to a Stripe Customer object. Required to use Stripe as an invocing
2126
+ provider.
2127
+ },
2128
+ "metadata": {},
2129
+ "primaryEmail": "str", # Optional. The primary email address of the
2130
+ customer.
2131
+ "timezone": "str", # Optional. Timezone of the customer.
2132
+ "updatedAt": {} # Optional. Timestamp of when the resource was last updated.
2133
+ }
2134
+ """
1158
2135
 
2136
+ @distributed_trace
2137
+ def update_customer(self, customer_id_or_key: Any, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
2138
+ # pylint: disable=line-too-long
2139
+ """Update a customer by ID or key.
1159
2140
 
1160
- def build_test_notification_rule_request(rule_id: str, **kwargs: Any) -> HttpRequest:
1161
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
2141
+ :param customer_id_or_key: Required.
2142
+ :type customer_id_or_key: any
2143
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
2144
+ :type body: JSON or IO[bytes]
2145
+ :return: JSON object
2146
+ :rtype: JSON
2147
+ :raises ~azure.core.exceptions.HttpResponseError:
1162
2148
 
1163
- accept = _headers.pop("Accept", "application/json, application/problem+json")
2149
+ Example:
2150
+ .. code-block:: python
1164
2151
 
1165
- # Construct URL
1166
- _url = "/api/v1/notification/rules/{ruleId}/test"
1167
- path_format_arguments = {
1168
- "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"),
1169
- }
2152
+ # JSON input template you can fill out and use as your body input.
2153
+ body = {
2154
+ "id": {}, # A unique identifier for the customer. Required.
2155
+ "name": "str", # Human-readable name for the resource. Between 1 and 256
2156
+ characters. Required.
2157
+ "usageAttribution": {
2158
+ "subjectKeys": [
2159
+ "str" # The subjects that are attributed to the customer.
2160
+ Required.
2161
+ ]
2162
+ },
2163
+ "archivedAt": {}, # Optional. Timestamp of when the resource was archived.
2164
+ "billingAddress": {
2165
+ "city": "str", # Optional. The billing address of the customer. Used
2166
+ for tax and invoicing.
2167
+ "country": "str", # Optional. `ISO 3166-1
2168
+ <https://www.iso.org/iso-3166-country-codes.html>`_ alpha-2 country code.
2169
+ Custom two-letter country codes are also supported for convenience.
2170
+ "line1": "str", # Optional. The billing address of the customer.
2171
+ Used for tax and invoicing.
2172
+ "line2": "str", # Optional. The billing address of the customer.
2173
+ Used for tax and invoicing.
2174
+ "phoneNumber": "str", # Optional. The billing address of the
2175
+ customer. Used for tax and invoicing.
2176
+ "postalCode": "str", # Optional. The billing address of the
2177
+ customer. Used for tax and invoicing.
2178
+ "state": "str" # Optional. The billing address of the customer. Used
2179
+ for tax and invoicing.
2180
+ },
2181
+ "createdAt": {}, # Optional. Timestamp of when the resource was created.
2182
+ "currency": {}, # Optional. Currency of the customer. Used for billing, tax
2183
+ and invoicing.
2184
+ "deletedAt": {}, # Optional. Timestamp of when the resource was permanently
2185
+ deleted.
2186
+ "description": "str", # Optional. Optional description of the resource.
2187
+ Maximum 1024 characters.
2188
+ "external": {
2189
+ "stripeCustomerId": "str" # Optional. The Stripe customer ID.
2190
+ Mapping to a Stripe Customer object. Required to use Stripe as an invocing
2191
+ provider.
2192
+ },
2193
+ "metadata": {},
2194
+ "primaryEmail": "str", # Optional. The primary email address of the
2195
+ customer.
2196
+ "timezone": "str", # Optional. Timezone of the customer.
2197
+ "updatedAt": {} # Optional. Timestamp of when the resource was last updated.
2198
+ }
1170
2199
 
1171
- _url: str = _url.format(**path_format_arguments) # type: ignore
2200
+ # response body for status code(s): 200
2201
+ response == {
2202
+ "id": {}, # A unique identifier for the customer. Required.
2203
+ "name": "str", # Human-readable name for the resource. Between 1 and 256
2204
+ characters. Required.
2205
+ "usageAttribution": {
2206
+ "subjectKeys": [
2207
+ "str" # The subjects that are attributed to the customer.
2208
+ Required.
2209
+ ]
2210
+ },
2211
+ "archivedAt": {}, # Optional. Timestamp of when the resource was archived.
2212
+ "billingAddress": {
2213
+ "city": "str", # Optional. The billing address of the customer. Used
2214
+ for tax and invoicing.
2215
+ "country": "str", # Optional. `ISO 3166-1
2216
+ <https://www.iso.org/iso-3166-country-codes.html>`_ alpha-2 country code.
2217
+ Custom two-letter country codes are also supported for convenience.
2218
+ "line1": "str", # Optional. The billing address of the customer.
2219
+ Used for tax and invoicing.
2220
+ "line2": "str", # Optional. The billing address of the customer.
2221
+ Used for tax and invoicing.
2222
+ "phoneNumber": "str", # Optional. The billing address of the
2223
+ customer. Used for tax and invoicing.
2224
+ "postalCode": "str", # Optional. The billing address of the
2225
+ customer. Used for tax and invoicing.
2226
+ "state": "str" # Optional. The billing address of the customer. Used
2227
+ for tax and invoicing.
2228
+ },
2229
+ "createdAt": {}, # Optional. Timestamp of when the resource was created.
2230
+ "currency": {}, # Optional. Currency of the customer. Used for billing, tax
2231
+ and invoicing.
2232
+ "deletedAt": {}, # Optional. Timestamp of when the resource was permanently
2233
+ deleted.
2234
+ "description": "str", # Optional. Optional description of the resource.
2235
+ Maximum 1024 characters.
2236
+ "external": {
2237
+ "stripeCustomerId": "str" # Optional. The Stripe customer ID.
2238
+ Mapping to a Stripe Customer object. Required to use Stripe as an invocing
2239
+ provider.
2240
+ },
2241
+ "metadata": {},
2242
+ "primaryEmail": "str", # Optional. The primary email address of the
2243
+ customer.
2244
+ "timezone": "str", # Optional. Timezone of the customer.
2245
+ "updatedAt": {} # Optional. Timestamp of when the resource was last updated.
2246
+ }
2247
+ """
2248
+ error_map = {
2249
+ 404: ResourceNotFoundError,
2250
+ 409: ResourceExistsError,
2251
+ 304: ResourceNotModifiedError,
2252
+ 400: HttpResponseError,
2253
+ 401: lambda response: ClientAuthenticationError(response=response),
2254
+ }
2255
+ error_map.update(kwargs.pop("error_map", {}) or {})
1172
2256
 
1173
- # Construct headers
1174
- _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
2257
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
2258
+ _params = kwargs.pop("params", {}) or {}
1175
2259
 
1176
- return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
2260
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
2261
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
1177
2262
 
2263
+ content_type = content_type or "application/json"
2264
+ _json = None
2265
+ _content = None
2266
+ if isinstance(body, (IOBase, bytes)):
2267
+ _content = body
2268
+ else:
2269
+ _json = body
1178
2270
 
1179
- def build_list_notification_events_request(
1180
- *,
1181
- page: int = 1,
1182
- page_size: int = 100,
1183
- order_by: str = "createdAt",
1184
- order: str = "ASC",
1185
- from_parameter: Optional[datetime.datetime] = None,
1186
- to: Optional[datetime.datetime] = None,
1187
- feature: Optional[List[str]] = None,
1188
- subject: Optional[List[str]] = None,
1189
- rule: Optional[List[str]] = None,
1190
- channel: Optional[List[str]] = None,
1191
- **kwargs: Any
1192
- ) -> HttpRequest:
1193
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
1194
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
2271
+ _request = build_update_customer_request(
2272
+ customer_id_or_key=customer_id_or_key,
2273
+ content_type=content_type,
2274
+ json=_json,
2275
+ content=_content,
2276
+ headers=_headers,
2277
+ params=_params,
2278
+ )
2279
+ _request.url = self._client.format_url(_request.url)
1195
2280
 
1196
- accept = _headers.pop("Accept", "application/json, application/problem+json")
2281
+ _stream = False
2282
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
2283
+ _request, stream=_stream, **kwargs
2284
+ )
1197
2285
 
1198
- # Construct URL
1199
- _url = "/api/v1/notification/events"
2286
+ response = pipeline_response.http_response
1200
2287
 
1201
- # Construct parameters
1202
- if page is not None:
1203
- _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1)
1204
- if page_size is not None:
1205
- _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int", maximum=1000, minimum=1)
1206
- if order_by is not None:
1207
- _params["orderBy"] = _SERIALIZER.query("order_by", order_by, "str")
1208
- if order is not None:
1209
- _params["order"] = _SERIALIZER.query("order", order, "str")
1210
- if from_parameter is not None:
1211
- _params["from"] = _SERIALIZER.query("from_parameter", from_parameter, "iso-8601")
1212
- if to is not None:
1213
- _params["to"] = _SERIALIZER.query("to", to, "iso-8601")
1214
- if feature is not None:
1215
- _params["feature"] = _SERIALIZER.query("feature", feature, "[str]")
1216
- if subject is not None:
1217
- _params["subject"] = _SERIALIZER.query("subject", subject, "[str]")
1218
- if rule is not None:
1219
- _params["rule"] = _SERIALIZER.query("rule", rule, "[str]")
1220
- if channel is not None:
1221
- _params["channel"] = _SERIALIZER.query("channel", channel, "[str]")
2288
+ if response.status_code not in [200]:
2289
+ if _stream:
2290
+ response.read() # Load the body in memory and close the socket
2291
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
2292
+ raise HttpResponseError(response=response)
1222
2293
 
1223
- # Construct headers
1224
- _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
2294
+ if response.content:
2295
+ deserialized = response.json()
2296
+ else:
2297
+ deserialized = None
1225
2298
 
1226
- return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
2299
+ if cls:
2300
+ return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
1227
2301
 
2302
+ return cast(JSON, deserialized) # type: ignore
1228
2303
 
1229
- def build_get_notification_event_request(event_id: str, **kwargs: Any) -> HttpRequest:
1230
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
2304
+ @distributed_trace
2305
+ def delete_customer(self, customer_id_or_key: Any, **kwargs: Any) -> JSON:
2306
+ # pylint: disable=line-too-long
2307
+ """Delete a customer by ID or key.
1231
2308
 
1232
- accept = _headers.pop("Accept", "application/json, application/problem+json")
2309
+ :param customer_id_or_key: Required.
2310
+ :type customer_id_or_key: any
2311
+ :return: JSON object
2312
+ :rtype: JSON
2313
+ :raises ~azure.core.exceptions.HttpResponseError:
1233
2314
 
1234
- # Construct URL
1235
- _url = "/api/v1/notification/events/{eventId}"
1236
- path_format_arguments = {
1237
- "eventId": _SERIALIZER.url("event_id", event_id, "str"),
1238
- }
2315
+ Example:
2316
+ .. code-block:: python
1239
2317
 
1240
- _url: str = _url.format(**path_format_arguments) # type: ignore
2318
+ # response body for status code(s): 200
2319
+ response == {
2320
+ "id": {}, # A unique identifier for the customer. Required.
2321
+ "name": "str", # Human-readable name for the resource. Between 1 and 256
2322
+ characters. Required.
2323
+ "usageAttribution": {
2324
+ "subjectKeys": [
2325
+ "str" # The subjects that are attributed to the customer.
2326
+ Required.
2327
+ ]
2328
+ },
2329
+ "archivedAt": {}, # Optional. Timestamp of when the resource was archived.
2330
+ "billingAddress": {
2331
+ "city": "str", # Optional. The billing address of the customer. Used
2332
+ for tax and invoicing.
2333
+ "country": "str", # Optional. `ISO 3166-1
2334
+ <https://www.iso.org/iso-3166-country-codes.html>`_ alpha-2 country code.
2335
+ Custom two-letter country codes are also supported for convenience.
2336
+ "line1": "str", # Optional. The billing address of the customer.
2337
+ Used for tax and invoicing.
2338
+ "line2": "str", # Optional. The billing address of the customer.
2339
+ Used for tax and invoicing.
2340
+ "phoneNumber": "str", # Optional. The billing address of the
2341
+ customer. Used for tax and invoicing.
2342
+ "postalCode": "str", # Optional. The billing address of the
2343
+ customer. Used for tax and invoicing.
2344
+ "state": "str" # Optional. The billing address of the customer. Used
2345
+ for tax and invoicing.
2346
+ },
2347
+ "createdAt": {}, # Optional. Timestamp of when the resource was created.
2348
+ "currency": {}, # Optional. Currency of the customer. Used for billing, tax
2349
+ and invoicing.
2350
+ "deletedAt": {}, # Optional. Timestamp of when the resource was permanently
2351
+ deleted.
2352
+ "description": "str", # Optional. Optional description of the resource.
2353
+ Maximum 1024 characters.
2354
+ "external": {
2355
+ "stripeCustomerId": "str" # Optional. The Stripe customer ID.
2356
+ Mapping to a Stripe Customer object. Required to use Stripe as an invocing
2357
+ provider.
2358
+ },
2359
+ "metadata": {},
2360
+ "primaryEmail": "str", # Optional. The primary email address of the
2361
+ customer.
2362
+ "timezone": "str", # Optional. Timezone of the customer.
2363
+ "updatedAt": {} # Optional. Timestamp of when the resource was last updated.
2364
+ }
2365
+ """
2366
+ error_map = {
2367
+ 404: ResourceNotFoundError,
2368
+ 409: ResourceExistsError,
2369
+ 304: ResourceNotModifiedError,
2370
+ 400: HttpResponseError,
2371
+ 401: lambda response: ClientAuthenticationError(response=response),
2372
+ }
2373
+ error_map.update(kwargs.pop("error_map", {}) or {})
1241
2374
 
1242
- # Construct headers
1243
- _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
2375
+ _headers = kwargs.pop("headers", {}) or {}
2376
+ _params = kwargs.pop("params", {}) or {}
1244
2377
 
1245
- return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
2378
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
1246
2379
 
2380
+ _request = build_delete_customer_request(
2381
+ customer_id_or_key=customer_id_or_key,
2382
+ headers=_headers,
2383
+ params=_params,
2384
+ )
2385
+ _request.url = self._client.format_url(_request.url)
1247
2386
 
1248
- def build_receive_svix_operational_event_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long
1249
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
2387
+ _stream = False
2388
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
2389
+ _request, stream=_stream, **kwargs
2390
+ )
1250
2391
 
1251
- content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
1252
- accept = _headers.pop("Accept", "application/problem+json")
2392
+ response = pipeline_response.http_response
1253
2393
 
1254
- # Construct URL
1255
- _url = "/api/v1/notification/webhook/svix"
2394
+ if response.status_code not in [200]:
2395
+ if _stream:
2396
+ response.read() # Load the body in memory and close the socket
2397
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
2398
+ raise HttpResponseError(response=response)
1256
2399
 
1257
- # Construct headers
1258
- if content_type is not None:
1259
- _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
1260
- _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
2400
+ if response.content:
2401
+ deserialized = response.json()
2402
+ else:
2403
+ deserialized = None
1261
2404
 
1262
- return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
2405
+ if cls:
2406
+ return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore
1263
2407
 
2408
+ return cast(JSON, deserialized) # type: ignore
1264
2409
 
1265
- class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-methods
1266
2410
  @distributed_trace
1267
2411
  def list_events(
1268
2412
  self,
@@ -2623,11 +3767,11 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
2623
3767
  # response body for status code(s): 200
2624
3768
  response == [
2625
3769
  {
3770
+ "id": "str", # Required.
2626
3771
  "key": "str", # Required.
2627
3772
  "currentPeriodEnd": "2020-02-20 00:00:00", # Optional.
2628
3773
  "currentPeriodStart": "2020-02-20 00:00:00", # Optional.
2629
3774
  "displayName": "str", # Optional.
2630
- "id": "str", # Optional.
2631
3775
  "metadata": {
2632
3776
  "str": {} # Optional. Dictionary of :code:`<any>`.
2633
3777
  },
@@ -2702,11 +3846,11 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
2702
3846
  # JSON input template you can fill out and use as your body input.
2703
3847
  body = [
2704
3848
  {
3849
+ "id": "str", # Required.
2705
3850
  "key": "str", # Required.
2706
3851
  "currentPeriodEnd": "2020-02-20 00:00:00", # Optional.
2707
3852
  "currentPeriodStart": "2020-02-20 00:00:00", # Optional.
2708
3853
  "displayName": "str", # Optional.
2709
- "id": "str", # Optional.
2710
3854
  "metadata": {
2711
3855
  "str": {} # Optional. Dictionary of :code:`<any>`.
2712
3856
  },
@@ -2717,11 +3861,11 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
2717
3861
  # response body for status code(s): 200
2718
3862
  response == [
2719
3863
  {
3864
+ "id": "str", # Required.
2720
3865
  "key": "str", # Required.
2721
3866
  "currentPeriodEnd": "2020-02-20 00:00:00", # Optional.
2722
3867
  "currentPeriodStart": "2020-02-20 00:00:00", # Optional.
2723
3868
  "displayName": "str", # Optional.
2724
- "id": "str", # Optional.
2725
3869
  "metadata": {
2726
3870
  "str": {} # Optional. Dictionary of :code:`<any>`.
2727
3871
  },
@@ -2755,11 +3899,11 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
2755
3899
  # response body for status code(s): 200
2756
3900
  response == [
2757
3901
  {
3902
+ "id": "str", # Required.
2758
3903
  "key": "str", # Required.
2759
3904
  "currentPeriodEnd": "2020-02-20 00:00:00", # Optional.
2760
3905
  "currentPeriodStart": "2020-02-20 00:00:00", # Optional.
2761
3906
  "displayName": "str", # Optional.
2762
- "id": "str", # Optional.
2763
3907
  "metadata": {
2764
3908
  "str": {} # Optional. Dictionary of :code:`<any>`.
2765
3909
  },
@@ -2790,11 +3934,11 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
2790
3934
  # response body for status code(s): 200
2791
3935
  response == [
2792
3936
  {
3937
+ "id": "str", # Required.
2793
3938
  "key": "str", # Required.
2794
3939
  "currentPeriodEnd": "2020-02-20 00:00:00", # Optional.
2795
3940
  "currentPeriodStart": "2020-02-20 00:00:00", # Optional.
2796
3941
  "displayName": "str", # Optional.
2797
- "id": "str", # Optional.
2798
3942
  "metadata": {
2799
3943
  "str": {} # Optional. Dictionary of :code:`<any>`.
2800
3944
  },
@@ -2877,11 +4021,11 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
2877
4021
 
2878
4022
  # response body for status code(s): 200
2879
4023
  response == {
4024
+ "id": "str", # Required.
2880
4025
  "key": "str", # Required.
2881
4026
  "currentPeriodEnd": "2020-02-20 00:00:00", # Optional.
2882
4027
  "currentPeriodStart": "2020-02-20 00:00:00", # Optional.
2883
4028
  "displayName": "str", # Optional.
2884
- "id": "str", # Optional.
2885
4029
  "metadata": {
2886
4030
  "str": {} # Optional. Dictionary of :code:`<any>`.
2887
4031
  },