Shipping Refund Calculation For Line Item

Is there a Shopify API or formula to calculate the shipping amount of a specific line item when preparing a refund as opposed to refunding the entire order shipping amount?