diff --git a/deltachat-jsonrpc/src/api/types/account.rs b/deltachat-jsonrpc/src/api/types/account.rs index eeebc991f..9a2d88100 100644 --- a/deltachat-jsonrpc/src/api/types/account.rs +++ b/deltachat-jsonrpc/src/api/types/account.rs @@ -9,6 +9,7 @@ use super::color_int_to_hex_string; #[derive(Serialize, TypeDef)] #[serde(tag = "type")] pub enum Account { + #[serde(rename_all = "camelCase")] Configured { id: u32, display_name: Option, @@ -17,6 +18,7 @@ pub enum Account { profile_image: Option, // TODO: This needs to be converted to work with blob http server. color: String, }, + #[serde(rename_all = "camelCase")] Unconfigured { id: u32, }, diff --git a/deltachat-jsonrpc/src/api/types/chat.rs b/deltachat-jsonrpc/src/api/types/chat.rs index 1bc5920a0..d12e254c3 100644 --- a/deltachat-jsonrpc/src/api/types/chat.rs +++ b/deltachat-jsonrpc/src/api/types/chat.rs @@ -11,6 +11,7 @@ use super::color_int_to_hex_string; use super::contact::ContactObject; #[derive(Serialize, TypeDef)] +#[serde(rename_all = "camelCase")] pub struct FullChat { id: u32, name: String, diff --git a/deltachat-jsonrpc/src/api/types/contact.rs b/deltachat-jsonrpc/src/api/types/contact.rs index c34097723..13534f9bf 100644 --- a/deltachat-jsonrpc/src/api/types/contact.rs +++ b/deltachat-jsonrpc/src/api/types/contact.rs @@ -7,7 +7,7 @@ use typescript_type_def::TypeDef; use super::color_int_to_hex_string; #[derive(Serialize, TypeDef)] -#[serde(rename = "Contact")] +#[serde(rename = "Contact", rename_all = "camelCase")] pub struct ContactObject { address: String, color: String, diff --git a/deltachat-jsonrpc/src/api/types/message.rs b/deltachat-jsonrpc/src/api/types/message.rs index 01d1f42bb..adbb90194 100644 --- a/deltachat-jsonrpc/src/api/types/message.rs +++ b/deltachat-jsonrpc/src/api/types/message.rs @@ -12,7 +12,7 @@ use typescript_type_def::TypeDef; use super::contact::ContactObject; #[derive(Serialize, TypeDef)] -#[serde(rename = "Message")] +#[serde(rename = "Message", rename_all = "camelCase")] pub struct MessageObject { id: u32, chat_id: u32, diff --git a/deltachat-jsonrpc/src/api/types/provider_info.rs b/deltachat-jsonrpc/src/api/types/provider_info.rs index 22a43b163..59992e05b 100644 --- a/deltachat-jsonrpc/src/api/types/provider_info.rs +++ b/deltachat-jsonrpc/src/api/types/provider_info.rs @@ -4,6 +4,7 @@ use serde::Serialize; use typescript_type_def::TypeDef; #[derive(Serialize, TypeDef)] +#[serde(rename_all = "camelCase")] pub struct ProviderInfo { pub before_login_hint: String, pub overview_page: String, diff --git a/deltachat-jsonrpc/src/api/types/webxdc.rs b/deltachat-jsonrpc/src/api/types/webxdc.rs index 3adb24023..fe652bb43 100644 --- a/deltachat-jsonrpc/src/api/types/webxdc.rs +++ b/deltachat-jsonrpc/src/api/types/webxdc.rs @@ -9,7 +9,7 @@ use typescript_type_def::TypeDef; use super::maybe_empty_string_to_option; #[derive(Serialize, TypeDef)] -#[serde(rename = "WebxdcMessageInfo")] +#[serde(rename = "WebxdcMessageInfo", rename_all = "camelCase")] pub struct WebxdcMessageInfo { /// The name of the app. /// diff --git a/deltachat-jsonrpc/typescript/generated/types.ts b/deltachat-jsonrpc/typescript/generated/types.ts index d1000089c..9d07b0036 100644 --- a/deltachat-jsonrpc/typescript/generated/types.ts +++ b/deltachat-jsonrpc/typescript/generated/types.ts @@ -1,8 +1,8 @@ // AUTO-GENERATED by typescript-type-def export type U32=number; -export type Account=(({"type":"Configured";}&{"id":U32;"display_name":(string|null);"addr":(string|null);"profile_image":(string|null);"color":string;})|({"type":"Unconfigured";}&{"id":U32;})); -export type ProviderInfo={"before_login_hint":string;"overview_page":string;"status":U32;}; +export type Account=(({"type":"Configured";}&{"id":U32;"displayName":(string|null);"addr":(string|null);"profileImage":(string|null);"color":string;})|({"type":"Unconfigured";}&{"id":U32;})); +export type ProviderInfo={"beforeLoginHint":string;"overviewPage":string;"status":U32;}; export type Usize=number; export type ChatListEntry=[U32,U32]; export type I64=number; @@ -11,8 +11,8 @@ export type ChatListItemFetchResult=(({"type":"ChatListItem";}&{"id":U32;"name": * contact id if this is a dm chat (for view profile entry in context menu) */ "dmChatContact":(U32|null);})|{"type":"ArchiveLink";}|({"type":"Error";}&{"id":U32;"error":string;})); -export type Contact={"address":string;"color":string;"auth_name":string;"status":string;"display_name":string;"id":U32;"name":string;"profile_image":(string|null);"name_and_addr":string;"is_blocked":boolean;"is_verified":boolean;}; -export type FullChat={"id":U32;"name":string;"is_protected":boolean;"profile_image":(string|null);"archived":boolean;"chat_type":U32;"is_unpromoted":boolean;"is_self_talk":boolean;"contacts":(Contact)[];"contact_ids":(U32)[];"color":string;"fresh_message_counter":Usize;"is_contact_request":boolean;"is_device_chat":boolean;"self_in_group":boolean;"is_muted":boolean;"ephemeral_timer":U32;"can_send":boolean;}; +export type Contact={"address":string;"color":string;"authName":string;"status":string;"displayName":string;"id":U32;"name":string;"profileImage":(string|null);"nameAndAddr":string;"isBlocked":boolean;"isVerified":boolean;}; +export type FullChat={"id":U32;"name":string;"isProtected":boolean;"profileImage":(string|null);"archived":boolean;"chatType":U32;"isUnpromoted":boolean;"isSelfTalk":boolean;"contacts":(Contact)[];"contactIds":(U32)[];"color":string;"freshMessageCounter":Usize;"isContactRequest":boolean;"isDeviceChat":boolean;"selfInGroup":boolean;"isMuted":boolean;"ephemeralTimer":U32;"canSend":boolean;}; export type Viewtype=("Unknown"| /** * Text message. @@ -60,7 +60,7 @@ export type Viewtype=("Unknown"| "Webxdc"); export type I32=number; export type U64=number; -export type Message={"id":U32;"chat_id":U32;"from_id":U32;"quoted_text":(string|null);"quoted_message_id":(U32|null);"text":(string|null);"has_location":boolean;"has_html":boolean;"view_type":Viewtype;"state":U32;"timestamp":I64;"sort_timestamp":I64;"received_timestamp":I64;"has_deviating_timestamp":boolean;"subject":string;"show_padlock":boolean;"is_setupmessage":boolean;"is_info":boolean;"is_forwarded":boolean;"duration":I32;"dimensions_height":I32;"dimensions_width":I32;"videochat_type":(U32|null);"videochat_url":(string|null);"override_sender_name":(string|null);"sender":Contact;"setup_code_begin":(string|null);"file":(string|null);"file_mime":(string|null);"file_bytes":U64;"file_name":(string|null);}; +export type Message={"id":U32;"chatId":U32;"fromId":U32;"quotedText":(string|null);"quotedMessageId":(U32|null);"text":(string|null);"hasLocation":boolean;"hasHtml":boolean;"viewType":Viewtype;"state":U32;"timestamp":I64;"sortTimestamp":I64;"receivedTimestamp":I64;"hasDeviatingTimestamp":boolean;"subject":string;"showPadlock":boolean;"isSetupmessage":boolean;"isInfo":boolean;"isForwarded":boolean;"duration":I32;"dimensionsHeight":I32;"dimensionsWidth":I32;"videochatType":(U32|null);"videochatUrl":(string|null);"overrideSenderName":(string|null);"sender":Contact;"setupCodeBegin":(string|null);"file":(string|null);"fileMime":(string|null);"fileBytes":U64;"fileName":(string|null);}; export type WebxdcMessageInfo={ /** * The name of the app. @@ -93,5 +93,5 @@ export type WebxdcMessageInfo={ * defaults to an empty string. * Implementations may offer an menu or a button to open this URL. */ -"source_code_url":(string|null);}; +"sourceCodeUrl":(string|null);}; export type __AllTyps=[string,boolean,Record,U32,U32,null,(U32)[],U32,null,(U32|null),(Account)[],U32,Account,U32,string,(ProviderInfo|null),U32,boolean,U32,Record,U32,string,(string|null),null,U32,Record,null,U32,string,null,U32,string,(string|null),U32,(string)[],Record,U32,null,U32,null,U32,(U32)[],U32,U32,Usize,U32,string,U32,U32,string,null,U32,(U32|null),(string|null),(U32|null),(ChatListEntry)[],U32,(ChatListEntry)[],Record,U32,U32,FullChat,U32,U32,null,U32,U32,null,U32,string,string,U32,U32,U32,U32,(U32)[],U32,U32,Message,U32,(U32)[],Record,U32,U32,Contact,U32,string,(string|null),U32,U32,U32,U32,U32,U32,null,U32,U32,null,U32,(Contact)[],U32,U32,(string|null),(U32)[],U32,U32,(string|null),(Contact)[],U32,(U32)[],Record,U32,U32,Viewtype,(Viewtype|null),(Viewtype|null),(U32)[],U32,U32,string,string,null,U32,U32,U32,string,U32,U32,WebxdcMessageInfo,U32,string,U32,U32]; diff --git a/deltachat-jsonrpc/typescript/test/basic.ts b/deltachat-jsonrpc/typescript/test/basic.ts index d8096f3df..ea300643f 100644 --- a/deltachat-jsonrpc/typescript/test/basic.ts +++ b/deltachat-jsonrpc/typescript/test/basic.ts @@ -89,14 +89,14 @@ describe("basic tests", () => { "example@delta.chat", null ); - expect((await dc.rpc.contactsGetContact(accountId, contactId)).is_blocked).to.be + expect((await dc.rpc.contactsGetContact(accountId, contactId)).isBlocked).to.be .false; await dc.rpc.contactsBlock(accountId, contactId); - expect((await dc.rpc.contactsGetContact(accountId, contactId)).is_blocked).to.be + expect((await dc.rpc.contactsGetContact(accountId, contactId)).isBlocked).to.be .true; expect(await dc.rpc.contactsGetBlocked(accountId)).to.have.length(1); await dc.rpc.contactsUnblock(accountId, contactId); - expect((await dc.rpc.contactsGetContact(accountId, contactId)).is_blocked).to.be + expect((await dc.rpc.contactsGetContact(accountId, contactId)).isBlocked).to.be .false; expect(await dc.rpc.contactsGetBlocked(accountId)).to.have.length(0); }); diff --git a/deltachat-jsonrpc/typescript/test/online.ts b/deltachat-jsonrpc/typescript/test/online.ts index c57297dbf..ba8b50673 100644 --- a/deltachat-jsonrpc/typescript/test/online.ts +++ b/deltachat-jsonrpc/typescript/test/online.ts @@ -158,14 +158,14 @@ describe("online tests", function () { ).reverse()[0]; const message2 = await dc.rpc.messageGetMessage(accountId1, messageId); expect(message2.text).equal("super secret message"); - expect(message2.show_padlock).equal(true); + expect(message2.showPadlock).equal(true); }); it("get provider info for example.com", async () => { const acc = await dc.rpc.addAccount(); const info = await dc.rpc.getProviderInfo(acc, "example.com"); expect(info).to.be.not.null; - expect(info?.overview_page).to.equal( + expect(info?.overviewPage).to.equal( "https://providers.delta.chat/example-com" ); expect(info?.status).to.equal(3);