-- | Updates an object in Netsuite.
updateNS
    :: (IsNsRestletConfig cfg, IsNsType t, IsNsData d)
    => cfg -- ^ Restlet configuration
    -> t -- ^ NetSuite entity type
    -> d -- ^ Data to update entity with (must include ID)
    -> IO (Either RestletError Value)
updateNS cfg t d =
    if testNsDataForId $ toNsData d
    then doNS (toNsRestletConfig cfg) $
        NsActUpdate (toNsType t)
                    (toNsData d)
                    (typeFields (toNsRestletConfig cfg) $ toNsType t)
    else error "Update data does not contain ID."
updateNS
    :: (IsNsRestletConfig cfg, IsNsType t, IsNsData d)
    => cfg -- ^ Restlet configuration
    -> t -- ^ NetSuite entity type
    -> d -- ^ Data to update entity with (must include ID)
    -> IO (Either RestletError Value)
updateNS cfg t d =
    if testNsDataForId $ toNsData d
    then doNS (toNsRestletConfig cfg) $
        NsActUpdate (toNsType t)
                    (toNsData d)
                    (typeFields (toNsRestletConfig cfg) $ toNsType t)
    else error "Update data does not contain ID."
updateNS cfg t d =
    if testNsDataForId $ toNsData d
    then doNS (toNsRestletConfig cfg) $
        NsActUpdate (toNsType t)
                    (toNsData d)
                    (typeFields (toNsRestletConfig cfg) $ toNsType t)
    else error "Update data does not contain ID."