mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +00:00
Finished patch support
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
import { SortOptions } from '../cache/models/sort-options.model';
|
||||
import { GenericConstructor } from '../shared/generic-constructor';
|
||||
import { GlobalConfig } from '../../../config/global-config.interface';
|
||||
import { RESTURLCombiner } from '../url-combiner/rest-url-combiner';
|
||||
import { BrowseEntriesResponseParsingService } from './browse-entries-response-parsing.service';
|
||||
import { DSOResponseParsingService } from './dso-response-parsing.service';
|
||||
import { ResponseParsingService } from './parsing.service';
|
||||
@@ -10,35 +8,17 @@ import { BrowseResponseParsingService } from './browse-response-parsing.service'
|
||||
import { ConfigResponseParsingService } from './config-response-parsing.service';
|
||||
import { AuthResponseParsingService } from '../auth/auth-response-parsing.service';
|
||||
import { HttpOptions } from '../dspace-rest-v2/dspace-rest-v2.service';
|
||||
import { HttpHeaders } from '@angular/common/http';
|
||||
import { IntegrationResponseParsingService } from '../integration/integration-response-parsing.service';
|
||||
import { RestRequestMethod } from './/rest-request-method';
|
||||
|
||||
/* tslint:disable:max-classes-per-file */
|
||||
|
||||
/**
|
||||
* Represents a Request Method.
|
||||
*
|
||||
* I didn't reuse the RequestMethod enum in @angular/http because
|
||||
* it uses numbers. The string values here are more clear when
|
||||
* debugging.
|
||||
*
|
||||
* The ones commented out are still unsupported in the rest of the codebase
|
||||
*/
|
||||
export enum RestRequestMethod {
|
||||
Get = 'GET',
|
||||
Post = 'POST',
|
||||
Put = 'PUT',
|
||||
Delete = 'DELETE',
|
||||
Options = 'OPTIONS',
|
||||
Head = 'HEAD',
|
||||
Patch = 'PATCH'
|
||||
}
|
||||
|
||||
export abstract class RestRequest {
|
||||
constructor(
|
||||
public uuid: string,
|
||||
public href: string,
|
||||
public method: RestRequestMethod = RestRequestMethod.Get,
|
||||
public method: RestRequestMethod = RestRequestMethod.GET,
|
||||
public body?: any,
|
||||
public options?: HttpOptions
|
||||
) {
|
||||
@@ -56,7 +36,7 @@ export class GetRequest extends RestRequest {
|
||||
public body?: any,
|
||||
public options?: HttpOptions
|
||||
) {
|
||||
super(uuid, href, RestRequestMethod.Get, body)
|
||||
super(uuid, href, RestRequestMethod.GET, body)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +47,7 @@ export class PostRequest extends RestRequest {
|
||||
public body?: any,
|
||||
public options?: HttpOptions
|
||||
) {
|
||||
super(uuid, href, RestRequestMethod.Post, body)
|
||||
super(uuid, href, RestRequestMethod.POST, body)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +58,7 @@ export class PutRequest extends RestRequest {
|
||||
public body?: any,
|
||||
public options?: HttpOptions
|
||||
) {
|
||||
super(uuid, href, RestRequestMethod.Put, body)
|
||||
super(uuid, href, RestRequestMethod.PUT, body)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +69,7 @@ export class DeleteRequest extends RestRequest {
|
||||
public body?: any,
|
||||
public options?: HttpOptions
|
||||
) {
|
||||
super(uuid, href, RestRequestMethod.Delete, body)
|
||||
super(uuid, href, RestRequestMethod.DELETE, body)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +80,7 @@ export class OptionsRequest extends RestRequest {
|
||||
public body?: any,
|
||||
public options?: HttpOptions
|
||||
) {
|
||||
super(uuid, href, RestRequestMethod.Options, body)
|
||||
super(uuid, href, RestRequestMethod.OPTIONS, body)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +91,7 @@ export class HeadRequest extends RestRequest {
|
||||
public body?: any,
|
||||
public options?: HttpOptions
|
||||
) {
|
||||
super(uuid, href, RestRequestMethod.Head, body)
|
||||
super(uuid, href, RestRequestMethod.HEAD, body)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +102,7 @@ export class PatchRequest extends RestRequest {
|
||||
public body?: any,
|
||||
public options?: HttpOptions
|
||||
) {
|
||||
super(uuid, href, RestRequestMethod.Patch, body)
|
||||
super(uuid, href, RestRequestMethod.PATCH, body)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user