1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-15 07:43:37 +00:00

initial commit

This commit is contained in:
Kyle Spearrin
2016-05-02 02:52:09 -04:00
commit bc3d9c4465
95 changed files with 9245 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
using System.Net;
namespace Bit.App.Models.Api
{
public class ApiError
{
public string Message { get; set; }
public HttpStatusCode StatusCode { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
using System.Collections.Generic;
namespace Bit.App.Models.Api
{
public class ApiResult<T>
{
private List<ApiError> m_errors = new List<ApiError>();
public bool Succeeded { get; private set; }
public T Result { get; set; }
public IEnumerable<ApiError> Errors => m_errors;
public static ApiResult<T> Success(T result)
{
return new ApiResult<T>
{
Succeeded = true,
Result = result
};
}
public static ApiResult<T> Failed(params ApiError[] errors)
{
var result = new ApiResult<T> { Succeeded = false };
if(errors != null)
{
result.m_errors.AddRange(errors);
}
return result;
}
}
}

View File

@@ -0,0 +1,7 @@
namespace Bit.App.Models.Api
{
public class FolderRequest
{
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
namespace Bit.App.Models.Api
{
public class SiteRequest
{
public string FolderId { get; set; }
public string Name { get; set; }
public string Uri { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public string Notes { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
namespace Bit.App.Models.Api
{
public class TokenRequest
{
public string Email { get; set; }
public string MasterPasswordHash { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using System.Collections.Generic;
namespace Bit.App.Models.Api
{
public class ErrorResponse
{
public string Message { get; set; }
public Dictionary<string, IEnumerable<string>> ValidationErrors { get; set; }
// For use in development environments.
public string ExceptionMessage { get; set; }
public string ExceptionStackTrace { get; set; }
public string InnerExceptionMessage { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
namespace Bit.App.Models.Api
{
public class FolderResponse
{
public string Id { get; set; }
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
namespace Bit.App.Models.Api
{
public class ProfileResponse
{
public string Id { get; set; }
public string Name { get; set; }
public string Email { get; set; }
public string MasterPasswordHint { get; set; }
public string Culture { get; set; }
public bool TwoFactorEnabled { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
namespace Bit.App.Models.Api
{
public class SiteResponse
{
public string Id { get; set; }
public string FolderId { get; set; }
public string Name { get; set; }
public string Uri { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public string Notes { get; set; }
// Expandables
public FolderResponse Folder { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
namespace Bit.App.Models.Api
{
public class TokenResponse
{
public string Token { get; set; }
public ProfileResponse Profile { get; set; }
}
}