Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RequestService<RequestType, ResponseType>

Type Parameters

  • RequestType

  • ResponseType

Hierarchy

  • RequestService

Index

Constructors

  • new RequestService<RequestType, ResponseType>(config: ProtoHttpConfig<RequestType, ResponseType>, http: HttpClient, errorsService: ErrorsService): RequestService<RequestType, ResponseType>

Methods

  • request(endpoint: string, req?: RequestType, options?: RequestOptions): Observable<ResponseType>
  • Makes an http request.

    Example:

    @Injectable()
    export class MenuService {

    constructor(
    private request: RequestService<Request.AsObject, Response.AsObject>,
    ) {}

    getCategoryList(): Observable<CategoryListResponse.AsObject> {
    return this.request.request(
    baseUrl + '/category/list',
    {categories: {}} // instance of the Request.AsObject
    ).pipe(map(resp => resp.categories!))
    }
    }

    Parameters

    • endpoint: string

      A destination for the request.

    • Optional req: RequestType

      The request body. Passed to the ProtoHttpConfig.serializer before sending the request.

    • Optional options: RequestOptions

      {@link RequestOptions}

    Returns Observable<ResponseType>

  • requestFile(endpoint: string, req?: RequestType, options?: RequestOptions): Observable<File>

Generated using TypeDoc