Skip to content

Commit 6702a11

Browse files
authored
Merge pull request #288 from umbraco/feature/v17/algolia
Feature/v17/algolia
2 parents 8cde74b + 2e8086e commit 6702a11

29 files changed

+2228
-2850
lines changed

examples/Umbraco.Cms.Integrations.Testsite.V17/Umbraco.Cms.Integrations.Testsite.V17.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
<ItemGroup>
1010
<PackageReference Include="Umbraco.Cms" Version="17.0.0" />
11+
<ProjectReference Include="..\..\src\Umbraco.Cms.Integrations.Search.Algolia\Umbraco.Cms.Integrations.Search.Algolia.csproj" />
1112
<ProjectReference Include="..\..\src\Umbraco.Cms.Integrations.Crm.Hubspot\Umbraco.Cms.Integrations.Crm.Hubspot.csproj" />
1213
<ProjectReference Include="..\..\src\Umbraco.Cms.Integrations.SEO.Semrush\Umbraco.Cms.Integrations.SEO.Semrush.csproj" />
1314
<ProjectReference Include="..\..\src\Umbraco.Cms.Integrations.Automation.Zapier\Umbraco.Cms.Integrations.Automation.Zapier.csproj" />

examples/Umbraco.Cms.Integrations.Testsite.V17/appsettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@
4141
}
4242
}
4343
}
44-
}
44+
}

src/Umbraco.Cms.Integrations.Search.Algolia/AlgoliaComposer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using Algolia.Search.Models.Search;
22
using Microsoft.Extensions.DependencyInjection;
3-
using Microsoft.OpenApi.Models;
3+
using Microsoft.OpenApi;
44
using Swashbuckle.AspNetCore.SwaggerGen;
55
using Umbraco.Cms.Api.Common.OpenApi;
66
using Umbraco.Cms.Core.Composing;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@umbraco-cms:registry=https://www.myget.org/F/umbracoprereleases/npm/
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// This file is auto-generated by @hey-api/openapi-ts
22

3-
import type { ClientOptions } from './types.gen';
4-
import { type Config, type ClientOptions as DefaultClientOptions, createClient, createConfig } from '@hey-api/client-fetch';
3+
import { type ClientOptions, type Config, createClient, createConfig } from '@hey-api/client-fetch';
4+
5+
import type { ClientOptions as ClientOptions2 } from './types.gen';
56

67
/**
78
* The `createClientConfig()` function will be called on client initialization
@@ -11,9 +12,9 @@ import { type Config, type ClientOptions as DefaultClientOptions, createClient,
1112
* `setConfig()`. This is useful for example if you're using Next.js
1213
* to ensure your client always has the correct values.
1314
*/
14-
export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>;
15+
export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
1516

16-
export const client = createClient(createConfig<ClientOptions>({
17-
baseUrl: 'http://localhost:58030',
17+
export const client = createClient(createConfig<ClientOptions2>({
18+
baseUrl: 'http://localhost:28157',
1819
throwOnError: true
19-
}));
20+
}));
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// This file is auto-generated by @hey-api/openapi-ts
2+
23
export * from './types.gen';
34
export * from './client.gen';
4-
export * from './sdk.gen';
5+
export * from './sdk.gen';

src/Umbraco.Cms.Integrations.Search.Algolia/Client/generated/sdk.gen.ts

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

3-
import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch';
4-
import type { GetContentTypesData, GetContentTypesResponse, GetSearchContentTypeIndexByIdData, GetSearchContentTypeIndexByIdResponse, GetIndicesData, GetIndicesResponse, PostSaveIndexData, PostSaveIndexResponse, DeleteSearchIndexData, DeleteSearchIndexResponse, GetSearchIndexByIdData, GetSearchIndexByIdResponse, GetSearchIndexData, GetSearchIndexResponse, PostBuildSearchIndexData, PostBuildSearchIndexResponse } from './types.gen';
5-
import { client as _heyApiClient } from './client.gen';
3+
import type { Client, Options as Options2, TDataShape } from '@hey-api/client-fetch';
64

