Skip to main content
Latest
class ServiceRequest
Abstract
import { ServiceRequest } from "https://deno.land/x/steam_trader@v0.4.0/src/steam_api/requests/service_request.ts";

I could not think of a better approach to this at the time of writing this, because:

  1. I had a time limit
  2. Interfaces have some bug which makes using it unfeasable: https://github.com/microsoft/TypeScript/issues/22815

Properties

optional
body: FormData

the form data to send. optional. Only will be sent if the http method used supports sending body.

abstract
functionName: string

name of function in service interface

optional
getParams: Record<string,
| string
| number
| boolean
| undefined
>

an object to use as "GET" parameters

abstract
iface: string

name of service interface

abstract
method: Methods

HTTP Method

optional
responseStructure: Record<string, unknown>
abstract
version: string

version of service function. it is used in url directly after function name.

Methods

optional
postProcess(response: unknown): unknown | Promise<unknown>

a method that if defined, will be called with JSON-parsed result of the request. can be async.

if returns a value that is not undefined, the service response will be replaced by the returned value. otherwise original response will be used.