Beispiel #1
0
        /// <summary>
        /// Cancel an Operation Batch
        /// </summary>
        /// <remarks>
        /// Cancel an Async Operation batch - all unfinished Async Operation records in that batch
        /// will be moved to Cancelled state.
        /// </remarks>
        /// <param name="id"></param>
        /// <returns>
        /// A list of the modified Async Operations in the batch
        /// </returns>
        public IQuery <ODataFeed <AsyncOperation> > CancelBatch(string id)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <ODataFeed <AsyncOperation> >(Client);

            sfApiQuery.From("AsyncOperations");
            sfApiQuery.Action("CancelBatch");
            sfApiQuery.ActionIds(id);
            sfApiQuery.HttpMethod = "POST";
            return(sfApiQuery);
        }
Beispiel #2
0
        public IQuery <TwoFactorAuthApp> GetTFAByUser(Uri url, string tfaAppId)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <TwoFactorAuthApp>(Client);

            sfApiQuery.Action("TFA");
            sfApiQuery.Uri(url);
            sfApiQuery.ActionIds(tfaAppId);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
Beispiel #3
0
        /// <summary>
        /// Get List of AsyncOperations by Folder
        /// </summary>
        /// <remarks>
        /// Retrieves all AsyncOperations associated with the calling user and the Item ID
        /// </remarks>
        /// <param name="id"></param>
        /// <returns>
        /// A Feed of AsyncOperation objects, containing all pending operations in the specific folder,
        /// for the authenticated SDK user
        /// </returns>
        public IQuery <ODataFeed <AsyncOperation> > GetByFolder(string id)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <ODataFeed <AsyncOperation> >(Client);

            sfApiQuery.From("AsyncOperations");
            sfApiQuery.Action("GetByFolder");
            sfApiQuery.ActionIds(id);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
        public IQuery <Account> GetTenants(string id)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <Account>(Client);

            sfApiQuery.From("Accounts");
            sfApiQuery.Action("Tenants");
            sfApiQuery.ActionIds(id);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
        /// <summary>
        /// Get FavoriteFolder
        /// </summary>
        /// <remarks>
        /// Retrieves a single Favorite Folder
        /// </remarks>
        /// <param name="userid"></param>
        /// <param name="itemUrl"></param>
        /// <returns>
        /// A list of Favorite Folders specified by this user
        /// </returns>
        public IQuery <FavoriteFolder> GetByUser(Uri itemUrl, string userid)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <FavoriteFolder>(Client);

            sfApiQuery.Action("FavoriteFolders");
            sfApiQuery.Uri(itemUrl);
            sfApiQuery.ActionIds(userid);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
Beispiel #6
0
        /// <summary>
        /// Get Report Record by ID
        /// </summary>
        /// <remarks>
        /// Returns a single record.
        /// </remarks>
        /// <param name="id"></param>
        /// <returns>
        /// Single Record
        /// </returns>
        public IQuery <ReportRecord> GetRecord(string id)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <ReportRecord>(Client);

            sfApiQuery.From("Reports");
            sfApiQuery.Action("Record");
            sfApiQuery.ActionIds(id);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
        /// <summary>
        /// Get Recipient of a Share
        /// </summary>
        /// <remarks>
        /// Retrieve a single Share Recipient identified by the alias id.
        /// </remarks>
        /// <param name="parentUrl"></param>
        /// <param name="id"></param>
        /// <returns>
        /// A Share Alias representing a single recipient of the Share
        /// </returns>
        public IQuery <ShareAlias> GetRecipients(Uri parentUrl, string id)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <ShareAlias>(Client);

            sfApiQuery.Action("Recipients");
            sfApiQuery.Uri(parentUrl);
            sfApiQuery.ActionIds(id);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
        /// <summary>
        /// Get Items of a Send Share
        /// </summary>
        /// <remarks>
        /// Retrieve a single Item in the Send Share
        /// </remarks>
        /// <param name="shareUrl"></param>
        /// <param name="itemid"></param>
        /// <returns>
        /// An item in the Share
        /// </returns>
        public IQuery <Item> GetItems(Uri shareUrl, string itemid)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <Item>(Client);

            sfApiQuery.Action("Items");
            sfApiQuery.Uri(shareUrl);
            sfApiQuery.ActionIds(itemid);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
        /// <summary>
        /// Get the Connector Group by Service ID
        /// </summary>
        /// <remarks>
        /// Retrieves a Connector Group
        /// </remarks>
        /// <param name="id"></param>
        /// <returns>
        /// A single ConnectorGroup object matching the query
        /// </returns>
        public IQuery <ConnectorGroupZone> GetZones(Uri url, string id)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <ConnectorGroupZone>(Client);

            sfApiQuery.Action("Zones");
            sfApiQuery.Uri(url);
            sfApiQuery.ActionIds(id);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
        /// <summary>
        /// Get an Access Control element
        /// </summary>
        /// <remarks>
        /// Retrieves a Connector Group Access Control of a given user
        /// </remarks>
        /// <param name="parentUrl"></param>
        /// <param name="id"></param>
        /// <returns>
        /// A single ConnectorGroup ACL object matching the query
        /// </returns>
        public IQuery <ConnectorGroupAccessControl> GetAccessControls(Uri parentUrl, string id)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <ConnectorGroupAccessControl>(Client);

            sfApiQuery.Action("AccessControls");
            sfApiQuery.Uri(parentUrl);
            sfApiQuery.ActionIds(id);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
        /// <summary>
        /// Get Connector Groups in a Zone
        /// </summary>
        /// <remarks>
        /// Retrieves the Connector Groups defined in a Zone.
        /// </remarks>
        /// <param name="zoneid"></param>
        /// <returns>
        /// Access Control List of the given object ID.
        /// </returns>
        public IQuery <ODataFeed <ConnectorGroup> > GetByZone(string zoneid)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <ODataFeed <ConnectorGroup> >(Client);

            sfApiQuery.From("ConnectorGroups");
            sfApiQuery.Action("GetByZone");
            sfApiQuery.ActionIds(zoneid);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
