public RegisterEventInfoResult RegisterToEvent(EventRegistrationFormFields form, bool sendPasswordFields = true) { // act: "event-register" StatusInfo status; // TODO: UrlEncode?? var requestString = sendPasswordFields ? $"sco-id={form.ScoId}&login={UrlEncode(form.Login)}&first-name={form.FirstName}&last-name={form.LastName}&email={UrlEncode(form.Email)}&password={form.Password}&password-verify={form.VerifyPassword}" : $"sco-id={form.ScoId}&login={UrlEncode(form.Login)}&first-name={form.FirstName}&last-name={form.LastName}&email={UrlEncode(form.Email)}"; if (form.AdditionalFields != null && form.AdditionalFields.Values.Any()) { foreach (var key in form.AdditionalFields.Keys) { requestString += $"&interaction-id={key}&response={form.AdditionalFields[key]}"; } } var doc = this.requestProcessor.Process("event-register", requestString, out status); if (ResponseIsOk(doc, status)) { Principal result = PrincipalParser.Parse(doc.SelectSingleNode("//principal ")); return(new RegisterEventInfoResult(status, result)); } return(new RegisterEventInfoResult(status)); }
/// <summary> /// Creates or updates a user or group. The user or group (that is, the principal) is created or /// updated in the same account as the user making the call. /// </summary> /// <param name="principalSetup">The principal setup.</param> /// <returns>Status Info.</returns> public PrincipalResult PrincipalUpdate(PrincipalSetup principalSetup, bool isUpdateOperation = false) { // action=principal-update var commandParams = QueryStringBuilder.EntityToQueryString(principalSetup, isUpdateOperation); StatusInfo status; var doc = requestProcessor.Process(Commands.Principal.Update, commandParams, out status); return(new PrincipalResult(status, PrincipalParser.Parse(doc))); }
/// <summary> /// Creates or updates a user or group. The user or group (that is, the principal) is created or /// updated in the same account as the user making the call. /// </summary> /// <param name="principalDelete">The principal setup.</param> /// <returns>Status Info.</returns> public PrincipalResult PrincipalDelete(PrincipalDelete principalDelete) { // action=principals-delete var commandParams = QueryStringBuilder.EntityToQueryString(principalDelete); StatusInfo status; var doc = this.requestProcessor.Process(Commands.Principal.Delete, commandParams, out status); return(new PrincipalResult(status, PrincipalParser.Parse(doc))); }