Beispiel #1
0
        /// <summary>
        /// Get List of Zones
        /// </summary>
        /// <remarks>
        /// Retrieve the list of Zones accessible to the authenticated user
        /// This method will concatenate the list of private zones in the user's account and the
        /// list of public zones accessible to this account. Any user can see the list of zones.
        /// </remarks>
        /// <param name="services"></param>
        /// <param name="includeDisabled"></param>
        /// <returns>
        /// The list of public and private zones accessible to this user
        /// </returns>
        public IQuery <ODataFeed <Zone> > Get(ZoneService services = ZoneService.StorageZone, bool includeDisabled = false)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <ODataFeed <Zone> >(Client);

            sfApiQuery.From("Zones");
            sfApiQuery.QueryString("services", services);
            sfApiQuery.QueryString("includeDisabled", includeDisabled);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
Beispiel #2
0
        /// <summary>
        /// Get User
        /// </summary>
        /// <remarks>
        /// Retrieve a single user, by ID or email, or the currently authenticated user.
        /// </remarks>
        /// <param name="id"></param>
        /// <param name="emailAddress"></param>
        /// <returns>
        /// the requested User object
        /// </returns>
        public IQuery <User> Get(string id = null, string emailAddress = null)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <User>(Client);

            sfApiQuery.From("Users");
            sfApiQuery.QueryString("id", id);
            sfApiQuery.QueryString("emailAddress", emailAddress);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
        /// <summary>
        /// Create Share Alias
        /// </summary>
        /// <remarks>
        /// Creates a share alias for the specified share ID and user email. If a user with the given email address does not
        /// exist it is created first.
        /// For shares requiring login an activation email is sent to the created user. If 'notify' is enabled, the user activation is
        /// included in the share notification email.
        /// </remarks>
        /// <param name="url"></param>
        /// <param name="email"></param>
        /// <param name="notify"></param>
        /// <returns>
        /// Share with the AliasID property set to the created alias ID
        /// </returns>
        public IQuery <Share> CreateAlias(Uri url, string email, bool notify = false)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <Share>(Client);

            sfApiQuery.Action("Alias");
            sfApiQuery.Uri(url);
            sfApiQuery.QueryString("email", email);
            sfApiQuery.QueryString("notify", notify);
            sfApiQuery.HttpMethod = "POST";
            return(sfApiQuery);
        }
Beispiel #4
0
        public IQuery <User> ValidateRemoteUploadUser(string id, string email)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <User>(Client);

            sfApiQuery.From("RemoteUploads");
            sfApiQuery.Action("ValidateRemoteUploadUser");
            sfApiQuery.QueryString("id", id);
            sfApiQuery.QueryString("email", email);
            sfApiQuery.HttpMethod = "POST";
            return(sfApiQuery);
        }
Beispiel #5
0
        /// <summary>
        /// Check if subdomain is required
        /// </summary>
        /// <param name="username"></param>
        /// <param name="singlePlane"></param>
        /// <returns>
        /// RequireSubdomainResult
        /// </returns>
        public IQuery <RequireSubdomainResult> RequireSubdomain(string username, bool singlePlane = false)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <RequireSubdomainResult>(Client);

            sfApiQuery.From("Accounts");
            sfApiQuery.Action("RequireSubdomain");
            sfApiQuery.QueryString("username", username);
            sfApiQuery.QueryString("singlePlane", singlePlane);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
Beispiel #6
0
        /// <summary>
        /// Get Account AddressBooks
        /// </summary>
        /// <remarks>
        /// Retrieves an address book from the account.
        /// Address Books are the contacts of Eployees and Clients, maintained on a personal or
        /// account-wide basis (shared).
        /// </remarks>
        /// <param name="type"></param>
        /// <param name="searchTerm"></param>
        /// <returns>
        /// A Feed of Contact objects representing the Address Book retrieved
        /// </returns>
        public IQuery <ODataFeed <Contact> > GetAddressBook(string type = "personal", string searchTerm = "")
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <ODataFeed <Contact> >(Client);

            sfApiQuery.From("Accounts");
            sfApiQuery.Action("AddressBook");
            sfApiQuery.QueryString("type", type);
            sfApiQuery.QueryString("searchTerm", searchTerm);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
        /// <summary>
        /// Get Account Single Sign-On Configuration
        /// </summary>
        /// <remarks>
        /// Retrieve the Single Sign-on configuration for the Account
        /// </remarks>
        /// <param name="provider"></param>
        /// <param name="idpEntityId"></param>
        public IQuery <SSOAccountProvider> GetSSO(string provider = "saml", string idpEntityId = null)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <SSOAccountProvider>(Client);

            sfApiQuery.From("Accounts");
            sfApiQuery.Action("SSO");
            sfApiQuery.QueryString("provider", provider);
            sfApiQuery.QueryString("idpEntityId", idpEntityId);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
        /// <summary>
        /// Login
        /// </summary>
        /// <remarks>
        /// API clients can provide ShareFile Authentication directly to any API operation using OAuth (Bearer).
        /// However, the client must know that the provided authentication type is supported on the API endpoint; and that SAML is not configured.
        ///
        /// This API provides a generic authentication routine for clients. It will challenge for ShareFile credentials
        /// passing all supported authentication methods; redirect to the SAML IDP if configured to do so; and handle
        /// certain HTTP headers, like device registration.
        ///
        /// If the client is already authenticated, the Session object is returned. If the client is not authenticated, and
        /// the account is not configured for SAML, then the API will challenge for a local authentication. If the account
        /// is configured for SAML, then the client will be redirected to the SAML IDP using the SAML passive flow - authentication
        /// will be performed at the IDP domain instead. The IDP callback will be on the API Acs, which will return a Session
        /// object if authentication is accepted.
        ///
        /// The following HTTP Headers are also processed in this request, and stored with the Session object:
        /// X-SFAPI-Tool: Tool string (user-agent equivalent for ShareFile)X-SFAPI-ToolVersion: Tool Version stringX-SFAPI-UserInitiated: true or false, indicates whether this is an interactive login, or re-authentication
        /// initiated by the ToolX-SFAPI-DeviceId: Device Identifier. If set to 'register', a new DeviceID will be generated. This will
        /// either create or associate an existing DeviceID to this session - indicates user is logging in using this DeviceX-SFAPI-DeviceName: Device Name. Only required/used when a registration process occurs.
        /// </remarks>
        /// <param name="authmethod"></param>
        /// <param name="authcomparison"></param>
        /// <returns>
        /// A Session object, if authentication is successful
        /// </returns>
        public IQuery <Session> Login(string authmethod = null, string authcomparison = null)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <Session>(Client);

            sfApiQuery.From("Sessions");
            sfApiQuery.Action("Login");
            sfApiQuery.QueryString("authmethod", authmethod);
            sfApiQuery.QueryString("authcomparison", authcomparison);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
