shoal-web-sdk 0.0.46 → 0.0.48

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.
@@ -1,5 +1,5 @@
1
1
  import type { Client, Options as Options2, TDataShape } from './client';
2
- import type { AddEdgesData, AddEdgesErrors, AddEdgesResponses, AddNodesData, AddNodesErrors, AddNodesResponses, CreateEnvironmentData, CreateEnvironmentErrors, CreateEnvironmentResponses, CreateProjectData, CreateProjectErrors, CreateProjectResponses, CreateSpaceData, CreateSpaceErrors, CreateSpaceResponses, FetchKindeOrganisationBillingAgreementsData, FetchKindeOrganisationBillingAgreementsErrors, FetchKindeOrganisationBillingAgreementsResponses, GetEnvironmentOverviewData, GetEnvironmentOverviewErrors, GetEnvironmentOverviewResponses, GetGraphOverviewData, GetGraphOverviewErrors, GetGraphOverviewResponses, GetProjectOverviewData, GetProjectOverviewErrors, GetProjectOverviewResponses, GetServiceHealthData, GetServiceHealthResponses, GetSpaceOverviewData, GetSpaceOverviewErrors, GetSpaceOverviewResponses, GetUserIdentitiesData, GetUserIdentitiesErrors, GetUserIdentitiesResponses, GetUserProfileData, GetUserProfileErrors, GetUserProfileResponses, RemoveEdgesData, RemoveEdgesErrors, RemoveEdgesResponses, RemoveNodesData, RemoveNodesErrors, RemoveNodesResponses, RequestAccountPasswordResetData, RequestAccountPasswordResetErrors, RequestAccountPasswordResetResponses } from './types.gen';
2
+ import type { AddEdgesData, AddEdgesErrors, AddEdgesResponses, AddNodesData, AddNodesErrors, AddNodesResponses, CreateAccountIdentityData, CreateAccountIdentityErrors, CreateAccountIdentityResponses, CreateEnvironmentData, CreateEnvironmentErrors, CreateEnvironmentResponses, CreateProjectData, CreateProjectErrors, CreateProjectResponses, CreateSpaceData, CreateSpaceErrors, CreateSpaceResponses, FetchKindeOrganisationBillingAgreementsData, FetchKindeOrganisationBillingAgreementsErrors, FetchKindeOrganisationBillingAgreementsResponses, GetConnectedAppUrlData, GetConnectedAppUrlErrors, GetConnectedAppUrlResponses, GetEnvironmentOverviewData, GetEnvironmentOverviewErrors, GetEnvironmentOverviewResponses, GetGraphOverviewData, GetGraphOverviewErrors, GetGraphOverviewResponses, GetProjectOverviewData, GetProjectOverviewErrors, GetProjectOverviewResponses, GetServiceHealthData, GetServiceHealthResponses, GetSpaceOverviewData, GetSpaceOverviewErrors, GetSpaceOverviewResponses, GetUserIdentitiesData, GetUserIdentitiesErrors, GetUserIdentitiesResponses, GetUserProfileData, GetUserProfileErrors, GetUserProfileResponses, ListInstallationBranchesData, ListInstallationBranchesErrors, ListInstallationBranchesResponses, ListInstallationRepositoriesData, ListInstallationRepositoriesErrors, ListInstallationRepositoriesResponses, ListUserInstallationsData, ListUserInstallationsErrors, ListUserInstallationsResponses, RemoveEdgesData, RemoveEdgesErrors, RemoveEdgesResponses, RemoveNodesData, RemoveNodesErrors, RemoveNodesResponses, RequestAccountPasswordResetData, RequestAccountPasswordResetErrors, RequestAccountPasswordResetResponses } from './types.gen';
3
3
  export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & {
4
4
  /**
5
5
  * You can provide a client instance returned by `createClient()` instead of
@@ -29,6 +29,26 @@ export declare const getUserProfile: <ThrowOnError extends boolean = false>(opti
29
29
  * Fetch the users identities.
30
30
  */
31
31
  export declare const getUserIdentities: <ThrowOnError extends boolean = false>(options?: Options<GetUserIdentitiesData, ThrowOnError>) => import("./client").RequestResult<GetUserIdentitiesResponses, GetUserIdentitiesErrors, ThrowOnError, "fields">;
32
+ /**
33
+ * Create an identity for the authenticated user.
34
+ */
35
+ export declare const createAccountIdentity: <ThrowOnError extends boolean = false>(options: Options<CreateAccountIdentityData, ThrowOnError>) => import("./client").RequestResult<CreateAccountIdentityResponses, CreateAccountIdentityErrors, ThrowOnError, "fields">;
36
+ /**
37
+ * Fetch a connected app authorization URL for the authenticated user.
38
+ */
39
+ export declare const getConnectedAppUrl: <ThrowOnError extends boolean = false>(options: Options<GetConnectedAppUrlData, ThrowOnError>) => import("./client").RequestResult<GetConnectedAppUrlResponses, GetConnectedAppUrlErrors, ThrowOnError, "fields">;
40
+ /**
41
+ * List repositories accessible to a GitHub App installation.
42
+ */
43
+ export declare const listInstallationRepositories: <ThrowOnError extends boolean = false>(options: Options<ListInstallationRepositoriesData, ThrowOnError>) => import("./client").RequestResult<ListInstallationRepositoriesResponses, ListInstallationRepositoriesErrors, ThrowOnError, "fields">;
44
+ /**
45
+ * List branches for a repository accessible to a GitHub App installation.
46
+ */
47
+ export declare const listInstallationBranches: <ThrowOnError extends boolean = false>(options: Options<ListInstallationBranchesData, ThrowOnError>) => import("./client").RequestResult<ListInstallationBranchesResponses, ListInstallationBranchesErrors, ThrowOnError, "fields">;
48
+ /**
49
+ * List GitHub App installations stored for the authenticated user.
50
+ */
51
+ export declare const listUserInstallations: <ThrowOnError extends boolean = false>(options?: Options<ListUserInstallationsData, ThrowOnError>) => import("./client").RequestResult<ListUserInstallationsResponses, ListUserInstallationsErrors, ThrowOnError, "fields">;
32
52
  /**
33
53
  * Create a space.
34
54
  */
@@ -60,6 +60,85 @@ export const getUserIdentities = (options) => {
60
60
  ...options
61
61
  });
