Ejemplo n.º 1
0
		public UploadWholeFileTask(UploadInfo file, IUploadProgressReporter progressReporter, IApiHelper apiHelper)
			: base(apiHelper)
		{
			_file = file;
			_filePath = file.FilePath;
			_progressReporter = progressReporter;
		}
Ejemplo n.º 2
0
		public UploadWholeFileTask(UploadInfo file, string filePath, IApiHelper apiHelper)
			: base(apiHelper)
		{
			_file = file;
			_filePath = filePath;
			_progressReporter = null;
		}
Ejemplo n.º 3
0
		public UploadFilesTask(JobInfo jobInfo, IUploadProgressReporter progressReporter, CancellationToken token, IApiHelper apiHelper)
			: base(apiHelper)
		{
			_jobInfo = jobInfo;
			_progressReporter = progressReporter;
			_token = token;
		}
Ejemplo n.º 4
0
		internal RetryDelayTask(int errors, int baseValue, CancellationToken token, IApiHelper apiHelper)
			: base(apiHelper)
		{
			_errors = errors;
			_token = token;
			_baseValue = baseValue;
		}
Ejemplo n.º 5
0
		public CreateFileVersionTask(bool uploadInChunks, UploadInfo file, long folderId, IApiHelper apiHelper)
			: base(apiHelper)
		{
			_uploadInChunks = uploadInChunks;
			_file = file;
			_folderId = folderId;
		}
Ejemplo n.º 6
0
 public LabelAsCompleteTask(JobInfo jobInfo, SkyDoxUploadJob skyDoxUploadJob, CancellationToken token,
                            IApiHelper apiHelper)
     : base(apiHelper)
 {
     _jobInfo = jobInfo;
     _job = skyDoxUploadJob;
     _token = token;
 }
Ejemplo n.º 7
0
		public void ResendValidationEmail(string hostUrl, string email, IApiHelper apiHelper)
		{
			if (apiHelper == null)
			{
				apiHelper = new ApiHelper();
			}
			RetryAction(() => apiHelper.ResendValidationEmail(hostUrl, email), 1);
		}
Ejemplo n.º 8
0
		public AuthenticateTask(JobInfo jobInfo, string loginName, string serviceUrl, string deviceToken, IApiHelper apiHelper, ILoginUserInteraction loginUi = null)
			: base(apiHelper)
		{
			_jobInfo = jobInfo;
			_serviceUrl = serviceUrl;
            DeviceToken = deviceToken;
			_loginName = loginName;
		    _loginUi = loginUi ?? new LoginUserInteraction();
		}
Ejemplo n.º 9
0
        public bool RegisterUser(string username, string password, IApiHelper apiHelper)
        {
	        if (apiHelper == null)
	        {
	            apiHelper = new ApiHelper();
	        }
            RetryAction(() => apiHelper.RegisterNewUser(ServiceUrl, username, password), 1);
            return Error == null;
        }
Ejemplo n.º 10
0
		public UploadFileChunksTask(string filePath, long fileSize, DeckCloudFileResponse response, CancellationToken token, IApiHelper apiHelper)
			: base(apiHelper)
		{
			_file = null;
			_filePath = filePath;
			_fileSize = fileSize;
			_progressReporter = null;
			_token = token;
			_deckCloudFileResponse = response;
		}
Ejemplo n.º 11
0
		public UploadFileChunksTask(UploadInfo file, IUploadProgressReporter progressReporter, CancellationToken token, IApiHelper apiHelper)
			: base(apiHelper)
		{
			_file = file;
			_filePath = file.FilePath;
			_fileSize = file.FileSize;
			_progressReporter = progressReporter;
			_token = token;
			_deckCloudFileResponse = file.DeckCloudFileResponse;
		}