Beispiel #12
0
        /// <summary>
        /// Get App by ID
        /// </summary>
        /// <param name="userUrl"></param>
        /// <param name="appid"></param>
        /// <returns>
        /// ConnectedApp
        /// </returns>
        public IQuery <ConnectedApp> GetByUser(Uri userUrl, string appid)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <ConnectedApp>(Client);

            sfApiQuery.Action("Apps");
            sfApiQuery.Uri(userUrl);
            sfApiQuery.ActionIds(appid);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
Beispiel #13
0
        /// <summary>
        /// Get Two Factor Authentication App by ID for the Current User
        /// </summary>
        /// <param name="appid"></param>
        /// <returns>
        /// TwoFactorAuthApp
        /// </returns>
        public IQuery <TwoFactorAuthApp> TFA(string appid)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <TwoFactorAuthApp>(Client);

            sfApiQuery.From("Apps");
            sfApiQuery.Action("TFA");
            sfApiQuery.ActionIds(appid);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
Beispiel #14
0
        /// <summary>
        /// Get StorageCenter Metadata
        /// </summary>
        /// <remarks>
        /// Gets metadata associated with the specified storage center
        /// </remarks>
        /// <param name="zUrl"></param>
        /// <param name="scid"></param>
        /// <returns>
        /// the storage center metadata feed
        /// </returns>
        public IQuery <ODataFeed <Metadata> > GetMetadata(Uri zUrl, string scid)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <ODataFeed <Metadata> >(Client);

            sfApiQuery.Action("StorageCenters");
            sfApiQuery.Uri(zUrl);
            sfApiQuery.ActionIds(scid);
            sfApiQuery.SubAction("Metadata");
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
Beispiel #15
0
        /// <summary>
        /// Update StorageCenter
        /// </summary>
        /// <example>
        /// {
        /// "ExternalAddress":"https://server/",
        /// "Version":"4.12.20",
        /// "HostName":"hostname"
        /// }
        /// </example>
        /// <remarks>
        /// Updates an existing Storage Center
        /// </remarks>
        /// <param name="zUrl"></param>
        /// <param name="scid"></param>
        /// <param name="storageCenter"></param>
        /// <returns>
        /// the modified storage center
        /// </returns>
        public IQuery <StorageCenter> UpdateByZone(Uri zUrl, string scid, StorageCenter storageCenter)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <StorageCenter>(Client);

            sfApiQuery.Action("StorageCenters");
            sfApiQuery.Uri(zUrl);
            sfApiQuery.ActionIds(scid);
            sfApiQuery.Body       = storageCenter;
            sfApiQuery.HttpMethod = "PATCH";
            return(sfApiQuery);
        }
Beispiel #16
0
        /// <summary>
        /// Update Employee or Promote Customer
        /// </summary>
        /// <example>
        /// {
        /// "FirstName":"FirstName",
        /// "LastName":"LastName",
        /// "Company":"Company",
        /// "Email":"*****@*****.**",
        /// "StorageQuotaLimitGB":100,
        /// "Security":
        /// {
        /// "IsDisabled":false
        /// }
        /// "DefaultZone":
        /// {
        /// "Id":"newzoneid"
        /// }
        /// }
        /// </example>
        /// <remarks>
        /// Modifies an existing user object
        /// The following parameters can be modified through this call: FirstName, LastName, Company,
        /// Email, IsEmployee, IsDisabled, DefaultZone Id, StorageQuotaLimitGB.During a promotion (the user id points to Customer), the following parameters can be
        /// modified: CanCreateFolders, CanUseFileBox, CanManageUsers. StorageQuotaLimitGB equal to -1 sets the user quota to the account default storage quota value.
        /// </remarks>
        /// <param name="id"></param>
        /// <param name="user"></param>
        /// <returns>
        /// a modified user record
        /// </returns>
        public IQuery <User> UpdateAccountUser(string id, AccountUser user)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <User>(Client);

            sfApiQuery.From("Users");
            sfApiQuery.Action("AccountUser");
            sfApiQuery.ActionIds(id);
            sfApiQuery.Body       = user;
            sfApiQuery.HttpMethod = "PATCH";
            return(sfApiQuery);
        }
Beispiel #17
0
        /// <summary>
        /// Update a single UserPolicy
        /// </summary>
        /// <example>
        /// {
        /// "Active": false
        /// }
        /// </example>
        /// <remarks>
        /// Updates a single user Policy. Currently this only allows an update to the Active flag.
        /// </remarks>
        /// <param name="url"></param>
        public IQuery <UserPolicy> UpdateByUser(Uri url, string id, UserPolicy updatedPolicy)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <UserPolicy>(Client);

            sfApiQuery.Action("Policies");
            sfApiQuery.Uri(url);
            sfApiQuery.ActionIds(id);
            sfApiQuery.Body       = updatedPolicy;
            sfApiQuery.HttpMethod = "PATCH";
            return(sfApiQuery);
        }
        /// <summary>
        /// Modifies the parameters of a Connector Group in associated with a Zone
        /// </summary>
        /// <example>
        /// {
        /// "Zone": {"Id":"ZoneId"},
        /// "ApiVersionMin":"v3",
        /// "ApiVersionMax":"v3",
        /// "IconUrl":"https://domain/icons",
        /// "FormUrl":"https://domain/forms"
        /// }
        /// </example>
        /// <param name="url"></param>
        /// <param name="zoneId"></param>
        /// <param name="connectorGroupZone"></param>
        /// <returns>
        /// the created or modified AccessControl instance
        /// </returns>
        public IQuery <ConnectorGroupZone> UpdateZones(Uri url, string zoneId, ConnectorGroupZone connectorGroupZone)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <ConnectorGroupZone>(Client);

            sfApiQuery.Action("Zones");
            sfApiQuery.Uri(url);
            sfApiQuery.ActionIds(zoneId);
            sfApiQuery.Body       = connectorGroupZone;
            sfApiQuery.HttpMethod = "PATCH";
            return(sfApiQuery);
        }
