npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@wursha/ngx-hadeethenc-api

v0.0.4

Published

an Angular api client for hadeethenc.com

Downloads

97

Readme

ngx-hadeethenc-api

angular npm github Build Status prettier eslint jasmine MIT PRs

An Angular api client for Hadeeth Encyclopedia

HadeethEnc is a project aims to provide simplified explanations and clear translation of the authentic Prophetic (Prophet Muhammad ﷺ) hadiths.

Contents of the project can be used, with the following terms and conditions:

  1. No modification, addition, or deletion of the content.
  2. Clearly referring to the publisher and the source (HadeethEnc.com).

Features

  • ✅ Covers all HadeethEnc APIs.
  • ✅ Using observable for all requests
  • ✅ MIT Licensed
  • ✅ Strongly typed using TypeScript
  • ✅ Supports standalone Angular.

Table of Contents

Installation

NPM

npm install @wursha/ngx-hadeethenc-api

Yarn

yarn add @wursha/ngx-hadeethenc-api

PNPM

pnpm add @wursha/ngx-hadeethenc-api

Bun

bun add @wursha/ngx-hadeethenc-api

Getting Started:

first Inject the service NgxHadeethencApiService anywhere you want to use it

import { NgxHadeethencApiService } from "ngx-hadeethenc-api";

export class AppComponent {
    constructor(public service: NgxHadeethencApiService) {}
}

and make sure that HttpClient is provided

import { provideHttpClient } from "@angular/common/http";

export const appConfig: ApplicationConfig = {
    providers: [... , provideHttpClient()],
};

now you are ready to use it.

Available API endpoints:

List all available languages for HadeethEnc.com

getLanguages(): Observable<languageResponse[]>

This endpoint returns json object containing all available languages with their iso codes and native names.

List all categories by language code.

getCategoriesList(language: string): Observable<categoriesRespone[]>

This endpoint accepts language iso code and returns array of json objects each object represents a category.

List root categories by language code.

getCategoriesRoots(language: string): Observable<categoriesResponse[]>g

This endpoint returns root categories (main categories) in specific language, it accepts language iso code and returns json array of objects each object represents a root category.

List Hadeeths by category id and language iso code.

getHadeethsList(p: {
  language: string;
  categoryId: string;
  page: string;
  perPage: string;
}): Observable<hadeethsListResponse>

This endpoint accepts language iso code, category id (both required) and page (represents page number, optional defaults to 1) and per_page (optional defaults to 20) and returns json object containing "data" object which contains array of json objects each object represents a Hadeeth basic information (id, title, translations iso codes), the second object is "meta" containing meta data required for pagination.

Get single Hadeeth details by Hadeeth id and language iso code.

getHadeethsOne(p: {
    language: string;
    id: string;
}): Observable<hadeethsOneResponse>

The response differs when the language is "Arabic" or not, if it's Arabic then it returns all Hadeeth data (id, title, Hadeeth text (matn), explanation, hints (fawaed), word meaning and references), if non Arabic it returns translated parts (id, title, Hadeeth text (matn), explanation and hints (if translated), it doesnt return reference nor word meaning as they are not translated.

Response models:

hadeethsOneResponse

interface hadeethsOneResponse {
    id: string;
    title: string;
    hadeeth: string;
    attribution: string;
    grade: string;
    explanation: string;
    hints: string[];
    categories: string[];
    translations: string[];
    words_meanings: wordsMeaning[];
    reference: string;
    hadeeth_ar: string;
    explanation_ar: string;
    hints_ar: string[];
    words_meanings_ar: wordsMeaning[];
    attribution_ar: string;
    grade_ar: string;
}

interface wordsMeaning {
    word: string;
    meaning: string;
}

languageResponse

interface languageResponse {
    code: string;
    native: string;
}

categoriesResponse

interface categoriesResponse {
    id: string;
    title: string;
    hadeeths_count: string;
    parent_id?: string;
}

hadeethsListResponse

interface hadeethsListResponse {
    data: hadeethsListData[];
    meta: hadeethsListMeta;
}

interface hadeethsListData {
    id: string;
    title: string;
    translations: string[];
}

interface hadeethsListMeta {
    current_page: string;
    last_page: number;
    total_items: number;
    per_page: string;
}

Core Team

Other libs from the author

If you enjoy working with TypeScript, we also recommend other libraries by the same author: