Octopus Energy Interview Question

Use this API to write a TypeScript function with error handling etc