62
62
  };
63
+ /**
64
+ * Create an identity for the authenticated user.
65
+ */
66
+ export const createAccountIdentity = (options) => {
67
+ return (options.client ?? client).post({
68
+ security: [
69
+ {
70
+ scheme: 'bearer',
71
+ type: 'http'
72
+ }
73
+ ],
74
+ url: '/auth/account/identities',
75
+ ...options,
76
+ headers: {
77
+ 'Content-Type': 'application/json',
78
+ ...options.headers
79
+ }
80
+ });
81
+ };
82
+ /**
83
+ * Fetch a connected app authorization URL for the authenticated user.
84
+ */
85
+ export const getConnectedAppUrl = (options) => {
86
+ return (options.client ?? client).get({
87
+ security: [
88
+ {
89
+ scheme: 'bearer',
90
+ type: 'http'
91
+ }
92
+ ],
93
+ url: '/auth/account/connected-app-url',
94
+ ...options
95
+ });
96
+ };
97
+ /**
98
+ * List repositories accessible to a GitHub App installation.
99
+ */
100
+ export const listInstallationRepositories = (options) => {
101
+ return (options.client ?? client).get({
102
+ security: [
103
+ {
104
+ scheme: 'bearer',
105
+ type: 'http'
106
+ }
107
+ ],
108
+ url: '/auth/installations/{installationID}/repositories',
109
+ ...options
110
+ });
111
+ };
112
+ /**
113
+ * List branches for a repository accessible to a GitHub App installation.
114
+ */
115
+ export const listInstallationBranches = (options) => {
116
+ return (options.client ?? client).get({
117
+ security: [
118
+ {
119
+ scheme: 'bearer',
120
+ type: 'http'
121
+ }
122
+ ],
123
+ url: '/auth/installations/{installationID}/branches',
124
+ ...options
125
+ });
126
+ };
127
+ /**
128
+ * List GitHub App installations stored for the authenticated user.
129
+ */
130
+ export const listUserInstallations = (options) => {
131
+ return (options?.client ?? client).get({
132
+ security: [
133
+ {
134
+ scheme: 'bearer',
135
+ type: 'http'
136
+ }
137
+ ],
138
+ url: '/auth/installations',
139
+ ...options
140
+ });
141
+ };
63
142
  /**
64
143
  * Create a space.
65
144
  */