Beispiel #9
0
        /// <summary>
        /// Apply folder template to folders in bulk
        /// </summary>
        /// <remarks>
        /// Applies the specified folder template to all subfolders of provided folder ID
        /// </remarks>
        /// <param name="templateUrl"></param>
        /// <param name="folderId"></param>
        /// <param name="batchSize"></param>
        /// <returns>
        /// The status of the operation: how many subfolders are left, and how many subfolders in total
        /// </returns>
        public IQuery <AsyncOperation> BulkApply(Uri templateUrl, string folderId, int batchSize = -1)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <AsyncOperation>(Client);

            sfApiQuery.Action("BulkApply");
            sfApiQuery.Uri(templateUrl);
            sfApiQuery.QueryString("folderId", folderId);
            sfApiQuery.QueryString("batchSize", batchSize);
            sfApiQuery.HttpMethod = "POST";
            return(sfApiQuery);
        }
Beispiel #10
0
        public IQuery <UploadSpecification> Upload2(Uri url, RemoteUploadRequestParams uploadParams, string userId, int?expirationDays = null)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <UploadSpecification>(Client);

            sfApiQuery.Action("Upload2");
            sfApiQuery.Uri(url);
            sfApiQuery.QueryString("userId", userId);
            sfApiQuery.QueryString("expirationDays", expirationDays);
            sfApiQuery.Body       = uploadParams;
            sfApiQuery.HttpMethod = "POST";
            return(sfApiQuery);
        }
Beispiel #11
0
        /// <summary>
        /// Get EncryptedEmail
        /// </summary>
        /// <remarks>
        /// Get EncryptedEmail by Id. If EncryptedEmail.RequireUserInfo is true, the user info query parameters are required.
        /// </remarks>
        /// <returns>
        /// EncryptedEmail with corresponding Id
        /// </returns>
        public IQuery <EncryptedEmail> Get(Uri url, string firstName = null, string lastName = null, string email = null, string company = null)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <EncryptedEmail>(Client);

            sfApiQuery.Uri(url);
            sfApiQuery.QueryString("firstName", firstName);
            sfApiQuery.QueryString("lastName", lastName);
            sfApiQuery.QueryString("email", email);
            sfApiQuery.QueryString("company", company);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
Beispiel #12
0
        /// <summary>
        /// Create Customer
        /// </summary>
        /// <example>
        /// {
        /// "Email":"*****@*****.**",
        /// "FirstName":"Name",
        /// "LastName":"Last Name",
        /// "Company":"Company",
        /// "Password":"******",
        /// "Preferences":
        /// {
        /// "CanResetPassword":true,
        /// "CanViewMySettings":true
        /// },
        /// "DefaultZone":
        /// {
        /// "Id":"zoneid"
        /// }
        /// }
        /// </example>
        /// <remarks>
        /// Creates a new Customer User and associates it to an Account
        /// The following parameters from the input object are used: Email, FirstName, LastName, Company,
        /// DefaultZone, Password, Preferences.CanResetPassword and Preferences.CanViewMySettingsOther parameters are ignored
        /// </remarks>
        /// <param name="user"></param>
        /// <param name="pushCreatorDefaultSettings"></param>
        /// <param name="addshared"></param>
        /// <param name="notify"></param>
        /// <param name="ifNecessary"></param>
        /// <returns>
        /// The new user
        /// </returns>
        public IQuery <User> Create(User user, bool pushCreatorDefaultSettings = false, bool addshared = false, bool notify = false, bool ifNecessary = false)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <User>(Client);

            sfApiQuery.From("Users");
            sfApiQuery.QueryString("pushCreatorDefaultSettings", pushCreatorDefaultSettings);
            sfApiQuery.QueryString("addshared", addshared);
            sfApiQuery.QueryString("notify", notify);
            sfApiQuery.QueryString("ifNecessary", ifNecessary);
            sfApiQuery.Body       = user;
            sfApiQuery.HttpMethod = "POST";
            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);
        }
        public IQuery <ShareAlias> CreateRecipients(Uri url, string Email = null, string FirstName = null, string LastName = null, string Company = null)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <ShareAlias>(Client);

            sfApiQuery.Action("Recipients");
            sfApiQuery.Uri(url);
            sfApiQuery.QueryString("Email", Email);
            sfApiQuery.QueryString("FirstName", FirstName);
            sfApiQuery.QueryString("LastName", LastName);
            sfApiQuery.QueryString("Company", Company);
            sfApiQuery.HttpMethod = "POST";
            return(sfApiQuery);
        }
        /// <summary>
        /// Create AccessControl
        /// </summary>
        /// <example>
        /// {
        /// "Principal":{"url":"https://account.sf-api.com/v3/Groups(id)"},
        /// "CanUpload":true,
        /// "CanDownload":true,
        /// "CanView":true,
        /// "CanDelete":true,
        /// "CanManagePermissions":true,
        /// "Message":"Message"
        /// }
        /// </example>
        /// <remarks>
        /// Creates a new Access Controls entry for a given Item. Access controls can only define a single Principal,
        /// which can be either a Group or User. The 'Principal' element is specified as an object - you should populate
        /// either the URL or the ID reference.
        /// </remarks>
        /// <param name="url"></param>
        /// <param name="accessControl"></param>
        /// <param name="recursive"></param>
        /// <param name="message"></param>
        /// <param name="sendDefaultNotification"></param>
        /// <returns>
        /// the created or modified AccessControl instance
        /// </returns>
        public IQuery <AccessControl> CreateByItem(Uri url, AccessControl accessControl, bool recursive = false, bool sendDefaultNotification = false, string message = null)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <AccessControl>(Client);

            sfApiQuery.Action("AccessControls");
            sfApiQuery.Uri(url);
            sfApiQuery.QueryString("recursive", recursive);
            sfApiQuery.QueryString("sendDefaultNotification", sendDefaultNotification);
            accessControl.AddProperty("message", message);
            sfApiQuery.Body       = accessControl;
            sfApiQuery.HttpMethod = "POST";
            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>
        /// Downloads Share Items
        /// </summary>
        /// <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 authentication, make sure this request is authenticated. To download
        /// shares that require require user information, provide the Name, Email and Company parameters in the URI
        /// query. Anyone can download files from anonymous shares.You can also download individual Items in the Share. Use the Share(id)/Items(id)/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="itemId"></param>
        /// <param name="Name"></param>
        /// <param name="Email"></param>
        /// <param name="Company"></param>
        /// <param name="redirect"></param>
        /// <returns>
        /// Redirects the caller (302) to the download address for the share contents.
        /// </returns>
        public IQuery <Stream> Download(Uri shareUrl, string itemId = null, string Name = null, string Email = null, string Company = null, bool redirect = true)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <Stream>(Client);

            sfApiQuery.Action("Download");
            sfApiQuery.Uri(shareUrl);
            sfApiQuery.QueryString("id", itemId);
            sfApiQuery.QueryString("Name", Name);
            sfApiQuery.QueryString("Email", Email);
            sfApiQuery.QueryString("Company", Company);
            sfApiQuery.QueryString("redirect", redirect);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
        /// <summary>
        /// Get current Account
        /// </summary>
        /// <remarks>
        /// Retrieves information about the Account defined in the call subdomain
        /// </remarks>
        /// <param name="id"></param>
        /// <returns>
        /// The subdomain account information
        /// </returns>
        public IQuery <Account> Get(string id = null)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <Account>(Client);

            sfApiQuery.From("Accounts");
            sfApiQuery.QueryString("id", id);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
