/// <summary> /// Returns information about principal-to-SCO transactions on your server or in your hosted account. /// A transaction is an instance of one principal visiting one SCO. The SCO can be an Acrobat /// Connect Professional Meeting, Course, document, or any Content on the server. /// Note: this call to report-bulk-consolidated-transactions, with filter-Type=Meeting, returns only /// users who logged in to the Meeting as participants, not users who entered the Meeting as guests. /// </summary> /// <param name="adobeConnectXmlApi">The adobe connect XML API.</param> /// <param name="filterBy">optional 'filter by' params</param> /// <returns> /// <see cref="EnumerableResultStatus{T}" /> /// </returns> public static EnumerableResultStatus <TransactionInfo> Report_ConsolidatedTransactions(this AdobeConnectXmlAPI adobeConnectXmlApi, string filterBy) { ApiStatus s = adobeConnectXmlApi.ProcessApiRequest("report-bulk-consolidated-transactions", filterBy); var resultStatus = Helpers.WrapBaseStatusInfo <EnumerableResultStatus <TransactionInfo> >(s); if (s.Code != StatusCodes.OK || s.ResultDocument == null) { return(resultStatus); } IEnumerable <XElement> list; try { IEnumerable <XElement> nodeData = s.ResultDocument.XPathSelectElements("//row"); list = nodeData as IList <XElement> ?? nodeData; } catch (Exception ex) { throw; } resultStatus.Result = list.Select(itemInfo => XmlSerializerHelpersGeneric.FromXML <TransactionInfo>(itemInfo.CreateReader(), new XmlRootAttribute("row"))); return(resultStatus); }
/// <summary> /// Provides a complete list of users and groups, including primary groups. /// </summary> /// <param name="adobeConnectXmlApi">The adobe connect XML API.</param> /// <param name="groupId">The group identifier.</param> /// <param name="filterBy">Optional filtering parameter.</param> /// <returns> /// <see cref="EnumerableResultStatus{T}" /> /// </returns> public static EnumerableResultStatus <PrincipalListItem> GetPrincipalList(this AdobeConnectXmlAPI adobeConnectXmlApi, string groupId, string filterBy) { ApiStatus s = adobeConnectXmlApi.ProcessApiRequest("principal-list", String.Format("group-id={0}&{1}", groupId, filterBy)); var resultStatus = Helpers.WrapBaseStatusInfo <EnumerableResultStatus <PrincipalListItem> >(s); if (s.Code != StatusCodes.OK || s.ResultDocument == null) { return(resultStatus); } IEnumerable <XElement> list; try { IEnumerable <XElement> nodeData = s.ResultDocument.XPathSelectElements("//principal-list/principal"); list = nodeData as IList <XElement> ?? nodeData; } catch (Exception ex) { throw; } resultStatus.Result = list.Select(itemInfo => XmlSerializerHelpersGeneric.FromXML <PrincipalListItem>(itemInfo.CreateReader())); return(resultStatus); }
private static LiveModel CreateLiveModelOrExit(string clientJsonPath) { if (!File.Exists(clientJsonPath)) { WriteErrorAndExit($"Could not find file with path '{clientJsonPath}'."); } string json = File.ReadAllText(clientJsonPath); ApiStatus apiStatus = new ApiStatus(); Configuration config; if (!Configuration.TryLoadConfigurationFromJson(json, out config, apiStatus)) { WriteStatusAndExit(apiStatus); } LiveModel liveModel = new LiveModel(config); if (!liveModel.TryInit(apiStatus)) { WriteStatusAndExit(apiStatus); } liveModel.BackgroundError += LiveModel_BackgroundError; return(liveModel); }
void ISender.Init(ApiStatus status) { if (this.Init != null) { this.Init(status); } }
void ISender.Send(SharedBuffer buffer, ApiStatus status) { if (this.Send != null) { this.Send(buffer, status); } }
/// <summary> /// Provides information about all Acrobat Connect meetings for which the user is a Host, invited /// participant, or registered guest. The Meeting can be scheduled in the past, present, or future. /// </summary> /// <param name="adobeConnectXmlApi">The adobe connect XML API.</param> /// <param name="likeName">filter like the Name of the Meeting</param> /// <returns> /// <see cref="EnumerableResultStatus{T}" /> /// </returns> public static async Task <EnumerableResultStatus <MeetingItem> > GetMyMeetings(this AdobeConnectXmlAPI adobeConnectXmlApi, string likeName) { string filterName = null; if (!String.IsNullOrEmpty(likeName)) { filterName = @"filter-like-name=" + likeName; } ApiStatus s = await adobeConnectXmlApi.ProcessApiRequest("report-my-meetings", filterName); var resultStatus = Helpers.WrapBaseStatusInfo <EnumerableResultStatus <MeetingItem> >(s); if (s.Code != StatusCodes.OK || s.ResultDocument == null) { return(resultStatus); } IEnumerable <XElement> list; try { IEnumerable <XElement> meetingsData = s.ResultDocument.XPathSelectElements("//my-meetings/meeting"); list = meetingsData as IList <XElement> ?? meetingsData; } catch (Exception ex) { throw ex.InnerException; } resultStatus.Result = adobeConnectXmlApi.PreProcessMeetingItems(list, new XmlRootAttribute("meeting")); return(resultStatus); }
public ApiResult(ApiStatus status = ApiStatus.OK, string message = "success", object data = null, ApiResultPage page = null) { this.Status = status; this.Message = message; this.Data = data; this.Page = page; }
public async Task <ApiStatus> ProcessRequest(string pAction, string qParams) { if (qParams == null) { qParams = string.Empty; } var url = string.Format(@"?action={0}&{1}", pAction, qParams); if (!Settings.ServiceURL.EndsWith("/api/xml")) { url = "/api/xml" + url; } ApiStatus operationApiStatus = new ApiStatus(); operationApiStatus.Code = StatusCodes.NotSet; var receiveStream = await ProcessRequestInternal(url); using (var readStream = new StreamReader(receiveStream, Encoding.UTF8)) { string buf = await readStream.ReadToEndAsync(); operationApiStatus = Helpers.ResolveOperationStatusFlags(new XmlTextReader(new StringReader(buf), true)); //AG: not sure } if (this.Settings.UseSessionParam) { operationApiStatus.SessionInfo = this.m_SessionInfo; } return(operationApiStatus); }
/// <summary> /// Provides information about each event the current user has attended or is scheduled to attend. /// The user can be either a Host or a participant in the event. The events returned are those in the /// user’s my-events Folder. /// To obtain information about all events on your Enterprise Server or in your Enterprise Hosted /// account, call sco-shortcuts to get the sco-id of the events Folder. Then, call scocontents /// with the sco-id to list all events. /// </summary> /// <param name="adobeConnectXmlApi">The adobe connect XML API.</param> /// <returns> /// <see cref="EnumerableResultStatus{T}" /> /// </returns> public static EnumerableResultStatus <EventInfo> ReportMyEvents(this AdobeConnectXmlAPI adobeConnectXmlApi) { ApiStatus s = adobeConnectXmlApi.ProcessApiRequest("report-my-events", null); var resultStatus = Helpers.WrapBaseStatusInfo <EnumerableResultStatus <EventInfo> >(s); if (s.Code != StatusCodes.OK || s.ResultDocument == null) { return(resultStatus); } IEnumerable <XElement> list; try { IEnumerable <XElement> nodeData = s.ResultDocument.XPathSelectElements("//my-events/event"); list = nodeData as IList <XElement> ?? nodeData; } catch (Exception ex) { throw; } resultStatus.Result = list.Select(itemInfo => XmlSerializerHelpersGeneric.FromXML <EventInfo>(itemInfo.CreateReader(), new XmlRootAttribute("event"))); return(resultStatus); }
/// <summary> /// Returns the list of principals (users or groups) who have permissions to act on a SCO, /// principal, or account. /// </summary> /// <param name="adobeConnectXmlApi">The adobe connect XML API.</param> /// <param name="aclId">*Required. /// The ID of a SCO, account, or principal /// that a principal has permission to act /// on. The acl-id is a sco-id, principalid, /// or account-id in other calls.</param> /// <param name="principalId">Optional. /// The ID of a user or group who has a /// permission (even if Denied or not set) to /// act on a SCO, an account, or another principal.</param> /// <param name="filter">Optional filtering parameter.</param> /// <returns> /// <see cref="EnumerableResultStatus{T}" /> /// </returns> public static EnumerableResultStatus <PermissionInfo> GetPermissionsInfo(this AdobeConnectXmlAPI adobeConnectXmlApi, string aclId, string principalId, string filter) { ApiStatus s = adobeConnectXmlApi.ProcessApiRequest("permissions-info", String.Format("acl-id={0}&principal-id={1}&filter-definition={2}", aclId, principalId, filter)); var resultStatus = Helpers.WrapBaseStatusInfo <EnumerableResultStatus <PermissionInfo> >(s); if (s.Code != StatusCodes.OK || s.ResultDocument == null) { return(resultStatus); } IEnumerable <XElement> list; try { IEnumerable <XElement> nodeData = s.ResultDocument.XPathSelectElements("//permissions/principal"); list = nodeData as IList <XElement> ?? nodeData; } catch (Exception ex) { throw; } resultStatus.Result = list.Select(itemInfo => XmlSerializerHelpersGeneric.FromXML <PermissionInfo>(itemInfo.CreateReader())); return(resultStatus); }
/// <summary> /// Provides information about a SCO on Connect Enterprise. The object can have any valid /// SCO Type. See Type for a list of the allowed SCO types. /// The response includes the account the SCO belongs to, the dates it was created and last /// modified, the owner, the URL that reaches it, and other data. For some types of SCOs, the /// response also includes information about a template from which this SCO was created. /// </summary> /// <param name="adobeConnectXmlApi">The adobe connect XML API.</param> /// <param name="scoId">Meeting id</param> /// <returns> /// <see cref="EnumerableResultStatus{T}" /> /// </returns> public static MeetingDetailStatus GetMeetingDetail(this AdobeConnectXmlAPI adobeConnectXmlApi, string scoId) { ApiStatus s = adobeConnectXmlApi.ProcessApiRequest("sco-info", String.Format("sco-id={0}", scoId)); var resultStatus = Helpers.WrapBaseStatusInfo <MeetingDetailStatus>(s); if (s.Code != StatusCodes.OK || s.ResultDocument == null) { return(resultStatus); } try { XElement nodeData = s.ResultDocument.XPathSelectElement("//sco"); if (nodeData == null || !nodeData.HasElements) { return(null); } resultStatus.Result = XmlSerializerHelpersGeneric.FromXML <MeetingDetail>(nodeData.CreateReader(), new XmlRootAttribute("sco")); resultStatus.Result.FullUrl = adobeConnectXmlApi.ResolveFullUrl(resultStatus.Result.UrlPath); return(resultStatus); } catch (Exception ex) { throw; } }
private LiveModel ConfigureLiveModel() { Configuration config; ApiStatus apiStatus = new ApiStatus(); if (!Configuration.TryLoadConfigurationFromJson(PseudoLocConfigJson, out config, apiStatus)) { Assert.Fail("Failed to parse pseudolocalized configuration JSON: " + apiStatus.ErrorMessage); } TempFileDisposable interactionDisposable = new TempFileDisposable(); this.TestCleanup.Add(interactionDisposable); TempFileDisposable observationDisposable = new TempFileDisposable(); this.TestCleanup.Add(observationDisposable); config["interaction.file.name"] = interactionDisposable.Path; config["observation.file.name"] = observationDisposable.Path; LiveModel liveModel = new LiveModel(config); liveModel.Init(); liveModel.RefreshModel(); return(liveModel); }
/// <summary> /// List all meetings on the server /// </summary> /// <param name="adobeConnectXmlApi">The adobe connect XML API.</param> /// <param name="likeName">filter like the Name of the Meeting</param> /// <returns> /// <see cref="EnumerableResultStatus{T}" /> /// </returns> public static EnumerableResultStatus <MeetingItem> GetAllMeetings(this AdobeConnectXmlAPI adobeConnectXmlApi, string likeName) { string filterName = String.Empty; if (!String.IsNullOrEmpty(likeName)) { filterName = @"&filter-like-name=" + likeName; } ApiStatus s = adobeConnectXmlApi.ProcessApiRequest("report-bulk-objects", "filter-type=meeting" + filterName); var resultStatus = Helpers.WrapBaseStatusInfo <EnumerableResultStatus <MeetingItem> >(s); if (s.Code != StatusCodes.OK || s.ResultDocument == null || s.ResultDocument.Root == null) { return(resultStatus); } IEnumerable <XElement> list; try { IEnumerable <XElement> meetingsData = s.ResultDocument.XPathSelectElements("//report-bulk-objects/row"); list = meetingsData as IList <XElement> ?? meetingsData; } catch (Exception ex) { throw; } resultStatus.Result = adobeConnectXmlApi.PreProcessMeetingItems(list, new XmlRootAttribute("row")); return(resultStatus); }
/// <summary> /// Provides information about the folders relevant to the current user. These include a Folder for /// the user’s current meetings, a Folder for the user’s Content, as well as folders above them in the /// navigation hierarchy. /// To determine the URL of a SCO, concatenate the url-path returned by sco-info, scocontents, /// or sco-expanded-contents with the domain-Name returned by sco-shortcuts. /// For example, you can concatenate these two strings: /// - http://test.server.com (the domain-Name returned by sco-shortcuts) /// - /f2006123456/ (the url-path returned by sco-info, sco-contents, or scoexpanded-contents) /// The result is this URL: http://test.server.com/f2006123456/ /// You can also call sco-contents with the sco-id of a Folder returned by sco-shortcuts to /// see the contents of the Folder. /// </summary> /// <param name="adobeConnectXmlApi">The adobe connect XML API.</param> /// <returns> /// <see cref="EnumerableResultStatus{T}" /> /// </returns> public static EnumerableResultStatus <ScoShortcut> GetSCOshortcuts(this AdobeConnectXmlAPI adobeConnectXmlApi) { ApiStatus s = adobeConnectXmlApi.ProcessApiRequest("sco-shortcuts", null); var resultStatus = Helpers.WrapBaseStatusInfo <EnumerableResultStatus <ScoShortcut> >(s); if (s.Code != StatusCodes.OK || s.ResultDocument == null) { return(resultStatus); } IEnumerable <XElement> list; try { IEnumerable <XElement> nodeData = s.ResultDocument.XPathSelectElements("//shortcuts/sco"); list = nodeData as IList <XElement> ?? nodeData; } catch (Exception ex) { throw; } resultStatus.Result = list.Select(itemInfo => XmlSerializerHelpersGeneric.FromXML <ScoShortcut>(itemInfo.CreateReader())); return(resultStatus); }
public static void PdfExample(string configPath) { const float outcome = 1.0f; const string eventId = "event_id"; const string contextJson = "{\"GUser\":{\"id\":\"a\",\"major\":\"eng\",\"hobby\":\"hiking\"},\"_multi\":[ { \"TAction\":{\"a1\":\"f1\"} },{\"TAction\":{\"a2\":\"f2\"}}],\"p\":[0.2, 0.8]}"; LiveModel liveModel = Helpers.CreateLiveModelOrExit(configPath); ApiStatus apiStatus = new ApiStatus(); RankingResponse rankingResponse = new RankingResponse(); if (!liveModel.TryChooseRank(eventId, contextJson, rankingResponse, apiStatus)) { Helpers.WriteStatusAndExit(apiStatus); } long actionId; if (!rankingResponse.TryGetChosenAction(out actionId, apiStatus)) { Helpers.WriteStatusAndExit(apiStatus); } Console.WriteLine($"Chosen action id: {actionId}"); if (!liveModel.TryQueueOutcomeEvent(eventId, outcome, apiStatus)) { Helpers.WriteStatusAndExit(apiStatus); } }
/// <summary> /// Returns a list of SCOs within another SCO. The enclosing SCO can be a Folder, Meeting, or /// Curriculum. /// In general, the contained SCOs can be of any type meetings, courses, curriculums, Content, /// events, folders, trees, or links (see the list in Type). However, the Type of the contained SCO /// needs to be valid for the enclosing SCO. For example, courses are contained within /// curriculums, and Meeting Content is contained within meetings. /// Because folders are SCOs, the returned list includes SCOs and subfolders at the next /// hierarchical level, but not the contents of the subfolders. To include the subfolder contents, /// call sco-expanded-contents. /// </summary> /// <param name="adobeConnectXmlApi">The adobe connect XML API.</param> /// <param name="scoId">Room/Folder ID</param> /// <returns> /// <see cref="EnumerableResultStatus{T}" /> /// </returns> public static EnumerableResultStatus <MeetingItem> GetMeetingsInRoom(this AdobeConnectXmlAPI adobeConnectXmlApi, string scoId) { ApiStatus s = adobeConnectXmlApi.ProcessApiRequest("sco-contents", String.Format("sco-id={0}", scoId)); var resultStatus = Helpers.WrapBaseStatusInfo <EnumerableResultStatus <MeetingItem> >(s); if (s.Code != StatusCodes.OK || s.ResultDocument == null) { return(resultStatus); } IEnumerable <XElement> list; try { IEnumerable <XElement> meetingsData = s.ResultDocument.XPathSelectElements("//sco"); list = meetingsData as IList <XElement> ?? meetingsData; } catch (Exception ex) { throw; } resultStatus.Result = adobeConnectXmlApi.PreProcessMeetingItems(list, new XmlRootAttribute("sco")); return(resultStatus); }
public void SpecialPermissionsUpdate() { string aclId = null; ApiStatus result = this.Api.SpecialPermissionsUpdate(aclId, SpecialPermissionId.Denied); Assert.AreEqual(StatusCodes.OK, result.Code); }
public void Invoke(ApiStatus status) { if (status != null) { this.callback(this.error_context, status.DangerousGetHandle()); GC.KeepAlive(status); } }
public void PermissionsReset() { string aclId = null; ApiStatus result = this.Api.PermissionsReset(aclId); Assert.AreEqual(StatusCodes.OK, result.Code); }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { JProperty property = JProperty.Load(reader); string value = property["status"].ToString(); ApiStatus status = (ApiStatus)Enum.Parse(typeof(ApiStatus), value.Replace("_", " ")); return(status); }
public static ApiResult CreateResult(ApiStatus status, string message = null, object data = null) { return(new ApiResult { Status = status, Message = message, Data = data }); }
public void PermissionsUpdate() { string aclId = null; string principalID = null; ApiStatus result = this.Api.PermissionsUpdate(aclId, principalID, PermissionId.View); Assert.AreEqual(StatusCodes.OK, result.Code); }
public ApiResult(ApiStatus status) { if (typeof(T) == typeof(bool)) { var res = status == ApiStatus.Success ? true : false; Result = (T)Convert.ChangeType(res, typeof(T)); } Status = status; }
public IHttpActionResult GetApiStatus() { ApiStatus status = new ApiStatus() { Version = "1.0.0" }; return(Ok(status)); }
private void SafeRaiseError(ApiStatus errorStatus) { EventHandler <ApiStatus> localHandler = this.OnError; if (localHandler != null) { localHandler(this, errorStatus); } }
public async Task TestApiStatusGenericBusinessException() { ApiStatus status = await StatusGenericBusinessException(); Assert.IsNotNull(status); Assert.IsFalse(status.IsSuccess); Assert.IsNull(status.ErrorCode); Assert.AreEqual("Message", status.ErrorMessage); Assert.AreEqual(0, status.ValidationErrors.Length); }
/// <summary> /// Updates the app version status of an app /// </summary> /// <param name="package">package of an app</param> /// <param name="version">version of an app</param> /// <param name="newStatus">status to update</param> /// <returns>Observable of an app</returns> public static IObservable<Application> UpdateAppVersionStatus(string package, string version, ApiStatus newStatus) { return RestEndpointFactory.Create<IApplicationsEndpoint>( SessionManager.Instance.CurrentLoggedUser) .UpdateAppVersionStatus(package, version, new AppVersion { Status = newStatus }) .ToObservable() .SubscribeOn(TaskPoolScheduler.Default) .InterpretingErrors(); }
public async Task TestGenericApiStatusValidationException() { ApiStatus <int> status = await GenericStatusValidationException(); Assert.IsNotNull(status); Assert.IsFalse(status.IsSuccess); Assert.IsNull(status.ErrorCode); Assert.IsNull(status.ErrorMessage); Assert.AreEqual(1, status.ValidationErrors.Length); }
public async Task TestApiStatusOk() { ApiStatus status = await StatusOk(); Assert.IsNotNull(status); Assert.IsTrue(status.IsSuccess); Assert.IsNull(status.ErrorCode); Assert.IsNull(status.ErrorMessage); Assert.AreEqual(0, status.ValidationErrors.Length); }
public async Task TestApiStatusUnknownException() { ApiStatus status = await StatusUnknownException(); Assert.IsNotNull(status); Assert.IsFalse(status.IsSuccess); Assert.IsNull(status.ErrorCode); Assert.AreEqual("The method or operation is not implemented.", status.ErrorMessage); Assert.AreEqual(0, status.ValidationErrors.Length); }
/// <summary> /// Changes a user’s password. /// <para>A password can be changed in either of these cases:</para> /// <para>- By an Administrator logged in to the account, with or without the user’s old password</para> /// <para>- By any Adobe Connect Server user, with the user’s principal-id number, login name, and old password</para> /// An Administrator can create rules for valid passwords on the server. /// These rules might include, for example, the number and types of characters a password must contain. /// If a user submits a new password that does not adhere to the rules, Adobe Connect would throw an error showing that the new password is invalid. /// <para>From <seealso href="https://helpx.adobe.com/adobe-connect/webservices/user-update-pwd.html">here</seealso>.</para> /// </summary> /// <param name="userId"></param> /// <param name="oldPassword"></param> /// <param name="password"></param> /// <returns> /// <see cref="ApiStatus" /> /// </returns> public static ApiStatus UpdatePassword(this AdobeConnectXmlAPI adobeConnectXmlApi, String userId, String oldPassword, String password) { // Password verify will probably be validated on the ui or another class before reaching this method. // Having that in mind, i'll send the password-verify equal to password var parameters = String.Format("user-id={0}&password-old={1}&password={2}&password-verify={2}", userId, oldPassword, password); ApiStatus s = adobeConnectXmlApi.ProcessApiRequest("user-update-pwd", parameters); return(s); }
public ApiException(ApiStatus status, String message) : base(message) { Status = status; }
public ApiException(ApiStatus status) : this(status, status.ToString()) { }