本文整理汇总了C#中Snapshot.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Snapshot.GetType方法的具体用法?C# Snapshot.GetType怎么用?C# Snapshot.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Snapshot
的用法示例。
在下文中一共展示了Snapshot.GetType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateWithHttpInfo
/// <summary>
/// Modify a Snapshot You can use update attributes of a resource
/// </summary>
/// <param name="snapshotId"></param>
/// <param name="snapshot">Modified Snapshot</param>
/// <param name="parameter">Controls whether response is pretty-printed (with indentation and new lines)</param>
/// <param name="depth">Controls the details depth of response objects. \nEg. GET /datacenters/[ID]\n - depth=0: only direct properties are included. Children (servers etc.) are not included\n - depth=1: direct properties and children references are included\n - depth=2: direct properties and children properties are included\n - depth=3: direct properties and children properties and children's children are included\n - depth=... and so on</param>
/// <returns>ApiResponse of Snapshot</returns>
public ApiResponse<Snapshot> UpdateWithHttpInfo(string snapshotId, Snapshot snapshot, bool? parameter = null, int? depth = null)
{
// verify the required parameter 'snapshotId' is set
if (snapshotId == null)
throw new ApiException(400, "Missing required parameter 'snapshotId' when calling SnapshotApi->Update");
// verify the required parameter 'snapshot' is set
if (snapshot == null)
throw new ApiException(400, "Missing required parameter 'snapshot' when calling SnapshotApi->Update");
var path_ = "/snapshots/{snapshotId}";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(Configuration.DefaultHeader);
var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>();
Object postBody = null;
// to determine the Content-Type header
String[] httpContentTypes = new String[] {
"application/json", "application/vnd.profitbricks.resource+json"
};
String httpContentType = Configuration.ApiClient.SelectHeaderContentType(httpContentTypes);
// to determine the Accept header
String[] httpHeaderAccepts = new String[] {
"application/vnd.profitbricks.resource+json"
};
String httpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAccept != null)
headerParams.Add("Accept", httpHeaderAccept);
// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
pathParams.Add("format", "json");
if (snapshotId != null) pathParams.Add("snapshotId", Configuration.ApiClient.ParameterToString(snapshotId)); // path parameter
if (parameter != null) queryParams.Add("parameter", Configuration.ApiClient.ParameterToString(parameter)); // query parameter
if (depth != null) queryParams.Add("depth", Configuration.ApiClient.ParameterToString(depth)); // query parameter
if (snapshot.GetType() != typeof(byte[]))
{
postBody = Configuration.ApiClient.Serialize(snapshot); // http body (model) parameter
}
else
{
postBody = snapshot; // byte array
}
// authentication (basicAuth) required
// http basic authentication required
if (!String.IsNullOrEmpty(Configuration.Username) || !String.IsNullOrEmpty(Configuration.Password))
{
headerParams["Authorization"] = "Basic " + ApiClient.Base64Encode(Configuration.Username + ":" + Configuration.Password);
}
// make the HTTP request
IRestResponse response = (IRestResponse)Configuration.ApiClient.CallApi(path_,
Method.PUT, queryParams, postBody, headerParams, formParams, fileParams,
pathParams, httpContentType);
int statusCode = (int)response.StatusCode;
if (statusCode >= 400)
throw new ApiException(statusCode, "Error calling Update: " + response.Content, response.Content);
else if (statusCode == 0)
throw new ApiException(statusCode, "Error calling Update: " + response.ErrorMessage, response.ErrorMessage);
return new ApiResponse<Snapshot>(statusCode,
response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
(Snapshot)Configuration.ApiClient.Deserialize(response, typeof(Snapshot)));
}