First make sure to install the dependecy npm install mawaqit
All the mawaqit API communication requires an access token. Therefore you need to fetch yours before you can make any calls
import { Client } from 'mawaqit';
const client = new Client();
const token = await client.login('[email protected]','yourTopSecretPassword');
console.log('YOUR TOKEN IS =>', token);
// outputs: aabaaed1-11bb-2222-accc-abcd1234efgh
Now that you have saved your token someowhere safe, you can pass it to the client to start making calls
import { Client } from 'mawaqit';
const { getMosquesByCountryCode } = new Client('aabaaed1-11bb-2222-accc-abcd1234efgh');
const dutchMosques = await getMosquesByCountryCode('NL');
console.log(dutchMosques)
uuid
: the uuid of the mosque you want to fetch
const { getPrayerTimeByMosqueUUID } = new Client('aabaaed1-11bb-2222-accc-abcd1234efgh');
const mosqueArrahmaan = await getPrayerTimeByMosqueUUID('ab52acf6-dc6a-4bc6-b9f7-184b7f874bf1');
uuid
: the uuid of the mosque you want to fetch the weather for
const { getWeatherByMosqueUUID } = new Client('aabaaed1-11bb-2222-accc-abcd1234efgh');
const weatherMosqueArrahmaan = await getWeatherByMosqueUUID('ab52acf6-dc6a-4bc6-b9f7-184b7f874bf1');
coordinates
: an object with the structure{ lon: 'xxx', lat: 'yyy' }
const { getMosquesByCoordinates } = new Client('aabaaed1-11bb-2222-accc-abcd1234efgh');
const mosquesInMyArea = await getMosquesByCoordinates({ lon: '5.403610', lat: '51.421310' });
countryCode
: a string that represents a country code (exampes: 'NL', 'FR', 'MA', 'US')
const { getMosquesByCountryCode } = new Client('aabaaed1-11bb-2222-accc-abcd1234efgh');
const mosquesInTheUSA = await getMosquesByCountryCode('Us');