Further organizes Calendar events
This commit is contained in:
@@ -153,10 +153,10 @@ import com.vitorpamplona.quartz.nip51Lists.relayLists.IndexerRelayListEvent
|
||||
import com.vitorpamplona.quartz.nip51Lists.relayLists.ProxyRelayListEvent
|
||||
import com.vitorpamplona.quartz.nip51Lists.relayLists.TrustedRelayListEvent
|
||||
import com.vitorpamplona.quartz.nip51Lists.relaySets.RelaySetEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.CalendarDateSlotEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.CalendarEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.CalendarRSVPEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.CalendarTimeSlotEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.appt.day.CalendarDateSlotEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.appt.time.CalendarTimeSlotEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.rsvp.CalendarRSVPEvent
|
||||
import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent
|
||||
import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent
|
||||
import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent
|
||||
|
||||
+3
-3
@@ -39,9 +39,9 @@ import com.vitorpamplona.quartz.nip34Git.issue.GitIssueEvent
|
||||
import com.vitorpamplona.quartz.nip34Git.patch.GitPatchEvent
|
||||
import com.vitorpamplona.quartz.nip34Git.reply.GitReplyEvent
|
||||
import com.vitorpamplona.quartz.nip47WalletConnect.LnZapPaymentResponseEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.CalendarDateSlotEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.CalendarRSVPEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.CalendarTimeSlotEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.appt.day.CalendarDateSlotEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.appt.time.CalendarTimeSlotEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.rsvp.CalendarRSVPEvent
|
||||
import com.vitorpamplona.quartz.nip56Reports.ReportEvent
|
||||
import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent
|
||||
import com.vitorpamplona.quartz.nip58Badges.BadgeAwardEvent
|
||||
|
||||
+3
-3
@@ -49,9 +49,9 @@ import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent
|
||||
import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent
|
||||
import com.vitorpamplona.quartz.nip34Git.issue.GitIssueEvent
|
||||
import com.vitorpamplona.quartz.nip34Git.patch.GitPatchEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.CalendarDateSlotEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.CalendarRSVPEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.CalendarTimeSlotEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.appt.day.CalendarDateSlotEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.appt.time.CalendarTimeSlotEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.rsvp.CalendarRSVPEvent
|
||||
import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent
|
||||
import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent
|
||||
import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent
|
||||
|
||||
+4
-4
@@ -201,10 +201,10 @@ import com.vitorpamplona.quartz.nip51Lists.relayLists.IndexerRelayListEvent
|
||||
import com.vitorpamplona.quartz.nip51Lists.relayLists.ProxyRelayListEvent
|
||||
import com.vitorpamplona.quartz.nip51Lists.relayLists.TrustedRelayListEvent
|
||||
import com.vitorpamplona.quartz.nip51Lists.relaySets.RelaySetEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.CalendarDateSlotEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.CalendarEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.CalendarRSVPEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.CalendarTimeSlotEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.appt.day.CalendarDateSlotEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.appt.time.CalendarTimeSlotEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.rsvp.CalendarRSVPEvent
|
||||
import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent
|
||||
import com.vitorpamplona.quartz.nip53LiveActivities.meetingSpaces.MeetingRoomEvent
|
||||
import com.vitorpamplona.quartz.nip53LiveActivities.meetingSpaces.MeetingSpaceEvent
|
||||
|
||||
+10
-10
@@ -18,7 +18,7 @@
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package com.vitorpamplona.quartz.nip52Calendar
|
||||
package com.vitorpamplona.quartz.nip52Calendar.appt.day
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import com.vitorpamplona.quartz.nip01Core.core.BaseAddressableEvent
|
||||
@@ -35,7 +35,7 @@ import com.vitorpamplona.quartz.nip23LongContent.tags.ImageTag
|
||||
import com.vitorpamplona.quartz.nip23LongContent.tags.SummaryTag
|
||||
import com.vitorpamplona.quartz.nip23LongContent.tags.TitleTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip52Calendar.tags.LocationTag
|
||||
import com.vitorpamplona.quartz.nip52Calendar.appt.tags.LocationTag
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
import kotlin.uuid.ExperimentalUuidApi
|
||||
import kotlin.uuid.Uuid
|
||||
@@ -49,25 +49,25 @@ class CalendarDateSlotEvent(
|
||||
content: String,
|
||||
sig: HexKey,
|
||||
) : BaseAddressableEvent(id, pubKey, createdAt, KIND, tags, content, sig) {
|
||||
fun title() = tags.firstNotNullOfOrNull(TitleTag::parse)
|
||||
fun title() = tags.firstNotNullOfOrNull(TitleTag.Companion::parse)
|
||||
|
||||
fun location() = tags.firstNotNullOfOrNull(LocationTag::parse)
|
||||
fun location() = tags.firstNotNullOfOrNull(LocationTag.Companion::parse)
|
||||
|
||||
fun locations() = tags.mapNotNull(LocationTag::parse)
|
||||
fun locations() = tags.mapNotNull(LocationTag.Companion::parse)
|
||||
|
||||
fun start() = tags.firstTagValue("start")
|
||||
|
||||
fun end() = tags.firstTagValue("end")
|
||||
|
||||
fun summary() = tags.firstNotNullOfOrNull(SummaryTag::parse)
|
||||
fun summary() = tags.firstNotNullOfOrNull(SummaryTag.Companion::parse)
|
||||
|
||||
fun image() = tags.firstNotNullOfOrNull(ImageTag::parse)
|
||||
fun image() = tags.firstNotNullOfOrNull(ImageTag.Companion::parse)
|
||||
|
||||
fun geohash() = tags.firstNotNullOfOrNull(GeoHashTag::parse)
|
||||
fun geohash() = tags.firstNotNullOfOrNull(GeoHashTag.Companion::parse)
|
||||
|
||||
fun hashtags() = tags.hashtags()
|
||||
|
||||
fun participants() = tags.mapNotNull(PTag::parse)
|
||||
fun participants() = tags.mapNotNull(PTag.Companion::parse)
|
||||
|
||||
fun references() = tags.references()
|
||||
|
||||
@@ -81,7 +81,7 @@ class CalendarDateSlotEvent(
|
||||
start: String,
|
||||
content: String = "",
|
||||
end: String? = null,
|
||||
dTag: String = Uuid.random().toString(),
|
||||
dTag: String = Uuid.Companion.random().toString(),
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<CalendarDateSlotEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, content, createdAt) {
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2025 Vitor Pamplona
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
||||
* Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package com.vitorpamplona.quartz.nip52Calendar.appt.day
|
||||
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.geohash.GeoHashTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.PTag
|
||||
import com.vitorpamplona.quartz.nip23LongContent.tags.ImageTag
|
||||
import com.vitorpamplona.quartz.nip23LongContent.tags.SummaryTag
|
||||
import com.vitorpamplona.quartz.nip23LongContent.tags.TitleTag
|
||||
import com.vitorpamplona.quartz.nip52Calendar.appt.tags.LocationTag
|
||||
|
||||
// CalendarDateSlotEvent builder extensions
|
||||
|
||||
fun TagArrayBuilder<CalendarDateSlotEvent>.titleDay(title: String) = addUnique(TitleTag.assemble(title))
|
||||
|
||||
fun TagArrayBuilder<CalendarDateSlotEvent>.startDate(date: String) = addUnique(arrayOf("start", date))
|
||||
|
||||
fun TagArrayBuilder<CalendarDateSlotEvent>.endDate(date: String) = addUnique(arrayOf("end", date))
|
||||
|
||||
fun TagArrayBuilder<CalendarDateSlotEvent>.location(location: String) = add(LocationTag.assemble(location))
|
||||
|
||||
fun TagArrayBuilder<CalendarDateSlotEvent>.locations(locations: List<String>) = addAll(locations.map { LocationTag.assemble(it) })
|
||||
|
||||
fun TagArrayBuilder<CalendarDateSlotEvent>.summary(summary: String) = addUnique(SummaryTag.assemble(summary))
|
||||
|
||||
fun TagArrayBuilder<CalendarDateSlotEvent>.image(imageUrl: String) = addUnique(ImageTag.assemble(imageUrl))
|
||||
|
||||
fun TagArrayBuilder<CalendarDateSlotEvent>.geohash(geohash: String) = addAll(GeoHashTag.assemble(geohash).toList())
|
||||
|
||||
fun TagArrayBuilder<CalendarDateSlotEvent>.participant(p: PTag) = add(p.toTagArray())
|
||||
|
||||
fun TagArrayBuilder<CalendarDateSlotEvent>.participants(ps: List<PTag>) = addAll(ps.map { it.toTagArray() })
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package com.vitorpamplona.quartz.nip52Calendar.tags
|
||||
package com.vitorpamplona.quartz.nip52Calendar.appt.tags
|
||||
|
||||
import com.vitorpamplona.quartz.nip01Core.core.has
|
||||
import com.vitorpamplona.quartz.utils.ensure
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package com.vitorpamplona.quartz.nip52Calendar.tags
|
||||
package com.vitorpamplona.quartz.nip52Calendar.appt.tags
|
||||
|
||||
import com.vitorpamplona.quartz.nip01Core.core.has
|
||||
import com.vitorpamplona.quartz.utils.ensure
|
||||
+10
-10
@@ -18,7 +18,7 @@
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package com.vitorpamplona.quartz.nip52Calendar
|
||||
package com.vitorpamplona.quartz.nip52Calendar.appt.time
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import com.vitorpamplona.quartz.nip01Core.core.BaseAddressableEvent
|
||||
@@ -36,7 +36,7 @@ import com.vitorpamplona.quartz.nip23LongContent.tags.ImageTag
|
||||
import com.vitorpamplona.quartz.nip23LongContent.tags.SummaryTag
|
||||
import com.vitorpamplona.quartz.nip23LongContent.tags.TitleTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip52Calendar.tags.LocationTag
|
||||
import com.vitorpamplona.quartz.nip52Calendar.appt.tags.LocationTag
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
import kotlin.uuid.ExperimentalUuidApi
|
||||
import kotlin.uuid.Uuid
|
||||
@@ -50,11 +50,11 @@ class CalendarTimeSlotEvent(
|
||||
content: String,
|
||||
sig: HexKey,
|
||||
) : BaseAddressableEvent(id, pubKey, createdAt, KIND, tags, content, sig) {
|
||||
fun title() = tags.firstNotNullOfOrNull(TitleTag::parse)
|
||||
fun title() = tags.firstNotNullOfOrNull(TitleTag.Companion::parse)
|
||||
|
||||
fun location() = tags.firstNotNullOfOrNull(LocationTag::parse)
|
||||
fun location() = tags.firstNotNullOfOrNull(LocationTag.Companion::parse)
|
||||
|
||||
fun locations() = tags.mapNotNull(LocationTag::parse)
|
||||
fun locations() = tags.mapNotNull(LocationTag.Companion::parse)
|
||||
|
||||
fun start() = tags.firstTagValueAsLong("start")
|
||||
|
||||
@@ -64,15 +64,15 @@ class CalendarTimeSlotEvent(
|
||||
|
||||
fun endTzId() = tags.firstTagValue("end_tzid")
|
||||
|
||||
fun summary() = tags.firstNotNullOfOrNull(SummaryTag::parse)
|
||||
fun summary() = tags.firstNotNullOfOrNull(SummaryTag.Companion::parse)
|
||||
|
||||
fun image() = tags.firstNotNullOfOrNull(ImageTag::parse)
|
||||
fun image() = tags.firstNotNullOfOrNull(ImageTag.Companion::parse)
|
||||
|
||||
fun geohash() = tags.firstNotNullOfOrNull(GeoHashTag::parse)
|
||||
fun geohash() = tags.firstNotNullOfOrNull(GeoHashTag.Companion::parse)
|
||||
|
||||
fun hashtags() = tags.hashtags()
|
||||
|
||||
fun participants() = tags.mapNotNull(PTag::parse)
|
||||
fun participants() = tags.mapNotNull(PTag.Companion::parse)
|
||||
|
||||
fun references() = tags.references()
|
||||
|
||||
@@ -88,7 +88,7 @@ class CalendarTimeSlotEvent(
|
||||
end: Long? = null,
|
||||
startTzId: String? = null,
|
||||
endTzId: String? = null,
|
||||
dTag: String = Uuid.random().toString(),
|
||||
dTag: String = Uuid.Companion.random().toString(),
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<CalendarTimeSlotEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, content, createdAt) {
|
||||
+2
-38
@@ -18,7 +18,7 @@
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package com.vitorpamplona.quartz.nip52Calendar
|
||||
package com.vitorpamplona.quartz.nip52Calendar.appt.time
|
||||
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.geohash.GeoHashTag
|
||||
@@ -26,33 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.tags.people.PTag
|
||||
import com.vitorpamplona.quartz.nip23LongContent.tags.ImageTag
|
||||
import com.vitorpamplona.quartz.nip23LongContent.tags.SummaryTag
|
||||
import com.vitorpamplona.quartz.nip23LongContent.tags.TitleTag
|
||||
import com.vitorpamplona.quartz.nip52Calendar.tags.FreeBusyTag
|
||||
import com.vitorpamplona.quartz.nip52Calendar.tags.LocationTag
|
||||
import com.vitorpamplona.quartz.nip52Calendar.tags.RSVPStatusTag
|
||||
|
||||
// CalendarDateSlotEvent builder extensions
|
||||
|
||||
fun TagArrayBuilder<CalendarDateSlotEvent>.titleDay(title: String) = addUnique(TitleTag.assemble(title))
|
||||
|
||||
fun TagArrayBuilder<CalendarDateSlotEvent>.startDate(date: String) = addUnique(arrayOf("start", date))
|
||||
|
||||
fun TagArrayBuilder<CalendarDateSlotEvent>.endDate(date: String) = addUnique(arrayOf("end", date))
|
||||
|
||||
fun TagArrayBuilder<CalendarDateSlotEvent>.location(location: String) = add(LocationTag.assemble(location))
|
||||
|
||||
fun TagArrayBuilder<CalendarDateSlotEvent>.locations(locations: List<String>) = addAll(locations.map { LocationTag.assemble(it) })
|
||||
|
||||
fun TagArrayBuilder<CalendarDateSlotEvent>.summary(summary: String) = addUnique(SummaryTag.assemble(summary))
|
||||
|
||||
fun TagArrayBuilder<CalendarDateSlotEvent>.image(imageUrl: String) = addUnique(ImageTag.assemble(imageUrl))
|
||||
|
||||
fun TagArrayBuilder<CalendarDateSlotEvent>.geohash(geohash: String) = addAll(GeoHashTag.assemble(geohash).toList())
|
||||
|
||||
fun TagArrayBuilder<CalendarDateSlotEvent>.participant(p: PTag) = add(p.toTagArray())
|
||||
|
||||
fun TagArrayBuilder<CalendarDateSlotEvent>.participants(ps: List<PTag>) = addAll(ps.map { it.toTagArray() })
|
||||
|
||||
// CalendarTimeSlotEvent builder extensions
|
||||
import com.vitorpamplona.quartz.nip52Calendar.appt.tags.LocationTag
|
||||
|
||||
fun TagArrayBuilder<CalendarTimeSlotEvent>.titleTime(title: String) = addUnique(TitleTag.assemble(title))
|
||||
|
||||
@@ -77,13 +51,3 @@ fun TagArrayBuilder<CalendarTimeSlotEvent>.geohash(geohash: String) = addAll(Geo
|
||||
fun TagArrayBuilder<CalendarTimeSlotEvent>.participant(p: PTag) = add(p.toTagArray())
|
||||
|
||||
fun TagArrayBuilder<CalendarTimeSlotEvent>.participants(ps: List<PTag>) = addAll(ps.map { it.toTagArray() })
|
||||
|
||||
// CalendarEvent builder extensions
|
||||
|
||||
fun TagArrayBuilder<CalendarEvent>.title(title: String) = addUnique(TitleTag.assemble(title))
|
||||
|
||||
// CalendarRSVPEvent builder extensions
|
||||
|
||||
fun TagArrayBuilder<CalendarRSVPEvent>.status(status: RSVPStatusTag.STATUS) = addUnique(status.toTagArray())
|
||||
|
||||
fun TagArrayBuilder<CalendarRSVPEvent>.freebusy(fb: FreeBusyTag.STATUS) = addUnique(fb.toTagArray())
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package com.vitorpamplona.quartz.nip52Calendar
|
||||
package com.vitorpamplona.quartz.nip52Calendar.calendar
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import com.vitorpamplona.quartz.nip01Core.core.BaseAddressableEvent
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2025 Vitor Pamplona
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
||||
* Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package com.vitorpamplona.quartz.nip52Calendar.calendar
|
||||
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip23LongContent.tags.TitleTag
|
||||
|
||||
// CalendarEvent builder extensions
|
||||
|
||||
fun TagArrayBuilder<CalendarEvent>.title(title: String) = addUnique(TitleTag.assemble(title))
|
||||
+8
-8
@@ -18,7 +18,7 @@
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package com.vitorpamplona.quartz.nip52Calendar
|
||||
package com.vitorpamplona.quartz.nip52Calendar.rsvp
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import com.vitorpamplona.quartz.nip01Core.core.BaseAddressableEvent
|
||||
@@ -33,8 +33,8 @@ import com.vitorpamplona.quartz.nip01Core.tags.events.ETag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.events.firstTaggedEvent
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.PTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip52Calendar.tags.FreeBusyTag
|
||||
import com.vitorpamplona.quartz.nip52Calendar.tags.RSVPStatusTag
|
||||
import com.vitorpamplona.quartz.nip52Calendar.appt.tags.RSVPStatusTag
|
||||
import com.vitorpamplona.quartz.nip52Calendar.rsvp.tags.FreeBusyTag
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
import kotlin.uuid.ExperimentalUuidApi
|
||||
import kotlin.uuid.Uuid
|
||||
@@ -48,17 +48,17 @@ class CalendarRSVPEvent(
|
||||
content: String,
|
||||
sig: HexKey,
|
||||
) : BaseAddressableEvent(id, pubKey, createdAt, KIND, tags, content, sig) {
|
||||
fun status() = tags.firstNotNullOfOrNull(RSVPStatusTag::parse)
|
||||
fun status() = tags.firstNotNullOfOrNull(RSVPStatusTag.Companion::parse)
|
||||
|
||||
fun statusValue() = tags.firstNotNullOfOrNull(RSVPStatusTag::parseValue)
|
||||
fun statusValue() = tags.firstNotNullOfOrNull(RSVPStatusTag.Companion::parseValue)
|
||||
|
||||
fun freebusy() = tags.firstNotNullOfOrNull(FreeBusyTag::parse)
|
||||
fun freebusy() = tags.firstNotNullOfOrNull(FreeBusyTag.Companion::parse)
|
||||
|
||||
fun calendarEventAddress() = firstTaggedAddress()
|
||||
|
||||
fun calendarEventId() = firstTaggedEvent()
|
||||
|
||||
fun calendarEventAuthor() = tags.firstNotNullOfOrNull(PTag::parse)
|
||||
fun calendarEventAuthor() = tags.firstNotNullOfOrNull(PTag.Companion::parse)
|
||||
|
||||
companion object {
|
||||
const val KIND = 31925
|
||||
@@ -72,7 +72,7 @@ class CalendarRSVPEvent(
|
||||
calendarEventId: ETag? = null,
|
||||
calendarEventAuthor: PTag? = null,
|
||||
freebusy: FreeBusyTag.STATUS? = null,
|
||||
dTag: String = Uuid.random().toString(),
|
||||
dTag: String = Uuid.Companion.random().toString(),
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<CalendarRSVPEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, content, createdAt) {
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2025 Vitor Pamplona
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
||||
* Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package com.vitorpamplona.quartz.nip52Calendar.rsvp
|
||||
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip52Calendar.appt.tags.RSVPStatusTag
|
||||
import com.vitorpamplona.quartz.nip52Calendar.rsvp.tags.FreeBusyTag
|
||||
|
||||
fun TagArrayBuilder<CalendarRSVPEvent>.status(status: RSVPStatusTag.STATUS) = addUnique(status.toTagArray())
|
||||
|
||||
fun TagArrayBuilder<CalendarRSVPEvent>.freebusy(fb: FreeBusyTag.STATUS) = addUnique(fb.toTagArray())
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package com.vitorpamplona.quartz.nip52Calendar.tags
|
||||
package com.vitorpamplona.quartz.nip52Calendar.rsvp.tags
|
||||
|
||||
import com.vitorpamplona.quartz.nip01Core.core.has
|
||||
import com.vitorpamplona.quartz.utils.ensure
|
||||
@@ -94,10 +94,10 @@ import com.vitorpamplona.quartz.nip51Lists.relayLists.IndexerRelayListEvent
|
||||
import com.vitorpamplona.quartz.nip51Lists.relayLists.ProxyRelayListEvent
|
||||
import com.vitorpamplona.quartz.nip51Lists.relayLists.TrustedRelayListEvent
|
||||
import com.vitorpamplona.quartz.nip51Lists.relaySets.RelaySetEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.CalendarDateSlotEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.CalendarEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.CalendarRSVPEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.CalendarTimeSlotEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.appt.day.CalendarDateSlotEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.appt.time.CalendarTimeSlotEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent
|
||||
import com.vitorpamplona.quartz.nip52Calendar.rsvp.CalendarRSVPEvent
|
||||
import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent
|
||||
import com.vitorpamplona.quartz.nip53LiveActivities.meetingSpaces.MeetingRoomEvent
|
||||
import com.vitorpamplona.quartz.nip53LiveActivities.meetingSpaces.MeetingSpaceEvent
|
||||
|
||||
@@ -20,6 +20,11 @@
|
||||
*/
|
||||
package com.vitorpamplona.quartz.nip64Chess
|
||||
|
||||
import com.vitorpamplona.quartz.nip64Chess.jester.JesterEvent
|
||||
import com.vitorpamplona.quartz.nip64Chess.jester.JesterGameEvents
|
||||
import com.vitorpamplona.quartz.nip64Chess.jester.JesterProtocol
|
||||
import com.vitorpamplona.quartz.nip64Chess.jester.isJesterEvent
|
||||
import com.vitorpamplona.quartz.nip64Chess.jester.toJesterEvent
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertFalse
|
||||
|
||||
Reference in New Issue
Block a user