Apple makes no guarantees as to the whether or not the customer can recover data. The gist is that "the user is responsible for performing proper backups".
Depending on what's wrong with your device, they might fix it or not. However, in many cases all they can offer is a complete replacement with another device. That's not a bad deal, but it requires that the data be backed up to restore onto the replacement. Even if there is an actual fix where they return the device to the customer, there's the possibility of a complete reset. This is from Apple's US repair terms for Apple retail stores, although similar language is found for AASP/mail-in service in all parts of the world:
Apple Inc. Repair Terms & Conditions
Apple understands that your data may be valuable to you. Data loss during service is always a possibility, and in some cases, data may be unrecoverable, erased, or reformatted during service. For this reason, it is your sole responsibility to back up all existing data, software, and/or programs from your product, and to decide whether to erase any such data from your product, prior to receiving service. Apple is not responsible for loss, recovery, or compromise of data, software or programs, or loss of use of your product or other equipment arising out of the services provided by Apple. You represent that your product does not contain any illegal files or data.