mirror of
https://github.com/supabase/supabase.git
synced 2026-05-08 01:40:13 -04:00
badcf17f70
* feat(content api): add client library api reference search results Allow searchDocs results to also return function references from the client library APIs * fix(content api): refine language enum handling
62 lines
1.2 KiB
TypeScript
62 lines
1.2 KiB
TypeScript
import { type SearchResultInterface } from '../globalSearch/globalSearchInterface'
|
|
|
|
export const SDKLanguages: Record<string, { value: string; pathSection: string }> = {
|
|
JAVASCRIPT: {
|
|
value: 'JavaScript',
|
|
pathSection: 'javascript',
|
|
},
|
|
SWIFT: {
|
|
value: 'Swift',
|
|
pathSection: 'swift',
|
|
},
|
|
DART: {
|
|
value: 'Dart',
|
|
pathSection: 'dart',
|
|
},
|
|
CSHARP: {
|
|
value: 'C#',
|
|
pathSection: 'csharp',
|
|
},
|
|
KOTLIN: {
|
|
value: 'Kotlin',
|
|
pathSection: 'kotlin',
|
|
},
|
|
PYTHON: {
|
|
value: 'Python',
|
|
pathSection: 'python',
|
|
},
|
|
}
|
|
|
|
export const SDKLanguageValues = Object.values(SDKLanguages).map(({ value }) => value)
|
|
|
|
export class ReferenceSDKFunctionModel implements SearchResultInterface {
|
|
public title?: string
|
|
public href?: string
|
|
public content?: string
|
|
public language: string
|
|
public methodName?: string
|
|
|
|
constructor({
|
|
title,
|
|
href,
|
|
content,
|
|
language,
|
|
methodName,
|
|
}: {
|
|
title?: string
|
|
href?: string
|
|
content?: string
|
|
language: string
|
|
methodName?: string
|
|
}) {
|
|
this.title = title
|
|
this.href = href
|
|
this.content = content
|
|
this.methodName = methodName
|
|
|
|
if (SDKLanguageValues.includes(language)) {
|
|
this.language = language
|
|
}
|
|
}
|
|
}
|