When replacing a partially filled order, how is qty determined?

So, I have an order that fills partially. When I update that order with a replace_order() call, what does the new order take as quantity?

For example, initial order of 100 shares, of which 50 are filled.

  1. I replace the order with a new limit price, and leave quantity the same. Then, is the new order for the original qty of 100, or for remaining 50?

  2. I replace the order with a limit price and a new quantity, say 80 shares. Then, is the new order for the specified 80 shares, or the remaining 30?

  qtyposition = apiPaper.get_position(setStock).qty

what programming language ?