Beispiel #19
0
        /// <summary>
        /// Get List of Zones
        /// </summary>
        /// <remarks>
        /// Retrieve the list of Zones accessible to the authenticated user
        /// This method will concatenate the list of private zones in the user's account and the
        /// list of public zones accessible to this account. Any user can see the list of zones.
        /// </remarks>
        /// <param name="services"></param>
        /// <param name="includeDisabled"></param>
        /// <returns>
        /// The list of public and private zones accessible to this user
        /// </returns>
        public IQuery <Zone> Get(Uri url, bool secret = false)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <Zone>(Client);

            sfApiQuery.Uri(url);
            sfApiQuery.QueryString("secret", secret);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
        /// <summary>
        /// Get the Connector Group by Provider
        /// </summary>
        /// <param name="provider"></param>
        /// <returns>
        /// A single ConnectorGroup matching the query
        /// </returns>
        public IQuery <ConnectorGroup> ByProvider(string provider)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <ConnectorGroup>(Client);

            sfApiQuery.From("ConnectorGroups");
            sfApiQuery.Action("ByProvider");
            sfApiQuery.QueryString("provider", provider);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
Beispiel #21
0
        /// <summary>
        /// Get recent reports
        /// </summary>
        /// <remarks>
        /// Returns the most recent reports run for the current account. 10 reports are returned unless otherwise specified.
        /// </remarks>
        /// <param name="maxReports"></param>
        /// <returns>
        /// List of reports
        /// </returns>
        public IQuery <ODataFeed <Report> > GetRecent(int maxReports = 10)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <ODataFeed <Report> >(Client);

            sfApiQuery.From("Reports");
            sfApiQuery.Action("Recent");
            sfApiQuery.QueryString("maxReports", maxReports);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
Beispiel #22
0
        /// <summary>
        /// Create Report
        /// </summary>
        /// <example>
        /// {
        /// "Title": "Usage Report",
        /// "ReportType": "Activity",
        /// "ActivityTypes": "Login,Upload,Download,View",
        /// "ObjectType": "Account",
        /// "ObjectId": "accountId",
        /// "DateOption": "Last30Days",
        /// "SaveFormat": "Excel"
        /// }
        /// </example>
        /// <remarks>
        /// Creates a new Report. The sample above is for an Account Activity Report. For more options please refer to the Report
        /// model documentation.
        /// </remarks>
        /// <param name="report"></param>
        /// <param name="runOnCreate"></param>
        /// <returns>
        /// Created Report
        /// </returns>
        public IQuery <Report> Create(Report report, bool runOnCreate)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <Report>(Client);

            sfApiQuery.From("Reports");
            sfApiQuery.QueryString("runOnCreate", runOnCreate);
            sfApiQuery.Body       = report;
            sfApiQuery.HttpMethod = "POST";
            return(sfApiQuery);
        }
Beispiel #23
0
        /// <summary>
        /// delete the email address from user
        /// </summary>
        /// <param name="email"></param>
        /// <returns>
        /// User
        /// </returns>
        public IQuery <User> DeleteEmailAddress(string email)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <User>(Client);

            sfApiQuery.From("Users");
            sfApiQuery.Action("DeleteEmailAddress");
            sfApiQuery.QueryString("email", email);
            sfApiQuery.HttpMethod = "POST";
            return(sfApiQuery);
        }
Beispiel #24
0
        /// <summary>
        /// Add a tenant account to a multi-tenant zone
        /// </summary>
        /// <param name="parentUrl"></param>
        /// <param name="accountId"></param>
        public IQuery <Account> CreateTenants(Uri parentUrl, string accountId)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <Account>(Client);

            sfApiQuery.Action("Tenants");
            sfApiQuery.Uri(parentUrl);
            sfApiQuery.QueryString("accountId", accountId);
            sfApiQuery.HttpMethod = "POST";
            return(sfApiQuery);
        }
Beispiel #25
0
        /// <summary>
        /// set email address as the primary email address for CURRENT user
        /// </summary>
        /// <param name="email"></param>
        /// <returns>
        /// User
        /// </returns>
        public IQuery <User> MakePrimary(string email)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <User>(Client);

            sfApiQuery.From("Users");
            sfApiQuery.Action("MakePrimary");
            sfApiQuery.QueryString("email", email);
            sfApiQuery.HttpMethod = "POST";
            return(sfApiQuery);
        }