7-
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
5+
import { client } from './client.gen';
6+
import type { DeleteSearchIndexData, DeleteSearchIndexErrors, DeleteSearchIndexResponses, GetContentTypesData, GetContentTypesErrors, GetContentTypesResponses, GetIndicesData, GetIndicesErrors, GetIndicesResponses, GetSearchContentTypeIndexByIdData, GetSearchContentTypeIndexByIdErrors, GetSearchContentTypeIndexByIdResponses, GetSearchIndexByIdData, GetSearchIndexByIdErrors, GetSearchIndexByIdResponses, GetSearchIndexData, GetSearchIndexErrors, GetSearchIndexResponses, PostBuildSearchIndexData, PostBuildSearchIndexErrors, PostBuildSearchIndexResponses, PostSaveIndexData, PostSaveIndexErrors, PostSaveIndexResponses } from './types.gen';
7+
8+
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & {
89
/**
910
* You can provide a client instance returned by `createClient()` instead of
1011
* individual options. This might be also useful if you want to implement a
@@ -18,9 +19,9 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
1819
meta?: Record<string, unknown>;
1920
};
2021

21-
export class AlgoliaSearchService {
22+
export class AlgoliaSearch {
2223
public static getContentTypes<ThrowOnError extends boolean = true>(options?: Options<GetContentTypesData, ThrowOnError>) {
23-
return (options?.client ?? _heyApiClient).get<GetContentTypesResponse, unknown, ThrowOnError>({
24+
return (options?.client ?? client).get<GetContentTypesResponses, GetContentTypesErrors, ThrowOnError>({
2425
security: [
2526
{
2627
scheme: 'bearer',
@@ -33,7 +34,7 @@ export class AlgoliaSearchService {
3334
}
3435

3536
public static getSearchContentTypeIndexById<ThrowOnError extends boolean = true>(options: Options<GetSearchContentTypeIndexByIdData, ThrowOnError>) {
36-
return (options.client ?? _heyApiClient).get<GetSearchContentTypeIndexByIdResponse, unknown, ThrowOnError>({
37+
return (options.client ?? client).get<GetSearchContentTypeIndexByIdResponses, GetSearchContentTypeIndexByIdErrors, ThrowOnError>({
3738
security: [
3839
{
3940
scheme: 'bearer',
@@ -46,7 +47,7 @@ export class AlgoliaSearchService {
4647
}
4748

4849
public static getIndices<ThrowOnError extends boolean = true>(options?: Options<GetIndicesData, ThrowOnError>) {
49-
return (options?.client ?? _heyApiClient).get<GetIndicesResponse, unknown, ThrowOnError>({
50+
return (options?.client ?? client).get<GetIndicesResponses, GetIndicesErrors, ThrowOnError>({
5051
security: [
5152
{
5253
scheme: 'bearer',
@@ -59,7 +60,7 @@ export class AlgoliaSearchService {
5960
}
6061

6162
public static postSaveIndex<ThrowOnError extends boolean = true>(options?: Options<PostSaveIndexData, ThrowOnError>) {
62-
return (options?.client ?? _heyApiClient).post<PostSaveIndexResponse, unknown, ThrowOnError>({
63+
return (options?.client ?? client).post<PostSaveIndexResponses, PostSaveIndexErrors, ThrowOnError>({
6364
security: [
6465
{
6566
scheme: 'bearer',
@@ -76,7 +77,7 @@ export class AlgoliaSearchService {
7677
}
7778

7879
public static deleteSearchIndex<ThrowOnError extends boolean = true>(options: Options<DeleteSearchIndexData, ThrowOnError>) {
79-
return (options.client ?? _heyApiClient).delete<DeleteSearchIndexResponse, unknown, ThrowOnError>({
80+
return (options.client ?? client).delete<DeleteSearchIndexResponses, DeleteSearchIndexErrors, ThrowOnError>({
8081
security: [
8182
{
8283
scheme: 'bearer',
@@ -89,7 +90,7 @@ export class AlgoliaSearchService {
8990
}
9091

9192
public static getSearchIndexById<ThrowOnError extends boolean = true>(options: Options<GetSearchIndexByIdData, ThrowOnError>) {
92-
return (options.client ?? _heyApiClient).get<GetSearchIndexByIdResponse, unknown, ThrowOnError>({
93+
return (options.client ?? client).get<GetSearchIndexByIdResponses, GetSearchIndexByIdErrors, ThrowOnError>({
9394
security: [
9495
{
9596
scheme: 'bearer',
@@ -102,7 +103,7 @@ export class AlgoliaSearchService {
102103
}
103104

104105
public static getSearchIndex<ThrowOnError extends boolean = true>(options: Options<GetSearchIndexData, ThrowOnError>) {
105-
return (options.client ?? _heyApiClient).get<GetSearchIndexResponse, unknown, ThrowOnError>({
106+
return (options.client ?? client).get<GetSearchIndexResponses, GetSearchIndexErrors, ThrowOnError>({
106107
security: [
107108
{
108109
scheme: 'bearer',
@@ -115,7 +116,7 @@ export class AlgoliaSearchService {
115116
}
116117

117118
public static postBuildSearchIndex<ThrowOnError extends boolean = true>(options?: Options<PostBuildSearchIndexData, ThrowOnError>) {
118-
return (options?.client ?? _heyApiClient).post<PostBuildSearchIndexResponse, unknown, ThrowOnError>({
119+
return (options?.client ?? client).post<PostBuildSearchIndexResponses, PostBuildSearchIndexErrors, ThrowOnError>({
119120
security: [
120121
{
121122
scheme: 'bearer',
@@ -130,5 +131,4 @@ export class AlgoliaSearchService {
130131
}
131132
});
132133
}
133-
134-
}
134+
}

src/Umbraco.Cms.Integrations.Search.Algolia/Client/generated/types.gen.ts

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// This file is auto-generated by @hey-api/openapi-ts
22

3+
export type ClientOptions = {
4+
baseUrl: 'http://localhost:28157' | (string & {});
5+
};
6+
37
export type ContentTypeDtoModel = {
48
id: number;
59
icon: string;
@@ -39,6 +43,15 @@ export type NotificationHeaderModel = {
3943
type: EventMessageTypeModel;
4044
};
4145

46+
export type ProblemDetails = {
47+
type?: string | null;
48+
title?: string | null;
49+
status?: number | null;
50+
detail?: string | null;
51+
instance?: string | null;
52+
[key: string]: unknown | string | null | string | null | number | null | string | null | string | null | undefined;
53+
};
54+
4255
export type ResponseModel = {
4356
itemsCount: number;
4457
pagesCount: number;
@@ -48,7 +61,7 @@ export type ResponseModel = {
4861
}>;
4962
};
5063

51-
export type ResultModelReadable = {
64+
export type ResultModel = {
5265
success: boolean;
5366
error: string;
5467
readonly failure: boolean;
@@ -119,8 +132,14 @@ export type GetIndicesErrors = {
119132
* The resource is protected and requires an authentication token
120133
*/
121134
401: unknown;
135+
/**
136+
* Internal Server Error
137+
*/
138+
500: ProblemDetails;
122139
};
123140