Ejemplo n.º 12
0
		/// <summary>
		/// Register a new user on the cloud storage server.
		/// Returns true on success, false if the user is already registered.
		/// </summary>
		/// <param name="hostUrl">The web services host URL.</param>
		/// <param name="email">The account holder's email address is used to log in.</param>
		/// <param name="password">The password to access the account.</param>
		/// <returns>Returns true on success, false if the user is already registered.</returns>
        public static RegisterNewUserResponse RegisterNewUser(string hostUrl, string email, string password, IApiHelper apiHelper)
		{
			try
			{
				// Register new user in cloud storage.
				Logger.LogDebug("Register new user at host: " + hostUrl);

				if (apiHelper.RegisterNewUser(hostUrl, email, password))
				{
					Logger.LogInfo(string.Format("Successfully registered user {0}.", email));
                    return RegisterNewUserResponse.Success;
				}

				Logger.LogError(string.Format("Failed to register user {0}.", email));
                return RegisterNewUserResponse.UndefinedError;
			}
			catch (UriFormatException ex)
			{
				Logger.LogError(ex);
				throw new InvalidHostUrlException(Resources.ConnectionErrorUrlFormat, ex);
			}
			catch (WebException ex)
			{
				Logger.LogError(ex);

				if (ex.IsConflictResponse409())
				{
					// The login name already exists.
                    return RegisterNewUserResponse.EmailAlreadyExists;
				}
				
				if (ex.IsUnprocessableEntityResponse422())
				{
					// The login name is invalid.
					return RegisterNewUserResponse.InvalidEmailAddress;
				}

				throw new StorageUnavailableException(Resources.ConnectionErrorGeneric, ex);
			}
			catch (Exception ex)
			{
				Logger.LogError(ex);

				// Any other exception, just throw a new exception with better text.
				throw new StorageUnavailableException(Resources.ConnectionErrorGeneric, ex);
			}
		}
Ejemplo n.º 13
0
		public EstimateFileTransferTimeTask(int bufferSize, JobInfo jobInfo, CancellationToken token, IUploadProgressReporter progressReporter, IApiHelper apiHelper)
			: base( apiHelper)
		{
			_jobInfo = jobInfo;
			_progressReporter = progressReporter;
			_token = token;

			byte[] random = new byte[bufferSize];
			new Random().NextBytes(random);
			
			var tempDir = CreateTempDirectory();
			_tempFilePath = Path.Combine(tempDir, "uploadtest.dat");
			_tempFileSize = random.Length;
			using (var upStream = new FileStream(_tempFilePath, FileMode.Create))
			{
				upStream.Write(random, 0, random.Length);
			}
		}
Ejemplo n.º 14
0
 public ShellViewModel(IEventAggregator events, IAuthenticatedUser authenticatedUser, IApiHelper apiHelper)
 {
     _events    = events;
     _user      = authenticatedUser;
     _apiHelper = apiHelper;
     _events.SubscribeOnUIThread(this);
     ActivateItemAsync(IoC.Get <LoginViewModel>());
 }
 public SparepartEndpoint(IApiHelper apiHelper)
 {
     _apiHelper = apiHelper;
 }
Ejemplo n.º 16
0
 public SObjectRegistry(IApiHelper apiHelper, IItemDelegator itemDelegator) : base(apiHelper, itemDelegator)
 {
 }
Ejemplo n.º 17
0
 public ServiceEndpoint(IApiHelper apiHelper)
 {
     _apiHelper = apiHelper;
 }
Ejemplo n.º 18
0
 public IDoxSession CreateSessionFromPassword(string username, string password, IApiHelper apiHelper)
 {
     return DoxSession.CreateFromPassword(this, username, password, apiHelper);
 }
Ejemplo n.º 19
0
 public LoginViewModel(IApiHelper apiHelper, IEventAggregator @event)
 {
     this.apiHelper = apiHelper;
     this.@event    = @event;
 }
