|
1 | 1 | import type { Struct } from '@bufbuild/protobuf';
|
2 |
| -import { |
3 |
| - createPromiseClient, |
4 |
| - type PromiseClient, |
5 |
| - type Transport, |
6 |
| -} from '@connectrpc/connect'; |
| 2 | +import { createClient, type Client, type Transport } from '@connectrpc/connect'; |
7 | 3 | import { PackageType } from '../gen/app/packages/v1/packages_pb';
|
8 | 4 | import { AppService } from '../gen/app/v1/app_connect';
|
9 | 5 | import {
|
@@ -114,10 +110,10 @@ export const createPermission = (
|
114 | 110 | };
|
115 | 111 |
|
116 | 112 | export class AppClient {
|
117 |
| - private client: PromiseClient<typeof AppService>; |
| 113 | + private client: Client<typeof AppService>; |
118 | 114 |
|
119 | 115 | constructor(transport: Transport) {
|
120 |
| - this.client = createPromiseClient(AppService, transport); |
| 116 | + this.client = createClient(AppService, transport); |
121 | 117 | }
|
122 | 118 |
|
123 | 119 | /**
|
@@ -827,6 +823,27 @@ export class AppClient {
|
827 | 823 | await this.client.deleteFragment({ id });
|
828 | 824 | }
|
829 | 825 |
|
| 826 | + /** |
| 827 | + * @param machineId The machine ID used to filter fragments defined in a |
| 828 | + * machine's parts. Also returns any fragments nested within the fragments |
| 829 | + * defined in parts. |
| 830 | + * @param additionalFragmentIds Additional fragment IDs to append to the |
| 831 | + * response. Useful when needing to view fragments that will be |
| 832 | + * provisionally added to the machine alongside existing fragments. |
| 833 | + * @returns The list of top level and nested fragments for a machine, as well |
| 834 | + * as additionally specified fragment IDs. |
| 835 | + */ |
| 836 | + async listMachineFragments( |
| 837 | + machineId: string, |
| 838 | + additionalFragmentIds?: string[] |
| 839 | + ): Promise<Fragment[]> { |
| 840 | + const resp = await this.client.listMachineFragments({ |
| 841 | + machineId, |
| 842 | + additionalFragmentIds, |
| 843 | + }); |
| 844 | + return resp.fragments; |
| 845 | + } |
| 846 | + |
830 | 847 | /**
|
831 | 848 | * Add a role under an organization.
|
832 | 849 | *
|
|
0 commit comments