public void BeginLogs(LogsAction action, LogsStatus status, string authRequest, Action <LogsResponse> onSuccess, Action <LogsResponse> onFailure) { ThreadPool.QueueUserWorkItem(_ => { var logsResponse = this.client.Logs(action, status, authRequest); if (logsResponse.Successful && onSuccess != null) { onSuccess(logsResponse); } if (!logsResponse.Successful && onFailure != null) { onFailure(logsResponse); } }); }
/// <summary> /// Notify the LaunchKey API of a status change, such as successful or unsuccessful logins or revocations. Implicitly calls <see cref="Ping"/>. /// </summary> /// <param name="action">Action that was performed</param> /// <param name="status">Outcome of action</param> /// <param name="authenticationRequest">Authentication request associated with the action</param> /// <returns><see cref="LogsResponse"/> object indicating success or failure of the status update</returns> public LogsResponse Logs(LogsAction action, LogsStatus status, string authenticationRequest) { if (string.IsNullOrWhiteSpace(authenticationRequest)) { throw new ArgumentException("authRequest must be provided"); } this.EnsureAuthorizationRecent(); var request = new RestRequest("logs", Method.PUT); request.AddParameter("action", Enum.GetName(typeof(LogsAction), action)); request.AddParameter("status", status == LogsStatus.Granted ? "True" : "False"); request.AddParameter("auth_request", authenticationRequest); return(this.AuthenticatedRestRequest <LogsResponse>(request)); }
/// <summary> /// Set logging status /// </summary> /// <param name="type">Type of logging to set status for</param> /// <param name="status">Status of logging</param> public void SetStatus(LoggingType type, LogsStatus status) { this._logMap[type] = status; }