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

exc-rest

v1.0.8

Published

ExcRestModule implements the ExcRestService.

Downloads

9

Readme

Documentation

Module Exc-Rest

ExcRestModule implements the ExcRestService.

Setup

To use ExcRestService you have to do preparations in your project.

  1. Ensure that the exc-core module is included as dependency in package.json
  2. Ensure that the exc-rest module is included as dependency in package.json
  3. Setup app.module.ts file

import {environment} from '../environments/environment';
import {HttpClient, HttpClientModule} from '@angular/common/http';
import {ExcCoreModule} from 'exc-core';
import {ExcRestModule} from 'exc-rest';
//...

@NgModule({
declarations:[],
imports:[
  HttpClientModule
  ExcRestModule
  //...
],
entryComponents:[],
providers:[],
bootstrap: [AppComponent]
})


export class AppModule{
  env = environment
  constuctor(){
    ExcCoreModule.RegisterConfig('Environment',_self.env);
  }
  //...
}
  1. Setup app.component.ts file

import {ExcCoreModule} from 'exc-core';
import {ExcRestModule} from 'exc-rest';
//...
export class AppComponent  implements OnInit{
//...
  constructor(private excRestService:ExcRestService){  
  }
}

ExcRestService

The ExcRestService is the service for standard communication with the EXCON REST Apis.

Parameter definition

  • name Defines the name of the endpoint in environment.ts under Endpoints.
  • pObj Defines an object for replacement of placeholders in URL
  • url Defines the url generated by computedUrl
  • data Defines the data that will be sent to the webservice
  • conf Defines the http config used by rest call. Detailed information under this paragraph
  • isbc Defines a call is a background call or not. It is used for global activity indicator. Background calls doesn't have an effect to indicator.
  • fullResponse Used by delete and put. By default these methods return the fullResponse. If you use this function please manually set parameter to false. The default behavior will be set to false in future.

Config object

  • MetaInfo:*object* Defines the definition for filter, paging and sorting for webservice.
  • OnProgress(progress):*function* Method that could be set to get information about progress of the call.
  • export:*Boolean* If set to true the call is marked as download and the webservice result is downloaded as file.

Members

Methods

Publics

All public methods have a default behavior. So the automatically triggers messages for success and error or are preprocessing data.

|Method|Return|Description| | --- | --- | --- | | computeUrl(name:string,pObj:object)|string|Gets a computed url from config and replaces placeholders with values of pObj| | delete(url:string,data:any,conf:object,fullResponse:Boolean(true))|Observable|Sends an HTTP DELETE request to given URL| | get(url:string,conf:object)|Observable|Sends an HTTP GET request to given URL| | sget(url:string,id:string,conf:object)|Observable|Sends an HTTP GET request to given URL. The given ID is used to identify the last call of an id. So it is possible to get the last valid call. At response you can check the flag valid to only use the last answer for the given id | | post(url:string,data:any,conf:object)|Observable|Sends an HTTP POST request to given URL| | put(url:string,data:any,conf:object,fullResponse:Boolean(true))|Observable|Sends an HTTP PUT request to given URL| | base64ToArrayBuffer(base64:string)|Uint8Array|Convert a base64 string to an arraybuffer| | exportBase64(base64String:string,contentType:string,filename:string)|void|starts a download of the base64 string with given contentType and filename| | exportBuffer(uInt8Array:Uint8Array,contentType:string,filename:string)|void|starts a download of the UInt8Array with given contentType and filename|

Internals

Internal call shouldn't be used for default behavior. The internal methods have no default behavior.

|Method|Return|Description| | --- | --- | --- | | _deleteInternal(url:string,data:any,conf:object,isbc:Boolean)|Observable|Sends an HTTP DELETE request to given URL| | _getInternal(url:string,conf:object,isbc:Boolean)|Observable|Sends an HTTP GET request to given URL| | _putInternal(url:string,data:any,conf:object,isbc:Boolean)|Observable|Sends an HTTP PUT request to given URL| | _postInternal(url:string,data:any,conf:object,isbc:Boolean)|Observable|Sends an HTTP POST request to given URL|

get example
import {ExcCoreModule} from './exc-core.module';

const excRest = ExcCoreModule.Services().ExcRest;
// OrderList: {uid}/order/:ordID
let obs = excRest.get(excRest.computeUrl('OrderDetails',{ordID:14}),{MetaInfo:{}});
obs.subscribe(result=>{
  //doIt
})
sget example
import {ExcCoreModule} from './exc-core.module';

const excRest = ExcCoreModule.Services().ExcRest;
// OrderList: {uid}/order
let obs = excRest.sget(excRest.computeUrl('OrderList',{key:'value',fts:'full-text-search-value'}),'MagicList',{MetaInfo:{}});
obs.subscribe(result=>{
  if(result.valid)
    {
       //doIt
    }
 
})