Skip to content
Permalink
Browse files

Merge pull request #193 from DamirLisak/Invitation

Invitation
  • Loading branch information...
daboxu committed May 8, 2017
2 parents 8ca533a + 4f4d9f2 commit 3594584535a452595c3cc6b3b2a752043bf0f339
@@ -21,8 +21,8 @@
</dependencies>

</metadata>
<files>
<!-- PCL projects -->
<file src="..\lib\Microsoft.OneDrive.Sdk.dll" target="lib\portable-net45+netcore45+wpa81+win8\Microsoft.OneDrive.Sdk.dll" />
</files>
<files>
<!-- PCL projects -->
<file src="..\lib\Microsoft.OneDrive.Sdk.dll" target="lib\portable-net45+netcore45+wpa81+win8\Microsoft.OneDrive.Sdk.dll" />
</files>
</package>
@@ -67,8 +67,8 @@
<Compile Include="Requests\UploadSessionRequest.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.Graph.Core, Version=1.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Graph.Core.1.2.1\lib\portable45-net45+win8+wpa81\Microsoft.Graph.Core.dll</HintPath>
<Reference Include="Microsoft.Graph.Core, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Graph.Core.1.3.1\lib\portable45-net45+win8+wpa81\Microsoft.Graph.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
@@ -77,6 +77,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
@@ -0,0 +1,37 @@
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------

// **NOTE** This file was generated by a tool and any changes will be overwritten.


namespace Microsoft.OneDrive.Sdk
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization;
using Microsoft.Graph;

/// <summary>
/// The type ItemCreateLinkRequestBody.
/// </summary>
[DataContract]
public partial class ItemInviteRequestBody
{
[DataMember(Name = "requireSignIn", EmitDefaultValue = false, IsRequired = false)]
public bool RequireSignIn { get; set; }

[DataMember(Name = "sendInvitation", EmitDefaultValue = false, IsRequired = false)]
public bool SendInvitation { get; set; }

[DataMember(Name = "roles", EmitDefaultValue = false, IsRequired = false)]
public string[] Roles { get; set; }

[DataMember(Name = "recipients", EmitDefaultValue = false, IsRequired = false)]
public Recipient[] Recipients { get; set; }

[DataMember(Name = "message", EmitDefaultValue = false, IsRequired = false)]
public string Message { get; set; }
}
}
@@ -0,0 +1,49 @@
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------

// **NOTE** This file was generated by a tool and any changes will be overwritten.


namespace Microsoft.OneDrive.Sdk
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization;
using Microsoft.Graph;
using Newtonsoft.Json;

/// <summary>
/// The type SharingInvitation.
/// </summary>
[DataContract]
[JsonConverter(typeof(DerivedTypeConverter))]
public partial class Recipient
{
/// <summary>
/// Gets or sets email.
/// </summary>
[DataMember(Name = "email", EmitDefaultValue = false, IsRequired = false)]
public string Email { get; set; }

/// <summary>
/// Gets or sets alias.
/// </summary>
[DataMember(Name = "alias", EmitDefaultValue = false, IsRequired = false)]
public string Alias { get; set; }

/// <summary>
/// Gets or sets objectId.
/// </summary>
[DataMember(Name = "objectId", EmitDefaultValue = false, IsRequired = false)]
public string ObjectId { get; set; }

/// <summary>
/// Gets or sets additional data.
/// </summary>
[JsonExtensionData(ReadData = true)]
public IDictionary<string, object> AdditionalData { get; set; }

}
}
@@ -0,0 +1,54 @@
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------

// **NOTE** This file was generated by a tool and any changes will be overwritten.


namespace Microsoft.OneDrive.Sdk
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
using System.Threading;
using Microsoft.Graph;

/// <summary>
/// The interface IItemCreateLinkRequest.
/// </summary>
public partial interface IItemInviteRequest : IBaseRequest
{

/// <summary>
/// Gets the request body.
/// </summary>
ItemInviteRequestBody RequestBody { get; }

/// <summary>
/// Issues the POST request.
/// </summary>
System.Threading.Tasks.Task<IItemPermissionsCollectionPage> PostAsync();

/// <summary>
/// Issues the POST request.
/// </summary>
/// /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
/// <returns>ThePermission</returns>
System.Threading.Tasks.Task<IItemPermissionsCollectionPage> PostAsync(CancellationToken cancellationToken);

/// <summary>
/// Adds the specified expand value to the request.
/// </summary>
/// <param name="value">The expand value.</param>
/// <returns>The request object to send.</returns>
IItemInviteRequest Expand(string value);

/// <summary>
/// Adds the specified select value to the request.
/// </summary>
/// <param name="value">The select value.</param>
/// <returns>The request object to send.</returns>
IItemInviteRequest Select(string value);
}
}
@@ -0,0 +1,27 @@
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------

// **NOTE** This file was generated by a tool and any changes will be overwritten.


