Restore SEBPatch
This commit is contained in:
31
SafeExamBrowser.Server.Contracts/Data/ConnectionInfo.cs
Normal file
31
SafeExamBrowser.Server.Contracts/Data/ConnectionInfo.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
namespace SafeExamBrowser.Server.Contracts.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains all information required to establish a connection with a server.
|
||||
/// </summary>
|
||||
public class ConnectionInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The API of the server as JSON string.
|
||||
/// </summary>
|
||||
public string Api { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The connection token for authentication with the server.
|
||||
/// </summary>
|
||||
public string ConnectionToken { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The OAuth2 token for authentication with the server.
|
||||
/// </summary>
|
||||
public string Oauth2Token { get; set; }
|
||||
}
|
||||
}
|
36
SafeExamBrowser.Server.Contracts/Data/Exam.cs
Normal file
36
SafeExamBrowser.Server.Contracts/Data/Exam.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
namespace SafeExamBrowser.Server.Contracts.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines a server exam.
|
||||
/// </summary>
|
||||
public class Exam
|
||||
{
|
||||
/// <summary>
|
||||
/// The identifier of the exam.
|
||||
/// </summary>
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the learning management system (LMS) on which the exam is running.
|
||||
/// </summary>
|
||||
public string LmsName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the exam.
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The URL of the exam.
|
||||
/// </summary>
|
||||
public string Url { get; set; }
|
||||
}
|
||||
}
|
49
SafeExamBrowser.Server.Contracts/Data/ServerResponse.cs
Normal file
49
SafeExamBrowser.Server.Contracts/Data/ServerResponse.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
namespace SafeExamBrowser.Server.Contracts.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the result of a communication with a SEB server.
|
||||
/// </summary>
|
||||
public class ServerResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// The message retrieved by the server in case the communication failed.
|
||||
/// </summary>
|
||||
public string Message { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Defines whether the communication was successful or not.
|
||||
/// </summary>
|
||||
public bool Success { get; }
|
||||
|
||||
public ServerResponse(bool success, string message = default)
|
||||
{
|
||||
Message = message;
|
||||
Success = success;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the result of a communication with a SEB server.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the expected response value.</typeparam>
|
||||
public class ServerResponse<T> : ServerResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// The response value. Can be <c>null</c> or <c>default(T)</c> in case the communication failed!
|
||||
/// </summary>
|
||||
public T Value { get; }
|
||||
|
||||
public ServerResponse(bool success, T value, string message = default) : base(success, message)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user