C# Client Library
A C# Client Library for the AnalyzeRe REST API
Loading...
Searching...
No Matches
LargeDataSubResource.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using RestSharp;
3
4namespace AnalyzeRe.APITypes
5{
13 {
14 #region Private Fields
15 private CommandSubResource _commit;
16 private SubResource<LargeDataUpload.StatusResponse> _status;
17 #endregion Private Fields
18
19 #region Public SubResources
21 public CommandSubResource commit => _commit ?? (_commit = new CommandSubResource(this, "commit"));
22
24 public SubResource<LargeDataUpload.StatusResponse> status => _status ??
25 (_status = new SubResource<LargeDataUpload.StatusResponse>(this, "status"));
26 #endregion Public SubResources
27
28 #region Constructors
35 #endregion Constructors
36
37 #region REST Methods
42 public void UploadString(string data, LargeDataUpload.Parameters parameters = null)
43 {
44 ValidateOwnerHasId();
46 LargeDataUpload.Utilities.GetStringStream(data), parameters, data.Length);
47 }
48
53 public void Post(long? totalSizeBytes, int? timeout = null)
54 {
55 ValidateOwnerHasId();
56 IEnumerable<Parameter> header = totalSizeBytes.HasValue ?
58 API.RequestAndParse<string>(Path, Method.POST, header, timeout ?? DefaultTimeout);
59 }
60
67 public void Patch(string data, long bytesOffset, int? timeout = null,
69 {
70 ValidateOwnerHasId();
72 .AddParameters(requestParameters);
73 PatchHelper(patchParameters, timeout);
74 }
75
83 public void Patch(byte[] data, int count, long bytesOffset, int? timeout = null,
85 {
86 ValidateOwnerHasId();
89 .AddParameters(requestParameters);
90 PatchHelper(patchParameters, timeout);
91 }
92
93 // Helper method for the two PATCH variations
94 private void PatchHelper(IEnumerable<Parameter> patchParameters, int? timeout)
95 {
97 }
98
106 public IRestResponse Head(int? timeout = null)
107 {
108 ValidateOwnerHasId();
110 }
111
117 {
118 ValidateOwnerHasId();
120 }
121 #endregion REST Methods
122 }
123}
Describes a command sub-resource available off a resource which can be POSTed to with no data to invo...
Describes an additional data sub-resource available off a resource. Endpoint supports GET and PUT.
Describes an endpoint off of some types of resources from which an associated "large data file" can b...
void Patch(byte[] data, int count, long bytesOffset, int? timeout=null, IEnumerable< Parameter > requestParameters=null)
Performs a PATCH of part of this object's data at this endpoint.
IRestResponse Head(int? timeout=null)
Perform a HEAD request on the data endpoint, which would return information about whether data is pre...
void Delete(int? timeout=null, IEnumerable< Parameter > requestParameters=null)
Perform a DELETE request on the data endpoint, which would cancel a large data upload if it is in pro...
SubResource< LargeDataUpload.StatusResponse > status
The endpoint at which the status of the data can be determined.
void UploadString(string data, LargeDataUpload.Parameters parameters=null)
Uploads this object's data in its entirety at this endpoint in a single blocking request.
CommandSubResource commit
The endpoint at which a large file upload is finalized with a POST.
void Patch(string data, long bytesOffset, int? timeout=null, IEnumerable< Parameter > requestParameters=null)
Performs a PATCH of part of this object's data at this endpoint.
LargeDataSubResource(IAPIResource_WithDataEndpoint owner)
Defines an endpoint off of some types of resources from which an associated "large data file" can be ...
void Post(long? totalSizeBytes, int? timeout=null)
Performs a POST that initiates a chunked large data upload.
Describes a collection of resources which can be listed.
Describes an additional sub-resource available off a resource which is not actually a property of tha...
int? DefaultTimeout
Can be used to override the API.DefaultRequestTimeout with one that better suits this SubResource.
Parameters that can be added to your REST requests to access additional API features.
static RequestParameters DataEntityLength(long totalBytes)
Creates an HTTP Header RestSharp parameter that specifies the length of an entity to be uploaded in s...
static RequestParameters DataPatchChunk(long offsetBytes, byte[] chunkData, int count)
Creates the RestSharp HTTP Header parameter required to PATCH a data endpoint with part of a file.
API methods / requests made available to the user.
static object RequestAndParse(Type deserializeType, string resource, Method method, IEnumerable< Parameter > requestParameters=null, int? timeout=null)
Perform a REST request on the server and serializes the response to the desired run-time type.
static IRestResponse ExecuteRestRequest(string resource, Method method, IEnumerable< Parameter > requestParameters=null, int? timeout=null, bool returnRawResponse=false, Action< Stream > responseStreamReader=null)
Perform a REST request on the server.
Describes an APIResource class that adds a "/data" sub-resource, since this functionality is common t...