Ejemplo n.º 20
0
 public ProductService(IApiHelper apiHelper)
 {
     _apiHelper = apiHelper;
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UpcomingShiftsActivity"/> class.
 /// </summary>
 /// <param name="telemetryClient">Having the telemetry capturing mechanism.</param>
 /// <param name="apiHelper">API helper to fetch tuple response by post soap requests.</param>
 public UpcomingShiftsActivity(TelemetryClient telemetryClient, IApiHelper apiHelper)
 {
     this.telemetryClient = telemetryClient;
     this.apiHelper       = apiHelper;
 }
Ejemplo n.º 22
0
 public SaleEndpoint(IApiHelper apiHelper)
 {
     _apiHelper = apiHelper;
 }
Ejemplo n.º 23
0
		/// <summary>
		/// Apply email addresses as recipients of a cloud folder's contents.
		/// </summary>
		/// <param name="recipientsEmailAddresses">The recipients email addresses.</param>
		/// <param name="folderId">The ID of the cloud folder.</param>
		/// <param name="apiHelper">ApiHelper instance </param>
		public static void AddRecipientsToFolder(IEnumerable<string> recipientsEmailAddresses, long folderId, IApiHelper apiHelper)
		{
			if (recipientsEmailAddresses == null)
			{
				Logger.LogInfo("No email addresses to add as members to the folder.");
				return;
			}

			try
			{
				string[] recipients = recipientsEmailAddresses.ToArray();
				if (recipients.Length == 0)
				{
					Logger.LogInfo("No email addresses to add as members to the folder.");
					return;
				}

				// Adding recipients to folder.
				Logger.LogDebug("Adding recipients to folder.");

				foreach (string emailAddress in recipients)
				{
					apiHelper.AddMemberToFolder(emailAddress, folderId);
				}

				Logger.LogInfo(string.Format("Successfully added {0} recipients to folder with ID {1}.", recipients.Length, folderId));
			}
			catch (WebException ex)
			{
				Logger.LogError(ex);
				throw;
			}
			catch (InvalidResponseException ex)
			{
				Logger.LogError(ex);
				throw;
			}
			catch (Exception ex)
			{
				Logger.LogError(string.Format("Failed to add recipients to the cloud storage folder (folder ID: {0}).", folderId));
				Logger.LogError(ex);
				throw new StorageUnavailableException(Resources.ConnectionErrorDuringUpload, ex);
			}
		}
Ejemplo n.º 24
0
		public InitiateChunkingTask(UploadInfo file, IApiHelper apiHelper)
			: base(apiHelper)
		{
			_file = file;
		}
Ejemplo n.º 25
0
 public HorarioConsultaEndpoint(IApiHelper apiHelper)
 {
     _apiHelper = apiHelper;
 }
 public AllocationReportViewModel(
     IApiHelper apiHelper)
 {
     _apiHelper = apiHelper;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TimeOffActivity"/> class.
 /// </summary>
 /// <param name="telemetryClient">The mechanisms to capture telemetry.</param>
 /// <param name="apiHelper">API helper to fetch tuple response by post soap requests.</param>
 public TimeOffActivity(TelemetryClient telemetryClient, IApiHelper apiHelper)
 {
     this.telemetryClient = telemetryClient;
     this.apiHelper       = apiHelper;
 }
Ejemplo n.º 28
0
		public SkyDoxUploadJob(string id, string skydoxServiceUrl, string localJobDirectoryPath, string loginName, string jobFileName, IApiHelper apiHelper, string deviceToken)
		{
			LocalId = id;
			LoginName = loginName;
		    DeviceToken = deviceToken;
			WorkingDirectory = localJobDirectoryPath;
			JobDefinitionPath = Path.Combine(WorkingDirectory, jobFileName);
			ServiceUrl = skydoxServiceUrl;

			_apiHelper = apiHelper;
			_jobXmlPath = Path.Combine(WorkingDirectory, "80517EA2-9283-4CA1-8E35-31CCB737E417.xml");
			_jobBackupXmlPath = Path.Combine(WorkingDirectory, "86405CE9-22BA-4241-8D51-03C882461986.backup");
			_signalFilePath = Path.Combine(WorkingDirectory, "EC264018-93C4-48BF-A736-2BB5FC43C81A.signal");

			_jobInfo = JobInfo.LoadJobInfo(id, _jobXmlPath, _jobBackupXmlPath, JobDefinitionPath, LoginName, _apiHelper.FILE_UPLOAD_CHUNK_SIZE);
		}
Ejemplo n.º 29
0
 public bool SetCredentials(string username, string password, IApiHelper apiHelper)
 {
     return RegisterUser(username, password, apiHelper);
 }
Ejemplo n.º 30
0
 public PhotoRepository()
 {
     _api = new ApiHelper();
     Init();
 }
Ejemplo n.º 31
0
 public MateriaEndpoint(IApiHelper apiHelper)
 {
     _apiHelper = apiHelper;
 }
Ejemplo n.º 32
0
 public PhotoRepository(IApiHelper apiHelper)
 {
     _api = apiHelper;
     Init();
 }
Ejemplo n.º 33
0
 public LevelOfImportanceController()
 {
     _apiHelper = new ApiHelper();
 }
Ejemplo n.º 34
0
		/// <summary>
		/// Delete folders with the specified ID.
		/// </summary>
		/// <param name="id">The ID of the folder in cloud storage.</param>
		/// <returns>Returns true on success.</returns>
		public static bool DeleteFolder(long id, IApiHelper apiHelper)
		{
			try
			{
				// Delete a folder from cloud storage.
				Logger.LogDebug("Deleting a folder from cloud storage.");
				bool success = apiHelper.DeleteFolder(id);
				if (!success)
				{
					Logger.LogError(string.Format("Failed to delete the folder with the ID {0}.", id));
					return false;
				}

				Logger.LogInfo(string.Format("Deleted the folder with the ID {0}.", id));
				return true;
			}
			catch (WebException ex)
			{
				Logger.LogError(ex);
				throw;
			}
			catch (Exception ex)
			{
				Logger.LogError(ex);
				throw new StorageUnavailableException(Resources.ConnectionErrorDuringUpload, ex);
			}
		}
Ejemplo n.º 35
0
		/// <summary>
		/// Upload a local file into a cloud storage folder.
		/// Returns true on success.
		/// </summary>
		/// <param name="callbackIncrementProgress">Increment the progress by an amount of bytes.</param>
		/// <param name="localFilePath">Path to the locally stored file.</param>
		/// <param name="cloudFileName">The display name of the uploaded file.</param>
		/// <param name="cloudFolderId">The ID of the cloud storage folder to contain the file.</param>
		/// <param name="cloudFileLink">A link to the uploaded file.</param>
		/// <returns>Returns true on success.</returns>
		public static bool UploadFile(Action<long, double> callbackIncrementProgress, string localFilePath, string cloudFileName, long cloudFolderId, out string cloudFileLink, IApiHelper apiHelper)
		{
			try
			{
				// Get file size and determine whether uploading in chunks is required.
				long fileSize = new FileInfo(localFilePath).Length;
				bool uploadInChunks = (fileSize > apiHelper.FILE_UPLOAD_CHUNK_SIZE);

				// Get version information for a new file.
				Logger.LogDebug(string.Format("Creating version information for file \"{0}\".", localFilePath));
				DeckVersionResponse deckVersionResponse = apiHelper.CreateVersion(Path.GetFileName(localFilePath), cloudFileName, cloudFolderId, uploadInChunks);
				if (deckVersionResponse == null)
				{
					Logger.LogError("Failed to create a file version.");
					cloudFileLink = null;
					return false;
				}

				// Upload the file data to the version placeholder.
				if (uploadInChunks)
				{
					// Initiate file chunk uploading.
					Logger.LogDebug("Initiate file chunk uploading.");
					DeckCloudFileResponse initiateChunkingResponse = apiHelper.InitiateChunking(deckVersionResponse);
					if (initiateChunkingResponse == null)
					{
						Logger.LogError("Failed to initiate chunking.");
						cloudFileLink = null;
						return false;
					}

					// Upload the file in chunks.
					Logger.LogDebug("Uploading the file in chunks.");
					apiHelper.UploadFileChunks(callbackIncrementProgress, localFilePath, initiateChunkingResponse);

					// Indicate the uploading of chunks has finished.
					Logger.LogDebug("Indicate the uploading of chunks has finished.");
					apiHelper.FinishChunking(initiateChunkingResponse);
				}
				else
				{
					// Upload the whole file.
					Logger.LogDebug("Uploading the whole file.");
					apiHelper.UploadWholeFile(callbackIncrementProgress, localFilePath, deckVersionResponse);
				}

				// Apply the changes.
				Logger.LogDebug("Applying version changes.");
				apiHelper.ApplyVersionChanges(deckVersionResponse.VersionId);

				// Get the file URL link.
				Logger.LogDebug("Get link to uploaded file.");
				DeckFileResponse deckFileResponse = apiHelper.GetFileLink(deckVersionResponse.FileId);
				cloudFileLink = deckFileResponse.Url;

				Logger.LogInfo("Retrieved cloud file link: " + cloudFileLink);
				return !string.IsNullOrEmpty(cloudFileLink);
			}
			catch (WebException ex)
			{
				Logger.LogError(ex);
				throw;
			}
			catch (Exception ex)
			{
				Logger.LogError(ex);
				throw new StorageUnavailableException(Resources.ConnectionErrorDuringUpload, ex);
			}
		}
Ejemplo n.º 36
0
		public AddRecipientsTask(JobInfo jobInfo, IApiHelper apiHelper)
			: base( apiHelper)
		{
			_jobInfo = jobInfo;
		}
Ejemplo n.º 37
0
 public ProjectsEndpoint(IApiHelper apiHelper)
 {
     _apiHelper = apiHelper;
 }
Ejemplo n.º 38
0
		/// <summary>
		/// Delete folders with the specified name. There may be any number of them.
		/// The name matching is case-insensitive, invariant culture.
		/// </summary>
		/// <param name="name">The name of the folder in cloud storage.</param>
		/// <returns>Returns true on success.</returns>
		public static bool DeleteFoldersByName(string name, IApiHelper apiHelper)
		{
			try
			{
				// Delete folders from cloud storage.
				Logger.LogDebug("Deleting folders from cloud storage.");
				long numberDeleted;
				bool success = apiHelper.DeleteFoldersByName(name, out numberDeleted);
				if (!success)
				{
					Logger.LogError(string.Format("Failed to delete all folders with the name \"{0}\". Number deleted: {1}.", name, numberDeleted));
					return false;
				}

				Logger.LogInfo(string.Format("Delete all folders with the name \"{0}\". Number deleted: {1}.", name, numberDeleted));
				return true;
			}
			catch( WebException ex)
			{
				Logger.LogError(ex);
				throw;
			}
			catch (Exception ex)
			{
				Logger.LogError(ex);
				throw new StorageUnavailableException(Resources.ConnectionErrorDuringUpload, ex);
			}
		}
Ejemplo n.º 39
0
 public RolesController(IApiHelper apiHelper,
                        DataProtector dataProtector)
 {
     _apiHelper     = apiHelper;
     _dataProtector = dataProtector;
 }
Ejemplo n.º 40
0
		/// <summary>
		/// Get the ID's of all folders in cloud storage.
		/// </summary>
		/// <returns>Returns all folder ID's.</returns>
		public static IEnumerable<long> GetAllFolderIds(IApiHelper apiHelper)
		{
			Logger.LogDebug("Attempting to get information about all folders from cloud storage.");
			DeckFoldersResponse deck = apiHelper.GetAllFolders();

			Logger.LogDebug("Filtering out Inbox, Sent Files and My Files.");
			IEnumerable<long> allFolderIds =
				from folder in deck.Folders
				where folder.Name != "Inbox" && folder.Name != "Sent Files" && folder.Name != "My Files"
				select folder.Id;

			Logger.LogDebug("Returning folder ID's.");
			return allFolderIds;
		}
Ejemplo n.º 41
0
 protected ItemRegistry(IApiHelper apiHelper, IItemDelegator itemDelegator)
 {
     this.ApiHelper     = apiHelper;
     this.ItemDelegator = itemDelegator;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SwapShiftActivity"/> class.
 /// </summary>
 /// <param name="telemetryClient">ApplicationInsights DI.</param>
 /// <param name="apiHelper">API helper to fetch tuple response by post soap requests.</param>
 public SwapShiftActivity(TelemetryClient telemetryClient, IApiHelper apiHelper)
 {
     this.telemetryClient = telemetryClient;
     this.apiHelper       = apiHelper;
 }
Ejemplo n.º 43
0
 public StockService(IApiHelper apiHelper, IConfiguration configuration)
 {
     _client        = apiHelper.InitializeClient();
     _configuration = configuration;
 }
Ejemplo n.º 44
0
 internal JsonApi(IApiHelper coreApi)
 {
     this._coreApi = coreApi;
     this.AddSmapiConverters(coreApi.Owner.Helper);
 }
Ejemplo n.º 45
0
 public HomeworkController(ITokenHelper tokenHelper, IApiHelper apiHelper)
 {
     error        = new Error();
     _tokenHelper = tokenHelper;
     _apiHelper   = apiHelper;
 }
Ejemplo n.º 46
0
 public FoxImageEndpoint(IApiHelper apiHelper)
 {
     _apiHelper = apiHelper;
 }
Ejemplo n.º 47
0
 public IDoxSession CreateSessionFromDeviceToken(string username, string deviceToken, IApiHelper apiHelper)
 {
     return DoxSession.CreateFromDeviceToken(this, username, deviceToken, apiHelper);
 }
Ejemplo n.º 48
0
		/// <summary>
		/// Create a cloud storage folder, within the Outbox folder.
		/// Returns true on success.
		/// </summary>
		/// <param name="name">Name of the folder.</param>
		/// <param name="description">The folder's description.</param>
		/// <param name="expiryUtc">The expiry date of the folder in coordinated universal time. If null then no expiry is set.</param>
		/// <param name="getReturnReceipt">If true then the sender will receive an email when a recipient follows the folder link.</param>
		/// <param name="cloudFolderId">The created folder's ID is returned here.</param>
		/// <param name="cloudFileLink">A URL link to the created folder is returned here.</param>
		/// <returns>Returns true on success.</returns>
		public static bool CreateFolder(string name, string description, DateTime? expiryUtc, bool getReturnReceipt, out long cloudFolderId, out string cloudFileLink, IApiHelper apiHelper)
		{
			try
			{
				// Create a folder in the cloud storage.
				Logger.LogDebug("Creating cloud folder.");
				DeckFolderStructureResponse deckResponse = apiHelper.CreateOutboxFolder(name, description, expiryUtc, getReturnReceipt);
				if (deckResponse == null)
				{
					cloudFolderId = 0;
					cloudFileLink = null;
					Logger.LogError("Failed to create the folder.");
					return false;
				}

				cloudFolderId = deckResponse.Id;
				cloudFileLink = deckResponse.Url;
				Logger.LogInfo(string.Format("Created folder with ID {0} and URL \"{1}\".", cloudFolderId, cloudFileLink));
				return true;
			}
			catch (WebException ex)
			{
				Logger.LogError(ex);
				throw new WebException(Resources.ConnectionErrorDuringUpload, ex);
			}
		}
Ejemplo n.º 49
0
        /// <summary>
        /// Creates a new user with sky dox using only an email address.
        /// A verification email will be sent to that email address with a link prompting to set a password
        /// </summary>
        /// <param name="username"></param>
        /// <returns>true if we were succesfully able to make the request, false if not. This method does not return any information about whether the user exists prior to the call or not, although the information is available.</returns>
        public static bool CreateUserByEmailAddress(string hostUrl, string username, IApiHelper apiHelper)
        {
            try
            {
                Logger.LogDebug("Register new sendlink user: "******"Caught WebException trying to sign up a new user. Treating it as an offline error (we'll retry registering next time)");
                Logger.LogError(ex);
                var response = ex.Response as HttpWebResponse;
                if (response != null)
                {
                    try
                    {
                        using (var stream = response.GetResponseStream())
                        {
                            using (var sr = new StreamReader(stream))
                            {
                                Logger.LogError("Response below:");
                                Logger.LogError(sr.ReadToEnd());
                            }
                        }
                    }
                    catch (Exception ex1)
                    {
                        Logger.LogError(ex1);
                    }

                    if (response.StatusCode == HttpStatusCode.Conflict)
                    {
                        Logger.LogInfo("User already exists, assume that's us, and we're already registered.");
                        return true;
                    }
                }
            }
            return false;
        }
Ejemplo n.º 50
0
        public ShellViewModel(IEventAggregator events, SalesViewModel salesVM, ILoggedInUserModel user, IApiHelper apiHelper)
        {
            _events    = events;
            _salesVM   = salesVM;
            _user      = user;
            _apiHelper = apiHelper;

            _events.Subscribe(this);

            ActivateItem(IoC.Get <LoginViewModel>());
        }
Ejemplo n.º 51
0
 public PrisonerEndpoint(IApiHelper apiHelper)
 {
     _apiHelper = apiHelper;
 }
Ejemplo n.º 52
0
        public static IDoxSession CreateFromDeviceToken(DoxApi api, string username, string deviceToken,
                                                        IApiHelper apiHelper = null)
        {
            if (apiHelper == null)
            {
                apiHelper = new ApiHelper();
            }

            IDoxUser user = null;

            if (!api.RetryAction(
                () => user = apiHelper.SetDeviceToken(api.ServiceUrl, deviceToken)))
            {
                return null;
            }

            var credentials = new DoxCredentials
                {
                    //UserId = user.Id,
                    UserName = username,
                    DeviceToken = deviceToken
                };

            var session = new DoxSession(api, credentials, apiHelper);
            session.CurrentUser = user;
            return session;
        }
Ejemplo n.º 53
0
 public ProfileEndpoint(IApiHelper apiHelper, IProfile profile, IAuthenticatedUser user)
 {
     _apiHelper = apiHelper;
     _profile   = profile;
     _user      = user;
 }
Ejemplo n.º 54
0
 private DoxSession(DoxApi api, IDoxCredentials credentials, IApiHelper apiHelper)
 {
     _api = api;
     _apiHelper = apiHelper;
     _credentials = credentials;
 }
Ejemplo n.º 55
0
 public MusicBrainzClient(IApiHelper apiHelper)
 {
     _ApiHelper = apiHelper;
 }
Ejemplo n.º 56
0
        public static IDoxSession CreateFromPassword(DoxApi api, string username, string password,
                                                     IApiHelper apiHelper = null)
        {
            if (apiHelper == null)
            {
                apiHelper = new ApiHelper();
            }
            string userId = null;
            string devicetoken = null;

            if (!api.RetryAction(() => apiHelper.Login(api.ServiceUrl, username, password, out userId, out devicetoken)))
            {
                return null;
            }
            api.ClearError();
            var credentials = new DoxCredentials
                {
                    //UserId = userId,
                    UserName = username,
                    DeviceToken = devicetoken
                };
            return new DoxSession(api, credentials, apiHelper);
        }
Ejemplo n.º 57
0
 public EventsBuilder(ApplicationDbContext db, IApiHelper apiHelper, IRelationsManager relations)
 {
     _db        = db;
     _apiHelper = apiHelper;
     _relations = relations;
 }
Ejemplo n.º 58
0
 public CommentsEndpoint(IApiHelper apiHelper)
 {
     _apiHelper = apiHelper;
 }
 public UsuarioEndpoint(IApiHelper apiHelper)
 {
     _apiHelper = apiHelper;
 }
Ejemplo n.º 60
0
		public static void SetFolderPermissions(long folderId, PermissionFlags flags, IApiHelper apiHelper)
		{
			try
			{
				// Applying permissions to folder.
				Logger.LogDebug("Applying permissions to folder.");

				apiHelper.SetFolderPermissions(folderId, flags);

				Logger.LogInfo(string.Format("Successfully applied permissions to folder {0}.", folderId));
			}
			catch( WebException ex)
			{
				Logger.LogError(string.Format("Failed to add recipients to the cloud storage folder (folder ID: {0}).", folderId));
				Logger.LogError(ex);
				throw;
			}
		}