Beispiel #26
0
        /// <summary>
        /// Update Folder Template
        /// </summary>
        /// <example>
        /// {
        /// "Name": "Client Folder",
        /// "Description": "For all client folders created in 2014 or after",
        /// "Items": [
        /// {
        /// "Name": "A new folder",
        /// "Items": [
        /// {
        /// "TemplateId": "ft-12345-abdef-abdef-12345-abdef",
        /// "Name": "A new subfolder"
        /// }
        /// ]
        /// },
        /// {
        /// "Id": "fti-xxxxx-xxxxx-xxxxx-xxxxx",
        /// "Name": "An existing folder with a different name"
        /// }
        /// ]
        /// }
        /// </example>
        /// <remarks>
        /// Updates an existing folder template
        /// </remarks>
        /// <param name="template"></param>
        /// <param name="overwrite"></param>
        /// <returns>
        /// The updated folder template
        /// </returns>
        public IQuery <FolderTemplate> Update(FolderTemplate template, bool overwrite = false)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <FolderTemplate>(Client);

            sfApiQuery.From("FolderTemplates");
            sfApiQuery.QueryString("overwrite", overwrite);
            sfApiQuery.Body       = template;
            sfApiQuery.HttpMethod = "PATCH";
            return(sfApiQuery);
        }
        /// <summary>
        /// Get List of current Account Employees
        /// </summary>
        /// <remarks>
        /// Retrives the list of Employees in the Account
        /// Employees are named users in the Account.
        /// </remarks>
        /// <param name="withRightSignature"></param>
        /// <returns>
        /// A Feed containing all Employees Contacts in the account
        /// </returns>
        public IQuery <ODataFeed <Contact> > GetEmployees(bool withRightSignature = false)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <ODataFeed <Contact> >(Client);

            sfApiQuery.From("Accounts");
            sfApiQuery.Action("Employees");
            sfApiQuery.QueryString("withRightSignature", withRightSignature);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
        /// <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);
        }
Beispiel #29
0
        /// <summary>
        /// Get SSO Info
        /// </summary>
        /// <param name="subdomain"></param>
        /// <returns>
        /// SSOInfo
        /// </returns>
        public IQuery <SSOInfo> GetSSOInfo(string subdomain)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <SSOInfo>(Client);

            sfApiQuery.From("Accounts");
            sfApiQuery.Action("SSOInfo");
            sfApiQuery.QueryString("subdomain", subdomain);
            sfApiQuery.HttpMethod = "GET";
            return(sfApiQuery);
        }
Beispiel #30
0
        /// <summary>
        /// Find Subdomain
        /// </summary>
        /// <example>
        /// {
        /// "UsernameShort":"usernameShort",
        /// "Password":"******",
        /// "EmployeeOnly":false
        /// }
        /// </example>
        /// <remarks>
        /// Find the user account information based on the short username
        /// </remarks>
        /// <param name="findSubdomainParams"></param>
        /// <param name="singlePlane"></param>
        /// <returns>
        /// FindSubdomainResult
        /// </returns>
        public IQuery <FindSubdomainResult> FindSubdomain(FindSubdomainParams findSubdomainParams, bool singlePlane = false)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <FindSubdomainResult>(Client);

            sfApiQuery.From("Accounts");
            sfApiQuery.Action("FindSubdomain");
            sfApiQuery.QueryString("singlePlane", singlePlane);
            sfApiQuery.Body       = findSubdomainParams;
            sfApiQuery.HttpMethod = "POST";
            return(sfApiQuery);
        }
Beispiel #31
0
 /// <summary>
 /// Reset Password
 /// </summary>
 /// <example>
 /// {
 /// "NewPassword":"******",
 /// "OldPassword":"******"
 /// }
 /// {
 /// "NewPassword":"******",
 /// "OldPassword":"******"
 /// }
 /// </example>
 /// <remarks>
 /// Resets a user password. A user can reset his own password providing the old and new
 /// passwords. Administrators can issue this call without providing the old password.
 /// </remarks>
 /// <param name="url"></param>
 /// <param name="properties"></param>
 /// <param name="notify"></param>
 /// <returns>
 /// The modified user record
 /// </returns>
 public IQuery<User> ResetPassword(Uri url, ODataObject properties, bool notify = false)
 {
     var sfApiQuery = new ShareFile.Api.Client.Requests.Query<User>(Client);
     sfApiQuery.Action("ResetPassword");
     sfApiQuery.Uri(url);
     sfApiQuery.QueryString("notify", notify);
     sfApiQuery.Body = properties;
     sfApiQuery.HttpMethod = "POST";
     return sfApiQuery;
 }
Beispiel #32
0
        /// <summary>
        /// Add a tenant account to a multi-tenant zone
        /// </summary>
        /// <param name="parentUrl"></param>
        /// <param name="accountId"></param>
        public IQuery<Account> CreateTenants(Uri parentUrl, string accountId)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<Account>(Client);
		    sfApiQuery.Action("Tenants");
            sfApiQuery.Uri(parentUrl);
            sfApiQuery.QueryString("accountId", accountId);
            sfApiQuery.HttpMethod = "POST";	
		    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 #34
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>
        /// Update AccessControl
        /// </summary>
        /// <example>
        /// {
        /// "Principal":{"Email":"*****@*****.**"},
        /// "CanUpload":true,
        /// "CanDownload":true,
        /// "CanView":true,
        /// "CanDelete":true,
        /// "CanManagePermissions":true
        /// }
        /// </example>
        /// <remarks>
        /// Updates an existing Access Controls of a given Item. The Principal element cannot be modified, it is provided
        /// in the Body to identity the AccessControl element to be modified. You can provide an ID, Email or URL on the
        /// Principal object.
        /// </remarks>
        /// <param name="url"></param>
        /// <param name="accessControl"></param>
        /// <param name="recursive"></param>
        /// <returns>
        /// the created or modified AccessControl instance
        /// </returns>
        public IQuery<AccessControl> UpdateByItem(Uri url, AccessControl accessControl, bool recursive = false)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<AccessControl>(Client);
		    sfApiQuery.Action("AccessControls");
            sfApiQuery.Uri(url);
            sfApiQuery.QueryString("recursive", recursive);
            sfApiQuery.Body = accessControl;
            sfApiQuery.HttpMethod = "PATCH";	
		    return sfApiQuery;
        }
