Skip to content

Commit 95eb969

Browse files
authored
Merge pull request #3 from passlickdev/wip-addsrc
Add project source
2 parents 8c4ea8f + 63ab40b commit 95eb969

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+34976
-0
lines changed

.gitignore

Lines changed: 434 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
**/.classpath
2+
**/.dockerignore
3+
**/.env
4+
**/.git
5+
**/.gitignore
6+
**/.project
7+
**/.settings
8+
**/.toolstarget
9+
**/.vs
10+
**/.vscode
11+
**/*.*proj.user
12+
**/*.dbmdl
13+
**/*.jfm
14+
**/azds.yaml
15+
**/bin
16+
**/charts
17+
**/docker-compose*
18+
**/Dockerfile*
19+
**/node_modules
20+
**/npm-debug.log
21+
**/obj
22+
**/secrets.dev.yaml
23+
**/values.dev.yaml
24+
LICENSE
25+
README.md
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using LearnwebNotifier.Library.Domain.Models;
2+
using System;
3+
using System.Collections.Generic;
4+
5+
namespace LearnwebNotifier.Library.Domain.Communication
6+
{
7+
public class ServiceResponse
8+
{
9+
public Guid ExecId { get; }
10+
public DateTime ExecDate { get; }
11+
public ServiceStatus Status { get; }
12+
public List<Activity> Activities { get; }
13+
14+
public ServiceResponse(ServiceStatus status, List<Activity> activities)
15+
{
16+
ExecId = Guid.NewGuid();
17+
ExecDate = DateTime.UtcNow;
18+
Status = status;
19+
Activities = activities;
20+
}
21+
}
22+
}
23+
24+
25+
// (c) Passlick Development 2020. All rights reserved.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
namespace LearnwebNotifier.Library.Domain.Communication
2+
{
3+
public enum ServiceStatus
4+
{
5+
Info = 1000,
6+
InfoRequested = 1001,
7+
OK = 2000,
8+
NewActivities = 2001,
9+
NoRecentActivities = 2002,
10+
PushSent = 2003,
11+
Valid = 2005,
12+
Exists = 2006,
13+
Warning = 3000,
14+
WidgetNotFound = 3001,
15+
Fail = 4000,
16+
PushFailed = 4003,
17+
NotFound = 4004,
18+
Invalid = 4005,
19+
Exception = 5000,
20+
Unauthorized = 5001,
21+
CriticalException = 6000,
22+
UnhandledException = 7000
23+
}
24+
}
25+
26+
27+
// (c) Passlick Development 2020. All rights reserved.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System;
2+
3+
namespace LearnwebNotifier.Library.Domain.Models
4+
{
5+
public class Activity
6+
{
7+
public DateTime? Date { get; }
8+
public Course Course { get; }
9+
public string Type { get; }
10+
public string Name { get; }
11+
public string Url { get; }
12+
13+
public Activity(DateTime? date, Course course, string type, string name, string url)
14+
{
15+
Date = date;
16+
Course = course;
17+
Type = type;
18+
Name = name;
19+
Url = url;
20+
}
21+
}
22+
}
23+
24+
25+
// (c) Passlick Development 2020. All rights reserved.
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
using System.Collections.Generic;
2+
using System.Text.Json.Serialization;
3+
4+
namespace LearnwebNotifier.Library.Domain.Models
5+
{
6+
public class ConfigStruct
7+
{
8+
[JsonPropertyName("service")]
9+
public ServiceConfig Service { get; set; } = new ServiceConfig(5);
10+
[JsonPropertyName("learnweb")]
11+
public LearnwebConfig Learnweb { get; set; } = new LearnwebConfig("", "", new List<string> { "" });
12+
[JsonPropertyName("pushover")]
13+
public PushoverConfig Pushover { get; set; } = new PushoverConfig("", "");
14+
[JsonPropertyName("sentry")]
15+
public SentryConfig Sentry { get; set; } = new SentryConfig(false, "");
16+
17+
public ConfigStruct(LearnwebConfig learnweb, PushoverConfig pushover)
18+
{
19+
Learnweb = learnweb;
20+
Pushover = pushover;
21+
}
22+
public ConfigStruct() { }
23+
24+
25+
public class ServiceConfig
26+
{
27+
[JsonPropertyName("refresh")]
28+
public uint Refresh { get; set; }
29+
30+
public ServiceConfig(uint refresh)
31+
{
32+
Refresh = refresh;
33+
}
34+
public ServiceConfig() { }
35+
}
36+
37+
public class LearnwebConfig
38+
{
39+
[JsonPropertyName("user")]
40+
public string Username { get; set; }
41+
[JsonPropertyName("password")]
42+
public string Password { get; set; }
43+
[JsonPropertyName("courses")]
44+
public List<string> Courses { get; set; }
45+
46+
public LearnwebConfig(string username, string password, List<string> courses)
47+
{
48+
Username = username;
49+
Password = password;
50+
Courses = courses;
51+
}
52+
public LearnwebConfig() { }
53+
}
54+
55+
public class PushoverConfig
56+
{
57+
[JsonPropertyName("token")]
58+
public string Token { get; set; }
59+
[JsonPropertyName("recipient")]
60+
public string Recipient { get; set; }
61+
62+
public PushoverConfig(string token, string recipient)
63+
{
64+
Token = token;
65+
Recipient = recipient;
66+
}
67+
public PushoverConfig() { }
68+
}
69+
70+
public class SentryConfig
71+
{
72+
[JsonPropertyName("activate")]
73+
public bool Activate { get; set; }
74+
[JsonPropertyName("dsn")]
75+
public string Dsn { get; set; }
76+
77+
public SentryConfig(bool activate, string dsn)
78+
{
79+
Activate = activate;
80+
Dsn = dsn;
81+
}
82+
public SentryConfig() { }
83+
}
84+
85+
}
86+
}
87+
88+
89+
// (c) Passlick Development 2020. All rights reserved.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
namespace LearnwebNotifier.Library.Domain.Models
2+
{
3+
public class Course
4+
{
5+
public string Id { get; }
6+
public string Name { get; set; }
7+
public string Abbrev { get; set; }
8+
public string Url { get; set; }
9+
10+
public Course(string id)
11+
{
12+
Id = id;
13+
Name = "N/A";
14+
Abbrev = "N/A";
15+
Url = $"https://sso.uni-muenster.de/LearnWeb/learnweb2/course/view.php?id={Id}&lang=en";
16+
}
17+
}
18+
}
19+
20+
21+
// (c) Passlick Development 2020. All rights reserved.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using LearnwebNotifier.Library.Domain.Communication;
2+
3+
namespace LearnwebNotifier.Library.Domain.Services
4+
{
5+
public interface IActivityService
6+
{
7+
public ServiceStatus Init();
8+
public ServiceResponse FetchActivities(string courseId);
9+
public ServiceStatus RefreshSession();
10+
public void ClearCookies();
11+
public void Dispose();
12+
}
13+
}
14+
15+
16+
// (c) Passlick Development 2020. All rights reserved.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using LearnwebNotifier.Library.Domain.Communication;
2+
using System.Net.Http;
3+
4+
namespace LearnwebNotifier.Library.Domain.Services
5+
{
6+
public interface IClientService
7+
{
8+
public ServiceStatus Init();
9+
public ServiceStatus Authorize();
10+
public ServiceStatus RefreshSession();
11+
public HttpClient GetClient();
12+
public void ClearCookies();
13+
public void Dispose();
14+
}
15+
}
16+
17+
18+
// (c) Passlick Development 2020. All rights reserved.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using LearnwebNotifier.Library.Domain.Communication;
2+
using LearnwebNotifier.Library.Domain.Models;
3+
4+
namespace LearnwebNotifier.Library.Domain.Services
5+
{
6+
public interface IConfigService
7+
{
8+
public ServiceStatus LoadConfig();
9+
public ServiceStatus GenerateConfig(ConfigStruct config);
10+
public ServiceStatus CheckConfigExistence();
11+
public (ServiceStatus status, string value) GetLearnwebPassword();
12+
public ServiceStatus ConfigAssistant();
13+
}
14+
}
15+
16+
17+
// (c) Passlick Development 2020. All rights reserved.

0 commit comments

Comments
 (0)