Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | 'use strict'; import { ReferencedResource } from './server-types'; /** * Inform that a new resource was created. Server will * add a Location header and set status to 201 */ export class NewResource<T> extends ReferencedResource<T> { /** * Constructor. Receives the location of the new resource created. * @param location To be added to the Location header on response * @param body To be added to the response body */ constructor(location: string, body?: T) { super(location, 201, body); } } /** * Inform that the request was accepted but is not completed. * A Location header should inform the location where the user * can monitor his request processing status. */ export class RequestAccepted<T> extends ReferencedResource<T> { /** * Constructor. Receives the location where information about the * request processing can be found. * @param location To be added to the Location header on response * @param body To be added to the response body */ constructor(location: string, body?: T) { super(location, 202, body); } } /** * Inform that the resource has permanently * moved to a new location, and that future references should use a * new URI with their requests. */ export class MovedPermanently<T> extends ReferencedResource<T> { /** * Constructor. Receives the location where the resource can be found. * @param location To be added to the Location header on response * @param body To be added to the response body */ constructor(location: string, body?: T) { super(location, 301, body); } } /** * Inform that the resource has temporarily * moved to another location, but that future references should * still use the original URI to access the resource. */ export class MovedTemporarily<T> extends ReferencedResource<T> { /** * Constructor. Receives the location where the resource can be found. * @param location To be added to the Location header on response * @param body To be added to the response body */ constructor(location: string, body?: T) { super(location, 302, body); } } /** * Used to download a resource. */ export class DownloadResource { /** * Constructor. * @param filePath The file path to download. * @param fileName The file name */ constructor(public filePath: string, public fileName: string) { } } /** * Used to download binary data as a file. */ export class DownloadBinaryData { /** * Constructor. Receives the location of the resource. * @param content The binary data to be downloaded as a file. * @param mimeType The mime-type to be passed on Content-Type header. * @param fileName The file name */ constructor(public content: Buffer, public mimeType: string, public fileName?: string) { } } |