Google Api

This commit is contained in:
Paul Schneider 2017-06-20 02:47:52 +02:00
commit 83f9fc1bd8
123 changed files with 12961 additions and 60 deletions

View file

@ -0,0 +1,72 @@
/*
Copyright 2012 Google Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
using System;
namespace Google.Apis.Upload
{
/// <summary>
/// Enum to communicate the status of an upload for progress reporting.
/// </summary>
public enum UploadStatus
{
/// <summary>
/// The upload has not started.
/// </summary>
NotStarted,
/// <summary>
/// The upload is initializing.
/// </summary>
Starting,
/// <summary>
/// Data is being uploaded.
/// </summary>
Uploading,
/// <summary>
/// The upload completed successfully.
/// </summary>
Completed,
/// <summary>
/// The upload failed.
/// </summary>
Failed
};
/// <summary>
/// Interface reporting upload progress.
/// </summary>
public interface IUploadProgress
{
/// <summary>
/// Gets the current status of the upload
/// </summary>
UploadStatus Status { get; }
/// <summary>
/// Gets the approximate number of bytes sent to the server.
/// </summary>
long BytesSent { get; }
/// <summary>
/// Gets an exception if one occurred.
/// </summary>
Exception Exception { get; }
}
}

View file

@ -0,0 +1,37 @@
/*
Copyright 2016 Google Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
namespace Google.Apis.Upload
{
/// <summary>
/// Interface IUploadSessionData: Provides UploadUri for client to persist. Allows resuming an upload after a program restart for seekable ContentStreams.
/// </summary>
/// <remarks>
/// Defines the data passed from the ResumeableUpload class upon initiation of an upload.
/// When the client application adds an event handler for the UploadSessionData event, the data
/// defined in this interface (currently the UploadURI) is passed as a parameter to the event handler procedure.
/// An event handler for the UploadSessionData event is only required if the application will support resuming the
/// upload after a program restart.
/// </remarks>
public interface IUploadSessionData
{
/// <summary>
/// The resumable session URI (UploadUri)
/// </summary>
System.Uri UploadUri { get; }
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,59 @@
// Copyright 2017 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using Google.Apis.Http;
using System;
using System.Net.Http;
namespace Google.Apis.Upload
{
/// <summary>
/// Options for <see cref="ResumableUpload"/> operations.
/// </summary>
public sealed class ResumableUploadOptions
{
/// <summary>
/// Gets or sets the HTTP client to use when starting the upload sessions and uploading data.
/// </summary>
public HttpClient HttpClient { get; set; }
/// <summary>
/// Gets or sets the callback for modifying the session initiation request.
/// See https://cloud.google.com/storage/docs/json_api/v1/how-tos/resumable-upload#start-resumable for more information.
/// </summary>
/// <remarks>
/// Note: If these options are used with a <see cref="ResumableUpload"/> created using <see cref="ResumableUpload.CreateFromUploadUri"/>,
/// this property will be ignored as the session has already been initiated.
/// </remarks>
public Action<HttpRequestMessage> ModifySessionInitiationRequest { get; set; }
/// <summary>
/// Gets or sets the serializer to use when parsing error responses.
/// </summary>
public ISerializer Serializer { get; set; }
/// <summary>
/// Gets or sets the name of the service performing the upload.
/// </summary>
/// <remarks>
/// This will be used to set the <see cref="GoogleApiException.ServiceName"/> in the event of an error.
/// </remarks>
public string ServiceName { get; set; }
/// <summary>
/// Gets the <see cref="HttpClient"/> as a <see cref="Google.Apis.Http.ConfigurableHttpClient"/> if it is an instance of one.
/// </summary>
internal ConfigurableHttpClient ConfigurableHttpClient => HttpClient as ConfigurableHttpClient;
}
}