VajehYab
VajehYab API client written in JS
Install
npm install vajehyab --save
Usage
You can get VajehYab API token from Developer Page (API Documentation)
const VajehYab = ;const vajehyabToken = processenvvajehyabToken; // VajehYab API Tokenconst client = vajehyabToken ip product prettyprint debug;
params
token
: VajehYab API tokenip
: The User IP. Default is, (Optional)
product
: The product name. Default is, (Optional)
prettyprint
: The response pretty printed. Default istrue
, (Optional)debug
: The debug mode. Default isfalse
, (Optional)
Example
const VajehYab = ;const vajehyabToken = processenvvajehyabToken; // VajehYab API Tokenconst client = vajehyabToken ip:'222.2.65.3' product: 'Test' prettyprint: true debug: false;
All method using async
/await
in Node >= 8
Search
This method is used to search for a term or phrase. The meaning of the word is limited and insert "..." at the end.
async { try const search = await client; console; catch e console; };
params
q
: The search wordtype
: The search type, You can setexact
,ava
,like
,text
. Default isexact
, (Optional)start
: The start row. Default is0
, (Optional)rows
: The response rows. Default is10
, (Optional)filter
: The Database names with priority. Default isdehkhoda, moein, amid, motaradef, farhangestan, sareh, ganjvajeh, wiki, slang, quran, name, thesis, isfahani, bakhtiari, tehrani, dezfuli, gonabadi, mazani, en2fa, ar2fa, fa2en, fa2ar
, (Optional)
Example
async { try const search = await client; console; catch e console; };
const search = await client;console;
Word Detail:
This method is used to get the full meaning of a word. It is possible with HTML tags.
const word = await client;
params
title
: The word from search method responsedb
: The Database name from search method responsenum
: Thenum
parameter from search method response
Example
const word = await client;console;
Suggest Word:
The proposed list is used for autocomplete.
const suggest = await client;
params
q
: The search word
Example
const suggest = await client;console;
Express Example
const VajehYab = ;const vajehyabToken = processenvvajehyabToken; // VajehYab API Tokenconst client = vajehyabToken ip:'222.2.65.3' product: 'Test' prettyprint: true debug: false;const express = ;const app = ; app;