@equinor/fusion-framework-module-services 7.1.7 → 7.2.0
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/CHANGELOG.md +33 -0
- package/dist/esm/people/client.js +16 -9
- package/dist/esm/people/client.js.map +1 -1
- package/dist/esm/people/resolve/client.js +14 -0
- package/dist/esm/people/resolve/client.js.map +1 -0
- package/dist/esm/people/resolve/generate-endpoint.js +7 -0
- package/dist/esm/people/resolve/generate-endpoint.js.map +1 -0
- package/dist/esm/people/resolve/generate-parameters.js +8 -0
- package/dist/esm/people/resolve/generate-parameters.js.map +1 -0
- package/dist/esm/people/resolve/index.js +5 -0
- package/dist/esm/people/resolve/index.js.map +1 -0
- package/dist/esm/people/resolve/types.js +2 -0
- package/dist/esm/people/resolve/types.js.map +1 -0
- package/dist/esm/people/suggest/client.js +9 -0
- package/dist/esm/people/suggest/client.js.map +1 -0
- package/dist/esm/people/suggest/generate-endpoint.js +7 -0
- package/dist/esm/people/suggest/generate-endpoint.js.map +1 -0
- package/dist/esm/people/suggest/generate-parameters.js +8 -0
- package/dist/esm/people/suggest/generate-parameters.js.map +1 -0
- package/dist/esm/people/suggest/index.js +5 -0
- package/dist/esm/people/suggest/index.js.map +1 -0
- package/dist/esm/people/suggest/types.js +2 -0
- package/dist/esm/people/suggest/types.js.map +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/people/api-models.d.ts +40 -0
- package/dist/types/people/client.d.ts +10 -0
- package/dist/types/people/resolve/client.d.ts +15 -0
- package/dist/types/people/resolve/generate-endpoint.d.ts +4 -0
- package/dist/types/people/resolve/generate-parameters.d.ts +5 -0
- package/dist/types/people/resolve/index.d.ts +4 -0
- package/dist/types/people/resolve/types.d.ts +4 -0
- package/dist/types/people/suggest/client.d.ts +10 -0
- package/dist/types/people/suggest/generate-endpoint.d.ts +4 -0
- package/dist/types/people/suggest/generate-parameters.d.ts +5 -0
- package/dist/types/people/suggest/index.d.ts +4 -0
- package/dist/types/people/suggest/types.d.ts +4 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +18 -4
- package/src/people/api-models.ts +57 -0
- package/src/people/client.ts +40 -10
- package/src/people/resolve/client.ts +29 -0
- package/src/people/resolve/generate-endpoint.ts +6 -0
- package/src/people/resolve/generate-parameters.ts +15 -0
- package/src/people/resolve/index.ts +6 -0
- package/src/people/resolve/types.ts +9 -0
- package/src/people/suggest/client.ts +24 -0
- package/src/people/suggest/generate-endpoint.ts +6 -0
- package/src/people/suggest/generate-parameters.ts +15 -0
- package/src/people/suggest/index.ts +6 -0
- package/src/people/suggest/types.ts +9 -0
- package/src/version.ts +1 -1
|
@@ -32,3 +32,43 @@ export type ApiPersonMap = {
|
|
|
32
32
|
[ApiVersion.v4]: ApiPerson_v4;
|
|
33
33
|
};
|
|
34
34
|
export type ApiPerson<T extends keyof typeof ApiVersion | ApiVersion> = T extends ApiVersion ? ApiPersonMap[T] : T extends keyof typeof ApiVersion ? ApiPersonMap[(typeof ApiVersion)[T]] : unknown;
|
|
35
|
+
export type ApiSuggestionPerson = {
|
|
36
|
+
accountType?: 'Unknown' | 'Employee' | 'Consultant' | 'Enterprise' | 'EnterpriseExternal' | 'External' | 'Local' | 'TemporaryEmployee' | 'System' | 'Admin' | 'MeetingRoom';
|
|
37
|
+
jobTitle?: string;
|
|
38
|
+
department?: string;
|
|
39
|
+
fullDepartment?: string;
|
|
40
|
+
employeeNumber?: string;
|
|
41
|
+
managerAzureUniqueId?: string;
|
|
42
|
+
upn?: string;
|
|
43
|
+
mobilePhone?: string;
|
|
44
|
+
};
|
|
45
|
+
export type ApiSuggestionApplication = {
|
|
46
|
+
applicationId: string;
|
|
47
|
+
applicationName?: string;
|
|
48
|
+
servicePrincipalType: 'Application' | 'ManagedIdentity' | 'ServicePrincipal';
|
|
49
|
+
};
|
|
50
|
+
export type ApiSuggestionValue = {
|
|
51
|
+
azureUniqueId: string;
|
|
52
|
+
name?: string;
|
|
53
|
+
accountType: 'Person' | 'SystemAccount' | 'Unknown';
|
|
54
|
+
accountLabel: string;
|
|
55
|
+
person?: ApiSuggestionPerson;
|
|
56
|
+
application?: ApiSuggestionApplication;
|
|
57
|
+
avatarColor: string;
|
|
58
|
+
avatarUrl: string;
|
|
59
|
+
isExpired: boolean;
|
|
60
|
+
};
|
|
61
|
+
export type ApiSuggestions = {
|
|
62
|
+
totalCount: number;
|
|
63
|
+
count: number;
|
|
64
|
+
'@nextPage': string | null;
|
|
65
|
+
value: Array<ApiSuggestionValue>;
|
|
66
|
+
};
|
|
67
|
+
export type ApiResolveItem = {
|
|
68
|
+
success: boolean;
|
|
69
|
+
statusCode: number;
|
|
70
|
+
errorMessage: string | null;
|
|
71
|
+
identifier: string;
|
|
72
|
+
account: ApiSuggestionValue | null;
|
|
73
|
+
};
|
|
74
|
+
export type ApiResolved = Array<ApiResolveItem>;
|
|
@@ -4,6 +4,8 @@ import { ApiVersion } from './static';
|
|
|
4
4
|
import { type ApiResponse as PersonDetailApiResponse, type ApiResult as PersonDetailResult, type SupportedApiVersion as PersonDetailSupportedApiVersion, type ApiRequestArgs as PersonDetailApiRequestArgs } from './person-details';
|
|
5
5
|
import { type ApiResponse as PersonQueryApiResponse, type ApiResult as PersonQueryResult, type SupportedApiVersion as PersonQuerySupportedApiVersion, type ApiRequestArgs as PersonQueryApiRequestArgs } from './query';
|
|
6
6
|
import { type ApiResponse as PersonPhotoApiResponse, type ApiResult as PersonPhotoResult, type SupportedApiVersion as PersonPhotoSupportedApiVersion, type ApiRequestArgs as PersonPhotoApiRequestArgs } from './person-photo';
|
|
7
|
+
import { type ApiResponse as PersonSuggestApiResponse, type ApiResult as PersonSuggestResult } from './suggest';
|
|
8
|
+
import { type ApiResponse as PersonResolveApiResponse, type ApiResult as PersonResolveResult } from './resolve';
|
|
7
9
|
export declare class PeopleApiClient<TClient extends IHttpClient = IHttpClient> {
|
|
8
10
|
protected _client: TClient;
|
|
9
11
|
get Version(): typeof ApiVersion;
|
|
@@ -20,5 +22,13 @@ export declare class PeopleApiClient<TClient extends IHttpClient = IHttpClient>
|
|
|
20
22
|
* Photo person service
|
|
21
23
|
*/
|
|
22
24
|
photo<TVersion extends PersonPhotoSupportedApiVersion, TArgs extends PersonPhotoApiRequestArgs<TVersion>, TResult extends PersonPhotoApiResponse<TVersion> = PersonPhotoApiResponse<TVersion>, TMethod extends keyof ClientDataMethod = keyof ClientDataMethod>(version: TVersion, method: TMethod, args: TArgs, init?: ClientRequestInit<TClient, TResult>): PersonPhotoResult<TMethod>;
|
|
25
|
+
/**
|
|
26
|
+
* Suggest person service
|
|
27
|
+
*/
|
|
28
|
+
suggest<TResult = PersonSuggestApiResponse, TMethod extends keyof ClientMethod<TResult> = keyof ClientMethod<TResult>>(method: TMethod, init?: ClientRequestInit<TClient, TResult>): PersonSuggestResult<TMethod, TResult>;
|
|
29
|
+
/**
|
|
30
|
+
* Resolve person service
|
|
31
|
+
*/
|
|
32
|
+
resolve<TResult = PersonResolveApiResponse, TMethod extends keyof ClientMethod<TResult> = keyof ClientMethod<TResult>>(method: TMethod, init?: ClientRequestInit<TClient, TResult>): PersonResolveResult<TMethod, TResult>;
|
|
23
33
|
}
|
|
24
34
|
export default PeopleApiClient;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ClientRequestInit, IHttpClient } from '@equinor/fusion-framework-module-http/client';
|
|
2
|
+
import type { ClientMethod } from '../../types';
|
|
3
|
+
import type { ApiResponse, ApiResult } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Factory for creating a typed client function for the people resolve endpoint.
|
|
6
|
+
*
|
|
7
|
+
* The returned function will use the provided HTTP client and method to call the
|
|
8
|
+
* resolve API for people identifiers, using parameters generated by
|
|
9
|
+
* {@link generateParameters}.
|
|
10
|
+
*
|
|
11
|
+
* @param client - HTTP client used to execute the request
|
|
12
|
+
* @param method - HTTP client method to invoke (for example, {@code 'json'})
|
|
13
|
+
*/
|
|
14
|
+
export declare const client: <TMethod extends keyof ClientMethod = keyof ClientMethod, TClient extends IHttpClient = IHttpClient>(client: TClient, method?: TMethod) => <T = ApiResponse>(init?: ClientRequestInit<TClient, T>) => ApiResult<TMethod, T>;
|
|
15
|
+
export default client;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ClientRequestInit, IHttpClient } from '@equinor/fusion-framework-module-http/client';
|
|
2
|
+
import type { ApiClientArguments } from '../../types';
|
|
3
|
+
/** function for creating http client arguments */
|
|
4
|
+
export declare const generateParameters: <TResult, TClient extends IHttpClient = IHttpClient>(init?: ClientRequestInit<TClient, TResult>) => ApiClientArguments<TClient, TResult>;
|
|
5
|
+
export default generateParameters;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ApiResolved } from '../api-models';
|
|
2
|
+
import type { ClientMethod } from '../../types';
|
|
3
|
+
export type ApiResponse = ApiResolved;
|
|
4
|
+
export type ApiResult<TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>, TResult = ApiResponse> = ClientMethod<TResult>[TMethod];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ClientRequestInit, IHttpClient } from '@equinor/fusion-framework-module-http/client';
|
|
2
|
+
import type { ClientMethod } from '../../types';
|
|
3
|
+
import type { ApiResponse, ApiResult } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Client factory for calling the people suggest endpoint.
|
|
6
|
+
* @param client - HTTP client used to perform the request
|
|
7
|
+
* @param method - HTTP client method to call (for example, 'json')
|
|
8
|
+
*/
|
|
9
|
+
export declare const client: <TMethod extends keyof ClientMethod = keyof ClientMethod, TClient extends IHttpClient = IHttpClient>(client: TClient, method?: TMethod) => <T = ApiResponse>(init?: ClientRequestInit<TClient, T>) => ApiResult<TMethod, T>;
|
|
10
|
+
export default client;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ClientRequestInit, IHttpClient } from '@equinor/fusion-framework-module-http/client';
|
|
2
|
+
import type { ApiClientArguments } from '../../types';
|
|
3
|
+
/** function for creating http client arguments */
|
|
4
|
+
export declare const generateParameters: <TResult, TClient extends IHttpClient = IHttpClient>(init?: ClientRequestInit<TClient, TResult>) => ApiClientArguments<TClient, TResult>;
|
|
5
|
+
export default generateParameters;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ApiSuggestions } from '../api-models';
|
|
2
|
+
import type { ClientMethod } from '../../types';
|
|
3
|
+
export type ApiResponse = ApiSuggestions;
|
|
4
|
+
export type ApiResult<TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>, TResult = ApiResponse> = ClientMethod<TResult>[TMethod];
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "7.
|
|
1
|
+
export declare const version = "7.2.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/fusion-framework-module-services",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -54,6 +54,14 @@
|
|
|
54
54
|
"import": "./dist/esm/people/query/index.js",
|
|
55
55
|
"types": "./dist/types/people/query/index.d.ts"
|
|
56
56
|
},
|
|
57
|
+
"./people/suggest": {
|
|
58
|
+
"import": "./dist/esm/people/suggest/index.js",
|
|
59
|
+
"types": "./dist/types/people/suggest/index.d.ts"
|
|
60
|
+
},
|
|
61
|
+
"./people/resolve": {
|
|
62
|
+
"import": "./dist/esm/people/resolve/index.js",
|
|
63
|
+
"types": "./dist/types/people/resolve/index.d.ts"
|
|
64
|
+
},
|
|
57
65
|
"./people/photo": {
|
|
58
66
|
"import": "./dist/esm/people/person-photo/index.js",
|
|
59
67
|
"types": "./dist/types/people/person-photo/index.d.ts"
|
|
@@ -99,6 +107,12 @@
|
|
|
99
107
|
"people/get": [
|
|
100
108
|
"./dist/types/people/person-details/index.d.ts"
|
|
101
109
|
],
|
|
110
|
+
"people/suggest": [
|
|
111
|
+
"./dist/types/people/suggest/index.d.ts"
|
|
112
|
+
],
|
|
113
|
+
"people/resolve": [
|
|
114
|
+
"./dist/types/people/resolve/index.d.ts"
|
|
115
|
+
],
|
|
102
116
|
"people/query": [
|
|
103
117
|
"./dist/types/people/query/index.d.ts"
|
|
104
118
|
],
|
|
@@ -130,9 +144,9 @@
|
|
|
130
144
|
"msw": "^2.7.3",
|
|
131
145
|
"typescript": "^5.8.2",
|
|
132
146
|
"vitest": "^3.2.4",
|
|
133
|
-
"@equinor/fusion-framework-module
|
|
134
|
-
"@equinor/fusion-framework-module-
|
|
135
|
-
"@equinor/fusion-framework-module": "^
|
|
147
|
+
"@equinor/fusion-framework-module": "^5.0.5",
|
|
148
|
+
"@equinor/fusion-framework-module-http": "^7.0.7",
|
|
149
|
+
"@equinor/fusion-framework-module-service-discovery": "^9.1.0"
|
|
136
150
|
},
|
|
137
151
|
"peerDependencies": {
|
|
138
152
|
"odata-query": "^8.0.4",
|
package/src/people/api-models.ts
CHANGED
|
@@ -50,3 +50,60 @@ export type ApiPerson<T extends keyof typeof ApiVersion | ApiVersion> = T extend
|
|
|
50
50
|
: T extends keyof typeof ApiVersion
|
|
51
51
|
? ApiPersonMap[(typeof ApiVersion)[T]]
|
|
52
52
|
: unknown;
|
|
53
|
+
|
|
54
|
+
export type ApiSuggestionPerson = {
|
|
55
|
+
accountType?:
|
|
56
|
+
| 'Unknown'
|
|
57
|
+
| 'Employee'
|
|
58
|
+
| 'Consultant'
|
|
59
|
+
| 'Enterprise'
|
|
60
|
+
| 'EnterpriseExternal'
|
|
61
|
+
| 'External'
|
|
62
|
+
| 'Local'
|
|
63
|
+
| 'TemporaryEmployee'
|
|
64
|
+
| 'System'
|
|
65
|
+
| 'Admin'
|
|
66
|
+
| 'MeetingRoom';
|
|
67
|
+
jobTitle?: string;
|
|
68
|
+
department?: string;
|
|
69
|
+
fullDepartment?: string;
|
|
70
|
+
employeeNumber?: string;
|
|
71
|
+
managerAzureUniqueId?: string;
|
|
72
|
+
upn?: string;
|
|
73
|
+
mobilePhone?: string;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export type ApiSuggestionApplication = {
|
|
77
|
+
applicationId: string;
|
|
78
|
+
applicationName?: string;
|
|
79
|
+
servicePrincipalType: 'Application' | 'ManagedIdentity' | 'ServicePrincipal';
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export type ApiSuggestionValue = {
|
|
83
|
+
azureUniqueId: string;
|
|
84
|
+
name?: string;
|
|
85
|
+
accountType: 'Person' | 'SystemAccount' | 'Unknown';
|
|
86
|
+
accountLabel: string;
|
|
87
|
+
person?: ApiSuggestionPerson;
|
|
88
|
+
application?: ApiSuggestionApplication;
|
|
89
|
+
avatarColor: string;
|
|
90
|
+
avatarUrl: string;
|
|
91
|
+
isExpired: boolean;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export type ApiSuggestions = {
|
|
95
|
+
totalCount: number;
|
|
96
|
+
count: number;
|
|
97
|
+
'@nextPage': string | null;
|
|
98
|
+
value: Array<ApiSuggestionValue>;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export type ApiResolveItem = {
|
|
102
|
+
success: boolean;
|
|
103
|
+
statusCode: number;
|
|
104
|
+
errorMessage: string | null;
|
|
105
|
+
identifier: string;
|
|
106
|
+
account: ApiSuggestionValue | null;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export type ApiResolved = Array<ApiResolveItem>;
|
package/src/people/client.ts
CHANGED
|
@@ -27,6 +27,18 @@ import {
|
|
|
27
27
|
type ApiRequestArgs as PersonPhotoApiRequestArgs,
|
|
28
28
|
} from './person-photo';
|
|
29
29
|
|
|
30
|
+
import {
|
|
31
|
+
client as personSuggestClient,
|
|
32
|
+
type ApiResponse as PersonSuggestApiResponse,
|
|
33
|
+
type ApiResult as PersonSuggestResult,
|
|
34
|
+
} from './suggest';
|
|
35
|
+
|
|
36
|
+
import {
|
|
37
|
+
client as personResolveClient,
|
|
38
|
+
type ApiResponse as PersonResolveApiResponse,
|
|
39
|
+
type ApiResult as PersonResolveResult,
|
|
40
|
+
} from './resolve';
|
|
41
|
+
|
|
30
42
|
export class PeopleApiClient<
|
|
31
43
|
// TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
|
|
32
44
|
TClient extends IHttpClient = IHttpClient,
|
|
@@ -90,16 +102,34 @@ export class PeopleApiClient<
|
|
|
90
102
|
const fn = personPhotoClient<TVersion, TMethod, TClient>(this._client, version, method);
|
|
91
103
|
return fn<TResult>(args, init);
|
|
92
104
|
}
|
|
93
|
-
}
|
|
94
105
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
106
|
+
/**
|
|
107
|
+
* Suggest person service
|
|
108
|
+
*/
|
|
109
|
+
public suggest<
|
|
110
|
+
TResult = PersonSuggestApiResponse,
|
|
111
|
+
TMethod extends keyof ClientMethod<TResult> = keyof ClientMethod<TResult>,
|
|
112
|
+
>(
|
|
113
|
+
method: TMethod,
|
|
114
|
+
init?: ClientRequestInit<TClient, TResult>,
|
|
115
|
+
): PersonSuggestResult<TMethod, TResult> {
|
|
116
|
+
const fn = personSuggestClient<TMethod, TClient>(this._client, method);
|
|
117
|
+
return fn<TResult>(init);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Resolve person service
|
|
122
|
+
*/
|
|
123
|
+
public resolve<
|
|
124
|
+
TResult = PersonResolveApiResponse,
|
|
125
|
+
TMethod extends keyof ClientMethod<TResult> = keyof ClientMethod<TResult>,
|
|
126
|
+
>(
|
|
127
|
+
method: TMethod,
|
|
128
|
+
init?: ClientRequestInit<TClient, TResult>,
|
|
129
|
+
): PersonResolveResult<TMethod, TResult> {
|
|
130
|
+
const fn = personResolveClient<TMethod, TClient>(this._client, method);
|
|
131
|
+
return fn<TResult>(init);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
104
134
|
|
|
105
135
|
export default PeopleApiClient;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ClientRequestInit, IHttpClient } from '@equinor/fusion-framework-module-http/client';
|
|
2
|
+
|
|
3
|
+
import { generateParameters } from './generate-parameters';
|
|
4
|
+
|
|
5
|
+
import type { ClientMethod } from '../../types';
|
|
6
|
+
import type { ApiResponse, ApiResult } from './types';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Factory for creating a typed client function for the people resolve endpoint.
|
|
10
|
+
*
|
|
11
|
+
* The returned function will use the provided HTTP client and method to call the
|
|
12
|
+
* resolve API for people identifiers, using parameters generated by
|
|
13
|
+
* {@link generateParameters}.
|
|
14
|
+
*
|
|
15
|
+
* @param client - HTTP client used to execute the request
|
|
16
|
+
* @param method - HTTP client method to invoke (for example, {@code 'json'})
|
|
17
|
+
*/
|
|
18
|
+
export const client =
|
|
19
|
+
<
|
|
20
|
+
TMethod extends keyof ClientMethod = keyof ClientMethod,
|
|
21
|
+
TClient extends IHttpClient = IHttpClient,
|
|
22
|
+
>(
|
|
23
|
+
client: TClient,
|
|
24
|
+
method: TMethod = 'json' as TMethod,
|
|
25
|
+
) =>
|
|
26
|
+
<T = ApiResponse>(init?: ClientRequestInit<TClient, T>): ApiResult<TMethod, T> =>
|
|
27
|
+
client[method](...generateParameters<T, TClient>(init)) as ApiResult<TMethod, T>;
|
|
28
|
+
|
|
29
|
+
export default client;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ClientRequestInit, IHttpClient } from '@equinor/fusion-framework-module-http/client';
|
|
2
|
+
|
|
3
|
+
import { generateEndpoint } from './generate-endpoint';
|
|
4
|
+
|
|
5
|
+
import type { ApiClientArguments } from '../../types';
|
|
6
|
+
|
|
7
|
+
/** function for creating http client arguments */
|
|
8
|
+
export const generateParameters = <TResult, TClient extends IHttpClient = IHttpClient>(
|
|
9
|
+
init?: ClientRequestInit<TClient, TResult>,
|
|
10
|
+
): ApiClientArguments<TClient, TResult> => {
|
|
11
|
+
const path = generateEndpoint();
|
|
12
|
+
return [path, init];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default generateParameters;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ApiResolved } from '../api-models';
|
|
2
|
+
import type { ClientMethod } from '../../types';
|
|
3
|
+
|
|
4
|
+
export type ApiResponse = ApiResolved;
|
|
5
|
+
|
|
6
|
+
export type ApiResult<
|
|
7
|
+
TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
|
|
8
|
+
TResult = ApiResponse,
|
|
9
|
+
> = ClientMethod<TResult>[TMethod];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ClientRequestInit, IHttpClient } from '@equinor/fusion-framework-module-http/client';
|
|
2
|
+
|
|
3
|
+
import { generateParameters } from './generate-parameters';
|
|
4
|
+
|
|
5
|
+
import type { ClientMethod } from '../../types';
|
|
6
|
+
import type { ApiResponse, ApiResult } from './types';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Client factory for calling the people suggest endpoint.
|
|
10
|
+
* @param client - HTTP client used to perform the request
|
|
11
|
+
* @param method - HTTP client method to call (for example, 'json')
|
|
12
|
+
*/
|
|
13
|
+
export const client =
|
|
14
|
+
<
|
|
15
|
+
TMethod extends keyof ClientMethod = keyof ClientMethod,
|
|
16
|
+
TClient extends IHttpClient = IHttpClient,
|
|
17
|
+
>(
|
|
18
|
+
client: TClient,
|
|
19
|
+
method: TMethod = 'json' as TMethod,
|
|
20
|
+
) =>
|
|
21
|
+
<T = ApiResponse>(init?: ClientRequestInit<TClient, T>): ApiResult<TMethod, T> =>
|
|
22
|
+
client[method](...generateParameters<T, TClient>(init)) as ApiResult<TMethod, T>;
|
|
23
|
+
|
|
24
|
+
export default client;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ClientRequestInit, IHttpClient } from '@equinor/fusion-framework-module-http/client';
|
|
2
|
+
|
|
3
|
+
import { generateEndpoint } from './generate-endpoint';
|
|
4
|
+
|
|
5
|
+
import type { ApiClientArguments } from '../../types';
|
|
6
|
+
|
|
7
|
+
/** function for creating http client arguments */
|
|
8
|
+
export const generateParameters = <TResult, TClient extends IHttpClient = IHttpClient>(
|
|
9
|
+
init?: ClientRequestInit<TClient, TResult>,
|
|
10
|
+
): ApiClientArguments<TClient, TResult> => {
|
|
11
|
+
const path = generateEndpoint();
|
|
12
|
+
return [path, init];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default generateParameters;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ApiSuggestions } from '../api-models';
|
|
2
|
+
import type { ClientMethod } from '../../types';
|
|
3
|
+
|
|
4
|
+
export type ApiResponse = ApiSuggestions;
|
|
5
|
+
|
|
6
|
+
export type ApiResult<
|
|
7
|
+
TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>,
|
|
8
|
+
TResult = ApiResponse,
|
|
9
|
+
> = ClientMethod<TResult>[TMethod];
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '7.
|
|
2
|
+
export const version = '7.2.0';
|