merge-api / merge-sdk-typescript

The Node SDK for accessing various Merge Unified APIs
Other
7 stars 6 forks source link

Model objects `ids` are typed as optional (`?`) #25

Open f-huang opened 1 year ago

f-huang commented 1 year ago

Merge category API

CRM (Customer Relationship Management)

Issue

Currently when creating or fetching data using CRM SDK, every returned object is typed with ?. It is kind of bothersome because when using these objects I must check everytime that the id exists.

As id is a property of Merge's API, I cannot figure why and/or in which circumstances it is typed as optional ?

Example for Account object

   export interface Account {
    /**
     * 
     * @type {string}
     * @memberof Account
     */
    readonly id?: string;
    ...
   }

What I would like

id in following objects are typed as readonly id: string:

I can open a PR about this if needed :) Thank you.

leonard-henriquez commented 1 year ago

@leewang0 did you get to see this issue ? Thank you in avance 🙏 🙂

f-huang commented 1 year ago

UP @leewang0 🙏 I can draft a Pull request if needed

leewang0 commented 1 year ago

@f-huang @leonard-henriquez while I agree this is a nice quality of life improvement, it would be a backwards-incompatible change in type. The API should never emit a null id, but we don't want to bump to version 4.x right now and it would differ from all of our other SDKs too. Apologies in advance.