Some checks failed
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
62 lines
1.2 KiB
TypeScript
62 lines
1.2 KiB
TypeScript
import type {
|
|
ICredentialDataDecryptedObject,
|
|
ICredentialTestRequest,
|
|
ICredentialType,
|
|
IHttpRequestOptions,
|
|
INodeProperties,
|
|
} from 'n8n-workflow';
|
|
|
|
export class AzureAiSearchApi implements ICredentialType {
|
|
name = 'azureAiSearchApi';
|
|
|
|
displayName = 'Azure AI Search API';
|
|
|
|
documentationUrl = 'azureaisearch';
|
|
|
|
properties: INodeProperties[] = [
|
|
{
|
|
displayName: 'Search Endpoint',
|
|
name: 'endpoint',
|
|
type: 'string',
|
|
required: true,
|
|
default: '',
|
|
placeholder: 'https://your-search-service.search.windows.net',
|
|
},
|
|
{
|
|
displayName: 'API Key',
|
|
name: 'apiKey',
|
|
type: 'string',
|
|
typeOptions: { password: true },
|
|
required: true,
|
|
default: '',
|
|
},
|
|
];
|
|
|
|
authenticate = async (
|
|
credentials: ICredentialDataDecryptedObject,
|
|
requestOptions: IHttpRequestOptions,
|
|
): Promise<IHttpRequestOptions> => {
|
|
return {
|
|
...requestOptions,
|
|
headers: {
|
|
...requestOptions.headers,
|
|
'api-key': credentials.apiKey,
|
|
},
|
|
};
|
|
};
|
|
|
|
test: ICredentialTestRequest = {
|
|
request: {
|
|
baseURL: '={{$credentials.endpoint}}/indexes',
|
|
url: '',
|
|
method: 'GET',
|
|
headers: {
|
|
accept: 'application/json',
|
|
},
|
|
qs: {
|
|
'api-version': '2024-07-01',
|
|
},
|
|
},
|
|
};
|
|
}
|