Beispiel #19
0
        /// <summary>
        /// Update Metadata
        /// </summary>
        /// <example>
        /// {
        /// "Value":"metadata value"
        /// }
        /// </example>
        /// <remarks>
        /// Updates a single Metadata entry that has a specified Name for a given Item. Fails if an entry with the given name doesn't exist for this Item.
        /// </remarks>
        /// <param name="url"></param>
        /// <param name="metadataId"></param>
        /// <returns>
        /// The updated Metadata object
        /// </returns>
        public IQuery <Metadata> UpdateByItem(Uri url, string metadataId, Metadata metadata)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <Metadata>(Client);

            sfApiQuery.Action("Metadata");
            sfApiQuery.Uri(url);
            sfApiQuery.ActionIds(metadataId);
            sfApiQuery.Body       = metadata;
            sfApiQuery.HttpMethod = "PATCH";
            return(sfApiQuery);
        }
        /// <summary>
        /// Get list of multi-tenant zones assigned to a tenant.
        /// </summary>
        /// <param name="parentid"></param>
        /// <returns>
        /// List of multi-tenant zones assigned to the tenant
        /// </returns>
        public IQuery <ODataFeed <Zone> > GetZones(string parentid)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <ODataFeed <Zone> >(Client);

            sfApiQuery.From("Accounts");
            sfApiQuery.Action("Tenants");
            sfApiQuery.ActionIds(parentid);
            sfApiQuery.SubAction("Zones");
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
        /// <summary>
        /// Get List of Protocol Links of a Share item
        /// </summary>
        /// <param name="shareUrl"></param>
        /// <param name="itemid"></param>
        /// <param name="platform"></param>
        /// <returns>
        /// A list of protocol links depending on the input parameter 'platform', 404 (Not Found) if not supported by the item
        /// </returns>
        public IQuery <ODataFeed <ItemProtocolLink> > ProtocolLinks(Uri shareUrl, string itemid, PreviewPlatform platform)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <ODataFeed <ItemProtocolLink> >(Client);

            sfApiQuery.Action("Items");
            sfApiQuery.Uri(shareUrl);
            sfApiQuery.ActionIds(itemid);
            sfApiQuery.SubAction("ProtocolLinks", platform);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
        /// <summary>
        /// Retrieve the list of Storage Centers associated with a Connector Group
        /// </summary>
        /// <remarks>
        /// Retrieve the list of storage centers associated with a Connector Group.
        /// </remarks>
        /// <param name="url"></param>
        /// <param name="zoneid"></param>
        /// <returns>
        /// The modified Connector Group
        /// </returns>
        public IQuery <ODataFeed <StorageCenter> > GetStorageCenters(Uri url, string zoneid)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <ODataFeed <StorageCenter> >(Client);

            sfApiQuery.Action("Zones");
            sfApiQuery.Uri(url);
            sfApiQuery.ActionIds(zoneid);
            sfApiQuery.SubAction("StorageCenters");
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
Beispiel #23
0
        /// <summary>
        /// Create or update StorageCenter Metadata
        /// </summary>
        /// <example>
        /// [
        /// {"Name":"metadataName1", "Value":"metadataValue1", "IsPublic":"true"},
        /// {"Name":"metadataName2", "Value":"metadataValue2", "IsPublic":"false"}
        /// ]
        /// </example>
        /// <remarks>
        /// Creates or updates Metadata entries associated with the specified storage center
        /// </remarks>
        /// <param name="zUrl"></param>
        /// <param name="scid"></param>
        /// <param name="metadata"></param>
        /// <returns>
        /// the storage center metadata feed
        /// </returns>
        public IQuery <ODataFeed <Metadata> > CreateMetadata(Uri zUrl, string scid, IEnumerable <Metadata> metadata)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <ODataFeed <Metadata> >(Client);

            sfApiQuery.Action("StorageCenters");
            sfApiQuery.Uri(zUrl);
            sfApiQuery.ActionIds(scid);
            sfApiQuery.SubAction("Metadata");
            sfApiQuery.Body       = metadata;
            sfApiQuery.HttpMethod = "POST";
            return(sfApiQuery);
        }
