Skip to content
This repository has been archived by the owner on Sep 4, 2023. It is now read-only.

Commit

Permalink
Merge pull request #20 from Typiqally/feat/beta-enhancements
Browse files Browse the repository at this point in the history
Beta enhancements
  • Loading branch information
NealGeilen authored Jun 21, 2022
2 parents aee3e28 + 054df8d commit 5d306bb
Show file tree
Hide file tree
Showing 52 changed files with 658 additions and 401 deletions.
2 changes: 1 addition & 1 deletion Epsilon.Abstractions/Export/ICanvasModuleExporter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Epsilon.Canvas.Abstractions.Data;
using Epsilon.Canvas.Abstractions.Model;

namespace Epsilon.Abstractions.Export;

Expand Down
2 changes: 2 additions & 0 deletions Epsilon.Abstractions/Export/IModuleExporterCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@

public interface IModuleExporterCollection
{
public IEnumerable<string> Formats();

public IDictionary<string, ICanvasModuleExporter> DetermineExporters(IEnumerable<string> formats);
}
8 changes: 8 additions & 0 deletions Epsilon.Canvas.Abstractions/Converter/IConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Epsilon.Canvas.Abstractions.Converter;

public interface IConverter<TTo, TFrom>
{
TTo ConvertFrom(TFrom from);

TFrom ConvertTo(TTo to);
}
8 changes: 8 additions & 0 deletions Epsilon.Canvas.Abstractions/Converter/ILinkHeaderConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Epsilon.Canvas.Abstractions.Model;

namespace Epsilon.Canvas.Abstractions.Converter;

public interface ILinkHeaderConverter : IConverter<LinkHeader, string>
{
public LinkHeader ConvertFrom(HttpResponseMessage response);
}
13 changes: 0 additions & 13 deletions Epsilon.Canvas.Abstractions/Data/Assignment.cs

This file was deleted.

18 changes: 0 additions & 18 deletions Epsilon.Canvas.Abstractions/Data/Module.cs

This file was deleted.

8 changes: 0 additions & 8 deletions Epsilon.Canvas.Abstractions/Data/Outcome.cs

This file was deleted.

11 changes: 0 additions & 11 deletions Epsilon.Canvas.Abstractions/Data/OutcomeResult.cs

This file was deleted.

4 changes: 2 additions & 2 deletions Epsilon.Canvas.Abstractions/ICanvasModuleCollectionFetcher.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Epsilon.Canvas.Abstractions.Data;
using Epsilon.Canvas.Abstractions.Model;

namespace Epsilon.Canvas.Abstractions;

public interface ICanvasModuleCollectionFetcher
{
public Task<IEnumerable<Module>> Fetch(int courseId);
public Task<IEnumerable<Module>> GetAll(int courseId);
}
9 changes: 9 additions & 0 deletions Epsilon.Canvas.Abstractions/Model/Alignment.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model;

public record Alignment(
[property: JsonPropertyName("id")] string Id,
[property: JsonPropertyName("name")] string Name,
[property: JsonPropertyName("html_url")] Uri Url
);
10 changes: 10 additions & 0 deletions Epsilon.Canvas.Abstractions/Model/Assignment.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model;

public record Assignment(
[property: JsonPropertyName("id")] int Id,
[property: JsonPropertyName("name")] string Name,
[property: JsonPropertyName("html_url")] Uri Url,
[property: JsonPropertyName("submission")] Submission? Submission
);
9 changes: 9 additions & 0 deletions Epsilon.Canvas.Abstractions/Model/LinkHeader.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Epsilon.Canvas.Abstractions.Model;

public record LinkHeader
{
public string? FirstLink { get; set; }
public string? PrevLink { get; set; }
public string? NextLink { get; set; }
public string? LastLink { get; set; }
}
15 changes: 15 additions & 0 deletions Epsilon.Canvas.Abstractions/Model/Module.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Text.Json.Serialization;
using Epsilon.Canvas.Abstractions.Response;

namespace Epsilon.Canvas.Abstractions.Model;

