2022-05-24 10:12:33 +00:00
|
|
|
/* eslint-disable import/export */
|
|
|
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
|
|
|
2022-05-24 13:34:03 +00:00
|
|
|
import { enumeration, encodeMessage, decodeMessage, message, bytes } from 'protons-runtime'
|
2022-05-24 10:12:33 +00:00
|
|
|
import type { Codec } from 'protons-runtime'
|
|
|
|
|
|
|
|
export interface ApplicationMetadataMessage {
|
|
|
|
signature: Uint8Array
|
|
|
|
payload: Uint8Array
|
|
|
|
type: ApplicationMetadataMessage.Type
|
|
|
|
}
|
|
|
|
|
|
|
|
export namespace ApplicationMetadataMessage {
|
|
|
|
export enum Type {
|
|
|
|
TYPE_UNKNOWN_UNSPECIFIED = 'TYPE_UNKNOWN_UNSPECIFIED',
|
|
|
|
TYPE_CHAT_MESSAGE = 'TYPE_CHAT_MESSAGE',
|
|
|
|
TYPE_CONTACT_UPDATE = 'TYPE_CONTACT_UPDATE',
|
|
|
|
TYPE_MEMBERSHIP_UPDATE_MESSAGE = 'TYPE_MEMBERSHIP_UPDATE_MESSAGE',
|
|
|
|
TYPE_PAIR_INSTALLATION = 'TYPE_PAIR_INSTALLATION',
|
|
|
|
TYPE_SYNC_INSTALLATION = 'TYPE_SYNC_INSTALLATION',
|
|
|
|
TYPE_REQUEST_ADDRESS_FOR_TRANSACTION = 'TYPE_REQUEST_ADDRESS_FOR_TRANSACTION',
|
|
|
|
TYPE_ACCEPT_REQUEST_ADDRESS_FOR_TRANSACTION = 'TYPE_ACCEPT_REQUEST_ADDRESS_FOR_TRANSACTION',
|
|
|
|
TYPE_DECLINE_REQUEST_ADDRESS_FOR_TRANSACTION = 'TYPE_DECLINE_REQUEST_ADDRESS_FOR_TRANSACTION',
|
|
|
|
TYPE_REQUEST_TRANSACTION = 'TYPE_REQUEST_TRANSACTION',
|
|
|
|
TYPE_SEND_TRANSACTION = 'TYPE_SEND_TRANSACTION',
|
|
|
|
TYPE_DECLINE_REQUEST_TRANSACTION = 'TYPE_DECLINE_REQUEST_TRANSACTION',
|
|
|
|
TYPE_SYNC_INSTALLATION_CONTACT = 'TYPE_SYNC_INSTALLATION_CONTACT',
|
|
|
|
TYPE_SYNC_INSTALLATION_ACCOUNT = 'TYPE_SYNC_INSTALLATION_ACCOUNT',
|
|
|
|
TYPE_SYNC_INSTALLATION_PUBLIC_CHAT = 'TYPE_SYNC_INSTALLATION_PUBLIC_CHAT',
|
|
|
|
TYPE_CONTACT_CODE_ADVERTISEMENT = 'TYPE_CONTACT_CODE_ADVERTISEMENT',
|
|
|
|
TYPE_PUSH_NOTIFICATION_REGISTRATION = 'TYPE_PUSH_NOTIFICATION_REGISTRATION',
|
|
|
|
TYPE_PUSH_NOTIFICATION_REGISTRATION_RESPONSE = 'TYPE_PUSH_NOTIFICATION_REGISTRATION_RESPONSE',
|
|
|
|
TYPE_PUSH_NOTIFICATION_QUERY = 'TYPE_PUSH_NOTIFICATION_QUERY',
|
|
|
|
TYPE_PUSH_NOTIFICATION_QUERY_RESPONSE = 'TYPE_PUSH_NOTIFICATION_QUERY_RESPONSE',
|
|
|
|
TYPE_PUSH_NOTIFICATION_REQUEST = 'TYPE_PUSH_NOTIFICATION_REQUEST',
|
|
|
|
TYPE_PUSH_NOTIFICATION_RESPONSE = 'TYPE_PUSH_NOTIFICATION_RESPONSE',
|
|
|
|
TYPE_EMOJI_REACTION = 'TYPE_EMOJI_REACTION',
|
|
|
|
TYPE_GROUP_CHAT_INVITATION = 'TYPE_GROUP_CHAT_INVITATION',
|
|
|
|
TYPE_CHAT_IDENTITY = 'TYPE_CHAT_IDENTITY',
|
|
|
|
TYPE_COMMUNITY_DESCRIPTION = 'TYPE_COMMUNITY_DESCRIPTION',
|
|
|
|
TYPE_COMMUNITY_INVITATION = 'TYPE_COMMUNITY_INVITATION',
|
|
|
|
TYPE_COMMUNITY_REQUEST_TO_JOIN = 'TYPE_COMMUNITY_REQUEST_TO_JOIN',
|
|
|
|
TYPE_PIN_MESSAGE = 'TYPE_PIN_MESSAGE',
|
|
|
|
TYPE_EDIT_MESSAGE = 'TYPE_EDIT_MESSAGE',
|
|
|
|
TYPE_STATUS_UPDATE = 'TYPE_STATUS_UPDATE',
|
|
|
|
TYPE_DELETE_MESSAGE = 'TYPE_DELETE_MESSAGE',
|
|
|
|
TYPE_SYNC_INSTALLATION_COMMUNITY = 'TYPE_SYNC_INSTALLATION_COMMUNITY',
|
2022-05-24 13:34:03 +00:00
|
|
|
TYPE_ANONYMOUS_METRIC_BATCH = 'TYPE_ANONYMOUS_METRIC_BATCH'
|
2022-05-24 10:12:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
enum __TypeValues {
|
|
|
|
TYPE_UNKNOWN_UNSPECIFIED = 0,
|
|
|
|
TYPE_CHAT_MESSAGE = 1,
|
|
|
|
TYPE_CONTACT_UPDATE = 2,
|
|
|
|
TYPE_MEMBERSHIP_UPDATE_MESSAGE = 3,
|
|
|
|
TYPE_PAIR_INSTALLATION = 4,
|
|
|
|
TYPE_SYNC_INSTALLATION = 5,
|
|
|
|
TYPE_REQUEST_ADDRESS_FOR_TRANSACTION = 6,
|
|
|
|
TYPE_ACCEPT_REQUEST_ADDRESS_FOR_TRANSACTION = 7,
|
|
|
|
TYPE_DECLINE_REQUEST_ADDRESS_FOR_TRANSACTION = 8,
|
|
|
|
TYPE_REQUEST_TRANSACTION = 9,
|
|
|
|
TYPE_SEND_TRANSACTION = 10,
|
|
|
|
TYPE_DECLINE_REQUEST_TRANSACTION = 11,
|
|
|
|
TYPE_SYNC_INSTALLATION_CONTACT = 12,
|
|
|
|
TYPE_SYNC_INSTALLATION_ACCOUNT = 13,
|
|
|
|
TYPE_SYNC_INSTALLATION_PUBLIC_CHAT = 14,
|
|
|
|
TYPE_CONTACT_CODE_ADVERTISEMENT = 15,
|
|
|
|
TYPE_PUSH_NOTIFICATION_REGISTRATION = 16,
|
|
|
|
TYPE_PUSH_NOTIFICATION_REGISTRATION_RESPONSE = 17,
|
|
|
|
TYPE_PUSH_NOTIFICATION_QUERY = 18,
|
|
|
|
TYPE_PUSH_NOTIFICATION_QUERY_RESPONSE = 19,
|
|
|
|
TYPE_PUSH_NOTIFICATION_REQUEST = 20,
|
|
|
|
TYPE_PUSH_NOTIFICATION_RESPONSE = 21,
|
|
|
|
TYPE_EMOJI_REACTION = 22,
|
|
|
|
TYPE_GROUP_CHAT_INVITATION = 23,
|
|
|
|
TYPE_CHAT_IDENTITY = 24,
|
|
|
|
TYPE_COMMUNITY_DESCRIPTION = 25,
|
|
|
|
TYPE_COMMUNITY_INVITATION = 26,
|
|
|
|
TYPE_COMMUNITY_REQUEST_TO_JOIN = 27,
|
|
|
|
TYPE_PIN_MESSAGE = 28,
|
|
|
|
TYPE_EDIT_MESSAGE = 29,
|
|
|
|
TYPE_STATUS_UPDATE = 30,
|
|
|
|
TYPE_DELETE_MESSAGE = 31,
|
|
|
|
TYPE_SYNC_INSTALLATION_COMMUNITY = 32,
|
2022-05-24 13:34:03 +00:00
|
|
|
TYPE_ANONYMOUS_METRIC_BATCH = 33
|
2022-05-24 10:12:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export namespace Type {
|
|
|
|
export const codec = () => {
|
|
|
|
return enumeration<typeof Type>(__TypeValues)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export const codec = (): Codec<ApplicationMetadataMessage> => {
|
|
|
|
return message<ApplicationMetadataMessage>({
|
|
|
|
1: { name: 'signature', codec: bytes },
|
|
|
|
2: { name: 'payload', codec: bytes },
|
2022-05-24 13:34:03 +00:00
|
|
|
3: { name: 'type', codec: ApplicationMetadataMessage.Type.codec() }
|
2022-05-24 10:12:33 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
export const encode = (obj: ApplicationMetadataMessage): Uint8Array => {
|
|
|
|
return encodeMessage(obj, ApplicationMetadataMessage.codec())
|
|
|
|
}
|
|
|
|
|
|
|
|
export const decode = (buf: Uint8Array): ApplicationMetadataMessage => {
|
|
|
|
return decodeMessage(buf, ApplicationMetadataMessage.codec())
|
|
|
|
}
|
|
|
|
}
|