Beispiel #24
0
        /// <summary>
        /// Get spreadsheet data
        /// </summary>
        /// <remarks>
        /// Download spreadsheet data for a report. If parameter "getSigndedUrl" is true,
        /// this endpoint returns a Download Specification object with a "url" parameter, which will point to the file's location
        /// </remarks>
        /// <param name="id"></param>
        /// <param name="getSignedUrl"></param>
        /// <returns>
        /// Excel Formatted Report Results or Download Specification
        /// </returns>
        public IQuery <DownloadSpecification> DownloadData(string id, bool getSignedUrl = false)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <DownloadSpecification>(Client);

            sfApiQuery.From("Reports");
            sfApiQuery.Action("Records");
            sfApiQuery.ActionIds(id);
            sfApiQuery.SubAction("DownloadData");
            sfApiQuery.QueryString("getSignedUrl", getSignedUrl);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
        /// <summary>
        /// Download Items from a Share for a Recipient
        /// </summary>
        /// <example>
        /// GET https://account.sf-api.com/sf/v3/Shares(shareid)/Recipients(aliasid)/DownloadWithAlias?id=itemid
        /// GET https://account.sf-api.com/sf/v3/Shares(shareid)/Recipients(aliasid)/DownloadWithAlias(itemid)
        /// </example>
        /// <remarks>
        /// Downloads items from the Share. The default action will download all Items in the Share.
        /// If a Share has a single item, the download attachment name
        /// will use the item name. Otherwise, the download will contain a ZIP archive containing all
        /// files and folders in the share, named Files.zip.To download Shares that require user informaion ( Email, First Name, Last Name and Company), make sure
        /// to create an Recipient (alias)To download Shares that require authentication, make sure this request is authenticated.
        /// Anyone can download files from anonymous shares.You can also download individual Items in the Share. Use the Shares(id)/Recipients(aliasid)/Download action. The
        /// item ID must be a top-level item in the Share - i.e., you cannot download or address files contained inside
        /// a shared folder.
        /// </remarks>
        /// <param name="shareUrl"></param>
        /// <param name="aliasid"></param>
        /// <param name="itemId"></param>
        /// <param name="redirect"></param>
        /// <returns>
        /// Redirects the caller (302) to the download address for the share contents.
        /// </returns>
        public IQuery <Stream> DownloadWithAlias(Uri shareUrl, string aliasid, string itemId = null, bool redirect = true)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <Stream>(Client);

            sfApiQuery.Action("Recipients");
            sfApiQuery.Uri(shareUrl);
            sfApiQuery.ActionIds(aliasid);
            sfApiQuery.SubAction("DownloadWithAlias");
            sfApiQuery.QueryString("id", itemId);
            sfApiQuery.QueryString("redirect", redirect);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
        /// <summary>
        /// Get Thumbnail of a Share Item
        /// </summary>
        /// <remarks>
        /// Retrieve a thumbnail link for the specified Item in the Share.
        /// </remarks>
        /// <param name="shareUrl"></param>
        /// <param name="itemid"></param>
        /// <param name="size"></param>
        /// <param name="redirect"></param>
        /// <returns>
        /// A 302 redirection to the Thumbnail link
        /// </returns>
        public IQuery <Stream> Thumbnail(Uri shareUrl, string itemid, int size = 75, bool redirect = false)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <Stream>(Client);

            sfApiQuery.Action("Items");
            sfApiQuery.Uri(shareUrl);
            sfApiQuery.ActionIds(itemid);
            sfApiQuery.SubAction("Thumbnail");
            sfApiQuery.QueryString("size", size);
            sfApiQuery.QueryString("redirect", redirect);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
        /// <summary>
        /// Get List of AsyncOperations by Folder
        /// </summary>
        /// <remarks>
        /// Retrieves all AsyncOperations associated with the calling user and the Item ID
        /// </remarks>
        /// <param name="id"></param>
        /// <returns>
        /// A Feed of AsyncOperation objects, containing all pending operations in the specific folder,
        /// for the authenticated SDK user
        /// </returns>
        public IQuery<ODataFeed<AsyncOperation>> GetByFolder(string id)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<ODataFeed<AsyncOperation>>(Client);
		    sfApiQuery.From("AsyncOperations");
		    sfApiQuery.Action("GetByFolder");
            sfApiQuery.ActionIds(id);
            sfApiQuery.HttpMethod = "GET";	
		    return sfApiQuery;
        }
        /// <summary>
        /// Get the progress of the AsyncOperations by Opertaion Batch ID
        /// </summary>
        /// <param name="id"></param>
        public IQuery<AsyncOperation> GetBatch(string id)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<AsyncOperation>(Client);
		    sfApiQuery.From("AsyncOperations");
		    sfApiQuery.Action("GetBatch");
            sfApiQuery.ActionIds(id);
            sfApiQuery.HttpMethod = "GET";	
		    return sfApiQuery;
        }
Beispiel #29
0
        /// <summary>
        /// Get Inbox for Recipient
        /// </summary>
        /// <remarks>
        /// Retrieve all outstanding Shares in the inbox.User identifier
        /// </remarks>
        /// <returns>
        /// List of Shares created by the authenticated user
        /// </returns>
        public IQuery<ODataFeed<Share>> GetInbox(string id = null, ShareType type = ShareType.Both, bool archived = false)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<ODataFeed<Share>>(Client);
		    sfApiQuery.From("Shares");
		    sfApiQuery.Action("Inbox");
            sfApiQuery.ActionIds(id);
            sfApiQuery.QueryString("type", type);
            sfApiQuery.QueryString("archived", archived);
            sfApiQuery.HttpMethod = "GET";	
		    return sfApiQuery;
        }
        /// <summary>
        /// Cancel an Operation Batch
        /// </summary>
        /// <remarks>
        /// Cancel an Async Operation batch - all unfinished Async Operation records in that batch
        /// will be moved to Cancelled state.
        /// </remarks>
        /// <param name="id"></param>
        /// <returns>
        /// A list of the modified Async Operations in the batch
        /// </returns>
        public IQuery<ODataFeed<AsyncOperation>> CancelBatch(string id)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<ODataFeed<AsyncOperation>>(Client);
		    sfApiQuery.From("AsyncOperations");
		    sfApiQuery.Action("CancelBatch");
            sfApiQuery.ActionIds(id);
            sfApiQuery.HttpMethod = "POST";	
		    return sfApiQuery;
        }
