Skip to content

Refactor APIClient to use Decodable objects or any other generic approach #178

@glm4

Description

@glm4

Currently, the APIClient class tries to parse a dictionary using JSONSerialization, this brings a couple of problems:

  1. single elements or Arrays from a JSON response are not be supported.
  2. The dictionary is then used to convert it into a Data object to then use a JSONDecoder. This is an unnecessary back and forth which adds complexity and more prone to errors.

Ideally, the client would pass a type that would like to get back and the APIClient will handle the rest. An alternativeis to ahve like a middle layer that takes care of the parsing/decoding.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions