Skip to content

Conversation

@JJ-Cro
Copy link
Contributor

@JJ-Cro JJ-Cro commented Dec 17, 2024

feat(): removed all deprecated functions, updated all FNs to use object parameters

Breaking Changes:

This PR finalises breaking changes planned a while back (see #88). Any REST API functions that had request properties as individual function parameters, will now only accept an object with the expected request parameters.

While we try to avoid breaking changes where possible, this is one that we saw as necessary to improve maintainability. Especially as new parameters are added to existing endpoints, introducing complexity in handling multiple separate parameters if some were optional.

The easiest way to address these changes it to look for any API calls where parameters are passed individually, for example:

api.setIsolatedMode('automatic', 'CONTRACTS')

Update the parameters to pass as an object instead:

api.setIsolatedMode({
  isoMode: 'automatic',
  type: 'MARGIN',
})

If you're not sure about the property names in the request object, refer to the OKX API documentation or the REST client. A convenient clickable list of endpoints can be found here:
https://github.com/tiagosiebler/okx-api/blob/master/docs/endpointFunctionList.md#how-to-use-table

If you're not already using it, typescript is highly recommended since it will catch any mistakes before you run your code.

@tiagosiebler tiagosiebler marked this pull request as draft December 17, 2024 16:01
@tiagosiebler tiagosiebler changed the base branch from objectParams to master March 10, 2025 23:29
@tiagosiebler tiagosiebler marked this pull request as ready for review March 26, 2025 10:47
@tiagosiebler tiagosiebler changed the title feat(): removed all deprecated functions, updated all FNs to use object parameters feat(v2.0.0): BREAKING CHANGES - updated all FNs to use object parameters, removed deprecated functions, updated tests Mar 27, 2025
@tiagosiebler tiagosiebler changed the title feat(v2.0.0): BREAKING CHANGES - updated all FNs to use object parameters, removed deprecated functions, updated tests feat(v2.0.0): BREAKING CHANGES: updated all FNs to use object parameters, removed deprecated functions, updated tests Mar 27, 2025
// expect(e).toBeFalsy();
expect(e).toMatchObject(
errorResponseObject(
'51010',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also start doing the api error code enum, but not in this PR. In future...

@tiagosiebler tiagosiebler merged commit d9df750 into tiagosiebler:master Mar 27, 2025
3 of 4 checks passed
@tiagosiebler tiagosiebler mentioned this pull request Apr 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants