本文整理汇总了C#中RusticiSoftware.HostedEngine.Client.ServiceRequest类的典型用法代码示例。如果您正苦于以下问题:C# ServiceRequest类的具体用法?C# ServiceRequest怎么用?C# ServiceRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceRequest类属于RusticiSoftware.HostedEngine.Client命名空间,在下文中一共展示了ServiceRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateRegistration
/// <summary>
/// Create a new Registration (Instance of a user taking a course)
/// </summary>
/// <param name="registrationId">Unique Identifier for the registration</param>
/// <param name="courseId">Unique Identifier for the course</param>
/// <param name="versionId">Optional versionID, if Int32.MinValue, latest course version is used.</param>
/// <param name="learnerId">Unique Identifier for the learner</param>
/// <param name="learnerFirstName">Learner's first name</param>
/// <param name="learnerLastName">Learner's last name</param>
/// <param name="resultsPostbackUrl">URL to which the server will post results back to</param>
/// <param name="authType">Type of Authentication used at results postback time</param>
/// <param name="postBackLoginName">If postback authentication is used, the logon name</param>
/// <param name="postBackLoginPassword">If postback authentication is used, the password</param>
/// <param name="resultsFormat">The Format of the results XML sent to the postback URL</param>
public void CreateRegistration(string registrationId, string courseId, int versionId, string learnerId,
string learnerFirstName, string learnerLastName, string resultsPostbackUrl,
RegistrationResultsAuthType authType, string postBackLoginName, string postBackLoginPassword,
RegistrationResultsFormat resultsFormat)
{
ServiceRequest request = new ServiceRequest(configuration);
request.Parameters.Add("regid", registrationId);
request.Parameters.Add("courseid", courseId);
request.Parameters.Add("fname", learnerFirstName);
request.Parameters.Add("lname", learnerLastName);
request.Parameters.Add("learnerid", learnerId);
// Required on this signature but not by the actual service
request.Parameters.Add("authtype", Enum.GetName(authType.GetType(), authType).ToLower());
request.Parameters.Add("resultsformat", Enum.GetName(resultsFormat.GetType(), resultsFormat).ToLower());
// Optional:
if (!String.IsNullOrEmpty(resultsPostbackUrl))
request.Parameters.Add("postbackurl", resultsPostbackUrl);
if (!String.IsNullOrEmpty(postBackLoginName))
request.Parameters.Add("urlname", postBackLoginName);
if (!String.IsNullOrEmpty(postBackLoginPassword))
request.Parameters.Add("urlpass", postBackLoginPassword);
if (versionId != Int32.MinValue)
request.Parameters.Add("versionid", versionId);
request.CallService("rustici.registration.createRegistration");
}
示例2: Cancel
/// <summary>
/// Calling this method will cancel the export with the passed in export id.
/// </summary>
/// <param name="exportId"></param>
/// <returns>True if successfully canceled</returns>
public bool Cancel(String exportId)
{
ServiceRequest sr = new ServiceRequest(this.configuration);
sr.Parameters.Add("exportid", exportId);
sr.CallService("rustici.export.cancel");
return true;
}
示例3: SetAppLrsAuthCallbackUrl
public void SetAppLrsAuthCallbackUrl(String lrsAuthCallbackUrl)
{
ServiceRequest request = new ServiceRequest(configuration);
request.Parameters.Add("lrsAuthCallbackUrl", lrsAuthCallbackUrl);
request.CallService("rustici.lrsaccount.setAppLrsAuthCallbackUrl");
}
示例4: Start
/// <summary>
/// Calling this method will start a new data export, and return an id
/// that can be used to check on the status of the export using a call to Status
/// </summary>
/// <returns>The unique id for the started data export</returns>
public string Start()
{
ServiceRequest sr = new ServiceRequest(this.configuration);
XmlDocument response = sr.CallService("rustici.export.start");
XmlElement elem = (XmlElement)response.GetElementsByTagName("export_id")[0];
return elem.InnerText;
}
示例5: SetLearnerTags
/* LEARNER RELATED */
public string SetLearnerTags(string learnerID, string learnerTags)
{
ServiceRequest request = new ServiceRequest(configuration);
request.Parameters.Add("learnerid", learnerID);
request.Parameters.Add("tags", learnerTags);
XmlDocument response = request.CallService("rustici.tagging.setLearnerTags");
return response.InnerXml;
}
示例6: CreateNewInstance
/// <summary>
/// Creates a new instance of an existing registration. This essentially creates a
/// fresh take of a course by the user. The latest version of the associated course
/// will be used.
/// </summary>
/// <param name="registrationId">Unique Identifier for the registration</param>
/// <returns>Instance ID of the newly created instance</returns>
public int CreateNewInstance(string registrationId)
{
ServiceRequest request = new ServiceRequest(configuration);
request.Parameters.Add("regid", registrationId);
XmlDocument response = request.CallService("rustici.registration.createNewInstance");
XmlNodeList successNodes = response.GetElementsByTagName("success");
return Convert.ToInt32(successNodes[0].Attributes["instanceid"].Value);
}
示例7: GetDestinationList
/// <summary>
/// List of existing dispatch destinations in your account. Callers should assume
/// another page of data is available by calling again with the page parameter
/// incremented, until an empty list is returned.
/// </summary>
/// <param name="page">Which page of results to return. Page numbers start at 1.</param>
/// <param name="tags">A comma separated list of tags to filter results by. Results must be tagged with every tag in the list.</param>
/// <returns>List of Destination Data objects.</returns>
public List<DestinationData> GetDestinationList(int page, string tags)
{
ServiceRequest request = new ServiceRequest(configuration);
request.Parameters.Add("page", page);
if (!string.IsNullOrEmpty(tags))
request.Parameters.Add("tags", tags);
XmlDocument response = request.CallService("rustici.dispatch.getDestinationList");
return DestinationData.ConvertToDestinationDataList(response);
}
示例8: GetReportageAuth
public String GetReportageAuth(ReportageNavPermission navPermission, bool isAdmin)
{
ServiceRequest request = new ServiceRequest(configuration);
request.Parameters.Add("navpermission", navPermission.ToString().ToLower());
request.Parameters.Add("admin", isAdmin.ToString().ToLower());
XmlDocument response = request.CallService("rustici.reporting.getReportageAuth");
XmlNode authNode = response.GetElementsByTagName("auth")[0];
return authNode.InnerText;
}
示例9: CreateUser
/// <summary>
/// Creates a new FTP User
/// </summary>
/// <param name="userId">User ID</param>
/// <param name="userPass">User's Password</param>
/// <param name="permissionDomain">permission domain for the new user</param>
public void CreateUser(string userId, string userPass, string permissionDomain)
{
ServiceRequest request = new ServiceRequest(configuration);
request.Parameters.Add("userid", userId);
request.Parameters.Add("userpass", userPass);
if (!String.IsNullOrEmpty(permissionDomain))
request.Parameters.Add("pd", permissionDomain);
request.CallService("rustici.ftp.createUser");
}
示例10: ChangeStatus
/// <summary>
/// Change the accessibility status of the invitation
/// </summary>
/// <param name="invitationId">invitationId of the invite in question</param>
/// <param name="enable">whether to set the invite as launchable</param>
/// <param name="open">whether new regs can be created against the invite (for public invites only)</param>
public void ChangeStatus(String invitationId, bool enable, bool open)
{
ServiceRequest request = new ServiceRequest(configuration);
request.Parameters.Add("invitationId", invitationId);
request.Parameters.Add("enable", enable.ToString().ToLower());
request.Parameters.Add("open", open.ToString().ToLower());
request.CallService("rustici.invitation.changeStatus");
}
示例11: AddOrRemoveLearnerTag
public string AddOrRemoveLearnerTag(string learnerID, string learnerTag, string ADD_or_REMOVE)
{
ServiceRequest request = new ServiceRequest(configuration);
request.Parameters.Add("learnerid", learnerID);
request.Parameters.Add("tag", learnerTag);
string serviceToCall = "addLearnerTag";
if (ADD_or_REMOVE == "REMOVE") serviceToCall = "removeLearnerTag";
XmlDocument response = request.CallService("rustici.tagging." + serviceToCall);
return response.InnerXml;
}
示例12: GetReportUrl
/// <summary>
/// Calling this method returns a URL which will authenticate and launch a Reportage session, starting
/// at the specified Reportage URL entry point.
/// </summary>
/// <returns>A URL from which the export data can be downloaded</returns>
public String GetReportUrl(String reportageAuth, String reportUrl)
{
ServiceRequest request = new ServiceRequest(configuration);
//Relative path, auto add the right server name
string fullReportUrl = reportUrl;
if (reportUrl.StartsWith("/Reportage"))
{
fullReportUrl = "http://" + request.Server + reportUrl;
}
request.Parameters.Add("auth", reportageAuth);
request.Parameters.Add("reporturl", fullReportUrl);
return request.ConstructUrl("rustici.reporting.launchReport");
}
示例13: CreateDestination
/// <summary>
/// Create a new Dispatch Destination in your SCORM Cloud account.
/// </summary>
/// <param name="name">The name of the new destination.</param>
/// <param name="tags">A comma separated list of tags to add to this destination.</param>
/// <param name="email">The email address associated with the user creating this destination.</param>
/// <returns>The id for the newly created destination.</returns>
public string CreateDestination(string name, string tags, string email)
{
ServiceRequest request = new ServiceRequest(configuration);
request.Parameters.Add("name", name);
if (!string.IsNullOrEmpty(tags))
request.Parameters.Add("tags", tags);
if (!string.IsNullOrEmpty(email))
request.Parameters.Add("email", email);
XmlDocument response = request.CallService("rustici.dispatch.createDestination");
String destinationId = ((XmlElement)response
.GetElementsByTagName("destinationId")[0])
.FirstChild.InnerText;
return destinationId;
}
示例14: GetLearnerTags
public string[] GetLearnerTags(string learnerID)
{
ServiceRequest request = new ServiceRequest(configuration);
request.Parameters.Add("learnerid", learnerID);
XmlDocument tagsXMLDoc = request.CallService("rustici.tagging.getLearnerTags");
XmlNodeList tagNodes = tagsXMLDoc.GetElementsByTagName("tag");
string[] tags = new string[tagNodes.Count];
for (int t = 0; t < tagNodes.Count; t++)
{
string nextTag = tagNodes[t].InnerText;
tags[t] = nextTag;
}
return tags;
}
示例15: TestRegistrationPostUrl
/// <summary>
/// This method provides a way to test a URL for posting registration results back to, as they would be posted when using the postbackurl in the createRegistration call. When called, an example registration result will be posted to the URL given, or else an error will be reported regarding why the post failed.
/// </summary>
/// <param name="postbackUrl">Specifies a URL for which to post activity and status data in real time as the course is completed</param>
/// <param name="authType">Optional parameter to specify how to authorize against the given postbackurl, can be "form" or "httpbasic". If form authentication, the username and password for authentication are submitted as form fields "username" and "password", and the registration data as the form field "data". If httpbasic authentication is used, the username and password are placed in the standard Authorization HTTP header, and the registration data is the body of the message (sent as text/xml content type). This field is set to "form" by default.</param>
/// <param name="urlname">You can optionally specify a login name to be used for credentials when posting to the URL specified in postbackurl</param>
/// <param name="urlpass">If credentials for the postbackurl are provided, this must be included, it is the password to be used in authorizing the postback of data to the URL specified by postbackurl</param>
/// <param name="resultsFormat">This parameter allows you to specify a level of detail in the information that is posted back while the course is being taken. It may be one of three values: "course" (course summary), "activity" (activity summary, or "full" (full detail), and is set to "course" by default. The information will be posted as xml, and the format of that xml is specified below under the method "getRegistrationResult"</param>
/// <returns>Rsp containing result and status code</returns>
public Rsp TestRegistrationPostUrl(string postbackUrl, RegistrationResultsAuthType authType, string urlname, string urlpass, RegistrationResultsFormat resultsFormat)
{
ServiceRequest request = new ServiceRequest(configuration);
request.Parameters.Add("postbackurl", postbackUrl);
//Api call will fail without a placeholder username and password at least:
if (!String.IsNullOrEmpty(urlname))
{
request.Parameters.Add("name", urlname);
}
else
{
request.Parameters.Add("name", "placeholderLoginName");
}
if (!String.IsNullOrEmpty(urlpass))
{
request.Parameters.Add("password", urlpass);
}
else
{
request.Parameters.Add("password", "placeholderLoginPassword");
}
request.Parameters.Add("authtype", Enum.GetName(authType.GetType(), authType).ToLower());
request.Parameters.Add("resultformat", Enum.GetName(resultsFormat.GetType(), resultsFormat).ToLower());
XmlDocument response = request.CallService("rustici.registration.testRegistrationPostUrl");
XmlElement rspElement = ((XmlElement)response.GetElementsByTagName("rsp")[0]);
return new Rsp(rspElement);
}