Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions MailUpExample/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ <h1><strong>MailUp Demo Client</strong></h1>
var param = params[i].split("=");
if (param[0]=="code") { // We have code returned from MailUp
var code = param[1];
mailUp.retreiveAccessTokenWithCode(code, function(token) {
mailUp.retrieveAccessTokenWithCode(code, function(token) {
authorized(token);
isToken(token);
expireTimer();
Expand All @@ -74,7 +74,7 @@ <h1><strong>MailUp Demo Client</strong></h1>

function Init(){
var opt = document.getElementById("lstEndpoint").options;
var getToken = mailUp.getAccessToken1();
var getToken = mailUp.getAccessToken1();
opt[1].value = mailUp.getMailstatisticsEndpoint();
opt[0].value = mailUp.getConsoleEndpoint();
if (getToken == "") {
Expand Down Expand Up @@ -199,7 +199,7 @@ <h1><strong>MailUp Demo Client</strong></h1>
if (accessTokenExpire) {
timer = (accessTokenExpire - (new Date()).getTime()) / 1000;
if (refreshInterval != 0) {
clearInterval(refreshInterval);
clearInterval(refreshInterval);
}
startTimer(timer, document.querySelector('#expiresInTimer'));
} else {
Expand Down Expand Up @@ -247,7 +247,7 @@ <h1><strong>MailUp Demo Client</strong></h1>
var url4 = "/Console/Import/" + importId;
messageResult = "Check the import result";
mailUp.callMethod(mailUp.getConsoleEndpoint() + url4, "GET", null, "JSON", function(body, data) {

errorResult = "Example methods completed successfully";
$(".example1").append(jQuery.validator.format(answer, messageResult, "GET", "JSON", "Console", url4, body? body : "", data));
$(".example1").append(jQuery.validator.format(successfullyAnswer, errorResult));
Expand Down Expand Up @@ -318,7 +318,7 @@ <h1><strong>MailUp Demo Client</strong></h1>
function runExample2() {
var messageResult = "";
var errorResult = "";
var imgId = "img2";
var imgId = "img2";
showImage(imgId, false);
$(".example2").children().not(".btn-success, .img").remove();
// Request for recipient in a group
Expand Down Expand Up @@ -534,7 +534,7 @@ <h1><strong>MailUp Demo Client</strong></h1>
var url3 = "/Console/List/"+LIST_ID+"/Email/" + emailId + "/Attachment/1";
messageResult = "Add an attachment";
mailUp.callMethod(mailUp.getConsoleEndpoint() + url3, "POST", attachmentRequest, "JSON", function(body, data) {

$(".example5").append(jQuery.validator.format(answer, messageResult, "POST", "JSON", "Console", url3, body? body : "", data));

// Retrieve message details
Expand Down Expand Up @@ -659,7 +659,7 @@ <h1><strong>MailUp Demo Client</strong></h1>
mailUp.callMethod(mailUp.getConsoleEndpoint() + url1, "POST", null, "JSON", function(body, data) {

errorResult = "Example methods completed successfully";
$(".example7").append(jQuery.validator.format(answer, messageResult, "POST", "JSON", "Console", url1, body? body : "", data));
$(".example7").append(jQuery.validator.format(answer, messageResult, "POST", "JSON", "Console", url1, body? body : "", data));
$(".example7").append(jQuery.validator.format(successfullyAnswer, errorResult));
showImage(imgId, true);

Expand Down
30 changes: 15 additions & 15 deletions MailUpExample/mailupclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function MailUpClient(inClientId, inClientSecret, inCallbackUri) {
this.tokenEndpoint = "https://services.mailup.com/Authorization/OAuth/Token";
this.consoleEndpoint = "https://services.mailup.com/API/v1.1/Rest/ConsoleService.svc";
this.mailstatisticsEndpoint = "https://services.mailup.com/API/v1.1/Rest/MailStatisticsService.svc";

this.clientId = inClientId;
this.clientSecret = inClientSecret;
this.callbackUri = inCallbackUri;
Expand Down Expand Up @@ -63,43 +63,43 @@ MailUpClient.prototype.getAjax = function() {
} else if (window.XMLHttpRequest) return new XMLHttpRequest();
else return false;
}

MailUpClient.prototype.getLogonEndpoint = function() {
return this.logonEndpoint;
}

MailUpClient.prototype.setLogonEndpoint = function(value) {
return this.logonEndpoint = value;
}

MailUpClient.prototype.getAuthorizationEndpoint = function() {
return this.authorizationEndpoint;
}

MailUpClient.prototype.setAuthorizationEndpoint = function(value) {
return this.authorizationEndpoint = value;
}

MailUpClient.prototype.getTokenEndpoint = function() {
return this.tokenEndpoint;
}

MailUpClient.prototype.setTokenEndpoint = function(value) {
return this.tokenEndpoint = value;
}

MailUpClient.prototype.getConsoleEndpoint = function() {
return this.consoleEndpoint;
}

MailUpClient.prototype.setConsoleEndpoint = function(value) {
return this.consoleEndpoint = value;
}

MailUpClient.prototype.getMailstatisticsEndpoint = function() {
return this.mailstatisticsEndpoint;
}

MailUpClient.prototype.setMailstatisticsEndpoint = function(value) {
return this.mailstatisticsEndpoint = value;
}
Expand Down Expand Up @@ -131,10 +131,10 @@ MailUpClient.prototype.logOn = function() {
}

MailUpClient.prototype.logOnWithUsernamePassword = function(username,password,onSuccess,onError) {
this.retreiveAccessToken(username,password,onSuccess,onError);
this.retrieveAccessToken(username,password,onSuccess,onError);
}

MailUpClient.prototype.retreiveAccessTokenWithCode = function(code, onSuccess, onError) {
MailUpClient.prototype.retrieveAccessTokenWithCode = function(code, onSuccess, onError) {
var url = this.getTokenEndpoint() + "?code=" + code + "&grant_type=authorization_code";
var request = this.getAjax();
var m = this;
Expand All @@ -156,7 +156,7 @@ MailUpClient.prototype.retreiveAccessTokenWithCode = function(code, onSuccess, o
request.send(null);
}

MailUpClient.prototype.retreiveAccessToken = function(login, password, onSuccess, onError) {
MailUpClient.prototype.retrieveAccessToken = function(login, password, onSuccess, onError) {
var url = this.getTokenEndpoint();
var body = "grant_type=password&client_id=" + this.clientId + "&client_secret=" + this.clientSecret + "&username=" + encodeURIComponent(login) + "&password=" + encodeURIComponent(password);
var request = this.getAjax();
Expand All @@ -183,7 +183,7 @@ MailUpClient.prototype.retreiveAccessToken = function(login, password, onSuccess
} else {
request.send(null);
}

}

MailUpClient.prototype.refreshAccessToken = function(onSuccess, onError) {
Expand Down