Beispiel #31
0
        /// <summary>
        /// Download Multiple Items from a Share for a Recipient
        /// </summary>
        /// <example>
        /// ["id1","id2",...]
        /// </example>
        /// <remarks>
        /// Download Multiple Items from a Share for a Recipient. The download will contain a ZIP archive containing all
        /// files and folders in the share, named Files.zip.To download Shares that require user informaion ( Email, First Name, Last Name and Company), make sure
        /// to create an Recipient (alias) and pass in the alaisId.To download Shares that require authentication, make sure this request is authenticated.
        /// Anyone can download files from anonymous shares.
        /// </remarks>
        /// <param name="shareUrl"></param>
        /// <param name="aliasid"></param>
        /// <param name="ids"></param>
        /// <param name="redirect"></param>
        /// <returns>
        /// Redirects the caller (302) to the download address for the share contents.
        /// </returns>
        public IQuery<Stream> BulkDownload(Uri shareUrl, string aliasid, IEnumerable<string> ids, bool redirect = true)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<Stream>(Client);
		    sfApiQuery.Action("Recipients");
            sfApiQuery.Uri(shareUrl);
            sfApiQuery.ActionIds(aliasid);
            sfApiQuery.SubAction("BulkDownload");
            sfApiQuery.QueryString("redirect", redirect);
            sfApiQuery.Body = ids;
            sfApiQuery.HttpMethod = "POST";	
		    return sfApiQuery;
        }
Beispiel #32
0
        /// <summary>
        /// Get Sent Message Content by Share
        /// </summary>
        /// <remarks>
        /// Returns sent message content.
        /// </remarks>
        /// <param name="shareUrl"></param>
        /// <param name="aliasId"></param>
        /// <returns>
        /// Sent Message Content
        /// </returns>
        public IQuery<Stream> Message(Uri shareUrl, string aliasId)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<Stream>(Client);
		    sfApiQuery.Action("Recipients");
            sfApiQuery.Uri(shareUrl);
            sfApiQuery.ActionIds(aliasId);
            sfApiQuery.SubAction("Message");
            sfApiQuery.HttpMethod = "GET";	
		    return sfApiQuery;
        }
Beispiel #33
0
 /// <summary>
 /// Update Note
 /// </summary>
 /// <example>
 /// {
 /// "Name":"Name",
 /// "Description":"Description",
 /// "Parent": { "Id": "parentid" },
 /// }
 /// </example>
 /// <remarks>
 /// Updates a Note object
 /// </remarks>
 /// <param name="id"></param>
 /// <param name="note"></param>
 /// <param name="notify"></param>
 /// <returns>
 /// The modified Note object
 /// </returns>
 public IQuery<Note> UpdateNote(string id, Note note, bool notify = false)
 {
     var sfApiQuery = new ShareFile.Api.Client.Requests.Query<Note>(Client);
     sfApiQuery.From("Items");
     sfApiQuery.Action("Note");
     sfApiQuery.ActionIds(id);
     sfApiQuery.QueryString("notify", notify);
     sfApiQuery.Body = note;
     sfApiQuery.HttpMethod = "PATCH";
     return sfApiQuery;
 }
        /// <summary>
        /// Adds a Connector Group to a Storage Center
        /// </summary>
        /// <example>
        /// {
        /// "Id":"storageCenterId"
        /// }
        /// </example>
        /// <remarks>
        /// Associate a Connector Group with a Storage Center. The Connector Group has to be
        /// associated with the Storage Center Zone.
        /// </remarks>
        /// <param name="url"></param>
        /// <param name="zoneid"></param>
        /// <returns>
        /// The modified Connector Group
        /// </returns>
        public IQuery<ODataFeed<StorageCenter>> CreateStorageCenters(Uri url, string zoneid, StorageCenter storageCenter)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<ODataFeed<StorageCenter>>(Client);
		    sfApiQuery.Action("Zones");
            sfApiQuery.Uri(url);
            sfApiQuery.ActionIds(zoneid);
            sfApiQuery.SubAction("StorageCenters");
            sfApiQuery.Body = storageCenter;
            sfApiQuery.HttpMethod = "POST";	
		    return sfApiQuery;
        }
 /// <summary>
 /// Get List of Protocol Links of a Share item
 /// </summary>
 /// <param name="shareUrl"></param>
 /// <param name="itemid"></param>
 /// <param name="platform"></param>
 /// <returns>
 /// A list of protocol links depending on the input parameter 'platform', 404 (Not Found) if not supported by the item
 /// </returns>
 public IQuery<ODataFeed<ItemProtocolLink>> ProtocolLinks(Uri shareUrl, string itemid, PreviewPlatform platform)
 {
     var sfApiQuery = new ShareFile.Api.Client.Requests.Query<ODataFeed<ItemProtocolLink>>(Client);
     sfApiQuery.Action("Items");
     sfApiQuery.Uri(shareUrl);
     sfApiQuery.ActionIds(itemid);
     sfApiQuery.SubAction("ProtocolLinks", platform);
     sfApiQuery.HttpMethod = "GET";
     return sfApiQuery;
 }
        /// <summary>
        /// Update Metadata
        /// </summary>
        /// <example>
        /// {
        /// "Value":"metadata value"
        /// }
        /// </example>
        /// <remarks>
        /// Updates a single Metadata entry that has a specified Name for a given Item. Fails if an entry with the given name doesn't exist for this Item.
        /// </remarks>
        /// <param name="url"></param>
        /// <param name="metadataId"></param>
        /// <returns>
        /// The updated Metadata object
        /// </returns>
        public IQuery<Metadata> UpdateByItem(Uri url, string metadataId, Metadata metadata)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<Metadata>(Client);
		    sfApiQuery.Action("Metadata");
            sfApiQuery.Uri(url);
            sfApiQuery.ActionIds(metadataId);
            sfApiQuery.Body = metadata;
            sfApiQuery.HttpMethod = "PATCH";	
		    return sfApiQuery;
        }
 /// <summary>
 /// Get Recipient of a Share
 /// </summary>
 /// <remarks>
 /// Retrieve a single Share Recipient identified by the alias id.
 /// </remarks>
 /// <param name="parentUrl"></param>
 /// <param name="id"></param>
 /// <returns>
 /// A Share Alias representing a single recipient of the Share
 /// </returns>
 public IQuery<ShareAlias> GetRecipients(Uri parentUrl, string id)
 {
     var sfApiQuery = new ShareFile.Api.Client.Requests.Query<ShareAlias>(Client);
     sfApiQuery.Action("Recipients");
     sfApiQuery.Uri(parentUrl);
     sfApiQuery.ActionIds(id);
     sfApiQuery.HttpMethod = "GET";
     return sfApiQuery;
 }
 /// <summary>
 /// Get Items of a Send Share
 /// </summary>
 /// <remarks>
 /// Retrieve a single Item in the Send Share
 /// </remarks>
 /// <param name="shareUrl"></param>
 /// <param name="itemid"></param>
 /// <returns>
 /// An item in the Share
 /// </returns>
 public IQuery<Item> GetItems(Uri shareUrl, string itemid)
 {
     var sfApiQuery = new ShareFile.Api.Client.Requests.Query<Item>(Client);
     sfApiQuery.Action("Items");
     sfApiQuery.Uri(shareUrl);
     sfApiQuery.ActionIds(itemid);
     sfApiQuery.HttpMethod = "GET";
     return sfApiQuery;
 }
