add exports
This commit is contained in:
13
ts/index.ts
13
ts/index.ts
@ -6,29 +6,28 @@ import * as interfaces from './smartrequest.interfaces'
|
||||
import { request } from './smartrequest.request'
|
||||
|
||||
|
||||
export {
|
||||
request
|
||||
}
|
||||
export { request } from './smartrequest.request'
|
||||
export { ISmartRequestOptions } from './smartrequest.interfaces'
|
||||
|
||||
export let get = async (domainArg: string, optionsArg: interfaces.SmartRequestOptions = {}) => {
|
||||
export let get = async (domainArg: string, optionsArg: interfaces.ISmartRequestOptions = {}) => {
|
||||
optionsArg.method = 'GET'
|
||||
let response = await request(domainArg, optionsArg)
|
||||
return response
|
||||
}
|
||||
|
||||
export let post = async (domainArg: string, optionsArg: interfaces.SmartRequestOptions = {}) => {
|
||||
export let post = async (domainArg: string, optionsArg: interfaces.ISmartRequestOptions = {}) => {
|
||||
optionsArg.method = 'POST'
|
||||
let response = await request(domainArg, optionsArg)
|
||||
return response
|
||||
}
|
||||
|
||||
export let put = async (domainArg: string, optionsArg: interfaces.SmartRequestOptions = {}) => {
|
||||
export let put = async (domainArg: string, optionsArg: interfaces.ISmartRequestOptions = {}) => {
|
||||
optionsArg.method = 'PUT'
|
||||
let response = await request(domainArg, optionsArg)
|
||||
return response
|
||||
}
|
||||
|
||||
export let del = async (domainArg: string, optionsArg: interfaces.SmartRequestOptions = {}) => {
|
||||
export let del = async (domainArg: string, optionsArg: interfaces.ISmartRequestOptions = {}) => {
|
||||
optionsArg.method = 'DELETE'
|
||||
let response = await request(domainArg, optionsArg)
|
||||
return response
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as plugins from './smartrequest.plugins'
|
||||
import * as https from 'https'
|
||||
|
||||
export interface SmartRequestOptions extends https.RequestOptions {
|
||||
export interface ISmartRequestOptions extends https.RequestOptions {
|
||||
requestBody?: any
|
||||
}
|
@ -20,7 +20,7 @@ let buildResponse = (responseArg): Promise<any> => {
|
||||
return done.promise
|
||||
}
|
||||
|
||||
export let request = async (domainArg: string, optionsArg: interfaces.SmartRequestOptions = {}, streamArg: boolean = false) => {
|
||||
export let request = async (domainArg: string, optionsArg: interfaces.ISmartRequestOptions = {}, streamArg: boolean = false) => {
|
||||
let done = plugins.q.defer()
|
||||
let parsedUrl: plugins.url.Url
|
||||
if (domainArg) {
|
||||
|
Reference in New Issue
Block a user