Refactor to separate the part packing code from the data sending.

- Extracted methods for packing a part and the header.
- Extracted methods to parse the cURL response from the Cloud API.
- Added some constants for the magic numbers and struct sizes.
- Added some documentation.
- Standardized casing of functions.
- Added tests for the part and header packing functions.