Implement AuthenticateUser and CreateSession methods on class SocialvoidClient

Signed-off-by: Aliwoto <aminnimaj@gmail.com>
This commit is contained in:
Aliwoto 2021-09-30 15:40:28 +00:00
parent 936f7e2663
commit e39d416aa6
No known key found for this signature in database
GPG Key ID: 646B4FE4205EC48C
67 changed files with 6006 additions and 0 deletions

BIN
Socialvoid.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

22
Socialvoid.sln Normal file
View File

@ -0,0 +1,22 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Socialvoid", "Socialvoid\Socialvoid.csproj", "{6CB5C21A-EB16-48D6-B98A-F18D7CE46785}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBD}") = "Tests", "Tests\Tests.csproj", "{2EFF7FAB-7794-4BFA-AB48-998ADADC45A9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6CB5C21A-EB16-48D6-B98A-F18D7CE46785}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6CB5C21A-EB16-48D6-B98A-F18D7CE46785}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6CB5C21A-EB16-48D6-B98A-F18D7CE46785}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6CB5C21A-EB16-48D6-B98A-F18D7CE46785}.Release|Any CPU.Build.0 = Release|Any CPU
{2EFF7FAB-7794-4BFA-AB48-998ADADC45A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2EFF7FAB-7794-4BFA-AB48-998ADADC45A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2EFF7FAB-7794-4BFA-AB48-998ADADC45A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2EFF7FAB-7794-4BFA-AB48-998ADADC45A9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,214 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Buffers;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
using Microsoft;
using Microsoft.VisualStudio.Threading;
using Nerdbank.Streams;
using StreamJsonRpc;
using StreamJsonRpc.Protocol;
/// <summary>
/// A <see cref="IJsonRpcMessageHandler"/> that sends requests and receives responses over HTTP using <see cref="HttpClient"/>.
/// </summary>
/// <remarks>
/// See the spec for JSON-RPC over HTTP here: https://www.jsonrpc.org/historical/json-rpc-over-http.html.
/// Only the POST method is supported.
/// </remarks>
public class HttpClientMessageHandler : IJsonRpcMessageHandler
{
#nullable enable
private static readonly ReadOnlyCollection<string> AllowedContentTypes = new ReadOnlyCollection<string>(new string[]
{
"application/json-rpc",
"application/json",
"application/jsonrequest",
});
/// <summary>
/// The Content-Type header to use in requests.
/// </summary>
private static readonly MediaTypeHeaderValue ContentTypeHeader = new MediaTypeHeaderValue(AllowedContentTypes[0]);
/// <summary>
/// The Accept header to use in requests.
/// </summary>
private static readonly MediaTypeWithQualityHeaderValue AcceptHeader = new MediaTypeWithQualityHeaderValue(AllowedContentTypes[0]);
private readonly HttpClient httpClient;
private readonly Uri requestUri;
private readonly AsyncQueue<HttpResponseMessage> incomingMessages = new AsyncQueue<HttpResponseMessage>();
/// <summary>
/// Backing field for the <see cref="TraceSource"/> property.
/// </summary>
private TraceSource traceSource = new TraceSource(nameof(JsonRpc));
/// <summary>
/// Initializes a new instance of the <see cref="HttpClientMessageHandler"/> class
/// with the default <see cref="JsonMessageFormatter"/>.
/// </summary>
/// <param name="httpClient">The <see cref="HttpClient"/> to use for transmitting JSON-RPC requests.</param>
/// <param name="requestUri">The URI to POST to where the entity will be the JSON-RPC message.</param>
public HttpClientMessageHandler(HttpClient httpClient, Uri requestUri)
: this(httpClient, requestUri, new JsonMessageFormatter())
{
}
/// <summary>
/// Initializes a new instance of the <see cref="HttpClientMessageHandler"/> class.
/// </summary>
/// <param name="httpClient">The <see cref="HttpClient"/> to use for transmitting JSON-RPC requests.</param>
/// <param name="requestUri">The URI to POST to where the entity will be the JSON-RPC message.</param>
/// <param name="formatter">The message formatter.</param>
public HttpClientMessageHandler(HttpClient httpClient, Uri requestUri, IJsonRpcMessageFormatter formatter)
{
this.httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
this.requestUri = requestUri ?? throw new ArgumentNullException(nameof(requestUri));
this.Formatter = formatter ?? throw new ArgumentNullException(nameof(formatter));
}
/// <summary>
/// Event IDs raised to our <see cref="TraceSource"/>.
/// </summary>
public enum TraceEvent
{
/// <summary>
/// An HTTP response with an error status code was received.
/// </summary>
HttpErrorStatusCodeReceived,
}
/// <summary>
/// Gets or sets the <see cref="System.Diagnostics.TraceSource"/> used to trace details about the HTTP transport operations.
/// </summary>
/// <value>The value can never be null.</value>
/// <exception cref="ArgumentNullException">Thrown by the setter if a null value is provided.</exception>
public TraceSource TraceSource
{
get => this.traceSource;
set
{
Requires.NotNull(value, nameof(value));
this.traceSource = value;
}
}
/// <inheritdoc/>
public bool CanRead => true;
/// <inheritdoc/>
public bool CanWrite => true;
/// <inheritdoc/>
public IJsonRpcMessageFormatter Formatter { get; }
/// <inheritdoc/>
public async ValueTask<JsonRpcMessage?> ReadAsync(CancellationToken cancellationToken)
{
var response = await this.incomingMessages.DequeueAsync(cancellationToken).ConfigureAwait(false);
var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
using (var sequence = new Sequence<byte>())
{
#if NETCOREAPP2_1
int bytesRead;
do
{
var memory = sequence.GetMemory(4096);
bytesRead = await responseStream.ReadAsync(memory, cancellationToken).ConfigureAwait(false);
sequence.Advance(bytesRead);
}
while (bytesRead > 0);
#else
var buffer = ArrayPool<byte>.Shared.Rent(4096);
try
{
int bytesRead;
while (true)
{
bytesRead = await responseStream.ReadAsync(buffer, 0, buffer.Length).ConfigureAwait(false);
if (bytesRead == 0)
{
break;
}
var memory = sequence.GetMemory(bytesRead);
buffer.AsMemory(0, bytesRead).CopyTo(memory);
sequence.Advance(bytesRead);
}
}
finally
{
ArrayPool<byte>.Shared.Return(buffer);
}
#endif
return this.Formatter.Deserialize(sequence);
}
}
/// <inheritdoc/>
public async ValueTask WriteAsync(JsonRpcMessage content, CancellationToken cancellationToken)
{
// Cast here because we only support transmitting requests anyway.
var contentAsRequest = (JsonRpcRequest)content;
// The JSON-RPC over HTTP spec requires that we supply a Content-Length header, so we have to serialize up front
// in order to measure its length.
using (var sequence = new Sequence<byte>())
{
this.Formatter.Serialize(sequence, content);
var requestMessage = new HttpRequestMessage(HttpMethod.Post, this.requestUri);
requestMessage.Headers.Accept.Add(AcceptHeader);
requestMessage.Content = new StreamContent(sequence.AsReadOnlySequence.AsStream());
requestMessage.Content.Headers.ContentType = ContentTypeHeader;
requestMessage.Content.Headers.ContentLength = sequence.Length;
var response = await this.httpClient.SendAsync(requestMessage, cancellationToken).ConfigureAwait(false);
if (response.IsSuccessStatusCode)
{
VerifyThrowStatusCode(contentAsRequest.IsResponseExpected ? HttpStatusCode.OK : HttpStatusCode.NoContent, response.StatusCode);
}
else
{
this.TraceSource.TraceEvent(TraceEventType.Error, (int)TraceEvent.HttpErrorStatusCodeReceived, "Received HTTP {0} {1} response to JSON-RPC request for method \"{2}\".", (int)response.StatusCode, response.StatusCode, contentAsRequest.Method);
}
// The response is expected to be a success code, or an error code with a content-type that we can deserialize.
if (response.IsSuccessStatusCode || (response.Content?.Headers.ContentType?.MediaType is string mediaType && AllowedContentTypes.Contains(mediaType)))
{
// Some requests don't merit response messages, such as notifications in JSON-RPC.
// Servers may communicate this with 202 or 204 HTTPS status codes in the response.
// Others may (poorly?) send a 200 response but with an empty entity.
if (response.Content?.Headers.ContentLength > 0)
{
// Make the response available for receiving.
this.incomingMessages.Enqueue(response);
}
}
else
{
// Throw an exception because of the unexpected failure from the server without a JSON-RPC message attached.
response.EnsureSuccessStatusCode();
}
}
}
private static void VerifyThrowStatusCode(HttpStatusCode expected, HttpStatusCode actual)
{
if (expected != actual)
{
throw new BadRpcHeaderException($"Expected \"{(int)expected} {expected}\" response but received \"{(int)actual} {actual}\" instead.");
}
}
}

View File

@ -0,0 +1,561 @@
using System;
using System.Text.Encodings;
using System.Text;
using System.Net.Http;
using System.Collections.Generic;
using System.IO;
using StreamJsonRpc;
using StreamJsonRpc.Protocol;
using Socialvoid.Security;
using Socialvoid.JObjects;
using Socialvoid.Errors.ServerErrors;
using Socialvoid.Errors.AuthenticationErrors;
using Socialvoid.Errors.ValidationErrors;
using MType = System.Net.Http.Headers.MediaTypeHeaderValue;
namespace Socialvoid.Client
{
/// <summary>
/// Socialvoid client.
/// <code> since: v0.0.0 </code>
/// </summary>
public abstract class SocialvoidClient
{
//-------------------------------------------------
#region Constant's Region
/// <summary>
/// the content type of all of our http requests.
/// <code> since: v0.0.0 </code>
/// </summary>
protected internal const string ContentType = "application/json-rpc";
/// <summary>
/// the username key in jsonrpc request params.
/// <code> since: v0.0.0 </code>
/// </summary>
protected const string UsernameKey = "username";
/// <summary>
/// the password key in jsonrpc request params.
/// <code> since: v0.0.0 </code>
/// </summary>
protected const string PasswordKey = "password";
/// <summary>
/// the otp key in jsonrpc request params.
/// <code> since: v0.0.0 </code>
/// </summary>
protected const string OtpKey = "otp";
/// <summary>
/// the public hash key in jsonrpc request params.
/// <code> since: v0.0.0 </code>
/// </summary>
protected const string PublicHashKey = "public_hash";
/// <summary>
/// the private hash key in jsonrpc request params.
/// <code> since: v0.0.0 </code>
/// </summary>
protected const string PrivateHashKey = "private_hash";
/// <summary>
/// the platform key in jsonrpc request params.
/// <code> since: v0.0.0 </code>
/// </summary>
protected const string PlatformKey = "platform";
/// <summary>
/// the name key in jsonrpc request params.
/// <code> since: v0.0.0 </code>
/// </summary>
protected const string NameKey = "name";
/// <summary>
/// the version key in jsonrpc request params.
/// <code> since: v0.0.0 </code>
/// </summary>
protected const string VersionKey = "version";
/// <summary>
/// <c>authenticate_user</c> method value.
/// <code> since: v0.0.0 </code>
/// </summary>
protected const string AuthenticateUserMethod = "session.authenticate_user";
/// <summary>
/// <c>authenticate_user</c> method value.
/// <code> since: v0.0.0 </code>
/// </summary>
protected const string CreateSessionMethod = "session.create";
/// <summary>
/// <c>authenticate_user</c> method value.
/// <code> since: v0.0.0 </code>
/// </summary>
protected const string SessionIDKey = "session_identification";
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The public hash of the client.
/// <code> since: v0.0.0 </code>
/// </summary>
public string PublicHash { get; protected set; }
/// <summary>
/// The private hash of the client.
/// <code> since: v0.0.0 </code>
/// </summary>
public string PrivateHash { get; protected set; }
/// <summary>
/// The platform of the client.
/// <code> since: v0.0.0 </code>
/// </summary>
public string Platform { get; protected set; }
/// <summary>
/// The name of the client.
/// <code> since: v0.0.0 </code>
/// </summary>
public string ClientName { get; protected set; }
/// <summary>
/// The version of the client.
/// <code> since: v0.0.0 </code>
/// </summary>
public string Version { get; protected set; }
/// <summary>
///
/// <code> since: v0.0.0 </code>
/// </summary>
public HttpClient HttpClient { get; protected set; }
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
/// <summary>
/// <code> since: v0.0.0 </code>
/// </summary>
protected JsonMessageFormatter _formatter = new(Encoding.UTF8);
/// <summary>
/// the endpoint url of socialvoid servers.
/// <code> since: v0.0.0 </code>
/// </summary>
protected internal string _endpoint = "http://socialvoid.qlg1.com:5601/";
/// <summary>
/// Session object of this client.
/// <code> since: v0.0.0 </code>
/// </summary>
protected internal SessionEstablished _session;
/// <summary>
/// if the client should send an otp answer in the next request,
/// this field should be set to <c>true</c>.
/// <code> since: v0.0.0 </code>
/// </summary>
protected bool _should_otp;
/// <summary>
/// the last otp value of the client which should be sent in the
/// next jsonrpc request.
/// <code> since: v0.0.0 </code>
/// </summary>
protected string _otp;
/// <summary>
/// <code> since: v0.0.0 </code>
/// </summary>
protected readonly MType _contentTypeValue = MType.Parse(ContentType);
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of the <see cref="SocialvoidClient"/> class.
/// <code> since: v0.0.0 </code>
/// </summary>
/// <param name="publicHash">
/// the public hash of the client.
/// </param>
/// <param name="privateHash">
/// the private hash of the client.
/// </param>
/// <param name="platform">
/// the platform of the client.
/// </param>
/// <param name="name">
/// the client name.
/// </param>
/// <param name="version">
/// the version of the client.
/// </param>
protected SocialvoidClient(string publicHash, string privateHash,
string platform, string name, string version)
{
PublicHash = publicHash;
PrivateHash = privateHash;
Platform = platform;
ClientName = name;
Version = version;
HttpClient = new();
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
#region Initialize Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region Graphical Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region event Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region overrided Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region ordinary Method's Region
/// <summary>
/// CreateSession method (session.create), establishes a new session
/// to the network.
/// Please do notice that new and unauthenticated sessions
/// expires after 10 minutes of inactivity, authenticating to the session
/// will increase the expiration time to 72 hours of inactivity. This timer
/// is reset whenever the session is used in one way or another.
/// <code> since: v0.0.0 </code>
/// </summary>
/// <exception cref="InternalServerErrorException">
/// Thrown if the server encounters an internal error.
/// </exception>
/// <exception cref="InvalidClientNameException">
/// Thrown if the parameter passed as client name is not valid.
/// </exception>
/// <exception cref="InvalidClientPublicHashException">
/// Thrown if the parameter passed as public hash is not valid.
/// </exception>
/// <exception cref="InvalidClientPrivateHashException">
/// Thrown if the parameter passed as private hash is not valid.
/// </exception>
/// <exception cref="InvalidPlatformException">
/// Thrown if the parameter passed as platform is not valid.
/// </exception>
/// <exception cref="InvalidVersionException">
/// Thrown if the parameter passed as version is not valid.
/// </exception>
public virtual SessionEstablished CreateSession()
{
JArgs args = new(){
{PublicHashKey, PublicHash},
{PrivateHashKey, PrivateHash},
{PlatformKey, Platform},
//{NameKey, ClientName},
{VersionKey, Version},
};
var request = GetRpcRequest(CreateSessionMethod, args);
var message = new HttpRequestMessage(HttpMethod.Post, _endpoint);
message.Content = SerializeContent(request);
message.Content.Headers.ContentType = _contentTypeValue;
var jresp = ParseContent<SessionEstablished>(message);
return null;
}
/// <summary>
/// AuthenticateUser method (session.authenticate_user),
/// Authenticates a user via a Username and Password combination.
/// Optionally two-factor authentication if the account has enabled it.
/// Once authenticated, the session will be able to access methods that
/// requires authentication and preform operations as the authenticated
/// user.
/// <code> since: v0.0.0 </code>
/// </summary>
/// <param name="sessionID">
/// The Session Identification object.
/// </param>
/// <param name="username">
/// The username of the user to authenticate to.
/// </param>
/// <param name="password">
/// The password used to authenticate to this account.
/// </param>
/// <param name="otp">
/// The optional one-time password used to authenticate to this account.
/// It will be ignored by server if empty or larger than 64 characters.
/// </param>
/// <exception cref="InternalServerErrorException">
/// Thrown if the server encounters an internal error.
/// </exception>
/// <exception cref="AuthenticationFailureException">
/// Thrown if the authentication fails.
/// </exception>
/// <exception cref="AlreadyAuthenticatedException">
/// Thrown if the user is already authenticated.
/// </exception>
/// <exception cref="AuthenticationNotApplicableException">
/// Thrown if the user is not able to authenticate.
/// </exception>
/// <exception cref="BadSessionChallengeAnswerException">
/// Thrown if the session challenge answer is invalid.
/// </exception>
/// <exception cref="IncorrectLoginCredentialsException">
/// Thrown if the username or password is incorrect.
/// </exception>
/// <exception cref="IncorrectTwoFactorAuthenticationCodeException">
/// Thrown if the two-factor authentication code is incorrect.
/// </exception>
/// <exception cref="PrivateAccessTokenRequiredException">
/// Thrown if the user is not authenticated and the private access token is required.
/// </exception>
/// <exception cref="SessionExpiredException">
/// Thrown if the session has expired.
/// </exception>
/// <exception cref="TwoFactorAuthenticationRequiredException">
/// Thrown if two-factor authentication is required.
/// </exception>
public virtual void AuthenticateUser(SessionIdentification sessionID,
string username, string password, string otp = null)
{
JArgs args = new(){
{UsernameKey, username},
{PasswordKey, password},
{SessionIDKey, sessionID},
};
// check if the passed-by otp argument is valid or not.
// if yes, ignore _otp field and use user's specified otp value.
// otherwise check for _should_otp and see if we should send an
// otp answer or not.
if (IsOtpValid(otp))
{
args.Add(OtpKey, otp);
}
else if (_should_otp && IsOtpValid(otp))
{
// after adding otp answer to args, don't forget to set
// _should_otp to false (and _otp to null).
args.Add(OtpKey, _otp);
_should_otp = false;
_otp = null;
}
var request = GetRpcRequest(AuthenticateUserMethod, args);
var message = new HttpRequestMessage(HttpMethod.Post, _endpoint);
message.Content = SerializeContent(request);
message.Content.Headers.ContentType = _contentTypeValue;
var resp = HttpClient.Send(message);
var contentStr = ReadFromContent(resp.Content);
Console.WriteLine(contentStr);
}
#endregion
//-------------------------------------------------
#region Get Method's Region
/// <summary>
/// Gets the session of this <see cref="SocialvoidClient"/> if and only
/// if you have already established a session (or has loaded it from a file);
/// oterwise it will just return a null object instead of throwing an exception.
/// <code> since: v0.0.0 </code>
/// </summary>
public virtual SessionEstablished GetSession()
{
return _session;
}
/// <summary>
/// <code> since: v0.0.0 </code>
/// </summary>
/// <param name="method">
/// the method.
/// </param>
/// <param name="args">
/// the arguments.
/// </param>
/// <param name="id">
/// the request ID.
/// </param>
/// <param name="useID">
/// set it to `true` if you want this request to have requestID parameter
/// set. (if the passed-by id paramater is null, this method will generate
/// a new id itself.)
/// </param>
protected internal JRequest GetRpcRequest(string method,
JArgs args = null,
Nullable<long> id = null,
bool useID = true)
{
if (string.IsNullOrWhiteSpace(method))
{
throw new ArgumentException(
"method name in a rpc request cannot be null or empty",
nameof(method));
}
if (useID && (id == null))
{
id = DateTime.Now.Ticks;
}
return useID && id != null && id.HasValue ?
new()
{
Method = method,
Arguments = args,
ID = id.Value,
} :
new()
{
Method = method,
Arguments = args,
};
}
/// <summary>
/// <code> since: v0.0.0 </code>
/// </summary>
protected StringContent SerializeContent(JRequest request)
{
return new(request.Serialize());
}
/// <summary>
/// Parses the content of a <see cref="HttpContent"/> as a
/// <see cref="JResponse{T}"/>.
/// </summary>
/// <exception cref="OutOfMemoryException" />
/// <exception cref="IOException" />
protected internal JResponse<VType> ParseContent<VType>(
HttpRequestMessage message,
bool ex = true)
where VType : class
{
if (HttpClient == null)
{
throw new InvalidOperationException("HttpClient wasn't initialized");
}
var resp = HttpClient.Send(message);
if (resp == null)
{
throw new InvalidOperationException("HttpClient.Send returned null");
}
return ParseContent<VType>(resp.Content, ex);
}
#endregion
//-------------------------------------------------
#region Set Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region static Method's Region
/// <summary>
/// Creates a new instance of the <see cref="SocialvoidClient"/> class.
/// <code> since: v0.0.0 </code>
/// </summary>
/// <param name="publicHash">
/// the public hash of the client.
/// </param>
/// <param name="privateHash">
/// the private hash of the client.
/// </param>
/// <param name="platform">
/// the platform of the client.
/// </param>
/// <param name="name">
/// the client name.
/// </param>
/// <param name="version">
/// the version of the client.
/// </param>
public static SocialvoidClient GetClient(string publicHash, string privateHash,
string platform, string name, string version)
{
if (string.IsNullOrWhiteSpace(publicHash) || publicHash.Length != 64)
{
throw new ArgumentException(
"publicHash parameter is invalid",
nameof(publicHash));
}
if (string.IsNullOrWhiteSpace(privateHash) || privateHash.Length != 64)
{
throw new ArgumentException(
"privateHash parameter is invalid",
nameof(privateHash));
}
if (string.IsNullOrWhiteSpace(platform))
{
throw new ArgumentException(
"platform cannot be null or empty",
nameof(platform));
}
if (string.IsNullOrWhiteSpace(version))
{
throw new ArgumentException(
"version cannot be null or empty",
nameof(version));
}
return new SvClient(publicHash, privateHash, platform, name, version);
}
/// <summary>
/// Checks if a string can be sent as a TOTOP answer or not.
/// <code> since: v0.0.0 </code>
/// </summary>
/// <param name="otp">
/// the otp string to check.
/// </param>
/// <returns>
/// <c>true</c> if the otp string is valid; otherwise <c>false</c>.
/// </returns>
protected internal static bool IsOtpValid(string otp)
{
return !(string.IsNullOrWhiteSpace(otp) || otp.Length > 64);
}
/// <summary>
/// reads the content of a <see cref="HttpContent"/> as a string.
/// returns <c>null</c> if the stream cannot be read.
/// </summary>
/// <exception cref="OutOfMemoryException" />
/// <exception cref="IOException" />
protected internal static string ReadFromContent(HttpContent content)
{
var stream = content.ReadAsStream();
if (stream == null || !stream.CanRead)
{
return null;
}
return new StreamReader(stream).ReadToEnd();
}
/// <summary>
/// Parses the content of a <see cref="HttpContent"/> as a
/// <see cref="JResponse{T}"/>.
/// </summary>
/// <exception cref="OutOfMemoryException" />
/// <exception cref="IOException" />
protected internal static JResponse<VType> ParseContent<VType>(
HttpContent content,
bool ex = true)
where VType : class
{
var jresp = JResponse<VType>.Deserialize(ReadFromContent(content));
if (ex && jresp.HasError())
{
throw jresp.GetException();
}
return jresp;
}
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,84 @@
using System;
namespace Socialvoid.Client
{
internal sealed class SvClient : SocialvoidClient
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
// some members here
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
public SvClient(string publicHash, string privateHash,
string platform, string name, string version) :
base(publicHash, privateHash, platform, name, version)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
#region Initialize Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region Graphical Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region event Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region overrided Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region ordinary Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region Get Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region Set Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region static Method's Region
// some methods here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,85 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.AuthenticationErrors
{
/// <summary>
/// This exception will be raised when the client is attempting
/// to authenticate when already authenticated.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class AlreadyAuthenticatedException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.AlreadyAuthenticated"/> error code
/// will be returned because the client is attempting to
/// authenticate while it's already authenticated.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.AlreadyAuthenticated;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="AlreadyAuthenticatedException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal AlreadyAuthenticatedException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,88 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.AuthenticationErrors
{
/// <summary>
/// This exception will be raised when the authentication process failed
/// for some unexpected reason; you need to see the exception message
/// for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class AuthenticationFailureException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.AuthenticationFailure"/> error code
/// will be returned because the authentication process failed
/// for some unexpected reason;
/// please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.AuthenticationFailure;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of
/// <see cref="AuthenticationFailureException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal AuthenticationFailureException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,87 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.AuthenticationErrors
{
/// <summary>
/// This exception will be raised when the user does not support
/// this method of authentication;
/// please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class AuthenticationNotApplicableException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.AuthenticationNotApplicable"/> error code
/// will be returned because the user does not support this method
/// of authentication; please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.AuthenticationNotApplicable;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of
/// <see cref="AuthenticationNotApplicableException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal AuthenticationNotApplicableException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,85 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.AuthenticationErrors
{
/// <summary>
/// This exception will be raised when the given session challenge answer
/// is incorrect or out of sync.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class BadSessionChallengeAnswerException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.BadSessionChallengeAnswer"/> error code
/// will be returned because the given session challenge answer
/// is incorrect or out of sync.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.BadSessionChallengeAnswer;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="BadSessionChallengeAnswerException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal BadSessionChallengeAnswerException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,84 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.AuthenticationErrors
{
/// <summary>
/// This exception will be raised when the given login credentials
/// are incorrect.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class IncorrectLoginCredentialsException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.IncorrectLoginCredentials"/> error code
/// will be returned because the given login credentials are incorrect.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.IncorrectLoginCredentials;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="IncorrectLoginCredentialsException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal IncorrectLoginCredentialsException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,86 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.AuthenticationErrors
{
/// <summary>
/// This exception will be raised when the given two-factor
/// authentication code is incorrect.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class IncorrectTwoFactorAuthenticationCodeException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.IncorrectTwoFactorAuthenticationCode"/> error code
/// will be returned because the given two-factor authentication code
/// is incorrect.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.IncorrectTwoFactorAuthenticationCode;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of
/// <see cref="IncorrectTwoFactorAuthenticationCodeException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal IncorrectTwoFactorAuthenticationCodeException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,85 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.AuthenticationErrors
{
/// <summary>
/// This exception will be raised when the client attempts to
/// invoke a method that requires authentication.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class NotAuthenticatedException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.NotAuthenticated"/> error code
/// will be returned because the client attempts
/// to invoke a method that requires authentication.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.NotAuthenticated;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="NotAuthenticatedException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal NotAuthenticatedException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,88 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.AuthenticationErrors
{
/// <summary>
/// This exception will be raised when the user/entity uses a
/// Private Access Token to authenticate and the client attempted
/// to authenticate in another way.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class PrivateAccessTokenRequiredException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.PrivateAccessTokenRequired"/> error code
/// will be returned because the user/entity uses a
/// Private Access Token to authenticate and the client attempted
/// to authenticate in another way.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.PrivateAccessTokenRequired;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of
/// <see cref="PrivateAccessTokenRequiredException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal PrivateAccessTokenRequiredException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,19 @@
# Authentication Errors
These errors are raised when anything related to authentication has failed,
this can include things from when trying to authenticate to session
challenge errors.
| Name | Code | Hex Code | Deprecated | Versions | Description |
|--------------------------------------|------|----------|------------|----------|--------------------------------------------------------------------------------------------------------------------------------------|
| IncorrectLoginCredentials | 8704 | 0x02200 | No | 1.0 | The given login credentials are incorrect |
| IncorrectTwoFactorAuthenticationCode | 8705 | 0x02201 | No | 1.0 | The given two-factor authentication code is incorrect |
| AuthenticationNotApplicable | 8706 | 0x02202 | No | 1.0 | Raised when the user does not support this method of authentication, see the message for further details |
| SessionNotFound | 8707 | 0x02203 | No | 1.0 | Raised when the requested session was not found in the network |
| NotAuthenticated | 8708 | 0x02204 | No | 1.0 | Raised when the client attempts to invoke a method that requires authentication |
| PrivateAccessTokenRequired | 8709 | 0x02205 | No | 1.0 | Raised when the user/entity uses a Private Access Token to authenticate and the client attempted to authenticate in another way. |
| AuthenticationFailure | 8710 | 0x02206 | No | 1.0 | The authentication process failed for some unexpected reason, see the message for further details. |
| BadSessionChallengeAnswer | 8711 | 0x02207 | No | 1.0 | The given session challenge answer is incorrect or out of sync. |
| TwoFactorAuthenticationRequired | 8712 | 0x02208 | No | 1.0 | Two-Factor Authentication is required, the client must repeat the same request but provide a Two-Factor authentication code as well. |
| AlreadyAuthenticated | 8713 | 0x02209 | No | 1.0 | The client is attempting to authenticate when already authenticated |
| SessionExpired | 8714 | 0x0220a | No | 1.0 | Raised when trying to use a session that has expired |

View File

@ -0,0 +1,85 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.AuthenticationErrors
{
/// <summary>
/// This exception will be raised when the client tried to use a session
/// that has been expired.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class SessionExpiredException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.SessionExpired"/> error code
/// will be returned because the client tried to use a session
/// that has been expired.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.SessionExpired;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="SessionExpiredException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal SessionExpiredException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,85 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.AuthenticationErrors
{
/// <summary>
/// This exception will be raised when the requested session can
/// not be found in the database on server-side.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class SessionNotFoundException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.InvalidUsername"/> error code
/// will be returned because the requested session was
/// not found in the database on server-side.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.SessionNotFound;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="SessionNotFoundException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal SessionNotFoundException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,87 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.AuthenticationErrors
{
/// <summary>
/// This exception will be raised when the Two-Factor Authentication
/// is required and so the client must repeat the same request
/// but provide a Two-Factor authentication code as well.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class TwoFactorAuthenticationRequiredException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.TwoFactorAuthenticationRequired"/>
/// error code will be returned because the Two-Factor Authentication
/// is required and so the client must repeat the same request
/// but provide a Two-Factor authentication code as well.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.TwoFactorAuthenticationRequired;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="TwoFactorAuthenticationRequiredException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal TwoFactorAuthenticationRequiredException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,328 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors
{
/// <summary>
/// All error codes received from the Socialvoid servers.
/// <code> Since: v0.0.0 </code>
/// </summary>
public enum ErrorCodes
{
//-------------------------------------------------
#region Unknown Error
/// <summary>
/// This error code will be returned when the error is not
/// implimented on client-side at all.
/// <code> Since: v0.0.0 </code>
/// </summary>
UnknownError = 0,
#endregion
//-------------------------------------------------
#region Validation Errors
/// <summary>
/// This error code will be returned when the given username
/// is invalid and does not meet the specification.
/// <code> Since: v0.0.0 </code>
/// <!--
/// These are errors raised when the client passes
/// on parameters or data that is invalid in some way or another.
/// -->
/// </summary>
InvalidUsername = 8448,
/// <summary>
/// This error code will be returned when the given password is
/// invalid and/or insecure and does not meet the specification.
/// <code> Since: v0.0.0 </code>
/// </summary>
InvalidPassword = 8449,
/// <summary>
/// This error code will be returned when the First Name provided
/// contains invalid characters and or is too long;
/// please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
InvalidFirstName = 8450,
/// <summary>
/// This error code will be returned when the Last Name provided
/// contains invalid characters and or is too long;
/// please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
InvalidLastName = 8451,
/// <summary>
/// This error code will be returned when the Biography is too long or
/// contains invalid characters;
/// please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
InvalidBiography = 8452,
/// <summary>
/// This error code will be returned when the given username
/// is already registered in the server and cannot be used.
/// <code> Since: v0.0.0 </code>
/// </summary>
UsernameAlreadyExists = 8453,
/// <summary>
/// This error code will be returned when the client provided
/// an invalid peer identification as input.
/// <code> Since: v0.0.0 </code>
/// </summary>
InvalidPeerInput = 8454,
/// <summary>
/// This error code will be returned when the post contains
/// invalid characters or is too long;
/// please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
InvalidPostText = 8455,
/// <summary>
/// This error code will be returned when the client's public hash
/// is invalid and cannot be identified as a sha256.
/// <code> Since: v0.0.0 </code>
/// </summary>
InvalidClientPublicHash = 8456,
/// <summary>
/// This error code will be returned when the client's private hash
/// is invalid and cannot be identified as a sha256.
/// <code> Since: v0.0.0 </code>
/// </summary>
InvalidClientPrivateHash = 8457,
/// <summary>
/// This error code will be returned when the version is invalid
/// or is too long;
/// please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
InvalidVersion = 8459,
/// <summary>
/// This error code will be returned when the client name contains
/// invalid characters or is too long;
/// please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
InvalidClientName = 8460,
/// <summary>
/// This error code will be returned when the session identification
/// object is invalid;
/// please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
InvalidSessionIdentification = 8461,
/// <summary>
/// This error code will be returned when the platform name contains
/// invalid characters or is too long;
/// please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
InvalidPlatform = 8464,
#endregion
//-------------------------------------------------
#region Authentication Errors
/// <summary>
/// This error code will be returned when the given login credentials
/// are incorrect.
/// <code> Since: v0.0.0 </code>
/// <!--
/// These errors are raised when anything related to authentication
/// has failed, this can include things from when trying
/// to authenticate to session challenge errors.
/// -->
/// </summary>
IncorrectLoginCredentials = 8704,
/// <summary>
/// This error code will be returned when the given two-factor
/// authentication code is incorrect.
/// <code> Since: v0.0.0 </code>
/// </summary>
IncorrectTwoFactorAuthenticationCode = 8705,
/// <summary>
/// This error code will be returned when the user does not support
/// this method of authentication;
/// please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
AuthenticationNotApplicable = 8706,
/// <summary>
/// This error code will be returned when the requested session
/// was not found in the database on server-side.
/// <code> Since: v0.0.0 </code>
/// </summary>
SessionNotFound = 8707,
/// <summary>
/// This error code will be returned when the client attempts
/// to invoke a method that requires authentication.
/// <code> Since: v0.0.0 </code>
/// </summary>
NotAuthenticated = 8708,
/// <summary>
/// This error code will be returned when the user/entity uses
/// a Private Access Token to authenticate and the client
/// attempted to authenticate in another way.
/// <code> Since: v0.0.0 </code>
/// </summary>
PrivateAccessTokenRequired = 8709,
/// <summary>
/// This error code will be returned when the authentication process
/// failed for some unexpected reason;
/// please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
AuthenticationFailure = 8710,
/// <summary>
/// This error code will be returned when the given session
/// challenge answer is incorrect or out of sync.
/// <code> Since: v0.0.0 </code>
/// </summary>
BadSessionChallengeAnswer = 8711,
/// <summary>
/// This error code will be returned when the Two-Factor
/// Authentication is required and so the client must repeat
/// the same request but provide a Two-Factor authentication
/// code as well.
/// <code> Since: v0.0.0 </code>
/// </summary>
TwoFactorAuthenticationRequired = 8712,
/// <summary>
/// This error code will be returned when the client is attempting
/// to authenticate when already authenticated.
/// <code> Since: v0.0.0 </code>
/// </summary>
AlreadyAuthenticated = 8713,
/// <summary>
/// This error code will be returned when trying to use a
/// session that has been expired.
/// <code> Since: v0.0.0 </code>
/// </summary>
SessionExpired = 8714,
#endregion
//-------------------------------------------------
#region Media Errors
// TODO: This part is a work in progress,
// media has yet to be implemented on the server-side.
#endregion
//-------------------------------------------------
#region Network Errors
/// <summary>
/// This error code will be returned when the requested user entity
/// was not found on the server-side.
/// <code> Since: v0.0.0 </code>
/// <!--
/// These are the catch-all errors when dealing with the network, from
/// finding peers, following them, posting, etc...
/// -->
/// </summary>
PeerNotFound = 12544,
/// <summary>
/// This error code will be returned when the client requested
/// a post that isn't found (or does not exist on the server-side).
/// <code> Since: v0.0.0 </code>
/// </summary>
PostNotFound = 12545,
/// <summary>
/// This error code will be returned when the client requested a post
/// that was deleted.
/// <code> Since: v0.0.0 </code>
/// </summary>
PostDeleted = 12546,
/// <summary>
/// This error code will be returned when the client attempts to
/// repost a post that has already been reposted (by the same user).
/// <code> Since: v0.0.0 </code>
/// </summary>
AlreadyReposted = 12547,
/// <summary>
/// This error code will be returned when there was an error while
/// trying to upload one or more files to the server.
/// <code> Since: v0.0.0 </code>
/// </summary>
FileUploadError = 12548,
#endregion
//-------------------------------------------------
#region Server Errors
/// <summary>
/// This error code will be returned when there was an unexpected
/// error while trying to process your request.
/// <code> Since: v0.0.0 </code>
/// <!--
/// These error codes are usually returned as a last resort
/// when something is wrong with the server.
/// -->
/// </summary>
InternalServerError = 16384,
#endregion
//-------------------------------------------------
#region RPC Errors
/// <summary>
/// Execution of the server method was aborted due to a cancellation request from
/// the client.
/// <code> Since: v0.0.0 </code>
/// </summary>
RequestCanceled = -32800,
/// <summary>
/// Invalid JSON was received by the server. An error occurred on the server while
/// parsing the JSON text.
/// <code> Since: v0.0.0 </code>
/// </summary>
ParseError = -32700,
/// <summary>
/// Internal JSON-RPC error.
/// <code> Since: v0.0.0 </code>
/// </summary>
InternalError = -32603,
/// <summary>
/// Invalid method parameter(s).
/// <code> Since: v0.0.0 </code>
/// </summary>
InvalidParams = -32602,
/// <summary>
/// The method does not exist / is not available.
/// <code> Since: v0.0.0 </code>
/// </summary>
MethodNotFound = -32601,
/// <summary>
/// The JSON object sent is not a valid Request object.
/// <code> Since: v0.0.0 </code>
/// </summary>
InvalidRequest = -32600,
/// <summary>
/// Indicates the RPC call was made but the target threw an exception.
/// <code> Since: v0.0.0 </code>
/// </summary>
InvocationErrorWithException = -32004,
/// <summary>
/// Indicates a response could not be serialized as the application intended.
/// <code> Since: v0.0.0 </code>
/// </summary>
ResponseSerializationFailure = -32003,
/// <summary>
/// Indicates a request was made to a remotely marshaled object that never existed
/// or has already been disposed of.
/// <code> Since: v0.0.0 </code>
/// </summary>
NoMarshaledObjectFound = -32001,
/// <summary>
/// Indicates the RPC call was made but the target threw an exception.
/// <code> Since: v0.0.0 </code>
/// </summary>
InvocationError = -32000
#endregion
}
}

View File

@ -0,0 +1,227 @@
using System;
using Socialvoid.Errors.RPCErrors;
using Socialvoid.Errors.ServerErrors;
using Socialvoid.Errors.NetworkErrors;
using Socialvoid.Errors.ValidationErrors;
using Socialvoid.Errors.AuthenticationErrors;
namespace Socialvoid.Errors
{
/// <summary>
///
/// <code> Since: v0.0.0 </code>
/// </summary>
[Serializable]
public class GeneralException : Exception
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The error code of this exception which is received from
/// the server.
/// <devdoc>
/// This property needs to be overrided in specific exception
/// classes of this library.
/// </devdoc>
/// <code> Since: v0.0.0 </code>
/// </summary>
public virtual ErrorCodes ErrorCode { get; }
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="GeneralException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
/// <param name="message">
/// the error message received from the server.
/// </param>
internal GeneralException(string message) : base(message)
{
}
/// <summary>
/// Creates a new instance of <see cref="GeneralException"/> using
/// the specified error message and erro code.
/// <code> Since: v0.0.0 </code>
/// </summary>
/// <param name="message">
/// the error message received from the server.
/// </param>
/// <param name="code">
/// the error code received from the server.
/// </param>
private GeneralException(string message, ErrorCodes code) : base(message)
{
ErrorCode = code;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
#region Initialize Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region Graphical Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region event Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region overrided Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region ordinary Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region Get Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region Set Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region static Method's Region
/// <summary>
/// GetException will return a new exception based on the
/// error code received from the server with the specified
/// error message.
/// <code> Since: v0.0.0 </code>
/// </summary>
public static GeneralException GetException(string m, ErrorCodes err)
{
return err switch
{
// Unknown Error
ErrorCodes.UnknownError => new(m),
// Validation Errors
ErrorCodes.InvalidUsername =>
new InvalidUsernameException(m),
ErrorCodes.InvalidPassword =>
new InvalidPasswordException(m),
ErrorCodes.InvalidFirstName =>
new InvalidFirstNameException(m),
ErrorCodes.InvalidLastName =>
new InvalidLastNameException(m),
ErrorCodes.InvalidBiography =>
new InvalidBiographyException(m),
ErrorCodes.UsernameAlreadyExists =>
new UsernameAlreadyExistsException(m),
ErrorCodes.InvalidPeerInput =>
new InvalidPeerInputException(m),
ErrorCodes.InvalidPostText =>
new InvalidPostTextException(m),
ErrorCodes.InvalidClientPublicHash =>
new InvalidClientPublicHashException(m),
ErrorCodes.InvalidClientPrivateHash =>
new InvalidClientPrivateHashException(m),
ErrorCodes.InvalidVersion =>
new InvalidVersionException(m),
ErrorCodes.InvalidClientName =>
new InvalidClientNameException(m),
ErrorCodes.InvalidSessionIdentification =>
new InvalidSessionIdentificationException(m),
ErrorCodes.InvalidPlatform =>
new InvalidPlatformException(m),
// Authentication Errors
ErrorCodes.IncorrectLoginCredentials =>
new IncorrectLoginCredentialsException(m),
ErrorCodes.IncorrectTwoFactorAuthenticationCode =>
new IncorrectTwoFactorAuthenticationCodeException(m),
ErrorCodes.AuthenticationNotApplicable =>
new AuthenticationNotApplicableException(m),
ErrorCodes.SessionNotFound =>
new SessionNotFoundException(m),
ErrorCodes.NotAuthenticated =>
new NotAuthenticatedException(m),
ErrorCodes.PrivateAccessTokenRequired =>
new PrivateAccessTokenRequiredException(m),
ErrorCodes.AuthenticationFailure =>
new AuthenticationFailureException(m),
ErrorCodes.BadSessionChallengeAnswer =>
new BadSessionChallengeAnswerException(m),
ErrorCodes.TwoFactorAuthenticationRequired =>
new TwoFactorAuthenticationRequiredException(m),
ErrorCodes.AlreadyAuthenticated =>
new AlreadyAuthenticatedException(m),
ErrorCodes.SessionExpired =>
new SessionExpiredException(m),
// Media Errors
// Network Errors
ErrorCodes.PeerNotFound =>
new PeerNotFoundException(m),
ErrorCodes.PostNotFound =>
new PostNotFoundException(m),
ErrorCodes.PostDeleted =>
new PostDeletedException(m),
ErrorCodes.AlreadyReposted =>
new AlreadyRepostedException(m),
ErrorCodes.FileUploadError =>
new FileUploadErrorException(m),
// Server Errors
ErrorCodes.InternalServerError =>
new InternalServerErrorException(m),
// RPC Errors
ErrorCodes.RequestCanceled =>
new RequestCanceledException(m),
ErrorCodes.ParseError =>
new ParseErrorException(m),
ErrorCodes.InternalError =>
new InternalErrorException(m),
ErrorCodes.InvalidParams =>
new InvalidParamsException(m),
ErrorCodes.MethodNotFound =>
new MethodNotFoundException(m),
ErrorCodes.InvalidRequest =>
new InvalidRequestException(m),
ErrorCodes.InvocationErrorWithException =>
new InvocationErrorWithExException(m),
ErrorCodes.ResponseSerializationFailure =>
new ResponseSerializationFailureException(m),
ErrorCodes.NoMarshaledObjectFound =>
new NoMarshaledObjectFound(m),
ErrorCodes.InvocationError =>
new InvocationErrorException(m),
// an unknown error code?
_ => new(m, err)
};
}
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,3 @@
# MediaErrors
This part is a work in progress, media has yet to be implemented.

View File

@ -0,0 +1,85 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.NetworkErrors
{
/// <summary>
/// This exception will be raised when the client attempts to repost a
/// post that has already been reposted (by the same user).
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class AlreadyRepostedException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.AlreadyReposted"/> error code
/// will be returned because the client attempted to repost a
/// post that has already been reposted (by the same user).
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.AlreadyReposted;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="AlreadyRepostedException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal AlreadyRepostedException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,85 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.NetworkErrors
{
/// <summary>
/// This exception will be raised when there was an error while trying to
/// upload one or more files to the server.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class FileUploadErrorException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.FileUploadError"/> error code
/// will be returned because there was an error while trying to
/// upload one or more files to the server.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.FileUploadError;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="FileUploadErrorException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal FileUploadErrorException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,85 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.NetworkErrors
{
/// <summary>
/// This exception will be raised when the requested user entity
/// can not be not found on the server-side.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class PeerNotFoundException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.PeerNotFound"/> error code
/// will be returned because the requested user entity was not found
/// on the server-side.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.PeerNotFound;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="AlreadyRepostedException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal PeerNotFoundException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,85 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.NetworkErrors
{
/// <summary>
/// This exception will be raised when the client requests a post that
/// is deleted.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class PostDeletedException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.PostDeleted"/> error code
/// will be returned because the client requested a post that
/// was deleted.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.PostDeleted;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="PostDeletedException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal PostDeletedException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,85 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.NetworkErrors
{
/// <summary>
/// This exception will be raised when the client requests a post that
/// isn't found (or does not exist on the server-side).
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class PostNotFoundException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.InvalidUsername"/> error code
/// will be returned because the client requested a post that
/// isn't found (or does not exist on the server-side).
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.PostNotFound;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="PostNotFoundException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal PostNotFoundException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,12 @@
# NetworkErrors
These are the catch-all errors when dealing with the network, from
finding peers, following them, posting, etc.
| Name | Code | Hex Code | Deprecated | Versions | Description |
|-----------------|-------|----------|------------|----------|----------------------------------------------------------------------------------------|
| PeerNotFound | 12544 | 0x03100 | No | 1.0 | The requested user entity was not found in the network |
| PostNotFound | 12545 | 0x03101 | No | 1.0 | Raised when the client requested a post that isn't found |
| PostDeleted | 12546 | 0x03102 | No | 1.0 | Raised when the client requested a post that was deleted |
| AlreadyReposted | 12547 | 0x03103 | No | 1.0 | Raised when the client attempts to repost a post that has already been reposted |
| FileUploadError | 12548 | 0x03104 | No | 1.0 | Raised when there was an error while trying to upload one or more files to the network |

View File

@ -0,0 +1,61 @@
# Errors
Socialvoid has it's own unique set of error codes aside from the ones
used by the standard of the RCP server. while your client should handle
standard error codes of the RCP protcol; if you are building a Socialvoid
client then it's important that your client can handle and represent these
errors returned by the Socialvoid Server.
These errors are designed to explain what the issue is to the client or
user, in cases the client use these errors to automatically correct their
request but some errors may be caused by users as well. so it's important
that your client can understand and catch these errors accordingly.
## Error Codes
Errors come in three components.
- Name
- Code
- Message
### Name
The name is the name of the error, it can be anything from `PeerNotFound`
to `InternalServerError`, this makes it easier for programming languages
to use a try catch statement to catch specific errors.
### Code
The error code is an alternative way to identify the error when the
name is not available or trying to catch a wide range of specific errors.
These are usually represented in integers.
### Message
A message explains more details about the error, while the same error
can occur for Situation A and B; Situation B may have a different reason
for the same error. This should not be used as a way to identify the error
and usually serves the purpose of troubleshooting or displaying the error
to the user.
--------------------------------------------------------------------------
## Error Types
Errors are split into sections to make it more easier to manage, you can
either identify errors indivdually by their error code or by range.
| Section | Set | Range | Description |
|-----------------------|-----|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Validation Errors | 21 | 8448 - 8703 | Errors that returns when the given parameters or data is invalid in some way or another |
| Authentication Errors | 22 | 8704 - 8979 | Errors related to authentication/session management, these errors are usually returned when there was an error while trying to authenticate or there are session errors such as the session being expired. |
| Media Errors | 23 | 8960 - 12543 | Errors related to the media on the network, errors are usually returned if your client uploads bad media files or for some reason there is an error related to the media content on the network. |
| Network Errors | 31 | 12544 - 16383 | Errors related to actions on the network, peers not being found, posts not being found, incorrect permissions, rate limits, etc. |
| Server Errors | 40 | 16384 - *(?) | Errors related to the server, unexpected errors, servers related to administrators/moderators performing administrative tasks on the server |
## Error Codes
- [Validation Errors](ValidationErrors.md) 8448 - 8703
- [Authentication Errors](AuthenticationErrors.md) 8704 - 8979
- [Media Errors](MediaErrors.md) 8960 - 12543
- [Network Errors](NetworkErrors.md) 12544 - 16383
- [Server Errors](ServerErrors.md) 16384 - *(?)

View File

@ -0,0 +1,84 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.RPCErrors
{
/// <summary>
/// This exception will be raised when an internal JSON-RPC error
/// happens at the server-side.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class InternalErrorException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.InternalError"/> error code
/// will be returned because of an internal JSON-RPC error.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.InternalError;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="InternalErrorException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal InternalErrorException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,85 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.RPCErrors
{
/// <summary>
/// This exception will be raised when invalid method parameter(s) is
/// received by socialvoid's servers.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class InvalidParamsException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.InvalidParams"/> error code
/// will be returned because invalid method parameter(s) is
/// received by socialvoid's servers.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.InvalidParams;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="InvalidParamsException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal InvalidParamsException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,85 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.RPCErrors
{
/// <summary>
/// This exception will be raised when the JSON object sent to
/// the socialvoid's server is not a valid Request object.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class InvalidRequestException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.InvalidRequest"/> error code
/// will be returned because the JSON object sent is not a
/// valid Request object.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.InvalidRequest;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="InvalidRequestException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal InvalidRequestException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,85 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.RPCErrors
{
/// <summary>
/// This exception will be raised when the RPC call was made but the target
/// threw an exception.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class InvocationErrorException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.InvocationError"/> error code
/// will be returned because the RPC call was made but the target
/// threw an exception.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.InvocationError;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="InvocationErrorException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal InvocationErrorException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,85 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.RPCErrors
{
/// <summary>
/// This exception will be raised when the RPC call was made but
/// the target threw an exception.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class InvocationErrorWithExException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.AlreadyReposted"/> error code
/// will be returned because the RPC call was made but
/// the target threw an exception.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.InvocationErrorWithException;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="InvocationErrorWithExException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal InvocationErrorWithExException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,85 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.RPCErrors
{
/// <summary>
/// This exception will be raised when the method does not exist / is
/// not available.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class MethodNotFoundException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.MethodNotFound"/> error code
/// will be returned because the method does not exist / is
/// not available.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.MethodNotFound;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="MethodNotFoundException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal MethodNotFoundException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,85 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.RPCErrors
{
/// <summary>
/// This exception will be raised when a request is made to a remotely
/// marshaled object that never existed or has already been disposed of.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class NoMarshaledObjectFound : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.NoMarshaledObjectFound"/> error code
/// will be returned because a request was made to a remotely marshaled object
/// that never existed or has already been disposed of.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.NoMarshaledObjectFound;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="NoMarshaledObjectFound"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal NoMarshaledObjectFound(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,85 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.RPCErrors
{
/// <summary>
/// This exception will be raised when invalid JSON is received by the server.
/// An error occurred on the server while parsing the JSON text.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class ParseErrorException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.ParseError"/> error code
/// will be returned because invalid JSON was received by the server.
/// An error occurred on the server while parsing the JSON text.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.ParseError;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="ParseErrorException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal ParseErrorException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,85 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.RPCErrors
{
/// <summary>
/// This exception will be raised when execution of the server method is
/// aborted due to a cancellation request from the client.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class RequestCanceledException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.RequestCanceled"/> error code
/// will be returned because execution of the server method was aborted
/// due to a cancellation request from the client.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.RequestCanceled;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="RequestCanceledException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal RequestCanceledException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,85 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.RPCErrors
{
/// <summary>
/// This exception will be raised when a response cannot not be serialized
/// as the application intended.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class ResponseSerializationFailureException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.ResponseSerializationFailure"/> error code
/// will be returned because a response could not be serialized
/// as the application intended.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.ResponseSerializationFailure;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="ResponseSerializationFailureException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal ResponseSerializationFailureException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,85 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.ServerErrors
{
/// <summary>
/// This exception will be raised when there is an unexpected error
/// while server tried to process our request.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class InternalServerErrorException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.InternalServerError"/> error code
/// will be returned because there was an unexpected error
/// while trying to process your request.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.InternalServerError;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="InternalServerErrorException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal InternalServerErrorException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,8 @@
# ServerErrors
These errors are usually rasied as a last resort when something is wrong
with the server.
| Name | Code | Hex Code | Deprecated | Versions | Description |
|---------------------|-------|----------|------------|----------|---------------------------------------------------------------------------------|
| InternalServerError | 16384 | 0x04000 | No | 1.0 | Raised when there was an unexpected error while trying to process your request. |

View File

@ -0,0 +1,87 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.ValidationErrors
{
/// <summary>
/// This exception will be raised when the Biography is too long
/// or contains invalid characters;
/// please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class InvalidBiographyException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.InvalidBiography"/> error code
/// will be returned because the Biography is too long
/// or contains invalid characters;
/// please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.InvalidBiography;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="InvalidBiographyException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal InvalidBiographyException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,87 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.ValidationErrors
{
/// <summary>
/// This exception will be raised when the client name contains invalid
/// characters or is too long;
/// please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class InvalidClientNameException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.InvalidClientName"/> error code
/// will be returned because the client name contains invalid
/// characters or is too long;
/// please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.InvalidClientName;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="InvalidClientNameException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal InvalidClientNameException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,86 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.ValidationErrors
{
/// <summary>
/// This exception will be raised when the client's private hash is invalid
/// and cannot be identified as a sha256.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class InvalidClientPrivateHashException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.InvalidClientPrivateHash"/> error code
/// will be returned because the client's private hash is invalid
/// and cannot be identified as a sha256.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.InvalidClientPrivateHash;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of
/// <see cref="InvalidClientPrivateHashException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal InvalidClientPrivateHashException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,85 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.ValidationErrors
{
/// <summary>
/// This exception will be raised when the client's public hash is invalid
/// and cannot be identified as a sha256.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class InvalidClientPublicHashException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.InvalidClientPublicHash"/> error code
/// will be returned because the client's public hash is invalid
/// and cannot be identified as a sha256.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.InvalidClientPublicHash;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="InvalidClientPublicHashException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal InvalidClientPublicHashException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,87 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.ValidationErrors
{
/// <summary>
/// This exception will be raised when the First Name provided contains
/// invalid characters and or is too long;
/// please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class InvalidFirstNameException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.InvalidFirstName"/> error code
/// will be returned because the First Name provided contains
/// invalid characters and or is too long;
/// please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.InvalidFirstName;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="InvalidFirstNameException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal InvalidFirstNameException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,87 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.ValidationErrors
{
/// <summary>
/// This exception will be raised when the Last Name provided contains
/// invalid characters and or is too long;
/// please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class InvalidLastNameException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.InvalidLastName"/> error code
/// will be returned because the Last Name provided contains
/// invalid characters and or is too long;
/// please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.InvalidLastName;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="InvalidLastNameException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal InvalidLastNameException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,85 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.ValidationErrors
{
/// <summary>
/// This exception will be raised when the given password is invalid and/or
/// insecure and does not meet the specification.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class InvalidPasswordException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.InvalidPassword"/> error code
/// will be returned because the given password is invalid and/or
/// insecure and does not meet the specification.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.InvalidPassword;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="InvalidPasswordException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal InvalidPasswordException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,85 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.ValidationErrors
{
/// <summary>
/// This exception will be raised when the client provide an invalid
/// peer identification as input.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class InvalidPeerInputException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.InvalidPeerInput"/> error code
/// will be returned because the client provided an invalid
/// peer identification as input.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.InvalidPeerInput;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="InvalidPeerInputException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal InvalidPeerInputException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,87 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.ValidationErrors
{
/// <summary>
/// This exception will be raised when the platform name contains invalid
/// characters or is too long;
/// please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class InvalidPlatformException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.InvalidPlatform"/> error code
/// will be returned because the platform name contains invalid
/// characters or is too long;
/// please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.InvalidPlatform;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="InvalidPlatformException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal InvalidPlatformException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,87 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.ValidationErrors
{
/// <summary>
/// This exception will be raised when the post contains invalid
/// characters or is too long;
/// please see the exception message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class InvalidPostTextException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.InvalidPostText"/> error code
/// will be returned because the post contains invalid characters
/// or is too long;
/// please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.InvalidPostText;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="InvalidPostTextException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal InvalidPostTextException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,88 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.ValidationErrors
{
/// <summary>
/// This exception will be raised when the session identification
/// object is invalid;
/// please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class InvalidSessionIdentificationException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.InvalidSessionIdentification"/>
/// error code will be returned because the session identification
/// object is invalid;
/// please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.InvalidSessionIdentification;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of
/// <see cref="InvalidSessionIdentificationException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal InvalidSessionIdentificationException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,85 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.ValidationErrors
{
/// <summary>
/// This exception will be raised when the given username is invalid
/// and does not meet the specification.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class InvalidUsernameException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.InvalidUsername"/> error code
/// will be returned because the given username is invalid and
/// does not meet the specifications.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.InvalidUsername;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="InvalidUsernameException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal InvalidUsernameException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,85 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.ValidationErrors
{
/// <summary>
/// This exception will be raised when the given username is invalid
/// and does not meet the specification.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class InvalidVersionException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.InvalidVersion"/> error code
/// will be returned because the version is invalid or is too long;
/// please see the message for further details.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.InvalidVersion;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="InvalidVersionException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal InvalidVersionException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,21 @@
# Validation Errors
These are errors raised when your client passes on parameters or data
that is invalid in some way or another.
| Name | Code | Hex Code | Deprecated | Versions | Description |
|------------------------------|------|----------|------------|----------|-------------------------------------------------------------------------------------------------------------|
| InvalidUsername | 8448 | 0x02100 | No | 1.0 | The given username is invalid and does not meet the specification |
| InvalidPassword | 8449 | 0x02101 | No | 1.0 | The given password is invalid and/or insecure and does not meet the specification |
| InvalidFirstName | 8450 | 0x02102 | No | 1.0 | The First Name provided contains invalid characters and or is too long, see the message for further details |
| InvalidLastName | 8451 | 0x02103 | No | 1.0 | The Last Name provided contains invalid characters and or is too long, see the message for further details |
| InvalidBiography | 8452 | 0x02104 | No | 1.0 | The Biography is too long or contains invalid characters, see the message for further details |
| UsernameAlreadyExists | 8453 | 0x02105 | No | 1.0 | The username is already registered in the network and cannot be used |
| InvalidPeerInput | 8454 | 0x02106 | No | 1.0 | The client provided an invalid peer identification as input |
| InvalidPostText | 8455 | 0x02107 | No | 1.0 | The post contains invalid characters or is too long, see the message for further details |
| InvalidClientPublicHash | 8456 | 0x02108 | No | 1.0 | The client's public hash is invalid and cannot be identified as a sha256 |
| InvalidClientPrivateHash | 8457 | 0x02109 | No | 1.0 | The client's private hash is invalid and cannot be identified as a sha256 |
| InvalidPlatform | 8464 | 0x02110 | No | 1.0 | The platform name contains invalid characters or is too long, see the message for further details |
| InvalidVersion | 8459 | 0x0210b | No | 1.0 | The version is invalid or is too long, see the message for further details |
| InvalidClientName | 8460 | 0x0210c | No | 1.0 | The client name contains invalid characters or is too long, see the message for further details |
| InvalidSessionIdentification | 8461 | 0x0210d | No | 1.0 | The session identification object is invalid, see the message for further details |

View File

@ -0,0 +1,86 @@
/*
* This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
* Copyright (c) 2021 Socialvoid.NET Authors.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code of library.
* If not, see <http://www.gnu.org/licenses/>.
*/
namespace Socialvoid.Errors.ValidationErrors
{
/// <summary>
/// This exception will be raised when the given username is invalid
/// and does not meet the specification.
/// <code> Since: v0.0.0 </code>
/// </summary>
public sealed class UsernameAlreadyExistsException : GeneralException
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The <see cref="ErrorCodes.InvalidUsername"/> error code
/// will be returned
/// because the given username is invalid and
/// does not meet the specifications.
/// <code> Since: v0.0.0 </code>
/// </summary>
public override ErrorCodes ErrorCode
{
get
{
return ErrorCodes.InvalidUsername;
}
}
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
/// Creates a new instance of <see cref="UsernameAlreadyExistsException"/>.
/// <code> Since: v0.0.0 </code>
/// </summary>
internal UsernameAlreadyExistsException(string message) : base(message)
{
;
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
}
}

BIN
Socialvoid/Icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
Socialvoid/Icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

View File

@ -0,0 +1,81 @@
using System;
using System.Text.Json.Serialization;
using System.Collections.Generic;
namespace Socialvoid.JObjects
{
/// <summary>
/// A simple <see cref="Dictionary{TKey, TValue}"/> object.
/// <code> since: v0.0.0 </code>
/// </summary>
[Serializable]
public class JArgs: Dictionary<string, object>
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
#region Initialize Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region Graphical Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region event Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region overrided Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region ordinary Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region Get Method's Region
#endregion
//-------------------------------------------------
#region Set Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region static Method's Region
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,94 @@
using System;
using System.Text.Json.Serialization;
namespace Socialvoid.JObjects
{
/// <summary>
/// A <see cref="JError"/> object which contains basic information
/// about an error returned by the server.
/// <code> since: v0.0.0 </code>
/// </summary>
[Serializable]
public sealed class JError
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The response error code.
/// <code> since: v0.0.0 </code>
/// </summary>
[JsonPropertyName("code")]
public int Code { get; set; }
/// <summary>
/// The error message.
/// <code> since: v0.0.0 </code>
/// </summary>
[JsonPropertyName("message")]
public string Message { get; set; }
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
#region Initialize Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region Graphical Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region event Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region overrided Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region ordinary Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region Get Method's Region
#endregion
//-------------------------------------------------
#region Set Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region static Method's Region
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,122 @@
using System;
using System.Text.Json.Serialization;
using System.Text.Json;
namespace Socialvoid.JObjects
{
/// <summary>
/// A <see cref="JRequest"/> object which contains basic information
/// about an error returned by the server.
/// <code> since: v0.0.0 </code>
/// </summary>
[Serializable]
public sealed class JRequest
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The JSON-RPC version. Should be equal to "2.0".
/// <code> since: v0.0.0 </code>
/// </summary>
[JsonPropertyName("jsonrpc")]
public string JsonRPC { get; set; } = "2.0";
/// <summary>
/// The error message.
/// <code> since: v0.0.0 </code>
/// </summary>
[JsonPropertyName("method")]
public string Method { get; set; }
/// <summary>
/// The error message.
/// <code> since: v0.0.0 </code>
/// </summary>
[JsonPropertyName("id")]
public long ID { get; set; }
/// <summary>
/// The error message.
/// <code> since: v0.0.0 </code>
/// </summary>
[JsonPropertyName("params")]
public JArgs Arguments { get; set; }
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
#region Initialize Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region Graphical Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region event Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region overrided Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region ordinary Method's Region
/// <summary>
/// Changes the ID property of this value to <c>DateTime.Now.Ticks</c>.
/// <code> since: v0.0.0 </code>
/// </summary>
public void ChangeID()
{
ID = DateTime.Now.Ticks;
}
#endregion
//-------------------------------------------------
#region Get Method's Region
/// <summary>
/// Serializes this request as a string.
/// <code> since: v0.0.0 </code>
/// </summary>
public string Serialize()
{
return JsonSerializer.Serialize(this);
}
#endregion
//-------------------------------------------------
#region Set Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region static Method's Region
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,145 @@
using System;
using System.Text.Json.Serialization;
using Socialvoid.Errors;
using System.Text.Json;
namespace Socialvoid.JObjects
{
/// <summary>
/// A <see cref="JResponse{T}"/> with a specified result type.
/// <code> since: v0.0.0 </code>
/// </summary>
[Serializable]
public sealed class JResponse<T> where T: class
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The Json-rpc version.
/// <code> since: v0.0.0 </code>
/// </summary>
[JsonPropertyName("jsonrpc")]
public string RPCVersion { get; set; }
/// <summary>
/// The Json-rpc request id.
/// <code> since: v0.0.0 </code>
/// </summary>
[JsonPropertyName("id")]
public long ID { get; set; }
/// <summary>
/// The results.
/// <code> since: v0.0.0 </code>
/// </summary>
[JsonPropertyName("result")]
public T Result { get; set; }
/// <summary>
/// The results.
/// <code> since: v0.0.0 </code>
/// </summary>
[JsonPropertyName("error")]
public JError Error { get; set; }
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
#region Initialize Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region Graphical Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region event Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region overrided Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region ordinary Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region Get Method's Region
/// <summary>
/// Checks if the current response has error or not.
/// <code> since: v0.0.0 </code>
/// </summary>
public bool HasError()
{
return Error != null;
}
/// <summary>
/// Will convert the current <see cref="Error"/> property of this value
/// to a <see cref="GeneralException"/>.
/// <code> since: v0.0.0 </code>
/// </summary>
/// <returns>
/// returns a <see cref="GeneralException"/> if and only if the
/// <see cref="Error"/> property is not null; otherwise returns null.
/// </returns>
public GeneralException GetException()
{
if (!HasError())
{
return null;
}
return GeneralException.GetException(Error.Message,
(ErrorCodes)Error.Code);
}
#endregion
//-------------------------------------------------
#region Set Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region static Method's Region
/// <summary>
/// Will convert a json string to a <see cref="JResponse{T}"/>.
/// <code> since: v0.0.0 </code>
/// </summary>
/// <returns>
/// returns a <see cref="JResponse{T}"/> value.
/// </returns>
public static JResponse<T> Deserialize(string text)
{
return JsonSerializer.Deserialize<JResponse<T>>(text);
}
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,10 @@
namespace Socialvoid.Methods
{
class CreateSession
{
public static bool Do(string public_hash, string private_hash, string platform, string version)
{
return true;
}
}
}

View File

@ -0,0 +1,136 @@
using System.Text.Json.Serialization;
namespace Socialvoid.Security
{
/// <summary>
/// A <see cref="SessionEstablished"/> object contains basic information
/// about the session that the server has created for us.
/// <code> since: v0.0.0 </code>
/// </summary>
public sealed class SessionEstablished
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The ID of the session obtained when establishing a session.
/// <code> since: v0.0.0 </code>
/// </summary>
[JsonPropertyName("id")]
public string SessionID { get; internal set; }
/// <summary>
/// The Public Hash of the client used when establishing the session.
/// <code> since: v0.0.0 </code>
/// </summary>
[JsonPropertyName("challenge")]
internal string ChallengeSecret { get; set; }
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
///
/// </summary>
private SessionEstablished()
{
;// make is private, so user use `EstablishNew` static method.
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
#region Initialize Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region Graphical Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region event Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region overrided Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region ordinary Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region Get Method's Region
/// <summary>
/// This method will return the challenge secret received from the
/// server.
/// <code> since: v0.0.0 </code>
/// </summary>
/// <returns>
/// <c>null</c> if this object doesn't have any challenge secret;
/// otherwise a valid challenge secret.
/// </returns>
public string GetChallengeSecret()
{
return string.IsNullOrWhiteSpace(ChallengeSecret) ?
null : ChallengeSecret;
}
#endregion
//-------------------------------------------------
#region Set Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region static Method's Region
/// <summary>
/// Establishes a new session.
/// <code> since: v0.0.0 </code>
/// </summary>
/// <param name="id">
/// the session id returned from the server or being stored in
/// a file.
/// </param>
/// <param name="challenge">
/// The challenge secret returned from the server.
/// it can be <c>null</c>.
/// please do notice that when you are going to load an already
/// existing session from a file, this parameter should remain <c>null</c>.
/// </param>
/// <returns>
/// A new instance of <see cref="SessionEstablished"/> class.
/// </returns>
public static SessionEstablished EstablishNew(string id, string challenge = null)
{
return new()
{
SessionID = id,
ChallengeSecret = challenge,
};
}
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,106 @@
namespace Socialvoid.Security
{
/// <summary>
/// A SessionIdentification object allows the client to identify the
/// session it's using and prove that it is the owner of the session;
/// it proves as a identification effort and security effort.
/// Most methods that requires authentication or some sort of identity
/// will require you to pass on this object as a parameter under
/// `session_identification`; missing parameters or invalid security values
/// will cause the request to fail as it's validated upon request.
/// <code> since: v0.0.0 </code>
/// </summary>
public sealed class SessionIdentification
{
//-------------------------------------------------
#region Constant's Region
// some members here
#endregion
//-------------------------------------------------
#region static Properties Region
// some members here
#endregion
//-------------------------------------------------
#region Properties Region
/// <summary>
/// The ID of the session obtained when establishing a session.
/// <code> since: v0.0.0 </code>
/// </summary>
public string SessionID { get; internal set; }
/// <summary>
/// The Public Hash of the client used when establishing the session.
/// <code> since: v0.0.0 </code>
/// </summary>
public string ClientPublicHash { get; internal set; }
/// <summary>
/// The session challenge answer revolving around the client's
/// private hash, the same client used to establish the session.
/// <code> since: v0.0.0 </code>
/// </summary>
public string ChallengeAnswer { get; internal set; }
#endregion
//-------------------------------------------------
#region static field's Region
// some members here
#endregion
//-------------------------------------------------
#region field's Region
// some members here
#endregion
//-------------------------------------------------
#region static event field's Region
// some members here
#endregion
//-------------------------------------------------
#region event field's Region
// some members here
#endregion
//-------------------------------------------------
#region Constructor's Region
/// <summary>
///
/// </summary>
public SessionIdentification()
{
}
#endregion
//-------------------------------------------------
#region Destructor's Region
// some members here
#endregion
//-------------------------------------------------
#region Initialize Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region Graphical Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region event Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region overrided Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region ordinary Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region Get Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region Set Method's Region
// some methods here
#endregion
//-------------------------------------------------
#region static Method's Region
// some methods here
#endregion
//-------------------------------------------------
}
}

View File

@ -0,0 +1,161 @@
<Project Sdk="Microsoft.NET.Sdk">
<!--
This file is part of Socialvoid.NET Project (https://github.com/Intellivoid/Socialvoid.NET).
Copyright (c) 2021 Socialvoid.NET Authors.
This library is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this source code of library.
If not, see <http://www.gnu.org/licenses/>.
-->
<!--===================================================-->
<PropertyGroup>
<!--
<RuntimeIdentifier Condition="'$(OS)' == 'unix'">linux-x64</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(OS)' == 'Windows_NT'">win-x64</RuntimeIdentifier>
-->
<AssemblyName>Socialvoid</AssemblyName>
<RootNamespace>Socialvoid</RootNamespace>
<description>The official Socialvoid RPC Library written for C#</description>
<NeutralLanguage>en-US</NeutralLanguage>
<!--
<TargetFramework Condition="'$(OS)' == 'Windows_NT'">net5.0;net461;netstandard2.0;netstandard2.1;uap10.0;monoandroid9.0;xamarin.ios10</TargetFramework>
<TargetFramework Condition="'$(OS)' == 'unix'">net5.0</TargetFramework>
-->
<TargetFramework>net5.0</TargetFramework>
<PackageId>SovialVoid</PackageId>
<Version>0.0.1</Version>
<Authors>Socialvoid Team</Authors>
<PackageProjectUrl>https://github.com/intellivoid/Socialvoid.NET</PackageProjectUrl>
<RepositoryUrl>https://github.com/intellivoid/Socialvoid.NET</RepositoryUrl>
<PackageIconUrl>https://github.com/intellivoid/Socialvoid.NET/raw/master/Socialvoid/Icon.ico</PackageIconUrl>
<PackageIcon>Icon.png</PackageIcon>
<RepositoryType>git</RepositoryType>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<license>LICENSE</license>
</PropertyGroup>
<!--===================================================-->
<PropertyGroup>
<NoWarn>1701;1702;1705</NoWarn>
</PropertyGroup>
<!--===================================================-->
<PropertyGroup>
<!--
define the __LINUX__ and __WINDOWS__ constants in order to use it in the
code as:
#if __LINUX__
....
#elif __WINDOWS__
...
#endif
===================================================================
please don't undefine this constant.
-->
<DefineConstants Condition="'$(OS)' == 'unix'">$(DefineConstants);__LINUX__</DefineConstants>
<DefineConstants Condition="'$(OS)' == 'Windows_NT'">$(DefineConstants);__WINDOWS__</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'uap10.0'">$(DefineConstants);__UAP__</DefineConstants>
<DefineConstants Condition="$(TargetFramework.StartsWith('monoandroid'))">$(DefineConstants);__ANDROID__</DefineConstants>
<DefineConstants Condition="$(TargetFramework.StartsWith('xamarin.ios'))">$(DefineConstants);__IOS__</DefineConstants>
</PropertyGroup>
<!--===================================================-->
<ItemGroup>
<None Include="Icon.png" Pack="true" PackagePath="\" />
<None Include="..\LICENSE" Pack="true" PackagePath="\" />
</ItemGroup>
<!--===================================================-->
<ItemGroup>
<EmbeddedResource Include="Icon.ico" />
</ItemGroup>
<!--===================================================-->
<ItemGroup>
<!--
All package references must be added here.
example:
<PackageReference Include="SharpDX" Version="4.2.0" Condition="'$(OS)' == 'Windows_NT'" />
<PackageReference Include="SharpDX.Direct3D9" Version="4.2.0" Condition="'$(OS)' == 'Windows_NT'" />
<PackageReference Include="SharpDX.DXGI" Version="4.2.0" Condition="'$(OS)' == 'Windows_NT'" />
<PackageReference Include="SharpDX.Mathematics" Version="4.2.0" Condition="'$(OS)' == 'Windows_NT'" />
<PackageReference Include="SharpDX.MediaFoundation" Version="4.2.0" Condition="'$(OS)' == 'Windows_NT'" />
<PackageReference Include="SharpDX.XAudio2" Version="4.2.0" Condition="'$(OS)' == 'Windows_NT'" />
<PackageReference Include="TextCopy" Version="4.3.1" />
<PackageReference Include="System.Drawing.Common" Version="5.0.2" />
<PackageReference Include="FontStashSharp.MonoGame" Version="0.9.5" />
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.0.1641" />
-->
<PackageReference Include="StreamJsonRpc" Version="2.8.21" />
</ItemGroup>
<!--===================================================-->
<!--
If you want to remove something, add it in this section.
example:
<ItemGroup Condition="'$(OS)' != 'Windows_NT'">
<None Remove="Controls\Music\MusicManager.resx"/>
</ItemGroup>
-->
<!--===================================================-->
<!--
All of the library includes must be added here.
example:
<ItemGroup Condition="'$(OS)' != 'Windows_NT'">
<Content Include="..\natives\libgdiplus.so">
<Link>libgdiplus.so</Link>
<PackagePath>runtimes\linux-x64\native</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\natives\libgdiplus.so.0">
<Link>libgdiplus.so.0</Link>
<PackagePath>runtimes\linux-x64\native</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\natives\libgdiplus.so.0.0.0">
<Link>libgdiplus.so.0.0.0</Link>
<PackagePath>runtimes\linux-x64\native</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
-->
<!--===================================================-->
<ItemGroup>
<!--Include the project folders here.-->
<!--
<Folder Include="GUIContent\bin\DesktopGL\Content">
<Link>GUIContent\bin\DesktopGL\Content</Link>
</Folder>
<Folder Include="Controls\Animation\AnimationCompanies" />
<Folder Include="Controls\GameGraphics\XDrawing" />
-->
</ItemGroup>
<!--===================================================-->
<!--
<ItemGroup>
<!Include another project .csproj file here.>
<!If you include them here, they will be built as well.>
<ProjectReference Include="..\WotoProvider\WotoProvider.csproj" />
</ItemGroup>
-->
<!--===================================================-->
</Project>
<!--End of the Socialvoid.NET Project File.-->
<!--2021 (C) Intellivoid Inc. -->
<!--2021 (C) Socialvoid Team -->

View File

@ -0,0 +1,71 @@
using System;
using Socialvoid.Errors;
using Socialvoid.Client;
using Socialvoid.Errors.ServerErrors;
using Socialvoid.Errors.NetworkErrors;
using Socialvoid.Errors.ValidationErrors;
using NUnit.Framework;
namespace Tests.Client
{
[TestFixture]
public class ClientTest
{
[TestCase("test1: the given login credentials are incorrect.", 8704)]
[TestCase("test2: the given two-factor authentication code is incorrect.", 8705)]
[TestCase("test3: the user 'aliwoto' does not support this method of authentication", 8706)]
[TestCase("test4: the requested session was not found in the database on server-side.", 8707)]
public void AuthenticationErrorsTest(string message, int errorCode)
{
try
{
CreateException(message, errorCode);
}
catch (GeneralException ex)
{
Log("got exception of type", ex.GetType(), "with error code of", ex.ErrorCode);
if (ex.Message != message || (int)ex.ErrorCode != errorCode)
{
throw;
}
}
}
[TestCase(
"4c7148caff498d24deee6c8325f1c15773d637ed76c3a4056e00b77b2beb3097", // public hash
"866d3218b239d39c174fa2b16f54e0fa58f9c69fce8c2d941c12a47a7bc75229", // private hash
"Linux", // platform
"Test .NET RCP Client", // the name
"1.0.0.0" // version
)]
public void AuthenticateUserTest(string publicHash, string privateHash,
string platform, string name, string version)
{
var myClient =
SocialvoidClient.GetClient(publicHash,
privateHash, platform, name, version);
myClient.CreateSession();
myClient.AuthenticateUser(new(), "aliwoto", "12345678");
}
private void CreateException(string message, int code)
{
throw GeneralException.GetException(message, (ErrorCodes)code);
}
private void Log(params object[] objs)
{
foreach (var obj in objs)
{
Console.Write(obj);
Console.Write(" ");
}
Console.Write("\n");
}
}
}

View File

@ -0,0 +1,8 @@
{
"endpoint": "http://127.0.0.1:5001/",
"public_hash": "4c7148caff498d24deee6c8325f1c15773d637ed76c3a4056e00b77b2beb3097",
"private_hash": "866d3218b239d39c174fa2b16f54e0fa58f9c69fce8c2d941c12a47a7bc75229",
"platform": "Linux",
"name": "Test Python RCP Client",
"version": "1.0.0.0"
}

View File

@ -63,6 +63,7 @@
<ItemGroup>
<PackageReference Include="nunit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
<PackageReference Include="StreamJsonRpc" Version="2.8.21" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
</ItemGroup>
<!--===================================================-->