Beispiel #39
0
 /// <summary>
 /// Update Link
 /// </summary>
 /// <example>
 /// {
 /// "Name":"Name",
 /// "Uri":"https://server/path",
 /// "Description":"Description",
 /// "Parent": { "Id": "parentid" },
 /// }
 /// </example>
 /// <remarks>
 /// Updates a Link object
 /// </remarks>
 /// <param name="id"></param>
 /// <param name="link"></param>
 /// <param name="notify"></param>
 /// <returns>
 /// A modified Link object
 /// </returns>
 public IQuery<Link> UpdateLink(string id, Link link, bool notify = false)
 {
     var sfApiQuery = new ShareFile.Api.Client.Requests.Query<Link>(Client);
     sfApiQuery.From("Items");
     sfApiQuery.Action("Link");
     sfApiQuery.ActionIds(id);
     sfApiQuery.QueryString("notify", notify);
     sfApiQuery.Body = link;
     sfApiQuery.HttpMethod = "PATCH";
     return sfApiQuery;
 }
Beispiel #40
0
 /// <summary>
 /// Update Employee or Promote Customer
 /// </summary>
 /// <example>
 /// {
 /// "FirstName":"FirstName",
 /// "LastName":"LastName",
 /// "Company":"Company",
 /// "Email":"*****@*****.**",
 /// "StorageQuotaLimitGB":100,
 /// "Security":
 /// {
 /// "IsDisabled":false
 /// }
 /// "DefaultZone":
 /// {
 /// "Id":"newzoneid"
 /// }
 /// }
 /// </example>
 /// <remarks>
 /// Modifies an existing user object
 /// The following parameters can be modified through this call: FirstName, LastName, Company,
 /// Email, IsEmployee, IsDisabled, DefaultZone Id, StorageQuotaLimitGB.During a promotion (the user id points to Customer), the following parameters can be
 /// modified: CanCreateFolders, CanUseFileBox, CanManageUsers. StorageQuotaLimitGB equal to -1 sets the user quota to the account default storage quota value.
 /// </remarks>
 /// <param name="id"></param>
 /// <param name="user"></param>
 /// <returns>
 /// a modified user record
 /// </returns>
 public IQuery<User> UpdateAccountUser(string id, AccountUser user)
 {
     var sfApiQuery = new ShareFile.Api.Client.Requests.Query<User>(Client);
     sfApiQuery.From("Users");
     sfApiQuery.Action("AccountUser");
     sfApiQuery.ActionIds(id);
     sfApiQuery.Body = user;
     sfApiQuery.HttpMethod = "PATCH";
     return sfApiQuery;
 }
        /// <summary>
        /// Get Connector Groups in a Zone
        /// </summary>
        /// <remarks>
        /// Retrieves the Connector Groups defined in a Zone.
        /// </remarks>
        /// <param name="zoneid"></param>
        /// <returns>
        /// Access Control List of the given object ID.
        /// </returns>
        public IQuery<ODataFeed<ConnectorGroup>> GetByZone(string zoneid)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<ODataFeed<ConnectorGroup>>(Client);
		    sfApiQuery.From("ConnectorGroups");
		    sfApiQuery.Action("GetByZone");
            sfApiQuery.ActionIds(zoneid);
            sfApiQuery.HttpMethod = "GET";	
		    return sfApiQuery;
        }
 /// <summary>
 /// Get Thumbnail of a Share Item
 /// </summary>
 /// <remarks>
 /// Retrieve a thumbnail link for the specified Item in the Share.
 /// </remarks>
 /// <param name="shareUrl"></param>
 /// <param name="itemid"></param>
 /// <param name="size"></param>
 /// <param name="redirect"></param>
 /// <returns>
 /// A 302 redirection to the Thumbnail link
 /// </returns>
 public IQuery<Stream> Thumbnail(Uri shareUrl, string itemid, int size = 75, bool redirect = false)
 {
     var sfApiQuery = new ShareFile.Api.Client.Requests.Query<Stream>(Client);
     sfApiQuery.Action("Items");
     sfApiQuery.Uri(shareUrl);
     sfApiQuery.ActionIds(itemid);
     sfApiQuery.SubAction("Thumbnail");
     sfApiQuery.QueryString("size", size);
     sfApiQuery.QueryString("redirect", redirect);
     sfApiQuery.HttpMethod = "GET";
     return sfApiQuery;
 }
        /// <summary>
        /// Get the Connector Group by Service ID
        /// </summary>
        /// <remarks>
        /// Retrieves a Connector Group
        /// </remarks>
        /// <param name="id"></param>
        /// <returns>
        /// A single ConnectorGroup object matching the query
        /// </returns>
        public IQuery<ConnectorGroupZone> GetZones(Uri url, string id)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<ConnectorGroupZone>(Client);
		    sfApiQuery.Action("Zones");
            sfApiQuery.Uri(url);
            sfApiQuery.ActionIds(id);
            sfApiQuery.HttpMethod = "GET";	
		    return sfApiQuery;
        }
