@vanakaru/ekilex-api-client
Version:
A node api client for the Ekilex API
202 lines (201 loc) • 5.42 kB
TypeScript
import { HttpClient } from '../http/http-client';
import { DatasetCode } from './datasets';
export declare type Word = {
wordId: number;
wordValue: string;
wordValuePrese: string;
homonymNr: number;
lang: string;
prefixoid: boolean;
suffixoid: boolean;
foreign: boolean;
datasetCodes: DatasetCode[];
lastActivityEventOn: string;
};
export declare type Forms = {
id: number;
value: string;
valuePrese: string;
components: string[];
displayForm: string;
morphCode: string;
morphValue: string;
morphFrequency: null | number;
formFrequency: null | number;
};
export declare type Paradigm = {
paradigmId: number;
comment: string | null;
inflectionType: string;
inflectionTypeNr: string;
wordClass: string;
forms: Forms[];
formsExist: boolean;
};
export declare type Government = {
id: number;
value: string;
typeCode: string | null;
complexity: string;
orderBy: number;
};
export declare type Lexeme = {
wordId: number;
wordValue: string;
wordValuePrese: string;
wordLang: string;
wordHomonymNr: number;
wordGenderCode: number | string | null;
wordAspectCode: number | string | null;
wordDisplayMorphCode: number | string | null;
wordTypeCodes: number | string | null;
prefixoid: boolean;
suffixoid: boolean;
foreign: boolean;
lexemeId: number;
meaningId: number;
datasetName: string;
datasetCode: DatasetCode;
level1: number;
level2: number;
levels: string;
lexemeValueStateCode: number | string | null;
lexemeValueState: number | string | null;
lexemeProficiencyLevelCode: number | string | null;
lexemeProficiencyLevel: number | string | null;
reliability: number | string | null;
tags: string[];
complexity: string;
weight: number;
wordTypes: number | string | null;
pos: {
name: string;
code: string;
value: string;
}[];
derivs: number | string | null;
registers: number | string | null;
governments: Government[];
grammars: unknown[];
usages: {
id: number;
value: string;
lang: string;
[key: string]: any;
}[];
lexemeFreeforms: unknown[];
lexemeNoteLangGroups: unknown[];
lexemeRelations: unknown[];
collocationPosGroups: unknown[];
secondaryCollocations: unknown[];
sourceLinks: unknown[];
meaning: {
definitions: {
id: number;
value: string;
lang: string;
[key: string]: any;
}[];
};
meaningWords: unknown | null;
synonymLangGroups: {
lang: string;
synonyms: {
type: string;
wordLang: string;
weight: number;
words: {
wordId: number;
wordValue: string;
wordValuePrese: string;
lang: string;
}[];
}[];
[key: string]: any;
}[];
lexemeOrMeaningClassifiersExist: boolean;
public: boolean;
};
export declare type WordSearchResponse = {
totalCount: number;
words: Word[];
};
export declare type WordRelationMembers = {
id: number;
lexemeId: number | null;
meaningId: number | null;
wordId: number;
wordValue: string;
wordValuePrese: 'ontlik';
wordLang: DatasetCode;
wordAspectCode: any;
wordTypeCodes: any;
prefixoid: boolean;
suffixoid: boolean;
foreign: boolean;
wordHomonymNr: any;
homonymsExist: boolean;
relTypeCode: string;
relTypeLabel: string;
orderBy: number;
groupId: any;
groupWordRelTypeCode: any;
};
export declare type WordRelationDetails = {
wordSynRelations: any;
primaryWordRelationGroups: {
id: number | null;
groupTypeCode: string;
groupTypeLabel: string;
members: WordRelationMembers[] | null;
}[];
secondaryWordRelationGroups: {
id: number | null;
groupTypeCode: string;
groupTypeLabel: string;
members: WordRelationMembers[] | null;
};
wordGroups: any[];
groupRelationExists: boolean;
};
export declare type WordDetailsResponse = {
word: Word & {
morphophonoForm: string;
lexemesTagNames: string[];
manualEventOn: string;
paradigms: Paradigm[];
};
wordTypes: string[];
lexemes: Lexeme[];
wordEtymology: unknown[];
odWordRecommendations: unknown[];
wordRelationDetails: WordRelationDetails;
firstDefinitionValue: string | null;
activeTagComplete: boolean;
};
export declare type WordCreateResponse = {
success: boolean;
messsage: string;
id: number;
};
export declare type WordCreateDto = {
lexemeDataset: DatasetCode;
meaningId?: number;
value: string;
valuePrese: string;
lang: string;
displayMorphCode: string;
genderCode: string;
aspectCode: string;
vocalForm: string;
};
export declare class Words {
private httpClient;
constructor(httpClient: HttpClient);
private getSearchPath;
private getWordDetailsPath;
private getWordCreatePath;
search(searchTerm: string, datasets?: Array<DatasetCode>): Promise<WordSearchResponse>;
getDetails(wordId: number, datasets?: Array<DatasetCode>): Promise<WordDetailsResponse>;
create(payload: WordCreateDto): Promise<WordCreateResponse>;
}