duffelhq / duffel-api-javascript

JavaScript client library for the Duffel API
https://duffel.com/docs
MIT License
36 stars 12 forks source link

`departure_time` and `departure_time` in offer request slices should not be typed as strings #936

Closed markoleavy closed 1 month ago

markoleavy commented 4 months ago

Hello! According to the api guide, the departure_time and departure_time in offer request should be an object { from?: string, to?:string }, but on the client are typed as strings.

const result = await duffel.partialOfferRequests.create({
    slices: [
      {
        origin: params.origin,
        destination: params.destination,
        departure_date: params.departure.date,
        arrival_time: {
          from: params.departure.from,
          to: params.departure.to,
        },
      },
      {
        origin: params.destination,
        destination: params.origin,
        departure_date: params.departure.date,
        departure_time: {
          from: params.departure.from,
          to: params.departure.to,
        },
      },
    ],
    passengers: new Array(params.numberOfPassengers).fill({
      fare_type: 'adult',
    }),
    cabin_class: 'economy',
  });
andrejak commented 1 month ago

Thank you for reporting, these should be objects now: https://github.com/duffelhq/duffel-api-javascript/blob/16bfff388f84f7d7944dd6ff57588335b22fb3eb/src/booking/OfferRequests/OfferRequestsTypes.ts#L321