Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@covalent/http-deprec

Package Overview
Dependencies
Maintainers
4
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@covalent/http-deprec

Teradata UI Platform Http Helper Module (deprecated)

  • 2.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created
Source

RESTService (deprecated)

Abstract class provided with methods that wraps http services to facilitate REST API calls with @angular/http.

API Summary

Methods
  • query: function(query?: IRestQuery, transform?: IRestTransform)
    • Creates a GET request to the generated endpoint URL.
  • get: function(id: string | number, transform?: IRestTransform)
    • Creates a GET request to the generated endpoint URL, adding the ID at the end.
  • create: function(obj: T, transform?: IRestTransform)
    • Creates a POST request to the generated endpoint URL.
  • update: function(id: string | number, obj: T, transform?: IRestTransform)
    • Creates a PATCH request to the generated endpoint URL, adding the ID at the end.
  • delete: function(id: string | number, transform?: IRestTransform)
    • Creates a DELETE request to the generated endpoint URL, adding the ID at the end.
  • buildUrl: function(id?: string | number, query?: IRestQuery)
    • Builds the endpoint URL with the configured properties and arguments passed in the method.

Usage

Example:

import { Injectable } from '@angular/core';
import { Response, Http, Headers } from '@angular/http';
import { RESTService, HttpInterceptorService } from '@covalent/http-deprec';

@Injectable()
export class CustomRESTService extends RESTService<any> {

  constructor(private _http: Http /* or HttpInterceptorService */) {
    super(_http, {
      baseUrl: 'www.api.com',
      path: '/path/to/endpoint',
      headers: new Headers(),
      dynamicHeaders: () => new Headers(),
      transform: (res: Response): any => res.json(),
    });
  }
}

Note: the constructor takes any object that implements the methods in [IHttp] interface. This can be the @angular [Http] service, the covalent [HttpInterceptorService] or a custom service.

export interface IHttp {
  delete: (url: string, options?: RequestOptionsArgs) => Observable<Response>;
  get: (url: string, options?: RequestOptionsArgs) => Observable<Response>;
  head: (url: string, options?: RequestOptionsArgs) => Observable<Response>;
  patch: (url: string, body: any, options?: RequestOptionsArgs) => Observable<Response>;
  post: (url: string, body: any, options?: RequestOptionsArgs) => Observable<Response>;
  put: (url: string, body: any, options?: RequestOptionsArgs) => Observable<Response>;
  request: (url: string | Request, options: RequestOptionsArgs) => Observable<Response>;
}

Keywords

FAQs

Package last updated on 20 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc