/// <summary>
 /// Modify Share
 /// </summary>
 /// <example>
 /// {
 /// "Title": "New Title",
 /// "ExpirationDate": "2013-07-23",
 /// "RequireLogin": false,
 /// "Items": [ { "Id":"itemid" }, {...} ],
 /// }
 /// </example>
 /// <remarks>
 /// Modifies an existing Share. If Items are specified they are added to the share.
 /// </remarks>
 /// <param name="url"></param>
 /// <param name="share"></param>
 /// <returns>
 /// The modified Share
 /// </returns>
 public IQuery<Share> Update(Uri url, Share share)
 {
     var sfApiQuery = new ShareFile.Api.Client.Requests.Query<Share>(Client);
     sfApiQuery.Uri(url);
     sfApiQuery.Body = share;
     sfApiQuery.HttpMethod = "PATCH";
     return sfApiQuery;
 }
Beispiel #2
0
        public static async Task<Share> ShareViaLink(ShareFileClient sfClient, Item fileToShare)
        {
            var share = new Share
            {
                Items = new List<Item>
                {
                    fileToShare
                }
            };

            return await sfClient.Shares.Create(share).ExecuteAsync();
        }
 /// <summary>
 /// Create Share
 /// </summary>
 /// <example>
 /// {
 /// "ShareType":"Send",
 /// "Title":"Sample Send Share",
 /// "Items": [ { "Id":"itemid" }, {...} ],
 /// "Recipients":[ { "User": { "Id":"userid" } }, { "User": { "Email": "user@email" } } ],
 /// "ExpirationDate": "2013-07-23",
 /// "RequireLogin": false,
 /// "RequireUserInfo": false,
 /// "MaxDownloads": -1,
 /// "UsesStreamIDs": false
 /// }
 /// {
 /// "ShareType":"Request",
 /// "Title":"Sample Request Share",
 /// "Recipients":[ { "User": { "Id":"userid" } }, { "User": { "Email": "user@email" } } ],
 /// "Parent": { "Id":"folderid" },
 /// "ExpirationDate": "2013-07-23",
 /// "RequireLogin": false,
 /// "RequireUserInfo": false,
 /// "TrackUntilDate": "2013-07-23",
 /// "SendFrequency": -1,
 /// "SendInterval": -1
 /// }
 /// </example>
 /// <remarks>
 /// Creates a new Send or Request Share.
 /// Expiration date:
 /// - if not specified the default is 30 days
 /// - "9999-12-31" disables share expiration.
 /// To use stream IDs as item IDs UsesStreamIDs needs to be set to true, and all the IDs in Items need to be specified
 /// as stream IDs.
 /// </remarks>
 /// <param name="share"></param>
 /// <param name="notify"></param>
 /// <returns>
 /// The new Share
 /// </returns>
 public IQuery<Share> Create(Share share, bool notify = false)
 {
     var sfApiQuery = new ShareFile.Api.Client.Requests.Query<Share>(Client);
     sfApiQuery.From("Shares");
     sfApiQuery.QueryString("notify", notify);
     sfApiQuery.Body = share;
     sfApiQuery.HttpMethod = "POST";
     return sfApiQuery;
 }