View raw

1 (** The workout-import port. An adapter parses one third-party export format 2 into a provisional {!Workout_import.batch}. The web layer names only this 3 port, so no adapter (and no parser library) is reachable from a controller. 4 The composition root plugs a concrete adapter in. 5 6 Errors are the adapter's own type. The web layer only phrases them through 7 [pp_error], so a new export format needs no change to the port. *) 8 9 module type S = sig 10 type error 11 12 val pp_error : Format.formatter -> error -> unit 13 14 val parse : 15 batch_id:Workout_import.batch_id -> 16 fingerprint:string -> 17 imported_at:Recovery.timestamp -> 18 utc_offset_seconds:int -> 19 string -> 20 (Workout_import.batch, error) result 21 (** Parse one export. [utc_offset_seconds] is the offset of the export's 22 wall-clock times from UTC. The batch is provisional: it is stored for 23 review, and promotion happens later through the service. *) 24 end 25