oxford-dictionary-api-client
Version:
A Node.js and browser wrapper for Oxford Dictionary API
457 lines (453 loc) • 10.8 kB
TypeScript
// Generated by dts-bundle-generator v9.5.1
export type Metadata = {
operation: string;
provider: string;
schema: string;
};
type Response$1<R, M = Metadata> = {
metadata: M;
results: R[];
};
export type DataItem = {
id?: string;
text?: string;
};
export declare enum EntryType {
Headword = "headword",
Inflection = "inflection",
Phrase = "phrase"
}
export declare enum ToneType {
Ipa = "ipa",
DictionarySpecific = "dictionarySpecific",
OupToneCode = "oupToneCode"
}
export type Tone = {
type: ToneType;
value: string;
};
export type ToneGroup = {
tones: Tone[];
};
export declare enum CollocationType {
Pre = "pre",
Post = "post"
}
export type Collocation = {
text: string;
type: CollocationType;
id: string;
};
export declare enum CrossReferenceType {
CloseMatch = "close match",
Related = "related",
SeeAlso = "see also",
VariantSpelling = "variant spelling",
Abbreviation = "abbreviation"
}
export type CrossReference = {
id: string;
text: string;
type: CrossReferenceType;
};
export declare enum NoteType {
GrammaticalNote = "grammaticalNote",
UsageNote = "usageNote",
EditorialNote = "editorialNote",
EncyclopedicNote = "encyclopedicNote",
EtymologyNote = "etymologyNote",
TechnicalNote = "technicalNote"
}
export type Note = {
id?: string;
text: string;
type: NoteType;
};
export type GrammaticalFeature = {
id: string;
text: string;
type: string;
};
export type SynonymOrAntonym = {
id?: string;
text: string;
language?: string;
regions?: DataItem[];
registers?: DataItem[];
domains?: DataItem[];
};
export type Example = {
definitions?: string[];
senseIds?: string[];
text: string;
translations?: Translation[];
collocations?: Collocation[];
crossReferenceMarkers?: string[];
crossReferences?: CrossReference[];
notes?: Note[];
regions?: DataItem[];
registers?: DataItem[];
domains?: DataItem[];
};
export type Pronunciation = {
phoneticNotation?: string;
phoneticSpelling?: string;
audioFile?: string;
dialects?: string[];
registers?: DataItem[];
regions?: DataItem[];
};
export type VariantForm = {
text: string;
pronunciations?: Pronunciation[];
notes?: Note[];
regions?: DataItem[];
registers?: DataItem[];
domains?: DataItem[];
};
export type Inflection = {
inflectedForm: string;
lexicalCategory?: DataItem;
grammaticalFeatures?: GrammaticalFeature[];
pronunciations?: Pronunciation[];
regions?: DataItem[];
registers?: DataItem[];
domains?: DataItem[];
};
export type Translation = {
text: string;
language: string;
toneGroups?: ToneGroup[];
type?: string;
collocations?: Collocation[];
grammaticalFeatures?: GrammaticalFeature[];
notes?: Note[];
regions?: DataItem[];
registers?: DataItem[];
domains?: DataItem[];
};
declare enum DictionaryType {
Monolingual = "monolingual",
Bilingual = "bilingual",
Other = "other"
}
export type DictionaryName = {
region?: string;
source?: string;
sourceLanguage?: {
id: string;
language: string;
};
targetLanguage?: {
id: string;
language: string;
};
type?: DictionaryType;
};
export type Entries = Response$1<Result>;
export type Word = {
text: string;
id: string;
language?: string;
registers?: DataItem[];
regions?: DataItem[];
domains?: DataItem[];
};
export type DatasetCrossLink = {
language: string;
entry_id: string;
sense_id: string;
};
export type ThesaurusLink = {
entry_id: string;
sense_id: string;
};
export type Construction = {
text: string;
examples?: Example[];
translations?: Translation[];
notes?: Note[];
regions?: DataItem[];
registers?: DataItem[];
domains?: DataItem[];
};
export type Sense = {
datasetCrossLinks?: DatasetCrossLink[];
definitions?: string[];
etymologies?: string[];
shortDefinitions?: string[];
id?: string;
subsenses?: Sense[];
thesaurusLinks?: ThesaurusLink[];
examples?: Example[];
inflections?: Inflection[];
constructions?: Construction[];
translations?: Translation[];
crossReferenceMarkers?: string[];
crossReferences?: CrossReference[];
pronunciations?: Pronunciation[];
notes?: Note[];
variantForms?: VariantForm[];
synonyms?: SynonymOrAntonym[];
antonyms?: SynonymOrAntonym[];
regions?: DataItem[];
registers?: DataItem[];
domains?: DataItem[];
domainClasses?: DataItem[];
semanticClasses?: DataItem[];
};
export type Entry = {
etymologies?: string[];
homographNumber?: string;
senses?: Sense[];
inflections?: Inflection[];
crossReferenceMarkers?: string[];
crossReferences?: CrossReference[];
grammaticalFeatures?: GrammaticalFeature[];
pronunciations?: Pronunciation[];
notes?: Note[];
variantForms?: VariantForm[];
};
export type LexicalEntry = {
entries?: Entry[];
derivatives?: Word[];
compounds?: Word[];
phrases?: Word[];
phrasalVerbs?: Word[];
derivativeOf?: Word[];
language: string;
text: string;
root?: string;
lexicalCategory: DataItem;
pronunciations?: Pronunciation[];
notes?: Note[];
variantForms?: VariantForm[];
};
type Result = {
id: string;
language: string;
lexicalEntries: LexicalEntry[];
type?: EntryType;
word: string;
pronunciations?: Pronunciation[];
};
export type Lemmas = Response$1<Result$1, Pick<Metadata, "provider">>;
type LexicalEntry$1 = {
language: string;
text: string;
inflectionOf: Required<DataItem>[];
lexicalCategory: Required<DataItem>;
grammaticalFeatures: GrammaticalFeature[];
};
type Result$1 = {
id: string;
language: string;
lexicalEntries: LexicalEntry$1[];
type?: EntryType;
word: string;
};
export type Inflections = Response$1<Result$2>;
type LexicalEntry$2 = {
language: string;
inflections?: Inflection[];
lexicalCategory: Required<DataItem>;
grammaticalFeatures?: GrammaticalFeature[];
};
type Result$2 = {
id: string;
text?: string;
language: string;
lexicalEntries: LexicalEntry$2[];
};
export type SearchMetadata = Metadata & {
limit: string;
offset: string;
total: string;
sourceLanguage: string;
};
type Result$3 = {
id: string;
label: string;
matchString: string;
matchType: string;
region?: string;
inflection_id?: string;
score: number;
word: string;
};
export type Search = Response$1<Result$3, SearchMetadata>;
type Example$1 = {
definitions?: string[];
senseIds?: string[];
text: string;
translations?: Translation[];
collocations?: Collocation[];
crossReferenceMarkers?: string[];
crossReferences?: CrossReference[];
notes?: Note[];
regions?: DataItem[];
registers?: DataItem[];
domains?: DataItem[];
};
type Sense$1 = {
id: string;
subsenses?: Sense$1[];
examples?: Example$1[];
antonyms?: SynonymOrAntonym[];
synonyms?: SynonymOrAntonym[];
regions?: DataItem[];
registers?: DataItem[];
domains?: DataItem[];
domainClasses?: DataItem[];
semanticClasses?: DataItem[];
};
type Entry$1 = {
homographNumber?: string;
senses?: Sense$1[];
grammaticalFeatures?: GrammaticalFeature[];
variantForms?: VariantForm[];
};
type LexicalEntry$3 = {
entries?: Entry$1[];
language: string;
text: string;
lexicalCategory: Required<DataItem>;
grammaticalFeatures?: GrammaticalFeature[];
variantForms?: VariantForm[];
};
type Result$4 = {
word: string;
id: string;
language: string;
type: EntryType;
lexicalEntries: LexicalEntry$3[];
};
export type Thesaurus = Response$1<Result$4>;
export type SentenceItem = {
definitions?: string[];
senseIds?: string[];
text: string;
translations?: Translation[];
collocations?: Collocation[];
crossReferenceMarkers?: string[];
crossReferences?: CrossReference[];
notes?: Note[];
regions?: DataItem[];
registers?: DataItem[];
domains?: DataItem[];
};
type LexicalEntry$4 = {
language: string;
text: string;
sentences: SentenceItem[];
lexicalCategory: Required<DataItem>;
grammaticalFeatures?: GrammaticalFeature[];
};
type Result$5 = {
id: string;
language: string;
lexicalEntries: LexicalEntry$4[];
type: EntryType;
word: string;
};
export type Sentences = Response$1<Result$5>;
type Headers$1 = {
app_id?: string;
app_key?: string;
[key: string]: string | undefined;
};
export declare class OxfordDictionary {
#private;
constructor(baseUrl: string, headers: Headers$1);
private request;
entries(sourceLang: string, wordId: string, options?: {
domains?: string;
fields?: string[];
grammaticalFeatures?: string;
lexicalCategory?: string;
registers?: string;
strictMatch?: boolean;
}): Promise<Entries>;
translations(sourceLang: string, targetLang: string, wordId: string, options?: {
domains?: string;
fields?: string[];
grammaticalFeatures?: string;
lexicalCategory?: string;
registers?: string;
strictMatch?: boolean;
}): Promise<Entries>;
words(sourceLang: string, query: string, options?: {
domains?: string;
fields?: string[];
grammaticalFeatures?: string;
lexicalCategory?: string;
registers?: string;
strictMatch?: boolean;
}): Promise<Entries>;
lemmas(sourceLang: string, wordId: string, options?: {
grammaticalFeatures?: string;
lexicalCategory?: string;
}): Promise<Lemmas>;
inflections(sourceLang: string, wordId: string, options?: {
strictMatch?: boolean;
}): Promise<Inflections>;
thesaurus(sourceLang: string, wordId: string, options?: {
fields?: string[];
strictMatch?: boolean;
}): Promise<Thesaurus>;
sentences(sourceLang: string, wordId: string, options?: {
strictMatch?: boolean;
}): Promise<Sentences>;
readonly utility: {
dictionaryNames: ({ targetLang, sourceLang, }: {
targetLang?: string;
sourceLang?: string;
}) => Promise<Response$1<DictionaryName>>;
filters: (endpoint?: string) => Promise<Response$1<{
entries?: string[];
thesaurus?: string[];
}>>;
fields: (endpoint?: string) => Promise<Response$1<{
entries?: string[];
thesaurus?: string[];
}>>;
lexicalCategories: (sourceLang: string, targetLang?: string) => Promise<Response$1<Record<string, {
en: string;
}>>>;
registers: (sourceLang: string, targetLang?: string) => Promise<Response$1<Record<string, {
en: string;
}>>>;
domains: (sourceLang: string, targetLang?: string) => Promise<Response$1<Record<string, {
en: string;
}>>>;
grammaticalFeatures: (sourceLang: string, targetLang?: string) => Promise<Response$1<Record<string, Record<string, {
en: string;
}>>>>;
};
readonly search: {
entries: (sourceLang: string, query: string, options?: {
limit?: number;
offset?: number;
prefix?: boolean;
}) => Promise<Search>;
thesaurus: (sourceLang: string, query: string, options?: {
limit?: number;
offset?: number;
prefix?: boolean;
}) => Promise<Search>;
translations: (sourceLang: string, targetLang: string, query: string, options?: {
limit?: number;
offset?: number;
prefix?: boolean;
}) => Promise<Search>;
};
}
export {
Result as EntriesItem,
Result$1 as LemmasItem,
Result$2 as InflectionsItem,
Result$3 as SearchItem,
Result$4 as ThesaurusItem,
Result$5 as SentencesItem,
};
export {};