mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: add request parsing related interfaces
This commit is contained in:
parent
e0d74fd68a
commit
70af46933b
5
src/ldp/http/BodyParser.ts
Normal file
5
src/ldp/http/BodyParser.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import { AsyncHandler } from '../../util/AsyncHandler';
|
||||
import { HttpRequest } from '../../server/HttpRequest';
|
||||
import { Representation } from '../representation/Representation';
|
||||
|
||||
export abstract class BodyParser extends AsyncHandler<HttpRequest, Representation> {}
|
5
src/ldp/http/PreferenceParser.ts
Normal file
5
src/ldp/http/PreferenceParser.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import { AsyncHandler } from '../../util/AsyncHandler';
|
||||
import { HttpRequest } from '../../server/HttpRequest';
|
||||
import { RepresentationPreferences } from '../representation/RepresentationPreferences';
|
||||
|
||||
export abstract class PreferenceParser extends AsyncHandler<HttpRequest, RepresentationPreferences> {}
|
5
src/ldp/http/TargetExtractor.ts
Normal file
5
src/ldp/http/TargetExtractor.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import { AsyncHandler } from '../../util/AsyncHandler';
|
||||
import { HttpRequest } from '../../server/HttpRequest';
|
||||
import { ResourceIdentifier } from '../representation/ResourceIdentifier';
|
||||
|
||||
export abstract class TargetExtractor extends AsyncHandler<HttpRequest, ResourceIdentifier> {}
|
13
src/ldp/representation/RepresentationPreference.ts
Normal file
13
src/ldp/representation/RepresentationPreference.ts
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Represents a single preference in a request.
|
||||
*/
|
||||
export interface RepresentationPreference {
|
||||
/**
|
||||
* The actual preference value.
|
||||
*/
|
||||
value: string;
|
||||
/**
|
||||
* How important this preference is in a value going from 0 to 1.
|
||||
*/
|
||||
weight?: number;
|
||||
}
|
@ -1,4 +1,12 @@
|
||||
import { RepresentationPreference } from './RepresentationPreference';
|
||||
|
||||
/**
|
||||
* Contains the preferences of which kind of representation is requested.
|
||||
*/
|
||||
export interface RepresentationPreferences {}
|
||||
export interface RepresentationPreferences {
|
||||
type?: RepresentationPreference[];
|
||||
charset?: RepresentationPreference[];
|
||||
datetime?: RepresentationPreference[];
|
||||
encoding?: RepresentationPreference[];
|
||||
language?: RepresentationPreference[];
|
||||
}
|
||||
|
@ -1,4 +1,9 @@
|
||||
/**
|
||||
* The unique identifier of a resource.
|
||||
*/
|
||||
export interface ResourceIdentifier {}
|
||||
export interface ResourceIdentifier {
|
||||
/**
|
||||
* Path to the relevant resource. Usually this would be an URL.
|
||||
*/
|
||||
path: string;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user