Beispiel #44
0
 /// <summary>
 /// Update SymbolicLink
 /// </summary>
 /// <example>
 /// {
 /// "Name":"Name",
 /// "Description":"Description",
 /// "Link": "https://server/path"
 /// }
 /// </example>
 /// <remarks>
 /// Updates a Symbolic Link object
 /// </remarks>
 /// <param name="id"></param>
 /// <param name="symlink"></param>
 /// <returns>
 /// The modified SymbolicLink object
 /// </returns>
 public IQuery<SymbolicLink> UpdateSymbolicLink(string id, SymbolicLink symlink)
 {
     var sfApiQuery = new ShareFile.Api.Client.Requests.Query<SymbolicLink>(Client);
     sfApiQuery.From("Items");
     sfApiQuery.Action("SymbolicLink");
     sfApiQuery.ActionIds(id);
     sfApiQuery.Body = symlink;
     sfApiQuery.HttpMethod = "PATCH";
     return sfApiQuery;
 }
        /// <summary>
        /// Get StorageCenter Metadata
        /// </summary>
        /// <remarks>
        /// Gets metadata associated with the specified storage center
        /// </remarks>
        /// <param name="zUrl"></param>
        /// <param name="scid"></param>
        /// <returns>
        /// the storage center metadata feed
        /// </returns>
        public IQuery<ODataFeed<Metadata>> GetMetadata(Uri zUrl, string scid)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<ODataFeed<Metadata>>(Client);
		    sfApiQuery.Action("StorageCenters");
            sfApiQuery.Uri(zUrl);
            sfApiQuery.ActionIds(scid);
            sfApiQuery.SubAction("Metadata");
            sfApiQuery.HttpMethod = "GET";	
		    return sfApiQuery;
        }
        public IQuery<Account> GetTenants(string id)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<Account>(Client);
		    sfApiQuery.From("Accounts");
		    sfApiQuery.Action("Tenants");
            sfApiQuery.ActionIds(id);
            sfApiQuery.HttpMethod = "GET";	
		    return sfApiQuery;
        }
        /// <summary>
        /// Modifies the parameters of a Connector Group in associated with a Zone
        /// </summary>
        /// <example>
        /// {
        /// "Zone": {"Id":"ZoneId"},
        /// "ApiVersionMin":"v3",
        /// "ApiVersionMax":"v3",
        /// "IconUrl":"https://domain/icons",
        /// "FormUrl":"https://domain/forms"
        /// }
        /// </example>
        /// <param name="url"></param>
        /// <param name="zoneId"></param>
        /// <param name="connectorGroupZone"></param>
        /// <returns>
        /// the created or modified AccessControl instance
        /// </returns>
        public IQuery<ConnectorGroupZone> UpdateZones(Uri url, string zoneId, ConnectorGroupZone connectorGroupZone)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<ConnectorGroupZone>(Client);
		    sfApiQuery.Action("Zones");
            sfApiQuery.Uri(url);
            sfApiQuery.ActionIds(zoneId);
            sfApiQuery.Body = connectorGroupZone;
            sfApiQuery.HttpMethod = "PATCH";	
		    return sfApiQuery;
        }
        /// <summary>
        /// Update StorageCenter
        /// </summary>
        /// <example>
        /// {
        /// "ExternalAddress":"https://server/",
        /// "Version":"4.12.20",
        /// "HostName":"hostname"
        /// }
        /// </example>
        /// <remarks>
        /// Updates an existing Storage Center
        /// </remarks>
        /// <param name="zUrl"></param>
        /// <param name="scid"></param>
        /// <param name="storageCenter"></param>
        /// <returns>
        /// the modified storage center
        /// </returns>
        public IQuery<StorageCenter> UpdateByZone(Uri zUrl, string scid, StorageCenter storageCenter)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<StorageCenter>(Client);
		    sfApiQuery.Action("StorageCenters");
            sfApiQuery.Uri(zUrl);
            sfApiQuery.ActionIds(scid);
            sfApiQuery.Body = storageCenter;
            sfApiQuery.HttpMethod = "PATCH";	
		    return sfApiQuery;
        }
        /// <summary>
        /// Get list of multi-tenant zones assigned to a tenant.
        /// </summary>
        /// <param name="parentid"></param>
        /// <returns>
        /// List of multi-tenant zones assigned to the tenant
        /// </returns>
        public IQuery<ODataFeed<Zone>> GetZones(string parentid)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<ODataFeed<Zone>>(Client);
		    sfApiQuery.From("Accounts");
		    sfApiQuery.Action("Tenants");
            sfApiQuery.ActionIds(parentid);
            sfApiQuery.SubAction("Zones");
            sfApiQuery.HttpMethod = "GET";	
		    return sfApiQuery;
        }
        /// <summary>
        /// Create or update StorageCenter Metadata
        /// </summary>
        /// <example>
        /// [
        /// {"Name":"metadataName1", "Value":"metadataValue1", "IsPublic":"true"},
        /// {"Name":"metadataName2", "Value":"metadataValue2", "IsPublic":"false"},
        /// ...
        /// ]
        /// </example>
        /// <remarks>
        /// Creates or updates Metadata entries associated with the specified storage center
        /// </remarks>
        /// <param name="zUrl"></param>
        /// <param name="scid"></param>
        /// <param name="metadata"></param>
        /// <returns>
        /// the storage center metadata feed
        /// </returns>
        public IQuery<ODataFeed<Metadata>> CreateMetadata(Uri zUrl, string scid, IEnumerable<Metadata> metadata)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<ODataFeed<Metadata>>(Client);
		    sfApiQuery.Action("StorageCenters");
            sfApiQuery.Uri(zUrl);
            sfApiQuery.ActionIds(scid);
            sfApiQuery.SubAction("Metadata");
            sfApiQuery.Body = metadata;
            sfApiQuery.HttpMethod = "POST";	
		    return sfApiQuery;
        }
        /// <summary>
        /// Get an Access Control element
        /// </summary>
        /// <remarks>
        /// Retrieves a Connector Group Access Control of a given user
        /// </remarks>
        /// <param name="parentUrl"></param>
        /// <param name="id"></param>
        /// <returns>
        /// A single ConnectorGroup ACL object matching the query
        /// </returns>
        public IQuery<ConnectorGroupAccessControl> GetAccessControls(Uri parentUrl, string id)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<ConnectorGroupAccessControl>(Client);
		    sfApiQuery.Action("AccessControls");
            sfApiQuery.Uri(parentUrl);
            sfApiQuery.ActionIds(id);
            sfApiQuery.HttpMethod = "GET";	
		    return sfApiQuery;
        }
        /// <summary>
        /// Get FavoriteFolder
        /// </summary>
        /// <remarks>
        /// Retrieves a single Favorite Folder
        /// </remarks>
        /// <param name="userid"></param>
        /// <param name="itemUrl"></param>
        /// <returns>
        /// A list of Favorite Folders specified by this user
        /// </returns>
        public IQuery<FavoriteFolder> GetByUser(Uri itemUrl, string userid)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<FavoriteFolder>(Client);
		    sfApiQuery.Action("FavoriteFolders");
            sfApiQuery.Uri(itemUrl);
            sfApiQuery.ActionIds(userid);
            sfApiQuery.HttpMethod = "GET";	
		    return sfApiQuery;
        }
 /// <summary>
 /// Download Items from a Share for a Recipient
 /// </summary>
 /// <example>
 /// GET https://account.sf-api.com/sf/v3/Shares(shareid)/Recipients(aliasid)/DownloadWithAlias?id=itemid
 /// GET https://account.sf-api.com/sf/v3/Shares(shareid)/Recipients(aliasid)/DownloadWithAlias(itemid)
 /// </example>
 /// <remarks>
 /// Downloads items from the Share. The default action will download all Items in the Share.
 /// If a Share has a single item, the download attachment name
 /// will use the item name. Otherwise, the download will contain a ZIP archive containing all
 /// files and folders in the share, named Files.zip.To download Shares that require user informaion ( Email, First Name, Last Name and Company), make sure
 /// to create an Recipient (alias)To download Shares that require authentication, make sure this request is authenticated.
 /// Anyone can download files from anonymous shares.You can also download individual Items in the Share. Use the Shares(id)/Recipients(aliasid)/Download action. The
 /// item ID must be a top-level item in the Share - i.e., you cannot download or address files contained inside
 /// a shared folder.
 /// </remarks>
 /// <param name="shareUrl"></param>
 /// <param name="aliasid"></param>
 /// <param name="itemId"></param>
 /// <param name="redirect"></param>
 /// <returns>
 /// Redirects the caller (302) to the download address for the share contents.
 /// </returns>
 public IQuery<Stream> DownloadWithAlias(Uri shareUrl, string aliasid, string itemId = null, bool redirect = true)
 {
     var sfApiQuery = new ShareFile.Api.Client.Requests.Query<Stream>(Client);
     sfApiQuery.Action("Recipients");
     sfApiQuery.Uri(shareUrl);
     sfApiQuery.ActionIds(aliasid);
     sfApiQuery.SubAction("DownloadWithAlias");
     sfApiQuery.QueryString("id", itemId);
     sfApiQuery.QueryString("redirect", redirect);
     sfApiQuery.HttpMethod = "GET";
     return sfApiQuery;
 }