Beispiel #36
0
 /// <summary>
 /// delete the email address from user
 /// </summary>
 /// <param name="email"></param>
 /// <returns>
 /// User
 /// </returns>
 public IQuery<User> DeleteEmailAddress(string email)
 {
     var sfApiQuery = new ShareFile.Api.Client.Requests.Query<User>(Client);
     sfApiQuery.From("Users");
     sfApiQuery.Action("DeleteEmailAddress");
     sfApiQuery.QueryString("email", email);
     sfApiQuery.HttpMethod = "POST";
     return sfApiQuery;
 }
        /// <summary>
        /// Get SSO Info
        /// </summary>
        /// <param name="subdomain"></param>
        /// <returns>
        /// SSOInfo
        /// </returns>
        public IQuery<SSOInfo> GetSSOInfo(string subdomain)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<SSOInfo>(Client);
		    sfApiQuery.From("Accounts");
		    sfApiQuery.Action("SSOInfo");
            sfApiQuery.QueryString("subdomain", subdomain);
            sfApiQuery.HttpMethod = "GET";	
		    return sfApiQuery;
        }
        /// <summary>
        /// Find Subdomain
        /// </summary>
        /// <example>
        /// {
        /// "UsernameShort":"usernameShort",
        /// "Password":"******",
        /// "EmployeeOnly":false
        /// }
        /// </example>
        /// <remarks>
        /// Find the user account information based on the short username
        /// </remarks>
        /// <param name="findSubdomainParams"></param>
        /// <param name="singlePlane"></param>
        /// <returns>
        /// FindSubdomainResult
        /// </returns>
        public IQuery<FindSubdomainResult> FindSubdomain(FindSubdomainParams findSubdomainParams, bool singlePlane = false)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<FindSubdomainResult>(Client);
		    sfApiQuery.From("Accounts");
		    sfApiQuery.Action("FindSubdomain");
            sfApiQuery.QueryString("singlePlane", singlePlane);
            sfApiQuery.Body = findSubdomainParams;
            sfApiQuery.HttpMethod = "POST";	
		    return sfApiQuery;
        }
        /// <summary>
        /// Check if subdomain is required
        /// </summary>
        /// <param name="username"></param>
        /// <param name="singlePlane"></param>
        /// <returns>
        /// RequireSubdomainResult
        /// </returns>
        public IQuery<RequireSubdomainResult> RequireSubdomain(string username, bool singlePlane = false)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<RequireSubdomainResult>(Client);
		    sfApiQuery.From("Accounts");
		    sfApiQuery.Action("RequireSubdomain");
            sfApiQuery.QueryString("username", username);
            sfApiQuery.QueryString("singlePlane", singlePlane);
            sfApiQuery.HttpMethod = "GET";	
		    return sfApiQuery;
        }
        /// <summary>
        /// Update Account Single Sign-On Configuration
        /// </summary>
        /// <example>
        /// {
        /// "LogoutUrl":"",
        /// "LoginUrl":"https://idp.com/signin",
        /// "IPRestrictions":"+all",
        /// "ForceSSO":true,
        /// "EntityID":"http://account.sf-api.com/saml/info",
        /// "SFEntityID":"http://idp.com/saml/info",
        /// "SPInitatedAuthContext":"exact",
        /// "SPInitatedAuthMethod":"urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport"
        /// }
        /// </example>
        /// <remarks>
        /// Modifies the Single Sign-on Configuration for this account.
        /// </remarks>
        /// <param name="sso"></param>
        /// <param name="provider"></param>
        public IQuery<SSOAccountProvider> UpdateSSO(SSOAccountProvider sso, string provider = "saml")
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<SSOAccountProvider>(Client);
		    sfApiQuery.From("Accounts");
		    sfApiQuery.Action("SSO");
            sfApiQuery.QueryString("provider", provider);
            sfApiQuery.Body = sso;
            sfApiQuery.HttpMethod = "PATCH";	
		    return sfApiQuery;
        }
        /// <summary>
        /// Get Account Single Sign-On Configuration
        /// </summary>
        /// <remarks>
        /// Retrieve the Single Sign-on configuration for the Account
        /// </remarks>
        /// <param name="provider"></param>
        /// <param name="idpEntityId"></param>
        public IQuery<SSOAccountProvider> GetSSO(string provider = "saml", string idpEntityId = null)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<SSOAccountProvider>(Client);
		    sfApiQuery.From("Accounts");
		    sfApiQuery.Action("SSO");
            sfApiQuery.QueryString("provider", provider);
            sfApiQuery.QueryString("idpEntityId", idpEntityId);
            sfApiQuery.HttpMethod = "GET";	
		    return sfApiQuery;
        }
        /// <summary>
        /// Get Account AddressBooks
        /// </summary>
        /// <remarks>
        /// Retrieves an address book from the account.
        /// Address Books are the contacts of Eployees and Clients, maintained on a personal or
        /// account-wide basis (shared).
        /// </remarks>
        /// <param name="type"></param>
        /// <param name="searchTerm"></param>
        /// <returns>
        /// A Feed of Contact objects representing the Address Book retrieved
        /// </returns>
        public IQuery<ODataFeed<Contact>> GetAddressBook(string type = "personal", string searchTerm = "")
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<ODataFeed<Contact>>(Client);
		    sfApiQuery.From("Accounts");
		    sfApiQuery.Action("AddressBook");
            sfApiQuery.QueryString("type", type);
            sfApiQuery.QueryString("searchTerm", searchTerm);
            sfApiQuery.HttpMethod = "GET";	
		    return sfApiQuery;
        }
 /// <summary>
 /// Create Share Alias
 /// </summary>
 /// <remarks>
 /// Creates a share alias for the specified share ID and user email. If a user with the given email address does not
 /// exist it is created first.
 /// For shares requiring login an activation email is sent to the created user. If 'notify' is enabled, the user activation is
 /// included in the share notification email.
 /// </remarks>
 /// <param name="url"></param>
 /// <param name="email"></param>
 /// <param name="notify"></param>
 /// <returns>
 /// Share with the AliasID property set to the created alias ID
 /// </returns>
 public IQuery<Share> CreateAlias(Uri url, string email, bool notify = false)
 {
     var sfApiQuery = new ShareFile.Api.Client.Requests.Query<Share>(Client);
     sfApiQuery.Action("Alias");
     sfApiQuery.Uri(url);
     sfApiQuery.QueryString("email", email);
     sfApiQuery.QueryString("notify", notify);
     sfApiQuery.HttpMethod = "POST";
     return sfApiQuery;
 }
Beispiel #44
0
 /// <summary>
 /// set email address as the primary email address for CURRENT user
 /// </summary>
 /// <param name="email"></param>
 /// <returns>
 /// User
 /// </returns>
 public IQuery<User> MakePrimary(string email)
 {
     var sfApiQuery = new ShareFile.Api.Client.Requests.Query<User>(Client);
     sfApiQuery.From("Users");
     sfApiQuery.Action("MakePrimary");
     sfApiQuery.QueryString("email", email);
     sfApiQuery.HttpMethod = "POST";
     return sfApiQuery;
 }
 /// <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;
 }
        /// <summary>
        /// Get the Connector Group by Provider
        /// </summary>
        /// <param name="provider"></param>
        /// <returns>
        /// A single ConnectorGroup matching the query
        /// </returns>
        public IQuery<ConnectorGroup> ByProvider(string provider)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<ConnectorGroup>(Client);
		    sfApiQuery.From("ConnectorGroups");
		    sfApiQuery.Action("ByProvider");
            sfApiQuery.QueryString("provider", provider);
            sfApiQuery.HttpMethod = "GET";	
		    return sfApiQuery;
        }
