1.0.4 • Published 4 years ago

@dots-connect-it/api v1.0.4

Weekly downloads
6
License
ISC
Repository
-
Last release
4 years ago

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

MethodDescriptionValue
indexGet whole list of entitiesObservable<ApiIndexResult>
createCreate new entityObservable
updateUpdate already existent entityObservable
getGet entity by dataKey(id)Observable<ApiSingleResult>
patchUpdate some properties from existent entityObservable
listGet serialized list of entities (key/value)Observable
1.0.4

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago