本文整理汇总了C#中IRequestOptions类的典型用法代码示例。如果您正苦于以下问题:C# IRequestOptions类的具体用法?C# IRequestOptions怎么用?C# IRequestOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IRequestOptions类属于命名空间,在下文中一共展示了IRequestOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetRequestOptions
internal static void SetRequestOptions(ref SerializableRequestOptions serializer, IRequestOptions requestOptions)
{
if (null == serializer && null == requestOptions)
{
return;
}
if (null == serializer)
{
serializer = CreateSerializableRequestOptions(requestOptions);
}
else
{
if ((requestOptions is FileRequestOptions)
&& (serializer is SerializableBlobRequestOptions))
{
serializer = new SerializableFileRequestOptions();
}
else if ((requestOptions is BlobRequestOptions)
&& (serializer is SerializableFileRequestOptions))
{
serializer = new SerializableBlobRequestOptions();
}
serializer.RequestOptions = requestOptions;
}
}
示例2: BaseSpaceClient
public BaseSpaceClient(IClientSettings settings, IRequestOptions defaultOptions = null)
{
if (settings == null)
{
throw new ArgumentNullException("settings");
}
Settings = settings;
WebClient = new JsonWebClient(settings, defaultOptions);
}
示例3: BaseSpaceClient
public BaseSpaceClient(IClientSettings settings, IWebClient client, IRequestOptions defaultOptions = null)
{
if (settings == null || client == null)
{
throw new ArgumentNullException("settings");
}
ClientSettings = settings;
WebClient = client;
SetDefaultRequestOptions(defaultOptions);
}
示例4: ListVariantsAsync
public Task<ListVariantsResponse> ListVariantsAsync(ListVariantsRequest request, IRequestOptions options = null)
{
return WebClient.SendAsync<ListVariantsResponse>(HttpMethods.GET, request.BuildUrl(ClientSettings.Version), null, options);
}
示例5: ListSamples
public ListSamplesResponse ListSamples(ListSamplesRequest request, IRequestOptions options)
{
return WebClient.Send<ListSamplesResponse>(HttpMethods.GET, request.BuildUrl(ClientSettings.Version), null, options);
}
示例6: UpdateAppSession
public UpdateAppSessionResponse UpdateAppSession(UpdateAppSessionRequest request, IRequestOptions options = null)
{
return WebClient.Send(request, options);
}
示例7: FinishOAuthDeviceAuth
public OAuthDeviceAccessTokenResponse FinishOAuthDeviceAuth(OAuthDeviceAccessTokenRequest request, IRequestOptions options = null)
{
try
{
return WebClient.Send<OAuthDeviceAccessTokenResponse> (HttpMethods.POST, request.BuildUrl (ClientSettings.Version), request, options);
}
catch (BaseSpaceException bex)
{
if(bex.InnerException != null && bex.InnerException.GetType() == typeof(WebServiceException))
{
var wsex = (WebServiceException)bex.InnerException;
return wsex.ResponseBody.FromJson<OAuthDeviceAccessTokenResponse>();
}
}
return null;
}
示例8: CreateAppResult
public PostAppResultResponse CreateAppResult(PostAppResultRequest request, IRequestOptions options = null)
{
return WebClient.Send<PostAppResultResponse>(HttpMethods.POST, request.BuildUrl(ClientSettings.Version), request, options);
}
示例9: GetStorageServiceProperties
/// <summary>
/// Get the service properties
/// </summary>
/// <param name="account">Cloud storage account</param>
/// <param name="type">Service type</param>
/// <param name="options">Request options</param>
/// <param name="operationContext">Operation context</param>
/// <returns>The service properties of the specified service type</returns>
public ServiceProperties GetStorageServiceProperties(StorageServiceType type, IRequestOptions options, OperationContext operationContext)
{
CloudStorageAccount account = StorageContext.StorageAccount;
switch (type)
{
case StorageServiceType.Blob:
return account.CreateCloudBlobClient().GetServiceProperties((BlobRequestOptions) options, operationContext);
case StorageServiceType.Queue:
return account.CreateCloudQueueClient().GetServiceProperties((QueueRequestOptions) options, operationContext);
case StorageServiceType.Table:
return account.CreateCloudTableClient().GetServiceProperties((TableRequestOptions) options, operationContext);
case StorageServiceType.File:
FileServiceProperties fileServiceProperties = account.CreateCloudFileClient().GetServiceProperties((FileRequestOptions)options, operationContext);
ServiceProperties sp = new ServiceProperties();
sp.Clean();
sp.Cors = fileServiceProperties.Cors;
return sp;
default:
throw new ArgumentException(Resources.InvalidStorageServiceType, "type");
}
}
示例10: SetStorageServiceProperties
/// <summary>
/// Set service properties
/// </summary>
/// <param name="account">Cloud storage account</param>
/// <param name="type">Service type</param>
/// <param name="properties">Service properties</param>
/// <param name="options">Request options</param>
/// <param name="operationContext">Operation context</param>
public void SetStorageServiceProperties(StorageServiceType type, ServiceProperties properties, IRequestOptions options, OperationContext operationContext)
{
CloudStorageAccount account = StorageContext.StorageAccount;
switch (type)
{
case StorageServiceType.Blob:
account.CreateCloudBlobClient().SetServiceProperties(properties, (BlobRequestOptions)options, operationContext);
break;
case StorageServiceType.Queue:
account.CreateCloudQueueClient().SetServiceProperties(properties, (QueueRequestOptions)options, operationContext);
break;
case StorageServiceType.Table:
account.CreateCloudTableClient().SetServiceProperties(properties, (TableRequestOptions)options, operationContext);
break;
case StorageServiceType.File:
if (null != properties.Logging)
{
throw new InvalidOperationException(Resources.FileNotSupportLogging);
}
if (null != properties.HourMetrics || null != properties.MinuteMetrics)
{
throw new InvalidOperationException(Resources.FileNotSupportMetrics);
}
FileServiceProperties fileServiceProperties = new FileServiceProperties();
fileServiceProperties.Cors = properties.Cors;
account.CreateCloudFileClient().SetServiceProperties(fileServiceProperties, (FileRequestOptions)options, operationContext);
break;
default:
throw new ArgumentException(Resources.InvalidStorageServiceType, "type");
}
}
示例11: CreateProject
public CreateProjectResponse CreateProject(CreateProjectRequest request, IRequestOptions options = null)
{
return WebClient.Send(request, options);
}
示例12: AssignToRequestOptions
private static void AssignToRequestOptions(IRequestOptions targetRequestOptions, IRequestOptions customRequestOptions)
{
if (null != customRequestOptions.MaximumExecutionTime)
{
targetRequestOptions.MaximumExecutionTime = customRequestOptions.MaximumExecutionTime;
}
if (null != customRequestOptions.RetryPolicy)
{
targetRequestOptions.RetryPolicy = customRequestOptions.RetryPolicy;
}
if (null != customRequestOptions.ServerTimeout)
{
targetRequestOptions.ServerTimeout = customRequestOptions.ServerTimeout;
}
targetRequestOptions.LocationMode = customRequestOptions.LocationMode;
}
示例13: CreateAppSessionLogs
public CreateAppSessionLogsResponse CreateAppSessionLogs(CreateAppSessionLogsRequest request, IRequestOptions options = null)
{
return WebClient.Send(request, options);
}
示例14: BeginOAuthDeviceAuth
public OAuthDeviceAuthResponse BeginOAuthDeviceAuth(OAuthDeviceAuthRequest request, IRequestOptions options = null)
{
return WebClient.Send(request, options);
}
示例15: UploadFileToFileSet
public UploadFileToFileSetResponse UploadFileToFileSet(UploadFileToFileSetRequest request, IRequestOptions options = null)
{
var fileUploadClient = new FileUpload(WebClient, Settings, options ?? WebClient.DefaultRequestOptions);
return fileUploadClient.UploadFile(request);
}