keycloak-api 0.2.2 → 0.2.3

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.
package/dist/index.mjs CHANGED
@@ -85,18 +85,21 @@ class KeycloakAdminApi {
85
85
  }
86
86
  class KeycloakAccountApi {
87
87
  #baseUrl;
88
+ #realm;
88
89
  #token;
89
90
  #fetch;
90
91
  constructor(options) {
91
92
  this.#baseUrl = options.baseUrl;
93
+ this.#realm = options.realm;
92
94
  this.#token = options.token;
93
95
  this.#fetch = options.fetch || fetch;
94
96
  if (!this.#fetch) throw new Error("Fetch is required");
95
97
  }
96
98
  async request(endpoint, params) {
99
+ const baseUrl = `${this.#baseUrl}/realms/${this.#realm}`;
97
100
  const [method = "", url = ""] = endpoint.split(" ");
98
101
  const extraParams = params || {};
99
- const result = await fetch$1({ ...extraParams, method, url, baseUrl: this.#baseUrl, token: this.#token, fetchImpl: this.#fetch });
102
+ const result = await fetch$1({ ...extraParams, method, url, baseUrl, token: this.#token, fetchImpl: this.#fetch });
100
103
  return result;
101
104
  }
102
105
  }
@@ -1657,125 +1660,135 @@ const extra$1 = {
1657
1660
  };
1658
1661
 
1659
1662
  const getAccount = (variables, signal) => fetch$1({
1660
- url: "/{realm}/account/",
1663
+ url: "/account/",
1661
1664
  method: "get",
1662
1665
  ...variables,
1663
1666
  signal
1664
1667
  });
1665
1668
  const updateAccount = (variables, signal) => fetch$1({
1666
- url: "/{realm}/account/",
1669
+ url: "/account/",
1667
1670
  method: "post",
1668
1671
  ...variables,
1669
1672
  signal
1670
1673
  });
1671
- const getApplications = (variables, signal) => fetch$1({ url: "/{realm}/account/applications", method: "get", ...variables, signal });
1674
+ const getApplications = (variables, signal) => fetch$1({
1675
+ url: "/account/applications",
1676
+ method: "get",
1677
+ ...variables,
1678
+ signal
1679
+ });
1672
1680
  const getConsent = (variables, signal) => fetch$1({
1673
- url: "/{realm}/account/applications/{clientId}/consent",
1681
+ url: "/account/applications/{clientId}/consent",
1674
1682
  method: "get",
1675
1683
  ...variables,
1676
1684
  signal
1677
1685
  });
1678
1686
  const createConsent = (variables, signal) => fetch$1({
1679
- url: "/{realm}/account/applications/{clientId}/consent",
1687
+ url: "/account/applications/{clientId}/consent",
1680
1688
  method: "post",
1681
1689
  ...variables,
1682
1690
  signal
1683
1691
  });
1684
1692
  const updateConsent = (variables, signal) => fetch$1({
1685
- url: "/{realm}/account/applications/{clientId}/consent",
1693
+ url: "/account/applications/{clientId}/consent",
1686
1694
  method: "put",
1687
1695
  ...variables,
1688
1696
  signal
1689
1697
  });
1690
1698
  const deleteConsent = (variables, signal) => fetch$1({
1691
- url: "/{realm}/account/applications/{clientId}/consent",
1699
+ url: "/account/applications/{clientId}/consent",
1692
1700
  method: "delete",
1693
1701
  ...variables,
1694
1702
  signal
1695
1703
  });
1696
- const getCredentials = (variables, signal) => fetch$1({ url: "/{realm}/account/credentials", method: "get", ...variables, signal });
1704
+ const getCredentials = (variables, signal) => fetch$1({
1705
+ url: "/account/credentials",
1706
+ method: "get",
1707
+ ...variables,
1708
+ signal
1709
+ });
1697
1710
  const deleteCredential = (variables, signal) => fetch$1({
1698
- url: "/{realm}/account/credentials/{credentialId}",
1711
+ url: "/account/credentials/{credentialId}",
1699
1712
  method: "delete",
1700
1713
  ...variables,
1701
1714
  signal
1702
1715
  });
1703
1716
  const updateCredentialLabel = (variables, signal) => fetch$1({
1704
- url: "/{realm}/account/credentials/{credentialId}/label",
1717
+ url: "/account/credentials/{credentialId}/label",
1705
1718
  method: "put",
1706
1719
  ...variables,
1707
1720
  signal
1708
1721
  });
1709
1722
  const getSessions = (variables, signal) => fetch$1({
1710
- url: "/{realm}/account/sessions",
1723
+ url: "/account/sessions",
1711
1724
  method: "get",
1712
1725
  ...variables,
1713
1726
  signal
1714
1727
  });
1715
1728
  const deleteCurrentSession = (variables, signal) => fetch$1({
1716
- url: "/{realm}/account/sessions",
1729
+ url: "/account/sessions",
1717
1730
  method: "delete",
1718
1731
  ...variables,
1719
1732
  signal
1720
1733
  });
1721
1734
  const getDevices = (variables, signal) => fetch$1({
1722
- url: "/{realm}/account/sessions/devices",
1735
+ url: "/account/sessions/devices",
1723
1736
  method: "get",
1724
1737
  ...variables,
1725
1738
  signal
1726
1739
  });
1727
1740
  const deleteSession = (variables, signal) => fetch$1({
1728
- url: "/{realm}/account/sessions/{sessionId}",
1741
+ url: "/account/sessions/{sessionId}",
1729
1742
  method: "delete",
1730
1743
  ...variables,
1731
1744
  signal
1732
1745
  });
1733
1746
  const getLinkedAccounts = (variables, signal) => fetch$1({
1734
- url: "/{realm}/account/linked-accounts",
1747
+ url: "/account/linked-accounts",
1735
1748
  method: "get",
1736
1749
  ...variables,
1737
1750
  signal
1738
1751
  });
1739
- const buildLinkingUri = (variables, signal) => fetch$1({ url: "/{realm}/account/linked-accounts/{providerId}", method: "get", ...variables, signal });
1752
+ const buildLinkingUri = (variables, signal) => fetch$1({ url: "/account/linked-accounts/{providerId}", method: "get", ...variables, signal });
1740
1753
  const deleteLinkedProvider = (variables, signal) => fetch$1({
1741
- url: "/{realm}/account/linked-accounts/{providerId}",
1754
+ url: "/account/linked-accounts/{providerId}",
1742
1755
  method: "delete",
1743
1756
  ...variables,
1744
1757
  signal
1745
1758
  });
1746
1759
  const getGroups = (variables, signal) => fetch$1({
1747
- url: "/{realm}/account/groups",
1760
+ url: "/account/groups",
1748
1761
  method: "get",
1749
1762
  ...variables,
1750
1763
  signal
1751
1764
  });
1752
1765
  const getOrganizations = (variables, signal) => fetch$1({
1753
- url: "/{realm}/account/organizations",
1766
+ url: "/account/organizations",
1754
1767
  method: "get",
1755
1768
  ...variables,
1756
1769
  signal
1757
1770
  });
1758
1771
 
1759
1772
  const operationsByPath = {
1760
- "GET /{realm}/account/": getAccount,
1761
- "POST /{realm}/account/": updateAccount,
1762
- "GET /{realm}/account/applications": getApplications,
1763
- "GET /{realm}/account/applications/{clientId}/consent": getConsent,
1764
- "POST /{realm}/account/applications/{clientId}/consent": createConsent,
1765
- "PUT /{realm}/account/applications/{clientId}/consent": updateConsent,
1766
- "DELETE /{realm}/account/applications/{clientId}/consent": deleteConsent,
1767
- "GET /{realm}/account/credentials": getCredentials,
1768
- "DELETE /{realm}/account/credentials/{credentialId}": deleteCredential,
1769
- "PUT /{realm}/account/credentials/{credentialId}/label": updateCredentialLabel,
1770
- "GET /{realm}/account/sessions": getSessions,
1771
- "DELETE /{realm}/account/sessions": deleteCurrentSession,
1772
- "GET /{realm}/account/sessions/devices": getDevices,
1773
- "DELETE /{realm}/account/sessions/{sessionId}": deleteSession,
1774
- "GET /{realm}/account/linked-accounts": getLinkedAccounts,
1775
- "GET /{realm}/account/linked-accounts/{providerId}": buildLinkingUri,
1776
- "DELETE /{realm}/account/linked-accounts/{providerId}": deleteLinkedProvider,
1777
- "GET /{realm}/account/groups": getGroups,
1778
- "GET /{realm}/account/organizations": getOrganizations
1773
+ "GET /account/": getAccount,
1774
+ "POST /account/": updateAccount,
1775
+ "GET /account/applications": getApplications,
1776
+ "GET /account/applications/{clientId}/consent": getConsent,
1777
+ "POST /account/applications/{clientId}/consent": createConsent,
1778
+ "PUT /account/applications/{clientId}/consent": updateConsent,
1779
+ "DELETE /account/applications/{clientId}/consent": deleteConsent,
1780
+ "GET /account/credentials": getCredentials,
1781
+ "DELETE /account/credentials/{credentialId}": deleteCredential,
1782
+ "PUT /account/credentials/{credentialId}/label": updateCredentialLabel,
1783
+ "GET /account/sessions": getSessions,
1784
+ "DELETE /account/sessions": deleteCurrentSession,
1785
+ "GET /account/sessions/devices": getDevices,
1786
+ "DELETE /account/sessions/{sessionId}": deleteSession,
1787
+ "GET /account/linked-accounts": getLinkedAccounts,
1788
+ "GET /account/linked-accounts/{providerId}": buildLinkingUri,
1789
+ "DELETE /account/linked-accounts/{providerId}": deleteLinkedProvider,
1790
+ "GET /account/groups": getGroups,
1791
+ "GET /account/organizations": getOrganizations
1779
1792
  };
1780
1793
 
1781
1794
  const extra = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keycloak-api",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "keycloak auto-generated type-safe API client",
5
5
  "author": "SferaDev",
6
6
  "license": "ISC",
@@ -259,15 +259,7 @@ components:
259
259
  security:
260
260
  - access_token: []
261
261
  paths:
262
- /{realm}/account/:
263
- parameters:
264
- - in: path
265
- name: realm
266
- description: realm name
267
- required: true
268
- schema:
269
- type: string
270
- style: simple
262
+ /account/:
271
263
  get:
272
264
  tags:
273
265
  - Account
@@ -300,15 +292,7 @@ paths:
300
292
  responses:
301
293
  204:
302
294
  description: success
303
- /{realm}/account/applications:
304
- parameters:
305
- - in: path
306
- name: realm
307
- description: realm name
308
- required: true
309
- schema:
310
- type: string
311
- style: simple
295
+ /account/applications:
312
296
  get:
313
297
  parameters:
314
298
  - name: name
@@ -328,15 +312,8 @@ paths:
328
312
  type: array
329
313
  items:
330
314
  $ref: '#/components/schemas/ClientRepresentation'
331
- /{realm}/account/applications/{clientId}/consent:
315
+ /account/applications/{clientId}/consent:
332
316
  parameters:
333
- - in: path
334
- name: realm
335
- description: realm name
336
- required: true
337
- schema:
338
- type: string
339
- style: simple
340
317
  - in: path
341
318
  name: clientId
342
319
  description: client id
@@ -388,15 +365,7 @@ paths:
388
365
  responses:
389
366
  204:
390
367
  description: Deleted
391
- /{realm}/account/credentials:
392
- parameters:
393
- - in: path
394
- name: realm
395
- description: realm name
396
- required: true
397
- schema:
398
- type: string
399
- style: simple
368
+ /account/credentials:
400
369
  get:
401
370
  tags:
402
371
  - Account
@@ -421,15 +390,8 @@ paths:
421
390
  type: array
422
391
  items:
423
392
  $ref: '#/components/schemas/CredentialRepresentation'
424
- /{realm}/account/credentials/{credentialId}:
393
+ /account/credentials/{credentialId}:
425
394
  parameters:
426
- - in: path
427
- name: realm
428
- description: realm name
429
- required: true
430
- schema:
431
- type: string
432
- style: simple
433
395
  - in: path
434
396
  name: credentialId
435
397
  description: Credential ID
@@ -445,15 +407,8 @@ paths:
445
407
  responses:
446
408
  204:
447
409
  description: success
448
- /{realm}/account/credentials/{credentialId}/label:
410
+ /account/credentials/{credentialId}/label:
449
411
  parameters:
450
- - in: path
451
- name: realm
452
- description: realm name
453
- required: true
454
- schema:
455
- type: string
456
- style: simple
457
412
  - in: path
458
413
  name: credentialId
459
414
  description: Credential ID
@@ -474,15 +429,7 @@ paths:
474
429
  responses:
475
430
  204:
476
431
  description: No Content
477
- /{realm}/account/sessions:
478
- parameters:
479
- - in: path
480
- name: realm
481
- description: realm name
482
- required: true
483
- schema:
484
- type: string
485
- style: simple
432
+ /account/sessions:
486
433
  get:
487
434
  tags:
488
435
  - Account
@@ -506,15 +453,7 @@ paths:
506
453
  responses:
507
454
  204:
508
455
  description: success
509
- /{realm}/account/sessions/devices:
510
- parameters:
511
- - in: path
512
- name: realm
513
- description: realm name
514
- required: true
515
- schema:
516
- type: string
517
- style: simple
456
+ /account/sessions/devices:
518
457
  get:
519
458
  tags:
520
459
  - Account
@@ -530,15 +469,8 @@ paths:
530
469
  type: array
531
470
  items:
532
471
  $ref: '#/components/schemas/DeviceRepresentation'
533
- /{realm}/account/sessions/{sessionId}:
472
+ /account/sessions/{sessionId}:
534
473
  parameters:
535
- - in: path
536
- name: realm
537
- description: realm name
538
- required: true
539
- schema:
540
- type: string
541
- style: simple
542
474
  - in: path
543
475
  name: sessionId
544
476
  description: Session ID
@@ -554,15 +486,7 @@ paths:
554
486
  responses:
555
487
  204:
556
488
  description: success
557
- /{realm}/account/linked-accounts:
558
- parameters:
559
- - in: path
560
- name: realm
561
- description: realm name
562
- required: true
563
- schema:
564
- type: string
565
- style: simple
489
+ /account/linked-accounts:
566
490
  get:
567
491
  tags:
568
492
  - Account
@@ -578,15 +502,8 @@ paths:
578
502
  type: array
579
503
  items:
580
504
  $ref: '#/components/schemas/LinkedAccountRepresentation'
581
- /{realm}/account/linked-accounts/{providerId}:
505
+ /account/linked-accounts/{providerId}:
582
506
  parameters:
583
- - in: path
584
- name: realm
585
- description: realm name
586
- required: true
587
- schema:
588
- type: string
589
- style: simple
590
507
  - in: path
591
508
  name: providerId
592
509
  description: Provider ID
@@ -622,15 +539,7 @@ paths:
622
539
  responses:
623
540
  204:
624
541
  description: success
625
- /{realm}/account/groups:
626
- parameters:
627
- - in: path
628
- name: realm
629
- description: realm name
630
- required: true
631
- schema:
632
- type: string
633
- style: simple
542
+ /account/groups:
634
543
  get:
635
544
  parameters:
636
545
  - name: briefRepresentation
@@ -651,15 +560,7 @@ paths:
651
560
  type: array
652
561
  items:
653
562
  $ref: '#/components/schemas/GroupRepresentation'
654
- /{realm}/account/organizations:
655
- parameters:
656
- - in: path
657
- name: realm
658
- description: realm name
659
- required: true
660
- schema:
661
- type: string
662
- style: simple
563
+ /account/organizations:
663
564
  get:
664
565
  tags:
665
566
  - Account