afternoon-sdk 0.0.6 → 0.0.7

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/reference.md +28 -490
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "afternoon-sdk",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "private": false,
5
5
  "repository": "https://github.com/fern-demo/afternoon-ts-sdk",
6
6
  "type": "commonjs",
package/reference.md CHANGED
@@ -326,9 +326,7 @@ await client.customers.updateACustomer({
326
326
  </dl>
327
327
  </details>
328
328
 
329
- ## Events
330
-
331
- <details><summary><code>client.events.<a href="/src/api/resources/events/client/Client.ts">ingestBillableEvents</a>({ ...params }) -> Afternoon.IngestResponse</code></summary>
329
+ <details><summary><code>client.customers.<a href="/src/api/resources/customers/client/Client.ts">listCustomerBalances</a>({ ...params }) -> Afternoon.CustomerBalancesResponse</code></summary>
332
330
  <dl>
333
331
  <dd>
334
332
 
@@ -340,7 +338,7 @@ await client.customers.updateACustomer({
340
338
  <dl>
341
339
  <dd>
342
340
 
343
- Accepts a batch of billable events for processing. Events are queued for async processing.
341
+ Returns all wallet balances for a customer.
344
342
 
345
343
  </dd>
346
344
  </dl>
@@ -356,15 +354,8 @@ Accepts a batch of billable events for processing. Events are queued for async p
356
354
  <dd>
357
355
 
358
356
  ```typescript
359
- await client.events.ingestBillableEvents({
360
- events: [
361
- {
362
- event_name: "api.request",
363
- idempotency_key: "evt_abc123xyz",
364
- customer_id: "cjld2cjxh0000qzrmn831i7rn",
365
- timestamp: "2023-11-07T05:31:56Z",
366
- },
367
- ],
357
+ await client.customers.listCustomerBalances({
358
+ id: "cm5x9z8nv0000h85r7l9p2k1m",
368
359
  });
369
360
  ```
370
361
 
@@ -381,7 +372,7 @@ await client.events.ingestBillableEvents({
381
372
  <dl>
382
373
  <dd>
383
374
 
384
- **request:** `Afternoon.IngestRequest`
375
+ **request:** `Afternoon.GetV1CustomersIdBalancesRequest`
385
376
 
386
377
  </dd>
387
378
  </dl>
@@ -389,7 +380,7 @@ await client.events.ingestBillableEvents({
389
380
  <dl>
390
381
  <dd>
391
382
 
392
- **requestOptions:** `Events.RequestOptions`
383
+ **requestOptions:** `Customers.RequestOptions`
393
384
 
394
385
  </dd>
395
386
  </dl>
@@ -400,7 +391,9 @@ await client.events.ingestBillableEvents({
400
391
  </dl>
401
392
  </details>
402
393
 
403
- <details><summary><code>client.events.<a href="/src/api/resources/events/client/Client.ts">synchronouslyIngestBillableEvents</a>({ ...params }) -> Afternoon.InngestSyncResponse</code></summary>
394
+ ## Events
395
+
396
+ <details><summary><code>client.events.<a href="/src/api/resources/events/client/Client.ts">ingestBillableEvents</a>({ ...params }) -> Afternoon.InngestSyncResponse</code></summary>
404
397
  <dl>
405
398
  <dd>
406
399
 
@@ -428,7 +421,7 @@ Accepts a single billable event and inserts it synchronously into the database.
428
421
  <dd>
429
422
 
430
423
  ```typescript
431
- await client.events.synchronouslyIngestBillableEvents({
424
+ await client.events.ingestBillableEvents({
432
425
  event_name: "api.request",
433
426
  idempotency_key: "evt_abc123xyz",
434
427
  customer_id: "cjld2cjxh0000qzrmn831i7rn",
@@ -667,7 +660,7 @@ await client.subscriptions.retrieveASubscription({
667
660
  </dl>
668
661
  </details>
669
662
 
670
- <details><summary><code>client.subscriptions.<a href="/src/api/resources/subscriptions/client/Client.ts">deleteASubscription</a>({ ...params }) -> Afternoon.DeleteSubscriptionResponse</code></summary>
663
+ <details><summary><code>client.subscriptions.<a href="/src/api/resources/subscriptions/client/Client.ts">updateASubscription</a>({ ...params }) -> Afternoon.SubscriptionResponse</code></summary>
671
664
  <dl>
672
665
  <dd>
673
666
 
@@ -679,7 +672,7 @@ await client.subscriptions.retrieveASubscription({
679
672
  <dl>
680
673
  <dd>
681
674
 
682
- Permanently deletes a subscription by its ID.
675
+ Updates an existing subscription. Only provided fields are changed. Setting status to "canceled" automatically sets canceled_at.
683
676
 
684
677
  </dd>
685
678
  </dl>
@@ -695,7 +688,7 @@ Permanently deletes a subscription by its ID.
695
688
  <dd>
696
689
 
697
690
  ```typescript
698
- await client.subscriptions.deleteASubscription({
691
+ await client.subscriptions.updateASubscription({
699
692
  id: "cm5x9z8nv0000h85r7l9p2k1m",
700
693
  });
701
694
  ```
@@ -713,7 +706,7 @@ await client.subscriptions.deleteASubscription({
713
706
  <dl>
714
707
  <dd>
715
708
 
716
- **request:** `Afternoon.DeleteV1SubscriptionsIdRequest`
709
+ **request:** `Afternoon.UpdateSubscriptionRequest`
717
710
 
718
711
  </dd>
719
712
  </dl>
@@ -732,7 +725,7 @@ await client.subscriptions.deleteASubscription({
732
725
  </dl>
733
726
  </details>
734
727
 
735
- <details><summary><code>client.subscriptions.<a href="/src/api/resources/subscriptions/client/Client.ts">updateASubscription</a>({ ...params }) -> Afternoon.SubscriptionResponse</code></summary>
728
+ <details><summary><code>client.subscriptions.<a href="/src/api/resources/subscriptions/client/Client.ts">cancelASubscription</a>({ ...params }) -> Afternoon.SubscriptionResponse</code></summary>
736
729
  <dl>
737
730
  <dd>
738
731
 
@@ -744,7 +737,7 @@ await client.subscriptions.deleteASubscription({
744
737
  <dl>
745
738
  <dd>
746
739
 
747
- Updates an existing subscription. Only provided fields are changed. Setting status to "canceled" automatically sets canceled_at.
740
+ Cancels a subscription immediately or at the end of the current billing period.
748
741
 
749
742
  </dd>
750
743
  </dl>
@@ -760,8 +753,9 @@ Updates an existing subscription. Only provided fields are changed. Setting stat
760
753
  <dd>
761
754
 
762
755
  ```typescript
763
- await client.subscriptions.updateASubscription({
756
+ await client.subscriptions.cancelASubscription({
764
757
  id: "cm5x9z8nv0000h85r7l9p2k1m",
758
+ cancel_mode: "now",
765
759
  });
766
760
  ```
767
761
 
@@ -778,7 +772,7 @@ await client.subscriptions.updateASubscription({
778
772
  <dl>
779
773
  <dd>
780
774
 
781
- **request:** `Afternoon.UpdateSubscriptionRequest`
775
+ **request:** `Afternoon.CancelSubscriptionRequest`
782
776
 
783
777
  </dd>
784
778
  </dl>
@@ -811,7 +805,7 @@ await client.subscriptions.updateASubscription({
811
805
  <dl>
812
806
  <dd>
813
807
 
814
- Returns a paginated list of invoices. Supports optional customer_id, subscription_id, and status filters.
808
+ Returns a paginated list of invoices. Supports optional customer_id, and status filters.
815
809
 
816
810
  </dd>
817
811
  </dl>
@@ -865,71 +859,6 @@ await client.invoices.listInvoices({
865
859
  </dl>
866
860
  </details>
867
861
 
868
- <details><summary><code>client.invoices.<a href="/src/api/resources/invoices/client/Client.ts">createADraftInvoice</a>({ ...params }) -> Afternoon.InvoiceResponse</code></summary>
869
- <dl>
870
- <dd>
871
-
872
- #### 📝 Description
873
-
874
- <dl>
875
- <dd>
876
-
877
- <dl>
878
- <dd>
879
-
880
- Creates a new draft invoice for a customer. The customer must belong to the authenticated company.
881
-
882
- </dd>
883
- </dl>
884
- </dd>
885
- </dl>
886
-
887
- #### 🔌 Usage
888
-
889
- <dl>
890
- <dd>
891
-
892
- <dl>
893
- <dd>
894
-
895
- ```typescript
896
- await client.invoices.createADraftInvoice({
897
- customer_id: "cm5x9z8nv0001h85r7l9p2k2m",
898
- });
899
- ```
900
-
901
- </dd>
902
- </dl>
903
- </dd>
904
- </dl>
905
-
906
- #### ⚙️ Parameters
907
-
908
- <dl>
909
- <dd>
910
-
911
- <dl>
912
- <dd>
913
-
914
- **request:** `Afternoon.CreateInvoiceRequest`
915
-
916
- </dd>
917
- </dl>
918
-
919
- <dl>
920
- <dd>
921
-
922
- **requestOptions:** `Invoices.RequestOptions`
923
-
924
- </dd>
925
- </dl>
926
- </dd>
927
- </dl>
928
-
929
- </dd>
930
- </dl>
931
- </details>
932
-
933
862
  <details><summary><code>client.invoices.<a href="/src/api/resources/invoices/client/Client.ts">retrieveAnInvoice</a>({ ...params }) -> Afternoon.InvoiceResponse</code></summary>
934
863
  <dl>
935
864
  <dd>
@@ -995,72 +924,9 @@ await client.invoices.retrieveAnInvoice({
995
924
  </dl>
996
925
  </details>
997
926
 
998
- <details><summary><code>client.invoices.<a href="/src/api/resources/invoices/client/Client.ts">deleteADraftInvoice</a>({ ...params }) -> Afternoon.DeleteInvoiceResponse</code></summary>
999
- <dl>
1000
- <dd>
1001
-
1002
- #### 📝 Description
1003
-
1004
- <dl>
1005
- <dd>
1006
-
1007
- <dl>
1008
- <dd>
1009
-
1010
- Permanently deletes a draft invoice. Returns 422 if the invoice is not in draft status.
1011
-
1012
- </dd>
1013
- </dl>
1014
- </dd>
1015
- </dl>
1016
-
1017
- #### 🔌 Usage
1018
-
1019
- <dl>
1020
- <dd>
927
+ ## SubscriptionSignupLinks
1021
928
 
1022
- <dl>
1023
- <dd>
1024
-
1025
- ```typescript
1026
- await client.invoices.deleteADraftInvoice({
1027
- id: "cm5x9z8nv0000h85r7l9p2k1m",
1028
- });
1029
- ```
1030
-
1031
- </dd>
1032
- </dl>
1033
- </dd>
1034
- </dl>
1035
-
1036
- #### ⚙️ Parameters
1037
-
1038
- <dl>
1039
- <dd>
1040
-
1041
- <dl>
1042
- <dd>
1043
-
1044
- **request:** `Afternoon.DeleteV1InvoicesIdRequest`
1045
-
1046
- </dd>
1047
- </dl>
1048
-
1049
- <dl>
1050
- <dd>
1051
-
1052
- **requestOptions:** `Invoices.RequestOptions`
1053
-
1054
- </dd>
1055
- </dl>
1056
- </dd>
1057
- </dl>
1058
-
1059
- </dd>
1060
- </dl>
1061
- </details>
1062
-
1063
- <details><summary><code>client.invoices.<a href="/src/api/resources/invoices/client/Client.ts">updateADraftInvoice</a>({ ...params }) -> Afternoon.InvoiceResponse</code></summary>
929
+ <details><summary><code>client.subscriptionSignupLinks.<a href="/src/api/resources/subscriptionSignupLinks/client/Client.ts">createASubscriptionSignupLink</a>({ ...params }) -> Afternoon.SubscriptionSignupLinkResponse</code></summary>
1064
930
  <dl>
1065
931
  <dd>
1066
932
 
@@ -1072,7 +938,7 @@ await client.invoices.deleteADraftInvoice({
1072
938
  <dl>
1073
939
  <dd>
1074
940
 
1075
- Updates a draft invoice. Only provided fields are changed. Returns 422 if the invoice is not in draft status.
941
+ Generates a tokenised signup link that allows a specific customer to subscribe to a plan. The returned token can be appended to your subscribe page URL (e.g. /subscribe/{token}). The token expires after 24 hours.
1076
942
 
1077
943
  </dd>
1078
944
  </dl>
@@ -1088,337 +954,9 @@ Updates a draft invoice. Only provided fields are changed. Returns 422 if the in
1088
954
  <dd>
1089
955
 
1090
956
  ```typescript
1091
- await client.invoices.updateADraftInvoice({
1092
- id: "cm5x9z8nv0000h85r7l9p2k1m",
1093
- });
1094
- ```
1095
-
1096
- </dd>
1097
- </dl>
1098
- </dd>
1099
- </dl>
1100
-
1101
- #### ⚙️ Parameters
1102
-
1103
- <dl>
1104
- <dd>
1105
-
1106
- <dl>
1107
- <dd>
1108
-
1109
- **request:** `Afternoon.UpdateInvoiceRequest`
1110
-
1111
- </dd>
1112
- </dl>
1113
-
1114
- <dl>
1115
- <dd>
1116
-
1117
- **requestOptions:** `Invoices.RequestOptions`
1118
-
1119
- </dd>
1120
- </dl>
1121
- </dd>
1122
- </dl>
1123
-
1124
- </dd>
1125
- </dl>
1126
- </details>
1127
-
1128
- <details><summary><code>client.invoices.<a href="/src/api/resources/invoices/client/Client.ts">finalizeADraftInvoice</a>({ ...params }) -> Afternoon.InvoiceResponse</code></summary>
1129
- <dl>
1130
- <dd>
1131
-
1132
- #### 📝 Description
1133
-
1134
- <dl>
1135
- <dd>
1136
-
1137
- <dl>
1138
- <dd>
1139
-
1140
- Transitions a draft invoice to open. Assigns an invoice number, sets finalizedAt, and recalculates totals. Requires at least one line item.
1141
-
1142
- </dd>
1143
- </dl>
1144
- </dd>
1145
- </dl>
1146
-
1147
- #### 🔌 Usage
1148
-
1149
- <dl>
1150
- <dd>
1151
-
1152
- <dl>
1153
- <dd>
1154
-
1155
- ```typescript
1156
- await client.invoices.finalizeADraftInvoice({
1157
- id: "cm5x9z8nv0000h85r7l9p2k1m",
1158
- });
1159
- ```
1160
-
1161
- </dd>
1162
- </dl>
1163
- </dd>
1164
- </dl>
1165
-
1166
- #### ⚙️ Parameters
1167
-
1168
- <dl>
1169
- <dd>
1170
-
1171
- <dl>
1172
- <dd>
1173
-
1174
- **request:** `Afternoon.PostV1InvoicesIdFinalizeRequest`
1175
-
1176
- </dd>
1177
- </dl>
1178
-
1179
- <dl>
1180
- <dd>
1181
-
1182
- **requestOptions:** `Invoices.RequestOptions`
1183
-
1184
- </dd>
1185
- </dl>
1186
- </dd>
1187
- </dl>
1188
-
1189
- </dd>
1190
- </dl>
1191
- </details>
1192
-
1193
- <details><summary><code>client.invoices.<a href="/src/api/resources/invoices/client/Client.ts">voidAnOpenInvoice</a>({ ...params }) -> Afternoon.InvoiceResponse</code></summary>
1194
- <dl>
1195
- <dd>
1196
-
1197
- #### 📝 Description
1198
-
1199
- <dl>
1200
- <dd>
1201
-
1202
- <dl>
1203
- <dd>
1204
-
1205
- Transitions an open invoice to void. Only open invoices can be voided.
1206
-
1207
- </dd>
1208
- </dl>
1209
- </dd>
1210
- </dl>
1211
-
1212
- #### 🔌 Usage
1213
-
1214
- <dl>
1215
- <dd>
1216
-
1217
- <dl>
1218
- <dd>
1219
-
1220
- ```typescript
1221
- await client.invoices.voidAnOpenInvoice({
1222
- id: "cm5x9z8nv0000h85r7l9p2k1m",
1223
- });
1224
- ```
1225
-
1226
- </dd>
1227
- </dl>
1228
- </dd>
1229
- </dl>
1230
-
1231
- #### ⚙️ Parameters
1232
-
1233
- <dl>
1234
- <dd>
1235
-
1236
- <dl>
1237
- <dd>
1238
-
1239
- **request:** `Afternoon.PostV1InvoicesIdVoidRequest`
1240
-
1241
- </dd>
1242
- </dl>
1243
-
1244
- <dl>
1245
- <dd>
1246
-
1247
- **requestOptions:** `Invoices.RequestOptions`
1248
-
1249
- </dd>
1250
- </dl>
1251
- </dd>
1252
- </dl>
1253
-
1254
- </dd>
1255
- </dl>
1256
- </details>
1257
-
1258
- <details><summary><code>client.invoices.<a href="/src/api/resources/invoices/client/Client.ts">addALineItem</a>({ ...params }) -> Afternoon.LineItemResponse</code></summary>
1259
- <dl>
1260
- <dd>
1261
-
1262
- #### 📝 Description
1263
-
1264
- <dl>
1265
- <dd>
1266
-
1267
- <dl>
1268
- <dd>
1269
-
1270
- Adds a line item to a draft invoice. Recalculates invoice totals.
1271
-
1272
- </dd>
1273
- </dl>
1274
- </dd>
1275
- </dl>
1276
-
1277
- #### 🔌 Usage
1278
-
1279
- <dl>
1280
- <dd>
1281
-
1282
- <dl>
1283
- <dd>
1284
-
1285
- ```typescript
1286
- await client.invoices.addALineItem({
1287
- id: "cm5x9z8nv0000h85r7l9p2k1m",
1288
- quantity: 1,
1289
- unit_amount_cents: 5000,
1290
- });
1291
- ```
1292
-
1293
- </dd>
1294
- </dl>
1295
- </dd>
1296
- </dl>
1297
-
1298
- #### ⚙️ Parameters
1299
-
1300
- <dl>
1301
- <dd>
1302
-
1303
- <dl>
1304
- <dd>
1305
-
1306
- **request:** `Afternoon.CreateLineItemRequest`
1307
-
1308
- </dd>
1309
- </dl>
1310
-
1311
- <dl>
1312
- <dd>
1313
-
1314
- **requestOptions:** `Invoices.RequestOptions`
1315
-
1316
- </dd>
1317
- </dl>
1318
- </dd>
1319
- </dl>
1320
-
1321
- </dd>
1322
- </dl>
1323
- </details>
1324
-
1325
- <details><summary><code>client.invoices.<a href="/src/api/resources/invoices/client/Client.ts">removeALineItem</a>({ ...params }) -> Afternoon.DeleteLineItemResponse</code></summary>
1326
- <dl>
1327
- <dd>
1328
-
1329
- #### 📝 Description
1330
-
1331
- <dl>
1332
- <dd>
1333
-
1334
- <dl>
1335
- <dd>
1336
-
1337
- Removes a line item from a draft invoice. Recalculates invoice totals.
1338
-
1339
- </dd>
1340
- </dl>
1341
- </dd>
1342
- </dl>
1343
-
1344
- #### 🔌 Usage
1345
-
1346
- <dl>
1347
- <dd>
1348
-
1349
- <dl>
1350
- <dd>
1351
-
1352
- ```typescript
1353
- await client.invoices.removeALineItem({
1354
- id: "id",
1355
- lineId: "lineId",
1356
- });
1357
- ```
1358
-
1359
- </dd>
1360
- </dl>
1361
- </dd>
1362
- </dl>
1363
-
1364
- #### ⚙️ Parameters
1365
-
1366
- <dl>
1367
- <dd>
1368
-
1369
- <dl>
1370
- <dd>
1371
-
1372
- **request:** `Afternoon.DeleteV1InvoicesIdLineItemsLineIdRequest`
1373
-
1374
- </dd>
1375
- </dl>
1376
-
1377
- <dl>
1378
- <dd>
1379
-
1380
- **requestOptions:** `Invoices.RequestOptions`
1381
-
1382
- </dd>
1383
- </dl>
1384
- </dd>
1385
- </dl>
1386
-
1387
- </dd>
1388
- </dl>
1389
- </details>
1390
-
1391
- <details><summary><code>client.invoices.<a href="/src/api/resources/invoices/client/Client.ts">updateALineItem</a>({ ...params }) -> Afternoon.LineItemResponse</code></summary>
1392
- <dl>
1393
- <dd>
1394
-
1395
- #### 📝 Description
1396
-
1397
- <dl>
1398
- <dd>
1399
-
1400
- <dl>
1401
- <dd>
1402
-
1403
- Updates a line item on a draft invoice. Recalculates invoice totals.
1404
-
1405
- </dd>
1406
- </dl>
1407
- </dd>
1408
- </dl>
1409
-
1410
- #### 🔌 Usage
1411
-
1412
- <dl>
1413
- <dd>
1414
-
1415
- <dl>
1416
- <dd>
1417
-
1418
- ```typescript
1419
- await client.invoices.updateALineItem({
1420
- id: "id",
1421
- lineId: "lineId",
957
+ await client.subscriptionSignupLinks.createASubscriptionSignupLink({
958
+ customer_id: "cm5x9z8nv0001h85r7l9p2k2m",
959
+ plan_id: "cm5x9z8nv0002h85r7l9p2k3m",
1422
960
  });
1423
961
  ```
1424
962
 
@@ -1435,7 +973,7 @@ await client.invoices.updateALineItem({
1435
973
  <dl>
1436
974
  <dd>
1437
975
 
1438
- **request:** `Afternoon.UpdateLineItemRequest`
976
+ **request:** `Afternoon.CreateSubscriptionSignupLinkRequest`
1439
977
 
1440
978
  </dd>
1441
979
  </dl>
@@ -1443,7 +981,7 @@ await client.invoices.updateALineItem({
1443
981
  <dl>
1444
982
  <dd>
1445
983
 
1446
- **requestOptions:** `Invoices.RequestOptions`
984
+ **requestOptions:** `SubscriptionSignupLinks.RequestOptions`
1447
985
 
1448
986
  </dd>
1449
987
  </dl>