Beispiel #47
0
 /// <summary>
 /// Get User
 /// </summary>
 /// <remarks>
 /// Retrieve a single user, by ID or email, or the currently authenticated user.
 /// </remarks>
 /// <param name="id"></param>
 /// <param name="emailAddress"></param>
 /// <returns>
 /// the requested User object
 /// </returns>
 public IQuery<User> Get(string id = null, string emailAddress = null)
 {
     var sfApiQuery = new ShareFile.Api.Client.Requests.Query<User>(Client);
     sfApiQuery.From("Users");
     sfApiQuery.QueryString("id", id);
     sfApiQuery.QueryString("emailAddress", emailAddress);
     sfApiQuery.HttpMethod = "GET";
     return sfApiQuery;
 }
 /// <summary>
 /// Login
 /// </summary>
 /// <remarks>
 /// API clients can provide ShareFile Authentication directly to any API operation using OAuth (Bearer).
 /// However, the client must know that the provided authentication type is supported on the API endpoint; and that SAML is not configured.
 /// 
 /// This API provides a generic authentication routine for clients. It will challenge for ShareFile credentials
 /// passing all supported authentication methods; redirect to the SAML IDP if configured to do so; and handle
 /// certain HTTP headers, like device registration.
 /// 
 /// If the client is already authenticated, the Session object is returned. If the client is not authenticated, and
 /// the account is not configured for SAML, then the API will challenge for a local authentication. If the account
 /// is configured for SAML, then the client will be redirected to the SAML IDP using the SAML passive flow - authentication
 /// will be performed at the IDP domain instead. The IDP callback will be on the API Acs, which will return a Session
 /// object if authentication is accepted.
 /// 
 /// The following HTTP Headers are also processed in this request, and stored with the Session object:
 /// X-SFAPI-Tool: Tool string (user-agent equivalent for ShareFile)X-SFAPI-ToolVersion: Tool Version stringX-SFAPI-UserInitiated: true or false, indicates whether this is an interactive login, or re-authentication
 /// initiated by the ToolX-SFAPI-DeviceId: Device Identifier. If set to 'register', a new DeviceID will be generated. This will
 /// either create or associate an existing DeviceID to this session - indicates user is logging in using this DeviceX-SFAPI-DeviceName: Device Name. Only required/used when a registration process occurs.
 /// </remarks>
 /// <param name="authmethod"></param>
 /// <param name="authcomparison"></param>
 /// <returns>
 /// A Session object, if authentication is successful
 /// </returns>
 public IQuery<Session> Login(string authmethod = null, string authcomparison = null)
 {
     var sfApiQuery = new ShareFile.Api.Client.Requests.Query<Session>(Client);
     sfApiQuery.From("Sessions");
     sfApiQuery.Action("Login");
     sfApiQuery.QueryString("authmethod", authmethod);
     sfApiQuery.QueryString("authcomparison", authcomparison);
     sfApiQuery.HttpMethod = "GET";
     return sfApiQuery;
 }
Beispiel #49
0
 /// <summary>
 /// Create Employee
 /// </summary>
 /// <example>
 /// {
 /// "Email":"*****@*****.**",
 /// "FirstName":"Name",
 /// "LastName":"Last Name",
 /// "Company":"Company",
 /// "Password":"******",
 /// "StorageQuotaLimitGB":50,
 /// "Preferences":
 /// {
 /// "CanResetPassword":true,
 /// "CanViewMySettings":true
 /// },
 /// "DefaultZone":
 /// {
 /// "Id":"zoneid"
 /// },
 /// "IsAdministrator": false,
 /// "CanCreateFolders": false,
 /// "CanUseFileBox": true,
 /// "CanManageUsers": false,
 /// "Roles": [
 /// "CanChangePassword", "CanManageMySettings",
 /// "CanUseFileBox, "CanManageUsers, "CanCreateFolders, "CanUseDropBox, "CanSelectFolderZone,
 /// "AdminAccountPolicies", "AdminBilling", "AdminBranding", "AdminChangePlan", "AdminFileBoxAccess",
 /// "AdminManageEmployees", "AdminRemoteUploadForms", "AdminReporting", "AdminSharedDistGroups",
 /// "AdminSharedAddressBook", "AdminViewReceipts", "AdminDelegate", "AdminManageFolderTemplates",
 /// "AdminEmailMessages", "AdminSSO", "AdminSuperGroup", "AdminZones", "AdminCreateSharedGroups", "AdminConnectors"
 /// ]
 /// }
 /// </example>
 /// <remarks>
 /// Creates a new Employee User (AccountUser) and associates it to an Account
 /// The following parameters from the input object are used: Email, FirstName, LastName, Company,
 /// DefaultZone, Password, IsEmployee, IsAdministrator, CanCreateFolders, CanUseFileBox, CanManageUsers,
 /// Preferences.CanResetPassword and Preferences.CanViewMySettings.
 /// Other parameters are ignoredStorageQuotaLimitGB parameter is optional. If not specified or equal to -1 the account default storage quota value will be set for the User.
 /// </remarks>
 /// <param name="user"></param>
 /// <param name="pushCreatorDefaultSettings"></param>
 /// <param name="addshared"></param>
 /// <param name="notify"></param>
 /// <param name="ifNecessary"></param>
 /// <returns>
 /// The new employee user
 /// </returns>
 public IQuery<User> CreateAccountUser(AccountUser user, bool pushCreatorDefaultSettings = false, bool addshared = false, bool notify = false, bool ifNecessary = false)
 {
     var sfApiQuery = new ShareFile.Api.Client.Requests.Query<User>(Client);
     sfApiQuery.From("Users");
     sfApiQuery.Action("AccountUser");
     sfApiQuery.QueryString("pushCreatorDefaultSettings", pushCreatorDefaultSettings);
     sfApiQuery.QueryString("addshared", addshared);
     sfApiQuery.QueryString("notify", notify);
     sfApiQuery.QueryString("ifNecessary", ifNecessary);
     sfApiQuery.Body = user;
     sfApiQuery.HttpMethod = "POST";
     return sfApiQuery;
 }
 public IQuery<ShareAlias> CreateRecipients(Uri url, string Email = null, string FirstName = null, string LastName = null, string Company = null)
 {
     var sfApiQuery = new ShareFile.Api.Client.Requests.Query<ShareAlias>(Client);
     sfApiQuery.Action("Recipients");
     sfApiQuery.Uri(url);
     sfApiQuery.QueryString("Email", Email);
     sfApiQuery.QueryString("FirstName", FirstName);
     sfApiQuery.QueryString("LastName", LastName);
     sfApiQuery.QueryString("Company", Company);
     sfApiQuery.HttpMethod = "POST";
     return sfApiQuery;
 }
 public IQuery<UploadSpecification> Upload2(Uri url, UploadRequestParams uploadParams, int? expirationDays = null)
 {
     var sfApiQuery = new ShareFile.Api.Client.Requests.Query<UploadSpecification>(Client);
     sfApiQuery.Action("Upload2");
     sfApiQuery.Uri(url);
     sfApiQuery.QueryString("expirationDays", expirationDays);
     sfApiQuery.Body = uploadParams;
     sfApiQuery.HttpMethod = "POST";
     return sfApiQuery;
 }
