Skip to content

Instantly share code, notes, and snippets.

@dyackson
Last active April 21, 2021 15:24
Show Gist options
  • Save dyackson/b2e0055cdc689704f5b705f4faf20517 to your computer and use it in GitHub Desktop.
Save dyackson/b2e0055cdc689704f5b705f4faf20517 to your computer and use it in GitHub Desktop.
Options for structure of request/response for FAS's /list/confirmations endpoint
# What should be the shapes of the request and response data for the FAS
# endpoint that exposes confirmations to orders_service?
# The example options below assume that an activity can have both shipment and
# receipt confirmations, but the options are still valid if that isn't true.
# Shape of request data
# -----------------------------
# Option: Single list
[activity_1_id, activity_2_id, activity_3_id]
# Option: Two lists
%{
shipment_confirmation_activity_ids: [activity_1_id, activity_2_id],
receipt_confirmation_activity_ids: [activity_2_id, activity_3_id],
}
# Shape of response data
# -----------------------------
# Option: Split by shipment/receipt first
# likely goes with the 2-list request
%{
shipment_confirmations_by_activity_id: %{
activity_1_id: [shipment_confirmation_1, shipment_confirmation_2]
activity_2_id: [shipment_confirmation_3, shipment_confirmation_4]
},
receipt_confirmations_by_activity_id: %{
activity_2_id: [receipt_confirmation_1, receipt_confirmation_2]
activity_3_id: [receipt_confirmation_3, receipt_confirmation_4]
}
}
# Option: Split by activity_id first
# likely goes with the 1-list request
%{
activity_id_1: %{
shipment_confirmations:[shipment_confirmation_1, shipment_confirmation_2]
receipt_confirmations: []
}
activity_id_2: %{
shipment_confirmations:[shipment_confirmation_3, shipment_confirmation_4]
receipt_confirmations: [receipt_confirmation_1, receipt_confirmation_2]
}
activity_id_3: %{
shipment_confirmations:[]
receipt_confirmations: [receipt_confirmation_2, receipt_confirmation_3]
}
}
# Option: Two lists (not keyed by activity_id)
# Likely goes with the 2-list request
# Defers sorting to the caller (orders_service)
%{
shipment_confirmations: [shipment_confirmation_1, shipment_confirmation_2, shipment_confirmation_3, shipment_confirmation_3],
receipt_confirmations: [receipt_confirmation_1, receipt_confirmation_2, receipt_confirmation_3, receipt_confirmation_3],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment