Skip to content

Commit

Permalink
create CalendatEventRepeatInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
MCUmbrella committed Jun 15, 2023
1 parent 78d7a1a commit c0645d6
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 2 deletions.
4 changes: 2 additions & 2 deletions _G_API_STD_COMM.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
When does Guilded4J currently correspond to the Guilded API standard?

2023-02-02 01:16:00
072197a827ac7a96416c9658d9b9bc93d29734f6
2023-02-07 12:26:37
7fa1f91bb09ca5c2247f6789bdaf5813150cd9c7
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
Copyright (C) 2021-2023 MCUmbrella & contributors
Licensed under the MIT License. See LICENSE in the project root for license information.
*/

package vip.floatationdevice.guilded4j.enums;

public enum CalendarEventRepeatType
{
ONCE,
EVERY_DAY,
EVERY_WEEK,
EVERY_MONTH,
CUSTOM;

public static CalendarEventRepeatType fromString(String s)
{
switch(s)
{
case "once":
return ONCE;
case "everyDay":
return EVERY_DAY;
case "everyWeek":
return EVERY_WEEK;
case "everyMonth":
return EVERY_MONTH;
case "custom":
return CUSTOM;
default:
throw new IllegalArgumentException("Unknown repeat type");
}
}

@Override
public String toString()
{
switch(this)
{
case ONCE:
return "once";
case EVERY_DAY:
return "everyDay";
case EVERY_WEEK:
return "everyWeek";
case EVERY_MONTH:
return "everyMonth";
case CUSTOM:
return "custom";
default:
throw new RuntimeException("Should not happen");
}
}
}
46 changes: 46 additions & 0 deletions src/main/java/vip/floatationdevice/guilded4j/enums/Weekday.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
Copyright (C) 2021-2023 MCUmbrella & contributors
Licensed under the MIT License. See LICENSE in the project root for license information.
*/

package vip.floatationdevice.guilded4j.enums;

public enum Weekday
{
MON,
TUE,
WED,
THU,
FRI,
SAT,
SUN;

public static Weekday fromString(String s)
{
switch (s.toLowerCase())
{
case "monday":
return MON;
case "tuesday":
return TUE;
case "wednesday":
return WED;
case "thursday":
return THU;
case "friday":
return FRI;
case "saturday":
return SAT;
case "sunday":
return SUN;
default:
throw new IllegalArgumentException("Invalid weekday");
}
}

@Override
public String toString()
{
return name().toLowerCase();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
Copyright (C) 2021-2023 MCUmbrella & contributors
Licensed under the MIT License. See LICENSE in the project root for license information.
*/

package vip.floatationdevice.guilded4j.object.misc;

import vip.floatationdevice.guilded4j.enums.CalendarEventRepeatType;
import vip.floatationdevice.guilded4j.enums.Weekday;

public class CalendatEventRepeatInfo //TODO
{
public enum Interval
{
DAY,
WEEK,
MONTH,
YEAR;

@Override
public String toString()
{
return name().toLowerCase();
}
}

private CalendarEventRepeatType type;
private Integer everyCount;
private Interval interval;
private Integer endsAfterOccurrences;
private String endDate;
private Weekday on;
}

0 comments on commit c0645d6

Please sign in to comment.