@dots-connect-it/api
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Dots API

This package contain service which should be inherited by another services for use default methods in each dots project.

Usage

Create service

ng g s car-api

Create interface

export interface Car {
    id: number;
    name: string;
    color: string;
}

Extend API service

Extends ApiService and indicate right endpoint.

import { ApiService } from '@dancornilov/api';

export class CarApiService extends ApiService<Car> {
    protected endpoint = 'car';
}

Interfaces

export interface ApiIndexResult<T> {
  data: T[];
  pagination: Paginator;
}

export interface ApiSingleResult<T> {
  data: T;
}

Methods

Method Description Value
index Get whole list of entities Observable<ApiIndexResult>
create Create new entity Observable
update Update already existent entity Observable
get Get entity by dataKey(id) Observable<ApiSingleResult>
patch Update some properties from existent entity Observable
list Get serialized list of entities (key/value) Observable

Readme

Keywords

none

Package Sidebar

Install

npm i @dots-connect-it/api

Weekly Downloads

1

Version

1.0.4

License

ISC

Unpacked Size

184 kB

Total Files

32

Last publish

Collaborators

  • dancornilov
  • mindruion