-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
217 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@yext/search-core](./search-core.md) > [CloudRegion](./search-core.cloudregion.md) | ||
|
||
## CloudRegion enum | ||
|
||
Defines the cloud region of the API domains. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare enum CloudRegion | ||
``` | ||
|
||
## Enumeration Members | ||
|
||
| Member | Value | Description | | ||
| --- | --- | --- | | ||
| EU | <code>"eu"</code> | | | ||
| US | <code>"us"</code> | | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@yext/search-core](./search-core.md) > [Environment](./search-core.environment.md) | ||
|
||
## Environment enum | ||
|
||
Defines the environment of the API domains. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare enum Environment | ||
``` | ||
|
||
## Enumeration Members | ||
|
||
| Member | Value | Description | | ||
| --- | --- | --- | | ||
| PROD | <code>"prod"</code> | | | ||
| SANDBOX | <code>"sbx"</code> | | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@yext/search-core](./search-core.md) > [provideEndpoints](./search-core.provideendpoints.md) | ||
|
||
## provideEndpoints() function | ||
|
||
Provides all endpoints based on environment and cloud region. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare function provideEndpoints(environment?: Environment, cloudRegion?: CloudRegion): Required<Endpoints>; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| environment | [Environment](./search-core.environment.md) | environment of the domain to use, defaults to prod if not provided | | ||
| cloudRegion | [CloudRegion](./search-core.cloudregion.md) | cloud region of the domain to use, defaults to us if not provided | | ||
|
||
<b>Returns:</b> | ||
|
||
Required<[Endpoints](./search-core.endpoints.md)<!-- -->> | ||
|
||
## Remarks | ||
|
||
Returns an [Endpoints](./search-core.endpoints.md) instance. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// main symbols | ||
export { SearchCore } from './SearchCore'; | ||
export { provideCore } from './provideCore'; | ||
export { SandboxEndpoints } from './constants'; | ||
export { provideEndpoints, Environment, CloudRegion, SandboxEndpoints } from './provideEndpoints'; | ||
export * from './models'; | ||
export * from './services'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import { Endpoints } from './models/core/Endpoints'; | ||
|
||
export const defaultApiVersion = 20220511; | ||
|
||
/** | ||
* Defines the cloud region of the API domains. | ||
* | ||
* @public | ||
*/ | ||
export enum CloudRegion { | ||
US = 'us', | ||
EU = 'eu', | ||
} | ||
|
||
/** | ||
* Defines the environment of the API domains. | ||
* | ||
* @public | ||
*/ | ||
export enum Environment { | ||
PROD = 'prod', | ||
SANDBOX = 'sbx', | ||
} | ||
|
||
/** | ||
* Provides methods for getting various endpoints. | ||
* | ||
* @internal | ||
*/ | ||
export class EndpointsProvider { | ||
private readonly environment: Environment; | ||
private readonly cloudRegion: CloudRegion; | ||
|
||
constructor(environment?: Environment, cloudRegion?: CloudRegion) { | ||
this.environment = environment || Environment.PROD; | ||
this.cloudRegion = cloudRegion || CloudRegion.US; | ||
} | ||
|
||
/** Provides the domain based on environment and cloud region. | ||
* @internal | ||
*/ | ||
getDomain() { | ||
return `https://${this.environment}-cdn.${this.cloudRegion}.yextapis.com`; | ||
} | ||
|
||
/** | ||
* Provides all endpoints based on environment and cloud region. | ||
* @internal | ||
*/ | ||
getEndpoints() { | ||
return { | ||
universalSearch: `${this.getDomain()}/v2/accounts/me/search/query`, | ||
verticalSearch: `${this.getDomain()}/v2/accounts/me/search/vertical/query`, | ||
questionSubmission: `${this.getDomain()}/v2/accounts/me/createQuestion`, | ||
status: 'https://answersstatus.pagescdn.com', | ||
universalAutocomplete: `${this.getDomain()}/v2/accounts/me/search/autocomplete`, | ||
verticalAutocomplete: `${this.getDomain()}/v2/accounts/me/search/vertical/autocomplete`, | ||
filterSearch: `${this.getDomain()}/v2/accounts/me/search/filtersearch`, | ||
}; | ||
} | ||
} | ||
|
||
/** | ||
* The endpoints to use for sandbox experiences. | ||
* | ||
* @deprecated Use {@link provideEndpoints} instead | ||
* | ||
* @public | ||
*/ | ||
export const SandboxEndpoints: Required<Endpoints> = | ||
new EndpointsProvider(Environment.SANDBOX, CloudRegion.US).getEndpoints(); | ||
|
||
/** | ||
* Provides all endpoints based on environment and cloud region. | ||
* | ||
* @remarks | ||
* Returns an {@link Endpoints} instance. | ||
* | ||
* @param environment - environment of the domain to use, defaults to prod if not provided | ||
* @param cloudRegion - cloud region of the domain to use, defaults to us if not provided | ||
* | ||
* @public | ||
*/ | ||
export function provideEndpoints( | ||
environment?: Environment, | ||
cloudRegion?: CloudRegion | ||
): Required<Endpoints> { | ||
return new EndpointsProvider(environment, cloudRegion).getEndpoints(); | ||
} |
Oops, something went wrong.