Beispiel #52
0
        /// <summary>
        /// Get List of Zones
        /// </summary>
        /// <remarks>
        /// Retrieve the list of Zones accessible to the authenticated user
        /// This method will concatenate the list of private zones in the user's account and the
        /// list of public zones accessible to this account. Any user can see the list of zones.
        /// </remarks>
        /// <param name="services"></param>
        /// <param name="includeDisabled"></param>
        /// <returns>
        /// The list of public and private zones accessible to this user
        /// </returns>
        public IQuery<ODataFeed<Zone>> Get(ZoneService services = ZoneService.StorageZone, bool includeDisabled = false)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<ODataFeed<Zone>>(Client);
		    sfApiQuery.From("Zones");
            sfApiQuery.QueryString("services", services);
            sfApiQuery.QueryString("includeDisabled", includeDisabled);
            sfApiQuery.HttpMethod = "GET";	
		    return sfApiQuery;
        }
Beispiel #53
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 #54
0
        /// <summary>
        /// Get List of Zones
        /// </summary>
        /// <remarks>
        /// Retrieve the list of Zones accessible to the authenticated user
        /// This method will concatenate the list of private zones in the user's account and the
        /// list of public zones accessible to this account. Any user can see the list of zones.
        /// </remarks>
        /// <param name="services"></param>
        /// <param name="includeDisabled"></param>
        /// <returns>
        /// The list of public and private zones accessible to this user
        /// </returns>
        public IQuery<Zone> Get(Uri url, bool secret = false)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<Zone>(Client);
            sfApiQuery.Uri(url);
            sfApiQuery.QueryString("secret", secret);
            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>
 /// Downloads Share Items
 /// </summary>
 /// <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 authentication, make sure this request is authenticated. To download
 /// shares that require require user information, provide the Name, Email and Company parameters in the URI
 /// query. Anyone can download files from anonymous shares.You can also download individual Items in the Share. Use the Share(id)/Items(id)/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="itemId"></param>
 /// <param name="Name"></param>
 /// <param name="Email"></param>
 /// <param name="Company"></param>
 /// <param name="redirect"></param>
 /// <returns>
 /// Redirects the caller (302) to the download address for the share contents.
 /// </returns>
 public IQuery<Stream> Download(Uri shareUrl, string itemId = null, string Name = null, string Email = null, string Company = null, bool redirect = true)
 {
     var sfApiQuery = new ShareFile.Api.Client.Requests.Query<Stream>(Client);
     sfApiQuery.Action("Download");
     sfApiQuery.Uri(shareUrl);
     sfApiQuery.QueryString("id", itemId);
     sfApiQuery.QueryString("Name", Name);
     sfApiQuery.QueryString("Email", Email);
     sfApiQuery.QueryString("Company", Company);
     sfApiQuery.QueryString("redirect", redirect);
     sfApiQuery.HttpMethod = "GET";
     return sfApiQuery;
 }
        /// <summary>
        /// Create AccessControl
        /// </summary>
        /// <example>
        /// {
        /// "Principal":{"url":"https://account.sf-api.com/v3/Groups(id)"},
        /// "CanUpload":true,
        /// "CanDownload":true,
        /// "CanView":true,
        /// "CanDelete":true,
        /// "CanManagePermissions":true,
        /// "Message":"Message"
        /// }
        /// </example>
        /// <remarks>
        /// Creates a new Access Controls entry for a given Item. Access controls can only define a single Principal,
        /// which can be either a Group or User. The 'Principal' element is specified as an object - you should populate
        /// either the URL or the ID reference.
        /// </remarks>
        /// <param name="url"></param>
        /// <param name="accessControl"></param>
        /// <param name="recursive"></param>
        /// <param name="message"></param>
        /// <param name="sendDefaultNotification"></param>
        /// <returns>
        /// the created or modified AccessControl instance
        /// </returns>
        public IQuery<AccessControl> CreateByItem(Uri url, AccessControl accessControl, bool recursive = false, bool sendDefaultNotification = false, string message = null)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<AccessControl>(Client);
		    sfApiQuery.Action("AccessControls");
            sfApiQuery.Uri(url);
            sfApiQuery.QueryString("recursive", recursive);
            sfApiQuery.QueryString("sendDefaultNotification", sendDefaultNotification);
            accessControl.AddProperty("message", message);
            sfApiQuery.Body = accessControl;
            sfApiQuery.HttpMethod = "POST";	
		    return sfApiQuery;
        }
 /// <summary>
 /// Upload File to Request Share
 /// </summary>
 /// <example>
 /// POST https://account.sf-api.com/sf/v3/Shares(id)/Upload2
 /// {
 /// "Method":"Method",
 /// "Raw": false,
 /// "FileName":"FileName"
 /// "FileLength": length
 /// }
 /// </example>
 /// <remarks>
 /// Prepares the links for uploading files to the target Share.
 /// This method returns an Upload Specification object. The fields are
 /// populated based on the upload method, provider, and resume parameters passed to the
 /// upload call.
 /// The Method determines how the URLs must be called.
 /// 
 /// Standard uploads use a single HTTP POST message to the ChunkUri address provided in
 /// the response. All other fields will be empty. Standard uploads do not support Resume.
 /// 
 /// Streamed uploads use multiple HTTP POST calls to the ChunkUri address. The client must
 /// append the parameters index, offset and hash to the end of the ChunkUri address. Index
 /// is a sequential number representing the data block (zero-based); Offset represents the
 /// byte offset for the block; and hash contains the MD5 hash of the block. The last HTTP
 /// POST must also contain finish=true parameter.
 /// 
 /// Threaded uploads use multiple HTTP POST calls to ChunkUri, and can have a number of
 /// threads issuing blocks in parallel. Clients must append index, offset and hash to
 /// the end of ChunkUri, as explained in Streamed. After all chunks were sent, the client
 /// must call the FinishUri provided in this spec.
 /// 
 /// For all uploaders, the contents of the POST Body can either be "raw", if the "Raw" parameter
 /// was provided to the Uploader, or use MIME multi-part form encoding otherwise. Raw uploads
 /// simply put the block content in the POST body - Content-Length specifies the size. Multi-part
 /// form encoding has to pass the File as a Form parameter named "File1".
 /// 
 /// For streamed and threaded, if Resume options were provided to the Upload call, then the
 /// fields IsResume, ResumeIndex, ResumeOffset and ResumeFileHash MAY be populated. If they are,
 /// it indicates that the server has identified a partial upload with that specification, and is
 /// ready to resume on the provided parameters. The clients can then verify the ResumeFileHash to
 /// ensure the file has not been modified; and continue issuing ChunkUri calls from the ResumeIndex
 /// ResumeOffset parameters. If the client decides to restart, it should simply ignore the resume
 /// parameters and send the blocks from Index 0.
 /// 
 /// For all uploaders: the result code for the HTTP POST calls to Chunk and Finish Uri can either
 /// be a 401 - indicating authentication is required; 4xx/5xx indicating some kind of error; or
 /// 200 with a Content Body of format 'ERROR:message'. Successful calls will return either a 200
 /// response with no Body, or with Body of format 'OK'.
 /// </remarks>
 /// <param name="url"></param>
 /// <param name="method"></param>
 /// <param name="raw"></param>
 /// <param name="fileName"></param>
 /// <param name="fileSize"></param>
 /// <param name="batchId"></param>
 /// <param name="batchLast"></param>
 /// <param name="canResume"></param>
 /// <param name="startOver"></param>
 /// <param name="unzip"></param>
 /// <param name="tool"></param>
 /// <param name="overwrite"></param>
 /// <param name="title"></param>
 /// <param name="details"></param>
 /// <param name="isSend"></param>
 /// <param name="sendGuid"></param>
 /// <param name="opid"></param>
 /// <param name="threadCount"></param>
 /// <param name="responseFormat"></param>
 /// <param name="notify"></param>
 /// <returns>
 /// an Upload Specification element, containing the links for uploading, and the parameters for resume.
 /// The caller must know the protocol for sending the prepare, chunk and finish URLs returned in the spec; as well as
 /// negotiate the resume upload.
 /// </returns>
 public IQuery<UploadSpecification> Upload(Uri url, UploadMethod method = UploadMethod.Standard, bool raw = false, string fileName = null, long fileSize = 0, string batchId = null, bool batchLast = false, bool canResume = false, bool startOver = false, bool unzip = false, string tool = "apiv3", bool overwrite = false, string title = null, string details = null, bool isSend = false, string sendGuid = null, string opid = null, int threadCount = 4, string responseFormat = "json", bool notify = false, DateTime? clientCreatedDateUTC = null, DateTime? clientModifiedDateUTC = null, int? expirationDays = null)
 {
     var sfApiQuery = new ShareFile.Api.Client.Requests.Query<UploadSpecification>(Client);
     sfApiQuery.Action("Upload");
     sfApiQuery.Uri(url);
     sfApiQuery.QueryString("method", method);
     sfApiQuery.QueryString("raw", raw);
     sfApiQuery.QueryString("fileName", fileName);
     sfApiQuery.QueryString("fileSize", fileSize);
     sfApiQuery.QueryString("batchId", batchId);
     sfApiQuery.QueryString("batchLast", batchLast);
     sfApiQuery.QueryString("canResume", canResume);
     sfApiQuery.QueryString("startOver", startOver);
     sfApiQuery.QueryString("unzip", unzip);
     sfApiQuery.QueryString("tool", tool);
     sfApiQuery.QueryString("overwrite", overwrite);
     sfApiQuery.QueryString("title", title);
     sfApiQuery.QueryString("details", details);
     sfApiQuery.QueryString("isSend", isSend);
     sfApiQuery.QueryString("sendGuid", sendGuid);
     sfApiQuery.QueryString("opid", opid);
     sfApiQuery.QueryString("threadCount", threadCount);
     sfApiQuery.QueryString("responseFormat", responseFormat);
     sfApiQuery.QueryString("notify", notify);
     sfApiQuery.QueryString("clientCreatedDateUTC", clientCreatedDateUTC);
     sfApiQuery.QueryString("clientModifiedDateUTC", clientModifiedDateUTC);
     sfApiQuery.QueryString("expirationDays", expirationDays);
     sfApiQuery.HttpMethod = "POST";
     return sfApiQuery;
 }