141+
export type GetIndicesError = GetIndicesErrors[keyof GetIndicesErrors];
142+
124143
export type GetIndicesResponses = {
125144
/**
126145
* OK
@@ -142,13 +161,19 @@ export type PostSaveIndexErrors = {
142161
* The resource is protected and requires an authentication token
143162
*/
144163
401: unknown;
164+
/**
165+
* Internal Server Error
166+
*/
167+
500: ProblemDetails;
145168
};
146169

170+
export type PostSaveIndexError = PostSaveIndexErrors[keyof PostSaveIndexErrors];
171+
147172
export type PostSaveIndexResponses = {
148173
/**
149174
* OK
150175
*/
151-
200: ResultModelReadable;
176+
200: ResultModel;
152177
};
153178

154179
export type PostSaveIndexResponse = PostSaveIndexResponses[keyof PostSaveIndexResponses];
@@ -173,7 +198,7 @@ export type DeleteSearchIndexResponses = {
173198
/**
174199
* OK
175200
*/
176-
200: ResultModelReadable;
201+
200: ResultModel;
177202
};
178203

179204
export type DeleteSearchIndexResponse = DeleteSearchIndexResponses[keyof DeleteSearchIndexResponses];
@@ -248,11 +273,7 @@ export type PostBuildSearchIndexResponses = {
248273
/**
249274
* OK
250275
*/
251-
200: ResultModelReadable;
276+
200: ResultModel;
252277
};
253278

254279
export type PostBuildSearchIndexResponse = PostBuildSearchIndexResponses[keyof PostBuildSearchIndexResponses];
255-
256-
export type ClientOptions = {
257-
baseUrl: 'http://localhost:58030' | (string & {});
258-
};

src/Umbraco.Cms.Integrations.Search.Algolia/Client/openapi-ts.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default defineConfig({
44
logs: {
55
level: 'debug',
66
},
7-
input: 'http://localhost:58030/umbraco/swagger/algolia-search-management/swagger.json',
7+
input: 'http://localhost:28157/umbraco/swagger/algolia-search-management/swagger.json',
88
output: {
99
path: 'generated',
1010
},

0 commit comments

Comments
 (0)