Skip to content

Commit 8a87b91

Browse files
BenWhite27Ben Whiteumbracotrd
authored
Allow developer to add custom FeedGeneratorService implementations (#44)
* Use a CollectionBuilder to register FeedGenerators. Updated Backend implementation to obtain IProductFeedGeneratorService instances via this collection. * Updated Frontend implementation to use FeedGeneratorId instead of FeedType * Provide a mechanism for IProductFeedGeneratrorService implementations to declare the format they generate. Use this format declaration to return the correct output within ProductFeedController. * Define a base class for ProductFeedGeneratorService implementations as a developer aid. * Resolve Typescript incompatible types error for feedGeneratorId * Remove GoogleMerchantFeed Mapping defaults * fix code format; add comments; add a general exception class. * clean up codes * remove unnecessary using statements * bump version to 16.1.0 * Fix breaking changes * Fix the breaking change * enable package validation * Fix breaking changes * Split the ProductFeedController to make it easier to bump the api version of the actions. Improve the backward compatibility. * rebuild frontend * Fix a API breaking change --------- Co-authored-by: Ben White <[email protected]> Co-authored-by: Dinh Tran <[email protected]>
1 parent 6a1bc60 commit 8a87b91

File tree

49 files changed

+1688
-658
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1688
-658
lines changed

src/Umbraco.Commerce.ProductFeeds.Client/frontend/package-lock.json

Lines changed: 563 additions & 517 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Umbraco.Commerce.ProductFeeds.Client/frontend/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "umbraco-commerce-product-feeds",
3-
"version": "15.0.0",
3+
"version": "16.0.0",
44
"description": "A product feeds generator for Umbraco Commerce",
55
"main": "./src/index.ts",
66
"type": "module",
@@ -31,8 +31,8 @@
3131
"license": "ISC",
3232
"dependencies": {
3333
"@hey-api/client-axios": "^0.8.0",
34-
"@umbraco-cms/backoffice": "^16.0.0-rc3",
35-
"@umbraco-commerce/backoffice": "^16.0.0-rc1",
34+
"@umbraco-cms/backoffice": "^16.0.0",
35+
"@umbraco-commerce/backoffice": "^16.0.0",
3636
"nanoid": "^5.1.5"
3737
}
38-
}
38+
}

src/Umbraco.Commerce.ProductFeeds.Client/frontend/src/generated/apis/client.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ import { type Config, type ClientOptions as DefaultClientOptions, createClient,
1414
export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>;
1515

1616
export const client = createClient(createConfig<ClientOptions>({
17-
baseURL: 'https://localhost:44322',
17+
baseURL: 'http://localhost:44321',
1818
}));

src/Umbraco.Commerce.ProductFeeds.Client/frontend/src/generated/apis/sdk.gen.ts

Lines changed: 128 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This file is auto-generated by @hey-api/openapi-ts
22

33
import { type Options as ClientOptions, type TDataShape, type Client, formDataBodySerializer } from '@hey-api/client-axios';
4-
import type { DeleteData, DeleteResponses, DeleteErrors, GetDocumentTypesData, GetDocumentTypesResponses, GetDocumentTypesErrors, GetFeedTypesData, GetFeedTypesResponses, GetFeedTypesErrors, GetDetailsData, GetDetailsResponses, GetDetailsErrors, GetByStoreData, GetByStoreResponses, GetByStoreErrors, GetPropertyValueExtractorsData, GetPropertyValueExtractorsResponses, GetPropertyValueExtractorsErrors, SaveData, SaveResponses, SaveErrors } from './types.gen';
4+
import type { DeleteV2Data, DeleteV2Responses, DeleteV2Errors, DeleteData, DeleteResponses, DeleteErrors, GetDocumentTypesData, GetDocumentTypesResponses, GetDocumentTypesErrors, GetDocumentTypesV2Data, GetDocumentTypesV2Responses, GetDocumentTypesV2Errors, GetFeedGeneratorsV2Data, GetFeedGeneratorsV2Responses, GetFeedGeneratorsV2Errors, GetFeedTypesData, GetFeedTypesResponses, GetFeedTypesErrors, GetDetailsData, GetDetailsResponses, GetDetailsErrors, GetDetailsV2Data, GetDetailsV2Responses, GetDetailsV2Errors, GetByStoreData, GetByStoreResponses, GetByStoreErrors, GetByStoreV2Data, GetByStoreV2Responses, GetByStoreV2Errors, GetPropertyValueExtractorsData, GetPropertyValueExtractorsResponses, GetPropertyValueExtractorsErrors, GetPropertyValueExtractorsV2Data, GetPropertyValueExtractorsV2Responses, GetPropertyValueExtractorsV2Errors, SaveData, SaveResponses, SaveErrors, SaveV2Data, SaveV2Responses, SaveV2Errors } from './types.gen';
55
import { client as _heyApiClient } from './client.gen';
66

77
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
@@ -18,6 +18,28 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
1818
meta?: Record<string, unknown>;
1919
};
2020