Beispiel #59
0
        /// <summary>
        /// Create Report
        /// </summary>
        /// <example>
        /// {
        /// "Id": "rs24f83e-b147-437e-9f28-e7d03634af42"
        /// "Title": "Usage Report",
        /// "ReportType": "Activity",
        /// "ObjectType": "Account",
        /// "ObjectId": "a024f83e-b147-437e-9f28-e7d0ef634af42",
        /// "DateOption": "Last30Days",
        /// "SaveFormat": "Excel"
        /// }
        /// </example>
        /// <remarks>
        /// Creates a new Report.
        /// </remarks>
        /// <param name="report"></param>
        /// <param name="runOnCreate"></param>
        /// <returns>
        /// the created report
        /// </returns>
        public IQuery<Report> Create(Report report, bool runOnCreate)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<Report>(Client);
		    sfApiQuery.From("Reports");
            sfApiQuery.QueryString("runOnCreate", runOnCreate);
            sfApiQuery.Body = report;
            sfApiQuery.HttpMethod = "POST";	
		    return sfApiQuery;
        }
        /// <summary>
        /// Get current Account
        /// </summary>
        /// <remarks>
        /// Retrieves information about the Account defined in the call subdomain
        /// </remarks>
        /// <param name="id"></param>
        /// <returns>
        /// The subdomain account information
        /// </returns>
        public IQuery<Account> Get(string id = null)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<Account>(Client);
		    sfApiQuery.From("Accounts");
            sfApiQuery.QueryString("id", id);
            sfApiQuery.HttpMethod = "GET";	
		    return sfApiQuery;
        }