forked from microsoftgraph/msgraph-sdk-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUploadResult.ts
More file actions
77 lines (69 loc) · 2.06 KB
/
UploadResult.ts
File metadata and controls
77 lines (69 loc) · 2.06 KB
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
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
/**
* Class representing a successful file upload result
*/
export class UploadResult {
/**
* @private
* Location value looked up in the response header
*/
private _location: string;
/**
* @private
* Response body of the final raw response
*/
private _responseBody: unknown;
/**
* @public
* Get of the location value.
* Location value is looked up in the response header
*/
public get location(): string {
return this._location;
}
/**
* @public
* Set the location value
* Location value is looked up in the response header
*/
public set location(location: string) {
this._location = location;
}
/**
* @public
* Get The response body from the completed upload response
*/
public get responseBody() {
return this._responseBody;
}
/**
* @public
* Set the response body from the completed upload response
*/
public set responseBody(responseBody: unknown) {
this._responseBody = responseBody;
}
/**
* @public
* @param {responseBody} responsebody - The response body from the completed upload response
* @param {location} location - The location value from the headers from the completed upload response
*/
public constructor(responseBody: unknown, location: string) {
// Response body or the location parameter can be undefined.
this._location = location;
this._responseBody = responseBody;
}
/**
* @public
* @param {responseBody} responseBody - The response body from the completed upload response
* @param {responseHeaders} responseHeaders - The headers from the completed upload response
*/
public static CreateUploadResult(responseBody?: unknown, responseHeaders?: Headers) {
return new UploadResult(responseBody, responseHeaders.get("location"));
}
}