Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "services/http/RestService"

Index

Type aliases

RestAttr

RestAttr: function

Type declaration

    • (target: BaseService, propertyKey: string | symbol, parameterIndex: number): void
    • Parameters

      • target: BaseService
      • propertyKey: string | symbol
      • parameterIndex: number

      Returns void

RestMethodAttr

RestMethodAttr: function

Type declaration

    • Parameters

      Returns function

        • (target: BaseService, propertyKey: string | symbol, descriptor: any): void
        • Parameters

          • target: BaseService
          • propertyKey: string | symbol
          • descriptor: any

          Returns void

RestParamAttr

RestParamAttr: function

Type declaration

    • (key: string, defaultValue?: any): RestAttr
    • Parameters

      • key: string
      • Optional defaultValue: any

      Returns RestAttr

Variables

Const Body

Body: RestAttr = parameterBuilder("Body")("")

This will register data fragment on ajax.

example
 @Post("/api/products")
 async getProducts(
     @Query("id")  id: number,
     @Body product: Product
 ): Promise<Product[]> {
 }
export
function

Body

Const BodyFormModel

BodyFormModel: RestAttr = parameterBuilder("BodyFormModel")("")

This will register data fragment on ajax in old formModel way.

example
 @Post("/api/products")
 async getProducts(
     @Query("id")  id: number,
     @BodyFormModel product: Product
 ): Promise<Product[]> {
 }
export
function

BodyFormModel

Const Delete

Delete: RestMethodAttr = methodBuilder("Delete")

Http Delete method

example
 @Delete("/api/products")
 async deleteProduct(
     @Body product: Product
 ): Promise<Product> {
 }
export
function

Delete

param

Url for the operation

Const Get

Get: RestMethodAttr = methodBuilder("Get")

Http Get Method

example
 @Get("/api/products/{category}")
 async getProducts(
     @Path("category") category?:string
 ): Promise<Product[]> {
 }
export
function

Body

Const Header

Header: RestParamAttr = parameterBuilder("Header")

This will register header on parameter.

example
 @Get("/api/products/{category}")
 async getProducts(
     @Header("x-http-auth")  category: number
 ): Promise<Product[]> {
 }
export
function

Path

param

Name of the parameter

Const Patch

Patch: RestMethodAttr = methodBuilder("Patch")

Http Patch method

example
 @Patch("/api/products")
 async saveProduct(
     @Body product: any
 ): Promise<Product> {
 }
export
function

Patch

param

Url for the operation

Const Path

Path: RestParamAttr = parameterBuilder("Path")

This will register Url path fragment on parameter.

example
 @Get("/api/products/{category}")
 async getProducts(
     @Path("category")  category: number
 ): Promise<Product[]> {
 }
export
function

Path

param

Name of the parameter

Const Post

Post: RestMethodAttr = methodBuilder("Post")

Http Post method

example
 @Post("/api/products")
 async saveProduct(
     @Body product: Product
 ): Promise<Product> {
 }
export
function

Post

param

Url for the operation

Const Put

Put: RestMethodAttr = methodBuilder("Put")

Http Put method

example
 @Put("/api/products")
 async saveProduct(
     @Body product: Product
 ): Promise<Product> {
 }
export
function

Put

param

Url for the operation

Const Queries

Queries: RestAttr = parameterBuilder("Queries")("")

This will register Url query fragments on parameter of type object

example
@Get("/api/products")
async getProducts(
     @Queries queries: { [key: string]: string | number | boolean | null }
): Promise<Product[]> {
    return null;

}

Const Query

Query: RestParamAttr = parameterBuilder("Query")

This will register Url query fragment on parameter.

example
 @Get("/api/products")
 async getProducts(
     @Query("category")  category: number
 ): Promise<Product[]> {
 }
export
function

Query

param

Name of the parameter

Const RawBody

RawBody: RestAttr = parameterBuilder("RawBody")("")

Const XmlBody

XmlBody: RestAttr = parameterBuilder("XmlBody")("")

Functions

BaseUrl

  • BaseUrl(baseUrl: string): function

Cancel

  • Cancel(target: BaseService, propertyKey: string | symbol, parameterIndex: number): void
  • Cancellation token

    example
     @Put("/api/products")
     async saveProduct(
         @Body product: Product
         @Cancel cancel: CancelToken
     ): Promise<Product> {
     }
    export
    function

    Put

    Parameters

    • target: BaseService
    • propertyKey: string | symbol
    • parameterIndex: number

    Returns void

Generated using TypeDoc