public record Module(
[property: JsonPropertyName("id")] int Id,
[property: JsonPropertyName("name")] string Name,
[property: JsonPropertyName("items_count")] int Count,
[property: JsonPropertyName("items")] IEnumerable<ModuleItem>? Items
)
{
[JsonIgnore]
public OutcomeResultCollection Collection { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Data;
namespace Epsilon.Canvas.Abstractions.Model;

public record ModuleItem(
[property: JsonPropertyName("id")] int Id,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Epsilon.Canvas.Abstractions.Data;
namespace Epsilon.Canvas.Abstractions.Model;

public enum ModuleItemType
{
Expand Down
9 changes: 9 additions & 0 deletions Epsilon.Canvas.Abstractions/Model/Outcome.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model;

public record Outcome(
[property: JsonPropertyName("id")] int Id,
[property: JsonPropertyName("title")] string Title,
[property: JsonPropertyName("description")] string Description
);
9 changes: 9 additions & 0 deletions Epsilon.Canvas.Abstractions/Model/OutcomeResult.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model;

public record OutcomeResult(
[property: JsonPropertyName("mastery")] bool? Mastery,
[property: JsonPropertyName("score")] double? Score,
[property: JsonPropertyName("links")] OutcomeResultLink Link
);
9 changes: 9 additions & 0 deletions Epsilon.Canvas.Abstractions/Model/OutcomeResultCollection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System.Text.Json.Serialization;
using Epsilon.Canvas.Abstractions.Model;

namespace Epsilon.Canvas.Abstractions.Response;

public record OutcomeResultCollection(
[property: JsonPropertyName("outcome_results")] IEnumerable<OutcomeResult> OutcomeResults,
[property: JsonPropertyName("linked")] OutcomeResultCollectionLink? Links
);
17 changes: 17 additions & 0 deletions Epsilon.Canvas.Abstractions/Model/OutcomeResultCollectionLink.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model;

public record OutcomeResultCollectionLink(
[property: JsonPropertyName("outcomes")] IEnumerable<Outcome>? Outcomes,
[property: JsonPropertyName("alignments")] IEnumerable<Alignment>? Alignments
)
{
public IDictionary<string, Outcome> OutcomesDictionary => Outcomes
.DistinctBy(static o => o.Id)
.ToDictionary(static o => o.Id.ToString(), static o => o);

public IDictionary<string, Alignment> AlignmentsDictionary => Alignments
.DistinctBy(static a => a.Id)
.ToDictionary(static a => a.Id, static a => a);
}
10 changes: 10 additions & 0 deletions Epsilon.Canvas.Abstractions/Model/OutcomeResultLink.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model;

public record OutcomeResultLink(
[property: JsonPropertyName("user")] string? User,
[property: JsonPropertyName("learning_outcome")] string? Outcome,
[property: JsonPropertyName("alignment")] string? Alignment,
[property: JsonPropertyName("assignment")] string? Assignment
);
9 changes: 9 additions & 0 deletions Epsilon.Canvas.Abstractions/Model/RubricAssessment.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model;

public record RubricAssessment(
[property: JsonPropertyName("score")] double? Score,
[property: JsonPropertyName("artifact_attempt")] int Attempt,
[property: JsonPropertyName("data")] IEnumerable<RubricRating> Ratings
);
12 changes: 12 additions & 0 deletions Epsilon.Canvas.Abstractions/Model/RubricRating.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model;

public record RubricRating(
[property: JsonPropertyName("points")] double? Points,
[property: JsonPropertyName("learning_outcome_id")] int? OutcomeId
)
{
[JsonIgnore]
public Outcome? Outcome { get; set; }
}
10 changes: 10 additions & 0 deletions Epsilon.Canvas.Abstractions/Model/Submission.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model;

public record Submission(
[property: JsonPropertyName("submitted_at")] DateTime? SubmittedAt,
[property: JsonPropertyName("graded_at")] DateTime? GradedAt,
[property: JsonPropertyName("full_rubric_assessment")] RubricAssessment? RubricAssessment,
[property: JsonPropertyName("assignment")] Assignment? Assignment
);
12 changes: 12 additions & 0 deletions Epsilon.Canvas.Abstractions/Model/User.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model;

public class User
{
[JsonPropertyName("id")]
public int Id { get; set; }

[JsonPropertyName("name")]
public string Name { get; set; }
}
9 changes: 9 additions & 0 deletions Epsilon.Canvas.Abstractions/Service/IAssignmentHttpService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Epsilon.Canvas.Abstractions.Model;

namespace Epsilon.Canvas.Abstractions.Service;

public interface IAssignmentHttpService
{
Task<IEnumerable<Assignment>?> GetAll(int courseId, IEnumerable<string> include);
Task<Assignment?> GetById(int courseId, int id);
}
10 changes: 10 additions & 0 deletions Epsilon.Canvas.Abstractions/Service/IModuleHttpService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Epsilon.Canvas.Abstractions.Model;

namespace Epsilon.Canvas.Abstractions.Service;

public interface IModuleHttpService
{
Task<IEnumerable<Module>?> GetAll(int courseId, IEnumerable<string> include);
Task<Module?> GetById(int courseId, int id);
Task<IEnumerable<ModuleItem>?> GetAllItems(int courseId, int moduleId, int limit = 100);
}
10 changes: 10 additions & 0 deletions Epsilon.Canvas.Abstractions/Service/IOutcomeHttpService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Epsilon.Canvas.Abstractions.Model;
using Epsilon.Canvas.Abstractions.Response;

namespace Epsilon.Canvas.Abstractions.Service;

public interface IOutcomeHttpService
{
Task<Outcome?> Find(int id);
Task<OutcomeResultCollection?> GetResults(int courseId, IEnumerable<string> include);
}
6 changes: 6 additions & 0 deletions Epsilon.Canvas.Abstractions/Service/IPaginatorHttpService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Epsilon.Canvas.Abstractions.Service;

public interface IPaginatorHttpService
{
public Task<IEnumerable<T>> GetAllPages<T>(HttpMethod method, string uri);
}
8 changes: 8 additions & 0 deletions Epsilon.Canvas.Abstractions/Service/ISubmissionHttpService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Epsilon.Canvas.Abstractions.Model;

namespace Epsilon.Canvas.Abstractions.Service;

public interface ISubmissionHttpService
{
public Task<IEnumerable<Submission>> GetAllFromStudent(int courseId, IEnumerable<string> include, int limit = 100);
}
8 changes: 0 additions & 8 deletions Epsilon.Canvas.Abstractions/Services/IAssignmentService.cs

This file was deleted.

10 changes: 0 additions & 10 deletions Epsilon.Canvas.Abstractions/Services/IModuleService.cs

This file was deleted.

9 changes: 0 additions & 9 deletions Epsilon.Canvas.Abstractions/Services/IOutcomeService.cs

This file was deleted.

Loading

0 comments on commit 5d306bb

Please sign in to comment.