21+
export const deleteV2 = <ThrowOnError extends boolean = false>(options?: Options<DeleteV2Data, ThrowOnError>) => {
22+
return (options?.client ?? _heyApiClient).post<DeleteV2Responses, DeleteV2Errors, ThrowOnError>({
23+
...formDataBodySerializer,
24+
responseType: 'json',
25+
security: [
26+
{
27+
scheme: 'bearer',
28+
type: 'http',
29+
},
30+
],
31+
url: '/umbraco/ucproductfeeds/management/api/v2/setting/delete',
32+
...options,
33+
headers: {
34+
'Content-Type': null,
35+
...options?.headers,
36+
},
37+
});
38+
};
39+
40+
/**
41+
* @deprecated
42+
*/
2143
export const delete_ = <ThrowOnError extends boolean = false>(options?: Options<DeleteData, ThrowOnError>) => {
2244
return (options?.client ?? _heyApiClient).post<DeleteResponses, DeleteErrors, ThrowOnError>({
2345
...formDataBodySerializer,
@@ -37,6 +59,9 @@ export const delete_ = <ThrowOnError extends boolean = false>(options?: Options<
3759
});
3860
};
3961

62+
/**
63+
* @deprecated
64+
*/
4065
export const getDocumentTypes = <ThrowOnError extends boolean = false>(options?: Options<GetDocumentTypesData, ThrowOnError>) => {
4166
return (options?.client ?? _heyApiClient).get<GetDocumentTypesResponses, GetDocumentTypesErrors, ThrowOnError>({
4267
security: [
@@ -50,6 +75,36 @@ export const getDocumentTypes = <ThrowOnError extends boolean = false>(options?:
5075
});
5176
};
5277

78+
export const getDocumentTypesV2 = <ThrowOnError extends boolean = false>(options?: Options<GetDocumentTypesV2Data, ThrowOnError>) => {
79+
return (options?.client ?? _heyApiClient).get<GetDocumentTypesV2Responses, GetDocumentTypesV2Errors, ThrowOnError>({
80+
security: [
81+
{
82+
scheme: 'bearer',
83+
type: 'http',
84+
},
85+
],
86+
url: '/umbraco/ucproductfeeds/management/api/v2/setting/documenttypes',
87+
...options,
88+
});
89+
};
90+
91+
export const getFeedGeneratorsV2 = <ThrowOnError extends boolean = false>(options?: Options<GetFeedGeneratorsV2Data, ThrowOnError>) => {
92+
return (options?.client ?? _heyApiClient).get<GetFeedGeneratorsV2Responses, GetFeedGeneratorsV2Errors, ThrowOnError>({
93+
responseType: 'json',
94+
security: [
95+
{
96+
scheme: 'bearer',
97+
type: 'http',
98+
},
99+
],
100+
url: '/umbraco/ucproductfeeds/management/api/v2/setting/feedgenerators',
101+
...options,
102+
});
103+
};
104+
105+
/**
106+
* @deprecated
107+
*/
53108
export const getFeedTypes = <ThrowOnError extends boolean = false>(options?: Options<GetFeedTypesData, ThrowOnError>) => {
54109
return (options?.client ?? _heyApiClient).get<GetFeedTypesResponses, GetFeedTypesErrors, ThrowOnError>({
55110
responseType: 'json',
@@ -64,6 +119,9 @@ export const getFeedTypes = <ThrowOnError extends boolean = false>(options?: Opt
64119
});
65120
};
66121

122+
/**
123+
* @deprecated
124+
*/
67125
export const getDetails = <ThrowOnError extends boolean = false>(options: Options<GetDetailsData, ThrowOnError>) => {
68126
return (options.client ?? _heyApiClient).get<GetDetailsResponses, GetDetailsErrors, ThrowOnError>({
69127
responseType: 'json',
@@ -78,6 +136,23 @@ export const getDetails = <ThrowOnError extends boolean = false>(options: Option
78136
});
79137
};
80138

139+
export const getDetailsV2 = <ThrowOnError extends boolean = false>(options: Options<GetDetailsV2Data, ThrowOnError>) => {
140+
return (options.client ?? _heyApiClient).get<GetDetailsV2Responses, GetDetailsV2Errors, ThrowOnError>({
141+
responseType: 'json',
142+
security: [
143+
{
144+
scheme: 'bearer',
145+
type: 'http',
146+
},
147+
],
148+
url: '/umbraco/ucproductfeeds/management/api/v2/setting/get/{id}',
149+
...options,
150+
});
151+
};
152+
153+
/**
154+
* @deprecated
155+
*/
81156
export const getByStore = <ThrowOnError extends boolean = false>(options: Options<GetByStoreData, ThrowOnError>) => {
82157
return (options.client ?? _heyApiClient).get<GetByStoreResponses, GetByStoreErrors, ThrowOnError>({
83158
responseType: 'json',
@@ -92,6 +167,23 @@ export const getByStore = <ThrowOnError extends boolean = false>(options: Option
92167
});
93168
};
94169

170+
export const getByStoreV2 = <ThrowOnError extends boolean = false>(options: Options<GetByStoreV2Data, ThrowOnError>) => {
171+
return (options.client ?? _heyApiClient).get<GetByStoreV2Responses, GetByStoreV2Errors, ThrowOnError>({
172+
responseType: 'json',
173+
security: [
174+
{
175+
scheme: 'bearer',
176+
type: 'http',
177+
},
178+
],
179+
url: '/umbraco/ucproductfeeds/management/api/v2/setting/getbystore',
180+
...options,
181+
});
182+
};
183+
184+
/**
185+
* @deprecated
186+
*/
95187
export const getPropertyValueExtractors = <ThrowOnError extends boolean = false>(options?: Options<GetPropertyValueExtractorsData, ThrowOnError>) => {
96188
return (options?.client ?? _heyApiClient).get<GetPropertyValueExtractorsResponses, GetPropertyValueExtractorsErrors, ThrowOnError>({
97189
responseType: 'json',
@@ -106,6 +198,23 @@ export const getPropertyValueExtractors = <ThrowOnError extends boolean = false>
106198
});
107199
};
108200

201+
export const getPropertyValueExtractorsV2 = <ThrowOnError extends boolean = false>(options?: Options<GetPropertyValueExtractorsV2Data, ThrowOnError>) => {
202+
return (options?.client ?? _heyApiClient).get<GetPropertyValueExtractorsV2Responses, GetPropertyValueExtractorsV2Errors, ThrowOnError>({
203+
responseType: 'json',
204+
security: [
205+
{
206+
scheme: 'bearer',
207+
type: 'http',
208+
},
209+
],
210+
url: '/umbraco/ucproductfeeds/management/api/v2/setting/propertyvalueextractors',
211+
...options,
212+
});
213+
};
214+
215+
/**
216+
* @deprecated
217+
*/
109218
export const save = <ThrowOnError extends boolean = false>(options?: Options<SaveData, ThrowOnError>) => {
110219
return (options?.client ?? _heyApiClient).post<SaveResponses, SaveErrors, ThrowOnError>({
111220
responseType: 'json',
@@ -122,4 +231,22 @@ export const save = <ThrowOnError extends boolean = false>(options?: Options<Sav
122231
...options?.headers,
123232
},
124233
});
234+
};
235+
236+
export const saveV2 = <ThrowOnError extends boolean = false>(options?: Options<SaveV2Data, ThrowOnError>) => {
237+
return (options?.client ?? _heyApiClient).post<SaveV2Responses, SaveV2Errors, ThrowOnError>({
238+
responseType: 'json',
239+
security: [
240+
{
241+
scheme: 'bearer',
242+
type: 'http',
243+
},
244+
],
245+
url: '/umbraco/ucproductfeeds/management/api/v2/setting/save',
246+
...options,
247+
headers: {
248+
'Content-Type': 'application/json',
249+
...options?.headers,
250+
},
251+
});
125252
};

0 commit comments

Comments
 (0)