@@ -65,6 +65,96 @@ export type AccountIdentity = {
65
65
  export type AccountIdentities = {
66
66
  identities: Array<AccountIdentity>;
67
67
  };
68
+ export type CreateAccountIdentityRequest = {
69
+ type: 'github';
70
+ /**
71
+ * External provider user id (e.g., GitHub user id).
72
+ */
73
+ identity?: string;
74
+ };
75
+ export type CreateAccountIdentityResponse = {
76
+ status: string;
77
+ };
78
+ export type ConnectedAppUrlResponse = {
79
+ url: string;
80
+ session_id: string;
81
+ };
82
+ export type GitHubRepoOwner = {
83
+ login: string;
84
+ type: string;
85
+ avatar: string;
86
+ id: number;
87
+ };
88
+ export type GitHubRepositorySummary = {
89
+ id: number;
90
+ name: string;
91
+ full_name: string;
92
+ visibility: string;
93
+ owner: GitHubRepoOwner;
94
+ };
95
+ export type GitHubRepositoriesResponse = {
96
+ repositories: Array<GitHubRepositorySummary>;
97
+ total_count: number;
98
+ page: number;
99
+ limit: number;
100
+ next_page?: number;
101
+ };
102
+ export type GitHubBranch = {
103
+ name?: string;
104
+ protected?: boolean;
105
+ commit?: {
106
+ sha: string;
107
+ url: string;
108
+ };
109
+ [key: string]: unknown | string | boolean | {
110
+ sha: string;
111
+ url: string;
112
+ } | undefined;
113
+ };
114
+ export type GitHubBranchesResponse = {
115
+ branches: Array<GitHubBranch>;
116
+ page: number;
117
+ limit: number;
118
+ next_page?: number;
119
+ };
120
+ export type GitHubBranchesAllResponse = {
121
+ branches: Array<GitHubBranch>;
122
+ total_count: number;
123
+ };
124
+ export type GitHubInstallationAccount = {
125
+ login: string;
126
+ id: number;
127
+ type: string;
128
+ };
129
+ export type GitHubInstallation = {
130
+ id: number;
131
+ app_id: number;
132
+ account: GitHubInstallationAccount;
133
+ repository_selection?: string;
134
+ access_tokens_url?: string;
135
+ repositories_url?: string;
136
+ html_url?: string;
137
+ target_type?: string;
138
+ [key: string]: unknown | number | GitHubInstallationAccount | string | undefined;
139
+ };
140
+ export type GitHubUserInstallationsResponse = {
141
+ installations: Array<GitHubInstallation>;
142
+ page: number;
143
+ limit: number;
144
+ next_page?: number;
145
+ };
146
+ export type UserGithubInstallation = {
147
+ installation_id: number;
148
+ account_name: string;
149
+ account_type: string;
150
+ };
151
+ export type UserGithubInstallations = {
152
+ installations: Array<UserGithubInstallation>;
153
+ };
154
+ export type UserGithubInstallationsResponse = {
155
+ installations: Array<UserGithubInstallation>;
156
+ next_page?: number;
157
+ };
68
158
  export type AccountProfile = {
69
159
  preferredEmail: string;
70
160
  phone: string;
@@ -246,6 +336,38 @@ export type ProjectHandle = string;
246
336
  * The space handle. This must be globally unique.
247
337
  */
248
338
  export type SpaceHandle = string;
339
+ /**
340
+ * GitHub App installation ID.
341
+ */
342
+ export type InstallationId = number;
343
+ /**
344
+ * Repository owner (user or organization login).
345
+ */
346
+ export type RepoOwner = string;
347
+ /**
348
+ * Repository name.
349
+ */
350
+ export type RepoName = string;
351
+ /**
352
+ * Page number (1-based).
353
+ */
354
+ export type Page = number;
355
+ /**
356
+ * Page size (max 100).
357
+ */
358
+ export type Limit = number;
359
+ /**
360
+ * When true, fetch all pages and return the full list (branches only).
361
+ */
362
+ export type All = boolean;
363
+ /**
364
+ * Connected app key code reference from Kinde.
365
+ */
366
+ export type KeyCodeRef = string;
367
+ /**
368
+ * GitHub OAuth access token for the authenticated Kinde user.
369
+ */
370
+ export type GitHubTokenHeader = string;
249
371
  export type GetServiceHealthData = {
250
372
  body?: never;
251
373
  path?: never;
@@ -342,6 +464,224 @@ export type GetUserIdentitiesResponses = {
342
464
  200: AccountIdentities;
343
465
  };
344
466
  export type GetUserIdentitiesResponse = GetUserIdentitiesResponses[keyof GetUserIdentitiesResponses];
467
+ export type CreateAccountIdentityData = {
468
+ body: CreateAccountIdentityRequest;
469
+ path?: never;
470
+ query?: never;
471
+ url: '/auth/account/identities';
472
+ };
473
+ export type CreateAccountIdentityErrors = {
474
+ /**
475
+ * Invalid request body.
476
+ */
477
+ 400: ErrorResponse;
478
+ /**
479
+ * Unauthorised user.
480
+ */
481
+ 401: ErrorResponse;
482
+ /**
483
+ * Invalid credentials.
484
+ */
485
+ 403: ErrorResponse;
486
+ /**
487
+ * Unexpected error.
488
+ */
489
+ 500: ErrorResponse;
490
+ };
491
+ export type CreateAccountIdentityError = CreateAccountIdentityErrors[keyof CreateAccountIdentityErrors];
492
+ export type CreateAccountIdentityResponses = {
493
+ /**
494
+ * Identity created successfully.
495
+ */
496
+ 201: CreateAccountIdentityResponse;
497
+ };
498
+ export type CreateAccountIdentityResponse2 = CreateAccountIdentityResponses[keyof CreateAccountIdentityResponses];
499
+ export type GetConnectedAppUrlData = {
500
+ body?: never;
501
+ path?: never;
502
+ query: {
503
+ /**
504
+ * Connected app key code reference from Kinde.
505
+ */
506
+ key_code_ref: string;
507
+ };
508
+ url: '/auth/account/connected-app-url';
509
+ };
510
+ export type GetConnectedAppUrlErrors = {
511
+ /**
512
+ * Invalid request parameters.
513
+ */
514
+ 400: ErrorResponse;
515
+ /**
516
+ * Unauthorised user.
517
+ */
518
+ 401: ErrorResponse;
519
+ /**
520
+ * Invalid credentials.
521
+ */
522
+ 403: ErrorResponse;
523
+ /**
524
+ * Related content not found.
525
+ */
526
+ 404: ErrorResponse;
527
+ /**
528
+ * Unexpected error.
529
+ */
530
+ 500: ErrorResponse;
531
+ };
532
+ export type GetConnectedAppUrlError = GetConnectedAppUrlErrors[keyof GetConnectedAppUrlErrors];
533
+ export type GetConnectedAppUrlResponses = {
534
+ /**
535
+ * Connected app URL and session id.
536
+ */
537
+ 200: ConnectedAppUrlResponse;
538
+ };
539
+ export type GetConnectedAppUrlResponse = GetConnectedAppUrlResponses[keyof GetConnectedAppUrlResponses];
540
+ export type ListInstallationRepositoriesData = {
541
+ body?: never;
542
+ path: {
543
+ /**
544
+ * GitHub App installation ID.
545
+ */
546
+ installationID: number;
547
+ };
548
+ query?: {
549
+ /**
550
+ * Page number (1-based).
551
+ */
552
+ page?: number;
553
+ /**
554
+ * Page size (max 100).
555
+ */
556
+ limit?: number;
557
+ };
558
+ url: '/auth/installations/{installationID}/repositories';
559
+ };
560
+ export type ListInstallationRepositoriesErrors = {
561
+ /**
562
+ * Invalid request parameters.
563
+ */
564
+ 400: ErrorResponse;
565
+ /**
566
+ * Unauthorised user.
567
+ */
568
+ 401: ErrorResponse;
569
+ /**
570
+ * Invalid credentials.
571
+ */
572
+ 403: ErrorResponse;
573
+ /**
574
+ * Unexpected error.
575
+ */
576
+ 500: ErrorResponse;
577
+ };
578
+ export type ListInstallationRepositoriesError = ListInstallationRepositoriesErrors[keyof ListInstallationRepositoriesErrors];
579
+ export type ListInstallationRepositoriesResponses = {
580
+ /**
581
+ * Repositories for the installation.
582
+ */
583
+ 200: GitHubRepositoriesResponse;
584
+ };
585
+ export type ListInstallationRepositoriesResponse = ListInstallationRepositoriesResponses[keyof ListInstallationRepositoriesResponses];
586
+ export type ListInstallationBranchesData = {
587
+ body?: never;
588
+ path: {
589
+ /**
590
+ * GitHub App installation ID.
591
+ */
592
+ installationID: number;
593
+ };
594
+ query: {
595
+ /**
596
+ * Repository owner (user or organization login).
597
+ */
598
+ owner: string;
599
+ /**
600
+ * Repository name.
601
+ */
602
+ repo: string;
603
+ /**
604
+ * Page number (1-based).
605
+ */
606
+ page?: number;
607
+ /**
608
+ * Page size (max 100).
609
+ */
610
+ limit?: number;
611
+ /**
612
+ * When true, fetch all pages and return the full list (branches only).
613
+ */
614
+ all?: boolean;
615
+ };
616
+ url: '/auth/installations/{installationID}/branches';
617
+ };
618
+ export type ListInstallationBranchesErrors = {
619
+ /**
620
+ * Invalid request parameters.
621
+ */
622
+ 400: ErrorResponse;
623
+ /**
624
+ * Unauthorised user.
625
+ */
626
+ 401: ErrorResponse;
627
+ /**
628
+ * Invalid credentials.
629
+ */
630
+ 403: ErrorResponse;
631
+ /**
632
+ * Unexpected error.
633
+ */
634
+ 500: ErrorResponse;
635
+ };
636
+ export type ListInstallationBranchesError = ListInstallationBranchesErrors[keyof ListInstallationBranchesErrors];
637
+ export type ListInstallationBranchesResponses = {
638
+ /**
639
+ * Branches for the repository.
640
+ */
641
+ 200: GitHubBranchesResponse | GitHubBranchesAllResponse;
642
+ };
643
+ export type ListInstallationBranchesResponse = ListInstallationBranchesResponses[keyof ListInstallationBranchesResponses];
644
+ export type ListUserInstallationsData = {
645
+ body?: never;
646
+ path?: never;
647
+ query?: {
648
+ /**
649
+ * Page number (1-based).
650
+ */
651
+ page?: number;
652
+ /**
653
+ * Page size (max 100).
654
+ */
655
+ limit?: number;
656
+ };
657
+ url: '/auth/installations';
658
+ };
659
+ export type ListUserInstallationsErrors = {
660
+ /**
661
+ * Invalid request parameters.
662
+ */
663
+ 400: ErrorResponse;
664
+ /**
665
+ * Unauthorised user.
666
+ */
667
+ 401: ErrorResponse;
668
+ /**
669
+ * Invalid credentials.
670
+ */
671
+ 403: ErrorResponse;
672
+ /**
673
+ * Unexpected error.
674
+ */
675
+ 500: ErrorResponse;
676
+ };
677
+ export type ListUserInstallationsError = ListUserInstallationsErrors[keyof ListUserInstallationsErrors];
678
+ export type ListUserInstallationsResponses = {
679
+ /**
680
+ * Installations for the authenticated user.
681
+ */
682
+ 200: UserGithubInstallationsResponse;
683
+ };
684
+ export type ListUserInstallationsResponse = ListUserInstallationsResponses[keyof ListUserInstallationsResponses];
345
685
  export type CreateSpaceData = {
346
686
  body: CreateSpace;
347
687
  path?: never;
@@ -1,6 +1,6 @@
1
1
  import { useMutation } from "@tanstack/react-query";
2
2
  import { GetSuccessResponse } from "../util";
3
- import { GetServiceHealthData, RequestAccountPasswordResetData, RequestAccountPasswordResetResponses, GetUserProfileData, GetUserIdentitiesData, CreateSpaceData, CreateSpaceResponses, GetSpaceOverviewData, FetchKindeOrganisationBillingAgreementsData, CreateProjectData, CreateProjectResponses, GetProjectOverviewData, CreateEnvironmentData, CreateEnvironmentResponses, GetEnvironmentOverviewData, GetGraphOverviewData, RemoveNodesData, RemoveNodesResponses, AddNodesData, AddNodesResponses, RemoveEdgesData, RemoveEdgesResponses, AddEdgesData, AddEdgesResponses } from "../../sdk/types.gen";
3
+ import { GetServiceHealthData, RequestAccountPasswordResetData, RequestAccountPasswordResetResponses, GetUserProfileData, GetUserIdentitiesData, CreateAccountIdentityData, CreateAccountIdentityResponses, GetConnectedAppUrlData, ListInstallationRepositoriesData, ListInstallationBranchesData, ListUserInstallationsData, CreateSpaceData, CreateSpaceResponses, GetSpaceOverviewData, FetchKindeOrganisationBillingAgreementsData, CreateProjectData, CreateProjectResponses, GetProjectOverviewData, CreateEnvironmentData, CreateEnvironmentResponses, GetEnvironmentOverviewData, GetGraphOverviewData, RemoveNodesData, RemoveNodesResponses, AddNodesData, AddNodesResponses, RemoveEdgesData, RemoveEdgesResponses, AddEdgesData, AddEdgesResponses } from "../../sdk/types.gen";
4
4
  export declare const useGetServiceHealth: (options?: Omit<GetServiceHealthData, "url"> & {
5
5
  enabled?: boolean;
6
6
  }) => import("@tanstack/react-query").UseQueryResult<import("../../sdk/types.gen").HealthResponse | undefined, Error>;
@@ -15,6 +15,23 @@ export declare const useGetUserProfile: (options?: Omit<GetUserProfileData, "url
15
15
  export declare const useGetUserIdentities: (options?: Omit<GetUserIdentitiesData, "url"> & {
16
16
  enabled?: boolean;
17
17
  }) => import("@tanstack/react-query").UseQueryResult<import("../../sdk/types.gen").AccountIdentities | undefined, Error>;
18
+ export declare const useCreateAccountIdentity: (config?: {
19
+ onSuccess?: (data: GetSuccessResponse<CreateAccountIdentityResponses>) => void;
20
+ onError?: Parameters<typeof useMutation>["0"]["onError"];
21
+ retry?: boolean;
22
+ }) => import("@tanstack/react-query").UseMutationResult<import("../../sdk/types.gen").CreateAccountIdentityResponse | undefined, unknown, Omit<CreateAccountIdentityData, "url">, unknown>;
23
+ export declare const useGetConnectedAppUrl: (options: Omit<GetConnectedAppUrlData, "url"> & {
24
+ enabled?: boolean;
25
+ }) => import("@tanstack/react-query").UseQueryResult<import("../../sdk/types.gen").ConnectedAppUrlResponse | undefined, Error>;
26
+ export declare const useListInstallationRepositories: (options: Omit<ListInstallationRepositoriesData, "url"> & {
27
+ enabled?: boolean;
28
+ }) => import("@tanstack/react-query").UseQueryResult<import("../../sdk/types.gen").GitHubRepositoriesResponse | undefined, Error>;
29
+ export declare const useListInstallationBranches: (options: Omit<ListInstallationBranchesData, "url"> & {
30
+ enabled?: boolean;
31
+ }) => import("@tanstack/react-query").UseQueryResult<import("../../sdk/types.gen").GitHubBranchesResponse | import("../../sdk/types.gen").GitHubBranchesAllResponse | undefined, Error>;
32
+ export declare const useListUserInstallations: (options?: Omit<ListUserInstallationsData, "url"> & {
33
+ enabled?: boolean;
34
+ }) => import("@tanstack/react-query").UseQueryResult<import("../../sdk/types.gen").UserGithubInstallationsResponse | undefined, Error>;
18
35
  export declare const useCreateSpace: (config?: {
19
36
  onSuccess?: (data: GetSuccessResponse<CreateSpaceResponses>) => void;
20
37
  onError?: Parameters<typeof useMutation>["0"]["onError"];
@@ -2,7 +2,7 @@
2
2
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
3
3
  import { isPromise } from "../util";
4
4
  import { useToken } from "../../provider/token-provider";
5
- import { getServiceHealth, requestAccountPasswordReset, getUserProfile, getUserIdentities, createSpace, getSpaceOverview, fetchKindeOrganisationBillingAgreements, createProject, getProjectOverview, createEnvironment, getEnvironmentOverview, getGraphOverview, removeNodes, addNodes, removeEdges, addEdges } from "../../sdk/sdk.gen";
5
+ import { getServiceHealth, requestAccountPasswordReset, getUserProfile, getUserIdentities, createAccountIdentity, getConnectedAppUrl, listInstallationRepositories, listInstallationBranches, listUserInstallations, createSpace, getSpaceOverview, fetchKindeOrganisationBillingAgreements, createProject, getProjectOverview, createEnvironment, getEnvironmentOverview, getGraphOverview, removeNodes, addNodes, removeEdges, addEdges } from "../../sdk/sdk.gen";
6
6
  export const useGetServiceHealth = (options) => {
7
7
  const token = useToken();
8
8
  let { enabled, ...rest } = options || { enabled: true };
@@ -85,6 +85,109 @@ export const useGetUserIdentities = (options) => {
85
85
  staleTime: 600000
86
86
  });
87
87
  };
88
+ export const useCreateAccountIdentity = (config) => {
89
+ const token = useToken();
90
+ const queryClient = useQueryClient();
91
+ const opts = { throwOnError: true, url: "/auth/account/identities" };
92
+ const funcer = async (options) => {
93
+ const auth = isPromise(token) ? (await token) || "" : token || "";
94
+ const res = await createAccountIdentity({ ...opts, ...options, auth });
95
+ return res?.data;
96
+ };
97
+ return useMutation({
98
+ mutationFn: funcer,
99
+ onSuccess: (res, options, c, ctx) => {
100
+ queryClient.invalidateQueries({ queryKey: ["account", "identities"] });
101
+ config?.onSuccess && config.onSuccess(res);
102
+ },
103
+ onError: config?.onError,
104
+ retry: config?.retry
105
+ });
106
+ };
107
+ export const useGetConnectedAppUrl = (options) => {
108
+ const token = useToken();
109
+ let { enabled, ...rest } = options || { enabled: true };
110
+ const opts = { throwOnError: true, url: "/auth/account/connected-app-url" };
111
+ const funcer = async () => {
112
+ const auth = isPromise(token) ? (await token) || "" : token || "";
113
+ if (isPromise(token) && !token)
114
+ return;
115
+ const res = await getConnectedAppUrl({ ...opts, ...rest, auth });
116
+ return res.data;
117
+ };
118
+ if (!token)
119
+ enabled = false;
120
+ return useQuery({
121
+ queryKey: ["account", "connected-app-url", options.query ?? {}],
122
+ queryFn: funcer,
123
+ enabled,
124
+ retry: false,
125
+ staleTime: 600000
126
+ });
127
+ };
128
+ export const useListInstallationRepositories = (options) => {
129
+ const token = useToken();
130
+ let { enabled, ...rest } = options || { enabled: true };
131
+ const opts = { throwOnError: true, url: "/auth/installations/{installationID}/repositories" };
132
+ const funcer = async () => {
133
+ const auth = isPromise(token) ? (await token) || "" : token || "";
134
+ if (isPromise(token) && !token)
135
+ return;
136
+ const res = await listInstallationRepositories({ ...opts, ...rest, auth });
137
+ return res.data;
138
+ };
139
+ if (!token)
140
+ enabled = false;
141
+ return useQuery({
142
+ queryKey: ["installations", options?.path?.installationID, "repositories", options.query ?? {}],
143
+ queryFn: funcer,
144
+ enabled,
145
+ retry: false,
146
+ staleTime: 600000
147
+ });
148
+ };
149
+ export const useListInstallationBranches = (options) => {
150
+ const token = useToken();
151
+ let { enabled, ...rest } = options || { enabled: true };
152
+ const opts = { throwOnError: true, url: "/auth/installations/{installationID}/branches" };
153
+ const funcer = async () => {
154
+ const auth = isPromise(token) ? (await token) || "" : token || "";
155
+ if (isPromise(token) && !token)
156
+ return;
157
+ const res = await listInstallationBranches({ ...opts, ...rest, auth });
158
+ return res.data;
159
+ };
160
+ if (!token)
161
+ enabled = false;
162
+ return useQuery({
163
+ queryKey: ["installations", options?.path?.installationID, "branches", options.query ?? {}],
164
+ queryFn: funcer,
165
+ enabled,
166
+ retry: false,
167
+ staleTime: 600000
168
+ });
169
+ };
170
+ export const useListUserInstallations = (options) => {
171
+ const token = useToken();
172
+ let { enabled, ...rest } = options || { enabled: true };
173
+ const opts = { throwOnError: true, url: "/auth/installations" };
174
+ const funcer = async () => {
175
+ const auth = isPromise(token) ? (await token) || "" : token || "";
176
+ if (isPromise(token) && !token)
177
+ return;
178
+ const res = await listUserInstallations({ ...opts, ...rest, auth });
179
+ return res.data;
180
+ };
181
+ if (!token)
182
+ enabled = false;
183
+ return useQuery({
184
+ queryKey: ["installations", options?.query ?? {}],
185
+ queryFn: funcer,
186
+ enabled,
187
+ retry: false,
188
+ staleTime: 600000
189
+ });
190
+ };
88
191
  export const useCreateSpace = (config) => {
89
192
  const token = useToken();
90
193
  const queryClient = useQueryClient();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shoal-web-sdk",
3
- "version": "0.0.46",
3
+ "version": "0.0.48",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "build-hooks": "npx tsx tanstack-codegen/generator.ts",