Beispiel #54
0
        /// <summary>
        /// Get Report Record by ID
        /// </summary>
        /// <remarks>
        /// Returns a single record.
        /// </remarks>
        /// <param name="id"></param>
        /// <returns>
        /// Single Record
        /// </returns>
        public IQuery<ReportRecord> GetRecord(string id)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<ReportRecord>(Client);
		    sfApiQuery.From("Reports");
		    sfApiQuery.Action("Record");
            sfApiQuery.ActionIds(id);
            sfApiQuery.HttpMethod = "GET";	
		    return sfApiQuery;
        }
Beispiel #55
0
 /// <summary>
 /// Get List of Item Protocol Links
 /// </summary>
 /// <param name="url"></param>
 /// <param name="platform"></param>
 /// <returns>
 /// A list of protocol links depending on the input parameter 'platform', 404 (Not Found) if not supported by the item
 /// </returns>
 public IQuery<ODataFeed<ItemProtocolLink>> GetProtocolLinks(Uri url, PreviewPlatform platform)
 {
     var sfApiQuery = new ShareFile.Api.Client.Requests.Query<ODataFeed<ItemProtocolLink>>(Client);
     sfApiQuery.Action("ProtocolLinks");
     sfApiQuery.Uri(url);
     sfApiQuery.ActionIds(platform);
     sfApiQuery.HttpMethod = "GET";
     return sfApiQuery;
 }