namespace Microsoft.OneDrive.Sdk
{
using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.Graph;

/// <summary>
/// The interface IItemCreateLinkRequestBuilder.
/// </summary>
public partial interface IItemInviteRequestBuilder
{
/// <summary>
/// Builds the request.
/// </summary>
/// <param name="options">The query and header options for the request.</param>
/// <returns>The built request.</returns>
IItemInviteRequest Request(IEnumerable<Option> options = null);
}
}
@@ -29,7 +29,7 @@ public partial interface IItemRequestBuilder : IBaseRequestBuilder
/// <param name="options">The query and header options for the request.</param>
/// <returns>The built request.</returns>
IItemRequest Request(IEnumerable<Option> options);

/// <summary>
/// Gets the request builder for Permissions.
/// </summary>
@@ -53,13 +53,13 @@ public partial interface IItemRequestBuilder : IBaseRequestBuilder
/// </summary>
/// <returns>The <see cref="IItemThumbnailsCollectionRequestBuilder"/>.</returns>
IItemThumbnailsCollectionRequestBuilder Thumbnails { get; }

/// <summary>
/// Gets the request builder for Content.
/// </summary>
/// <returns>The <see cref="IItemContentRequestBuilder"/>.</returns>
IItemContentRequestBuilder Content { get; }

/// <summary>
/// Gets the request builder for ItemCreateSession.
/// </summary>
@@ -95,6 +95,16 @@ public partial interface IItemRequestBuilder : IBaseRequestBuilder
/// <returns>The <see cref="IItemSearchRequestBuilder"/>.</returns>
IItemSearchRequestBuilder Search(
string q = null);


/// <summary>
/// Gets the request builder for ItemInvite.
/// </summary>
/// <returns>The <see cref="IItemInviteRequestBuilder"/>.</returns>
IItemInviteRequestBuilder Invite(string[] roles,
Recipient[] recipients,
bool requiresSignIn = false,
bool sendInvitation = false,
string message = null);

}
}
@@ -0,0 +1,108 @@
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------

// **NOTE** This file was generated by a tool and any changes will be overwritten.


namespace Microsoft.OneDrive.Sdk
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
using System.Threading;
using Microsoft.Graph;

/// <summary>
/// The type ItemCreateLinkRequest.
/// </summary>
public partial class ItemInviteRequest : BaseRequest, IItemInviteRequest
{
/// <summary>
/// Constructs a new ItemCreateLinkRequest.
/// </summary>
public ItemInviteRequest(
string requestUrl,
IBaseClient client,
IEnumerable<Option> options)
: base(requestUrl, client, options)
{
this.Method = "POST";
this.ContentType = "application/json";
this.RequestBody = new ItemInviteRequestBody();
}

/// <summary>
/// Gets the request body.
/// </summary>
public ItemInviteRequestBody RequestBody { get; private set; }

/// <summary>
/// Issues the POST request.
/// </summary>
public System.Threading.Tasks.Task<IItemPermissionsCollectionPage> PostAsync()
{
return this.PostAsync(CancellationToken.None);
}

/// <summary>
/// Issues the POST request.
/// </summary>
/// <param name=""cancellationToken"">The <see cref=""CancellationToken""/> for the request.</param>
/// <returns>The task to await for async call.</returns>
public async System.Threading.Tasks.Task<IItemPermissionsCollectionPage> PostAsync(
CancellationToken cancellationToken)
{
this.ContentType = "application/json";
this.Method = "POST";
var response = await this.SendAsync<ItemPermissionsCollectionResponse>(this.RequestBody, cancellationToken).ConfigureAwait(false);
if (response != null && response.Value != null && response.Value.CurrentPage != null)
{
if (response.AdditionalData != null)
{
object nextPageLink;
response.AdditionalData.TryGetValue("@odata.nextLink", out nextPageLink);

var nextPageLinkString = nextPageLink as string;

if (!string.IsNullOrEmpty(nextPageLinkString))
{
response.Value.InitializeNextPageRequest(
this.Client,
nextPageLinkString);
}

// Copy the additional data collection to the page itself so that information is not lost
response.Value.AdditionalData = response.AdditionalData;
}

return response.Value;
}

return null;
}

/// <summary>
/// Adds the specified expand value to the request.
/// </summary>
/// <param name="value">The expand value.</param>
/// <returns>The request object to send.</returns>
public IItemInviteRequest Expand(string value)
{
this.QueryOptions.Add(new QueryOption("$expand", value));
return this;
}

/// <summary>
/// Adds the specified select value to the request.
/// </summary>
/// <param name="value">The select value.</param>
/// <returns>The request object to send.</returns>
public IItemInviteRequest Select(string value)
{
this.QueryOptions.Add(new QueryOption("$select", value));
return this;
}
}
}

0 comments on commit 3594584

Please sign in to comment.
You can’t perform that action at this time.