Skip to content

Commit

Permalink
update bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Dec 21, 2024
1 parent c94a348 commit 866e971
Showing 1 changed file with 64 additions and 26 deletions.
90 changes: 64 additions & 26 deletions library/src/main/java/xmtpv3.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,10 @@ internal interface UniffiLib : Library {
`ptr`: Pointer, `accountAddresses`: RustBuffer.ByValue, `opts`: RustBuffer.ByValue,
): Long

fun uniffi_xmtpv3_fn_method_fficonversations_get_hmac_keys(
`ptr`: Pointer, uniffi_out_err: UniffiRustCallStatus,
): RustBuffer.ByValue

fun uniffi_xmtpv3_fn_method_fficonversations_get_sync_group(
`ptr`: Pointer, uniffi_out_err: UniffiRustCallStatus,
): Pointer
Expand Down Expand Up @@ -1523,10 +1527,6 @@ internal interface UniffiLib : Library {
`ptr`: Pointer, `entityType`: RustBuffer.ByValue, `entity`: RustBuffer.ByValue,
): Long

fun uniffi_xmtpv3_fn_method_ffixmtpclient_get_hmac_keys(
`ptr`: Pointer, uniffi_out_err: UniffiRustCallStatus,
): RustBuffer.ByValue

fun uniffi_xmtpv3_fn_method_ffixmtpclient_get_latest_inbox_state(
`ptr`: Pointer, `inboxId`: RustBuffer.ByValue,
): Long
Expand Down Expand Up @@ -2115,6 +2115,9 @@ internal interface UniffiLib : Library {
fun uniffi_xmtpv3_checksum_method_fficonversations_create_group(
): Short

fun uniffi_xmtpv3_checksum_method_fficonversations_get_hmac_keys(
): Short

fun uniffi_xmtpv3_checksum_method_fficonversations_get_sync_group(
): Short

Expand Down Expand Up @@ -2271,9 +2274,6 @@ internal interface UniffiLib : Library {
fun uniffi_xmtpv3_checksum_method_ffixmtpclient_get_consent_state(
): Short

fun uniffi_xmtpv3_checksum_method_ffixmtpclient_get_hmac_keys(
): Short

fun uniffi_xmtpv3_checksum_method_ffixmtpclient_get_latest_inbox_state(
): Short

Expand Down Expand Up @@ -2534,6 +2534,9 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) {
if (lib.uniffi_xmtpv3_checksum_method_fficonversations_create_group() != 7282.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
if (lib.uniffi_xmtpv3_checksum_method_fficonversations_get_hmac_keys() != 44064.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
if (lib.uniffi_xmtpv3_checksum_method_fficonversations_get_sync_group() != 42973.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
Expand Down Expand Up @@ -2690,9 +2693,6 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) {
if (lib.uniffi_xmtpv3_checksum_method_ffixmtpclient_get_consent_state() != 58208.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
if (lib.uniffi_xmtpv3_checksum_method_ffixmtpclient_get_hmac_keys() != 36015.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
if (lib.uniffi_xmtpv3_checksum_method_ffixmtpclient_get_latest_inbox_state() != 3165.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
Expand Down Expand Up @@ -5567,6 +5567,8 @@ public interface FfiConversationsInterface {
`opts`: FfiCreateGroupOptions,
): FfiConversation

fun `getHmacKeys`(): Map<kotlin.ByteArray, List<FfiHmacKey>>

fun `getSyncGroup`(): FfiConversation

suspend fun `list`(`opts`: FfiListConversationsOptions): List<FfiConversation>
Expand Down Expand Up @@ -5765,6 +5767,20 @@ open class FfiConversations : Disposable, AutoCloseable, FfiConversationsInterfa
}


@Throws(GenericException::class)
override fun `getHmacKeys`(): Map<kotlin.ByteArray, List<FfiHmacKey>> {
return FfiConverterMapByteArraySequenceTypeFfiHmacKey.lift(
callWithPointer {
uniffiRustCallWithError(GenericException) { _status ->
UniffiLib.INSTANCE.uniffi_xmtpv3_fn_method_fficonversations_get_hmac_keys(
it, _status
)
}
}
)
}


@Throws(GenericException::class)
override fun `getSyncGroup`(): FfiConversation {
return FfiConverterTypeFfiConversation.lift(
Expand Down Expand Up @@ -9054,8 +9070,6 @@ public interface FfiXmtpClientInterface {
`entity`: kotlin.String,
): FfiConsentState

fun `getHmacKeys`(): List<FfiHmacKey>

suspend fun `getLatestInboxState`(`inboxId`: kotlin.String): FfiInboxState

fun `inboxId`(): kotlin.String
Expand Down Expand Up @@ -9474,20 +9488,6 @@ open class FfiXmtpClient : Disposable, AutoCloseable, FfiXmtpClientInterface {
}


@Throws(GenericException::class)
override fun `getHmacKeys`(): List<FfiHmacKey> {
return FfiConverterSequenceTypeFfiHmacKey.lift(
callWithPointer {
uniffiRustCallWithError(GenericException) { _status ->
UniffiLib.INSTANCE.uniffi_xmtpv3_fn_method_ffixmtpclient_get_hmac_keys(
it, _status
)
}
}
)
}


@Throws(GenericException::class)
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
override suspend fun `getLatestInboxState`(`inboxId`: kotlin.String): FfiInboxState {
Expand Down Expand Up @@ -12377,6 +12377,44 @@ public object FfiConverterMapStringBoolean :
}


/**
* @suppress
*/
public object FfiConverterMapByteArraySequenceTypeFfiHmacKey :
FfiConverterRustBuffer<Map<kotlin.ByteArray, List<FfiHmacKey>>> {
override fun read(buf: ByteBuffer): Map<kotlin.ByteArray, List<FfiHmacKey>> {
val len = buf.getInt()
return buildMap<kotlin.ByteArray, List<FfiHmacKey>>(len) {
repeat(len) {
val k = FfiConverterByteArray.read(buf)
val v = FfiConverterSequenceTypeFfiHmacKey.read(buf)
this[k] = v
}
}
}

override fun allocationSize(value: Map<kotlin.ByteArray, List<FfiHmacKey>>): ULong {
val spaceForMapSize = 4UL
val spaceForChildren = value.map { (k, v) ->
FfiConverterByteArray.allocationSize(k) +
FfiConverterSequenceTypeFfiHmacKey.allocationSize(v)
}.sum()
return spaceForMapSize + spaceForChildren
}

override fun write(value: Map<kotlin.ByteArray, List<FfiHmacKey>>, buf: ByteBuffer) {
buf.putInt(value.size)
// The parens on `(k, v)` here ensure we're calling the right method,
// which is important for compatibility with older android devices.
// Ref https://blog.danlew.net/2017/03/16/kotlin-puzzler-whose-line-is-it-anyways/
value.forEach { (k, v) ->
FfiConverterByteArray.write(k, buf)
FfiConverterSequenceTypeFfiHmacKey.write(v, buf)
}
}
}


@Throws(GenericException::class)
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
suspend fun `connectToBackend`(`host`: kotlin.String, `isSecure`: kotlin.Boolean): XmtpApiClient {
Expand Down

0 comments on commit 866e971

Please sign in to comment.