1- import { algoliasearch } from 'algoliasearch' ;
21import type { FacetFilters } from 'algoliasearch' ;
2+ import { algoliasearch } from 'algoliasearch' ;
33import type { PlainSearchParameters } from 'algoliasearch-helper' ;
44
55import { getObjectIDs , getObjects } from './helpers/records' ;
66import {
77 GenerationSource ,
8- ProductsComparisonOptions ,
9- RequestParameters ,
108 Guide ,
119 GuideContentOptions ,
1210 GuideContentOptionsForGenerated ,
@@ -15,6 +13,8 @@ import {
1513 GuideHeadlinesOptionsForCombined ,
1614 GuideHeadlinesOptionsForGenerated ,
1715 GuideHeadlinesOptionsForIndex ,
16+ ProductsComparisonOptions ,
17+ RequestParameters ,
1818 TasksResponse ,
1919} from './types' ;
2020import { version } from './version' ;
@@ -128,15 +128,15 @@ export function createClient(opts: CreateClientOptions) {
128128 } while (
129129 (
130130 await this . request ( {
131- path : `/task/${ taskID } /status` ,
131+ path : `/1/ task/${ taskID } /status` ,
132132 headers,
133133 options : requestOptions ,
134134 } )
135135 ) . completed === false
136136 ) ;
137137
138138 return await this . request ( {
139- path : `/task/${ taskID } /result` ,
139+ path : `/1/ task/${ taskID } /result` ,
140140 headers,
141141 options : requestOptions ,
142142 } ) ;
@@ -156,7 +156,7 @@ export function createClient(opts: CreateClientOptions) {
156156 } ;
157157
158158 const { taskID } = await this . request ( {
159- path : '/generate/shopping_guides_headlines ' ,
159+ path : '/1/ generate/headlines ' ,
160160 body : {
161161 index_name : this . options . indexName ,
162162 output_index_name : this . _outputIndexName ( ) ,
@@ -173,11 +173,7 @@ export function createClient(opts: CreateClientOptions) {
173173 } ,
174174
175175 async generateContent (
176- {
177- objectID,
178- type = 'shopping_guide' ,
179- ...options
180- } : Omit < GuideContentOptionsForGenerated , 'source' > ,
176+ { objectID, ...options } : Omit < GuideContentOptionsForGenerated , 'source' > ,
181177 requestOptions ?: RequestParameters
182178 ) {
183179 if ( ! this . options . writeAPIKey ) {
@@ -189,7 +185,7 @@ export function createClient(opts: CreateClientOptions) {
189185 } ;
190186
191187 const { taskID } = await this . request ( {
192- path : `/generate/${ type } _content /${ objectID } ` ,
188+ path : `/1/ generate/guide_content /${ objectID } ` ,
193189 body : {
194190 index_name : this . options . indexName ,
195191 output_index_name : this . _outputIndexName ( ) ,
@@ -219,7 +215,7 @@ export function createClient(opts: CreateClientOptions) {
219215 } ;
220216
221217 const { taskID } = await this . request ( {
222- path : '/generate/products_comparison' ,
218+ path : '/1/ generate/products_comparison' ,
223219 body : {
224220 object_ids : objectIDs ,
225221 index_name : this . options . indexName ,
@@ -459,7 +455,7 @@ export function createClient(opts: CreateClientOptions) {
459455 } ;
460456
461457 return await this . request ( {
462- path : '/vote' ,
458+ path : '/1/ vote' ,
463459 body : {
464460 index_name : this . options . indexName ,
465461 output_index_name : this . _outputIndexName ( ) ,
@@ -489,7 +485,7 @@ export function createClient(opts: CreateClientOptions) {
489485 } ;
490486
491487 return await this . request ( {
492- path : '/delete/shopping_guides ' ,
488+ path : '/1/ delete/guides ' ,
493489 body : {
494490 object_ids : objectIDs ,
495491 index_name : this . _outputIndexName ( ) ,
@@ -516,7 +512,7 @@ export function createClient(opts: CreateClientOptions) {
516512 } ;
517513
518514 return await this . request ( {
519- path : '/delete/shopping_guides_content ' ,
515+ path : '/1/ delete/guides_content ' ,
520516 body : {
521517 object_ids : objectIDs ,
522518 index_name : this . _outputIndexName ( ) ,
@@ -547,7 +543,7 @@ export function createClient(opts: CreateClientOptions) {
547543 'X-Algolia-API-Key' : this . options . writeAPIKey ,
548544 } ;
549545 return await this . request ( {
550- path : '/update/shopping_guide ' ,
546+ path : '/1/ update/guide ' ,
551547 body : {
552548 object_id : objectID ,
553549 data,
@@ -574,7 +570,7 @@ export function createClient(opts: CreateClientOptions) {
574570 } ;
575571
576572 return await this . request ( {
577- path : '/create/shopping_guides_index /' ,
573+ path : '/1/ create/guides_index /' ,
578574 body : {
579575 index_name : indexName ,
580576 } ,
@@ -595,7 +591,7 @@ export function createClient(opts: CreateClientOptions) {
595591 'X-Algolia-API-Key' : this . options . writeAPIKey ,
596592 } ;
597593 return await this . request ( {
598- path : '/tasks' ,
594+ path : '/1/ tasks' ,
599595 headers,
600596 options : {
601597 ...requestOptions ,
0 commit comments