-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4fe164e
commit 2f4ff3b
Showing
27 changed files
with
3,514 additions
and
2,095 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
v1/src/commonMain/kotlin/ai/wandering/scoop/v1/models/Category.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
@file:OptIn(pbandk.PublicForGeneratedCode::class) | ||
|
||
package ai.wandering.scoop.v1.models | ||
|
||
@pbandk.Export | ||
public data class Category( | ||
val id: String = "", | ||
val timestamp: Long = 0L, | ||
val scoop: ai.wandering.scoop.v1.models.Scoop? = null, | ||
val tag: ai.wandering.scoop.v1.models.Tag? = null, | ||
override val unknownFields: Map<Int, pbandk.UnknownField> = emptyMap() | ||
) : pbandk.Message { | ||
override operator fun plus(other: pbandk.Message?): ai.wandering.scoop.v1.models.Category = protoMergeImpl(other) | ||
override val descriptor: pbandk.MessageDescriptor<ai.wandering.scoop.v1.models.Category> get() = Companion.descriptor | ||
override val protoSize: Int by lazy { super.protoSize } | ||
public companion object : pbandk.Message.Companion<ai.wandering.scoop.v1.models.Category> { | ||
public val defaultInstance: ai.wandering.scoop.v1.models.Category by lazy { ai.wandering.scoop.v1.models.Category() } | ||
override fun decodeWith(u: pbandk.MessageDecoder): ai.wandering.scoop.v1.models.Category = ai.wandering.scoop.v1.models.Category.decodeWithImpl(u) | ||
|
||
override val descriptor: pbandk.MessageDescriptor<ai.wandering.scoop.v1.models.Category> by lazy { | ||
val fieldsList = ArrayList<pbandk.FieldDescriptor<ai.wandering.scoop.v1.models.Category, *>>(4) | ||
fieldsList.apply { | ||
add( | ||
pbandk.FieldDescriptor( | ||
messageDescriptor = this@Companion::descriptor, | ||
name = "id", | ||
number = 1, | ||
type = pbandk.FieldDescriptor.Type.Primitive.String(), | ||
jsonName = "id", | ||
value = ai.wandering.scoop.v1.models.Category::id | ||
) | ||
) | ||
add( | ||
pbandk.FieldDescriptor( | ||
messageDescriptor = this@Companion::descriptor, | ||
name = "timestamp", | ||
number = 2, | ||
type = pbandk.FieldDescriptor.Type.Primitive.Int64(), | ||
jsonName = "timestamp", | ||
value = ai.wandering.scoop.v1.models.Category::timestamp | ||
) | ||
) | ||
add( | ||
pbandk.FieldDescriptor( | ||
messageDescriptor = this@Companion::descriptor, | ||
name = "scoop", | ||
number = 3, | ||
type = pbandk.FieldDescriptor.Type.Message(messageCompanion = ai.wandering.scoop.v1.models.Scoop.Companion), | ||
jsonName = "scoop", | ||
value = ai.wandering.scoop.v1.models.Category::scoop | ||
) | ||
) | ||
add( | ||
pbandk.FieldDescriptor( | ||
messageDescriptor = this@Companion::descriptor, | ||
name = "tag", | ||
number = 4, | ||
type = pbandk.FieldDescriptor.Type.Message(messageCompanion = ai.wandering.scoop.v1.models.Tag.Companion), | ||
jsonName = "tag", | ||
value = ai.wandering.scoop.v1.models.Category::tag | ||
) | ||
) | ||
} | ||
pbandk.MessageDescriptor( | ||
fullName = "ai.wandering.scoop.v1.models.Category", | ||
messageClass = ai.wandering.scoop.v1.models.Category::class, | ||
messageCompanion = this, | ||
fields = fieldsList | ||
) | ||
} | ||
} | ||
} | ||
|
||
@pbandk.Export | ||
@pbandk.JsName("orDefaultForCategory") | ||
public fun Category?.orDefault(): ai.wandering.scoop.v1.models.Category = this ?: Category.defaultInstance | ||
|
||
private fun Category.protoMergeImpl(plus: pbandk.Message?): Category = (plus as? Category)?.let { | ||
it.copy( | ||
scoop = scoop?.plus(plus.scoop) ?: plus.scoop, | ||
tag = tag?.plus(plus.tag) ?: plus.tag, | ||
unknownFields = unknownFields + plus.unknownFields | ||
) | ||
} ?: this | ||
|
||
@Suppress("UNCHECKED_CAST") | ||
private fun Category.Companion.decodeWithImpl(u: pbandk.MessageDecoder): Category { | ||
var id = "" | ||
var timestamp = 0L | ||
var scoop: ai.wandering.scoop.v1.models.Scoop? = null | ||
var tag: ai.wandering.scoop.v1.models.Tag? = null | ||
|
||
val unknownFields = u.readMessage(this) { _fieldNumber, _fieldValue -> | ||
when (_fieldNumber) { | ||
1 -> id = _fieldValue as String | ||
2 -> timestamp = _fieldValue as Long | ||
3 -> scoop = _fieldValue as ai.wandering.scoop.v1.models.Scoop | ||
4 -> tag = _fieldValue as ai.wandering.scoop.v1.models.Tag | ||
} | ||
} | ||
|
||
return Category(id, timestamp, scoop, tag, unknownFields) | ||
} |
89 changes: 89 additions & 0 deletions
89
v1/src/commonMain/kotlin/ai/wandering/scoop/v1/models/EditorsPick.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
@file:OptIn(pbandk.PublicForGeneratedCode::class) | ||
|
||
package ai.wandering.scoop.v1.models | ||
|
||
@pbandk.Export | ||
public data class EditorsPick( | ||
val id: String = "", | ||
val timestamp: Long = 0L, | ||
val stories: List<ai.wandering.scoop.v1.models.Story> = emptyList(), | ||
override val unknownFields: Map<Int, pbandk.UnknownField> = emptyMap() | ||
) : pbandk.Message { | ||
override operator fun plus(other: pbandk.Message?): ai.wandering.scoop.v1.models.EditorsPick = protoMergeImpl(other) | ||
override val descriptor: pbandk.MessageDescriptor<ai.wandering.scoop.v1.models.EditorsPick> get() = Companion.descriptor | ||
override val protoSize: Int by lazy { super.protoSize } | ||
public companion object : pbandk.Message.Companion<ai.wandering.scoop.v1.models.EditorsPick> { | ||
public val defaultInstance: ai.wandering.scoop.v1.models.EditorsPick by lazy { ai.wandering.scoop.v1.models.EditorsPick() } | ||
override fun decodeWith(u: pbandk.MessageDecoder): ai.wandering.scoop.v1.models.EditorsPick = ai.wandering.scoop.v1.models.EditorsPick.decodeWithImpl(u) | ||
|
||
override val descriptor: pbandk.MessageDescriptor<ai.wandering.scoop.v1.models.EditorsPick> by lazy { | ||
val fieldsList = ArrayList<pbandk.FieldDescriptor<ai.wandering.scoop.v1.models.EditorsPick, *>>(3) | ||
fieldsList.apply { | ||
add( | ||
pbandk.FieldDescriptor( | ||
messageDescriptor = this@Companion::descriptor, | ||
name = "id", | ||
number = 1, | ||
type = pbandk.FieldDescriptor.Type.Primitive.String(), | ||
jsonName = "id", | ||
value = ai.wandering.scoop.v1.models.EditorsPick::id | ||
) | ||
) | ||
add( | ||
pbandk.FieldDescriptor( | ||
messageDescriptor = this@Companion::descriptor, | ||
name = "timestamp", | ||
number = 2, | ||
type = pbandk.FieldDescriptor.Type.Primitive.Int64(), | ||
jsonName = "timestamp", | ||
value = ai.wandering.scoop.v1.models.EditorsPick::timestamp | ||
) | ||
) | ||
add( | ||
pbandk.FieldDescriptor( | ||
messageDescriptor = this@Companion::descriptor, | ||
name = "stories", | ||
number = 3, | ||
type = pbandk.FieldDescriptor.Type.Repeated<ai.wandering.scoop.v1.models.Story>(valueType = pbandk.FieldDescriptor.Type.Message(messageCompanion = ai.wandering.scoop.v1.models.Story.Companion)), | ||
jsonName = "stories", | ||
value = ai.wandering.scoop.v1.models.EditorsPick::stories | ||
) | ||
) | ||
} | ||
pbandk.MessageDescriptor( | ||
fullName = "ai.wandering.scoop.v1.models.EditorsPick", | ||
messageClass = ai.wandering.scoop.v1.models.EditorsPick::class, | ||
messageCompanion = this, | ||
fields = fieldsList | ||
) | ||
} | ||
} | ||
} | ||
|
||
@pbandk.Export | ||
@pbandk.JsName("orDefaultForEditorsPick") | ||
public fun EditorsPick?.orDefault(): ai.wandering.scoop.v1.models.EditorsPick = this ?: EditorsPick.defaultInstance | ||
|
||
private fun EditorsPick.protoMergeImpl(plus: pbandk.Message?): EditorsPick = (plus as? EditorsPick)?.let { | ||
it.copy( | ||
stories = stories + plus.stories, | ||
unknownFields = unknownFields + plus.unknownFields | ||
) | ||
} ?: this | ||
|
||
@Suppress("UNCHECKED_CAST") | ||
private fun EditorsPick.Companion.decodeWithImpl(u: pbandk.MessageDecoder): EditorsPick { | ||
var id = "" | ||
var timestamp = 0L | ||
var stories: pbandk.ListWithSize.Builder<ai.wandering.scoop.v1.models.Story>? = null | ||
|
||
val unknownFields = u.readMessage(this) { _fieldNumber, _fieldValue -> | ||
when (_fieldNumber) { | ||
1 -> id = _fieldValue as String | ||
2 -> timestamp = _fieldValue as Long | ||
3 -> stories = (stories ?: pbandk.ListWithSize.Builder()).apply { this += _fieldValue as kotlin.sequences.Sequence<ai.wandering.scoop.v1.models.Story> } | ||
} | ||
} | ||
|
||
return EditorsPick(id, timestamp, pbandk.ListWithSize.Builder.fixed(stories), unknownFields) | ||
} |
102 changes: 102 additions & 0 deletions
102
v1/src/commonMain/kotlin/ai/wandering/scoop/v1/models/FeedMetadata.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
@file:OptIn(pbandk.PublicForGeneratedCode::class) | ||
|
||
package ai.wandering.scoop.v1.models | ||
|
||
@pbandk.Export | ||
public data class FeedMetadata( | ||
val cursor: ai.wandering.scoop.v1.models.Cursor? = null, | ||
val totalCount: Int = 0, | ||
val isEndOfFeed: Boolean = false, | ||
val lastUpdated: Long = 0L, | ||
override val unknownFields: Map<Int, pbandk.UnknownField> = emptyMap() | ||
) : pbandk.Message { | ||
override operator fun plus(other: pbandk.Message?): ai.wandering.scoop.v1.models.FeedMetadata = protoMergeImpl(other) | ||
override val descriptor: pbandk.MessageDescriptor<ai.wandering.scoop.v1.models.FeedMetadata> get() = Companion.descriptor | ||
override val protoSize: Int by lazy { super.protoSize } | ||
public companion object : pbandk.Message.Companion<ai.wandering.scoop.v1.models.FeedMetadata> { | ||
public val defaultInstance: ai.wandering.scoop.v1.models.FeedMetadata by lazy { ai.wandering.scoop.v1.models.FeedMetadata() } | ||
override fun decodeWith(u: pbandk.MessageDecoder): ai.wandering.scoop.v1.models.FeedMetadata = ai.wandering.scoop.v1.models.FeedMetadata.decodeWithImpl(u) | ||
|
||
override val descriptor: pbandk.MessageDescriptor<ai.wandering.scoop.v1.models.FeedMetadata> by lazy { | ||
val fieldsList = ArrayList<pbandk.FieldDescriptor<ai.wandering.scoop.v1.models.FeedMetadata, *>>(4) | ||
fieldsList.apply { | ||
add( | ||
pbandk.FieldDescriptor( | ||
messageDescriptor = this@Companion::descriptor, | ||
name = "cursor", | ||
number = 1, | ||
type = pbandk.FieldDescriptor.Type.Message(messageCompanion = ai.wandering.scoop.v1.models.Cursor.Companion), | ||
jsonName = "cursor", | ||
value = ai.wandering.scoop.v1.models.FeedMetadata::cursor | ||
) | ||
) | ||
add( | ||
pbandk.FieldDescriptor( | ||
messageDescriptor = this@Companion::descriptor, | ||
name = "total_count", | ||
number = 2, | ||
type = pbandk.FieldDescriptor.Type.Primitive.Int32(), | ||
jsonName = "totalCount", | ||
value = ai.wandering.scoop.v1.models.FeedMetadata::totalCount | ||
) | ||
) | ||
add( | ||
pbandk.FieldDescriptor( | ||
messageDescriptor = this@Companion::descriptor, | ||
name = "is_end_of_feed", | ||
number = 3, | ||
type = pbandk.FieldDescriptor.Type.Primitive.Bool(), | ||
jsonName = "isEndOfFeed", | ||
value = ai.wandering.scoop.v1.models.FeedMetadata::isEndOfFeed | ||
) | ||
) | ||
add( | ||
pbandk.FieldDescriptor( | ||
messageDescriptor = this@Companion::descriptor, | ||
name = "last_updated", | ||
number = 4, | ||
type = pbandk.FieldDescriptor.Type.Primitive.Int64(), | ||
jsonName = "lastUpdated", | ||
value = ai.wandering.scoop.v1.models.FeedMetadata::lastUpdated | ||
) | ||
) | ||
} | ||
pbandk.MessageDescriptor( | ||
fullName = "ai.wandering.scoop.v1.models.FeedMetadata", | ||
messageClass = ai.wandering.scoop.v1.models.FeedMetadata::class, | ||
messageCompanion = this, | ||
fields = fieldsList | ||
) | ||
} | ||
} | ||
} | ||
|
||
@pbandk.Export | ||
@pbandk.JsName("orDefaultForFeedMetadata") | ||
public fun FeedMetadata?.orDefault(): ai.wandering.scoop.v1.models.FeedMetadata = this ?: FeedMetadata.defaultInstance | ||
|
||
private fun FeedMetadata.protoMergeImpl(plus: pbandk.Message?): FeedMetadata = (plus as? FeedMetadata)?.let { | ||
it.copy( | ||
cursor = cursor?.plus(plus.cursor) ?: plus.cursor, | ||
unknownFields = unknownFields + plus.unknownFields | ||
) | ||
} ?: this | ||
|
||
@Suppress("UNCHECKED_CAST") | ||
private fun FeedMetadata.Companion.decodeWithImpl(u: pbandk.MessageDecoder): FeedMetadata { | ||
var cursor: ai.wandering.scoop.v1.models.Cursor? = null | ||
var totalCount = 0 | ||
var isEndOfFeed = false | ||
var lastUpdated = 0L | ||
|
||
val unknownFields = u.readMessage(this) { _fieldNumber, _fieldValue -> | ||
when (_fieldNumber) { | ||
1 -> cursor = _fieldValue as ai.wandering.scoop.v1.models.Cursor | ||
2 -> totalCount = _fieldValue as Int | ||
3 -> isEndOfFeed = _fieldValue as Boolean | ||
4 -> lastUpdated = _fieldValue as Long | ||
} | ||
} | ||
|
||
return FeedMetadata(cursor, totalCount, isEndOfFeed, lastUpdated, unknownFields) | ||
} |
Oops, something went wrong.