2016-09-20 23:47:21 +02:00
|
|
|
var CipherResponse = function (response) {
|
2016-09-03 07:13:09 +02:00
|
|
|
this.id = response.Id;
|
|
|
|
this.folderId = response.FolderId;
|
|
|
|
this.type = response.Type;
|
2016-09-07 05:30:49 +02:00
|
|
|
this.favorite = response.Favorite;
|
2016-09-03 07:13:09 +02:00
|
|
|
this.data = response.Data;
|
|
|
|
this.revisionDate = response.RevisionDate;
|
|
|
|
};
|
|
|
|
|
|
|
|
var FolderResponse = function (response) {
|
|
|
|
this.id = response.Id;
|
|
|
|
this.name = response.Name;
|
|
|
|
this.revisionDate = response.RevisionDate;
|
|
|
|
};
|
|
|
|
|
2017-01-04 00:40:07 +01:00
|
|
|
var LoginResponse = function (response) {
|
2016-09-03 07:13:09 +02:00
|
|
|
this.id = response.Id;
|
|
|
|
this.folderId = response.FolderId;
|
|
|
|
this.name = response.Name;
|
|
|
|
this.uri = response.Uri;
|
|
|
|
this.username = response.Username;
|
|
|
|
this.password = response.Password;
|
|
|
|
this.notes = response.Notes;
|
2016-09-07 05:30:49 +02:00
|
|
|
this.favorite = response.Favorite;
|
2016-09-03 07:13:09 +02:00
|
|
|
this.revisionDate = response.RevisionDate;
|
|
|
|
|
2016-09-20 23:47:21 +02:00
|
|
|
if (response.Folder) {
|
2016-09-03 07:13:09 +02:00
|
|
|
this.folder = new FolderResponse(response.Folder);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
var ProfileResponse = function (response) {
|
|
|
|
this.id = response.Id;
|
|
|
|
this.name = response.Name;
|
|
|
|
this.email = response.Email;
|
|
|
|
this.masterPasswordHint = response.MasterPasswordHint;
|
|
|
|
this.culture = response.Culture;
|
|
|
|
this.twoFactorEnabled = response.TwoFactorEnabled;
|
|
|
|
};
|
|
|
|
|
2017-01-18 05:07:46 +01:00
|
|
|
var IdentityTokenResponse = function (response) {
|
|
|
|
this.accessToken = response.access_token;
|
|
|
|
this.expiresIn = response.expires_in;
|
|
|
|
this.refreshToken = response.refresh_token;
|
|
|
|
this.tokenType = response.token_type;
|
|
|
|
|
|
|
|
// TODO: extras
|
|
|
|
};
|
|
|
|
|
2016-09-03 07:13:09 +02:00
|
|
|
var ListResponse = function (data) {
|
2016-09-07 05:30:49 +02:00
|
|
|
this.data = data;
|
2016-09-03 07:13:09 +02:00
|
|
|
};
|
|
|
|
|
2017-01-19 04:14:51 +01:00
|
|
|
var ErrorResponse = function (response, identityResponse) {
|
|
|
|
var errorModel = null;
|
|
|
|
if (identityResponse && identityResponse === true && response.responseJSON && response.responseJSON.ErrorModel) {
|
|
|
|
errorModel = response.responseJSON.ErrorModel;
|
|
|
|
}
|
|
|
|
else if (response.responseJSON) {
|
|
|
|
errorModel = response.responseJSON;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (errorModel) {
|
|
|
|
this.message = errorModel.Message;
|
|
|
|
this.validationErrors = errorModel.ValidationErrors;
|
2016-09-20 23:47:21 +02:00
|
|
|
}
|
2016-09-03 21:44:32 +02:00
|
|
|
this.statusCode = response.status;
|
2016-09-03 07:13:09 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
var DeviceResponse = function (response) {
|
|
|
|
this.id = response.Id;
|
|
|
|
this.name = response.Name;
|
|
|
|
this.identifier = response.Identifier;
|
|
|
|
this.type = response.Type;
|
|
|
|
this.creationDate = response.CreationDate;
|
|
|
|
};
|
|
|
|
|
|
|
|
var CipherHistoryResponse = function (response) {
|
|
|
|
this.revised = [];
|
|
|
|
|
|
|
|
var revised = response.Revised;
|
|
|
|
for (var i = 0; i < revised.length; i++) {
|
2017-01-14 17:20:44 +01:00
|
|
|
this.revised.push(new CipherResponse(revised[i]));
|
2016-09-03 07:13:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
this.deleted = response.Deleted;
|
|
|
|
};
|
2017-01-14 17:20:44 +01:00
|
|
|
|
|
|
|
var DomainsResponse = function (response) {
|
|
|
|
var GlobalDomainResponse = function (response) {
|
|
|
|
this.type = response.Type;
|
|
|
|
this.domains = response.Domains;
|
|
|
|
this.excluded = response.Excluded;
|
|
|
|
};
|
|
|
|
|
|
|
|
this.equivalentDomains = response.EquivalentDomains;
|
|
|
|
this.globalEquivalentDomains = [];
|
|
|
|
|
|
|
|
var globalEquivalentDomains = response.GlobalEquivalentDomains;
|
|
|
|
if (!globalEquivalentDomains) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
for (var i = 0; i < globalEquivalentDomains.length; i++) {
|
|
|
|
this.globalEquivalentDomains.push(new GlobalDomainResponse(globalEquivalentDomains[i]));
|
|
|
|
}
|
|
|
|
};
|