Answering the actual question
It seems the closest thing to what you want is region.view_distance
Here's how to display it and other relevant informations about the current 3D viewport to the user :
import bpy
from math import pi
class HelloWorldPanel(bpy.types.Panel):
"""Creates a Panel in the Object properties window"""
bl_label = "Hello World Panel"
bl_idname = "OBJECT_PT_hello"
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_label = "camera zoom"
def draw(self, context):
layout = self.layout
[a.tag_redraw() for a in context.screen.areas] # If we don't do this, values don't update unless you hover your mouse over the panel
space = context.area.spaces.active
region = space.region_3d
col = layout.column()
col.prop(space, "lens")
# This is some kind of "zoom" but it doesn't go beyond 0 (eg. You can't zoom past region.view_location) :
col.prop(region, "view_distance")
col.prop(region, "is_perspective")
col.prop(region, "view_perspective")
col.prop(region, "view_location")
col.prop(region, "view_rotation")
euler = region.view_rotation.to_euler()
# Seeing Euler values is far more convenient to the layman. So we convert the quaternion to euler angles :
box = col.box()
box.label(text="View Rotation")
for axis in "x", "y", "z":
angle = round(getattr(euler, axis) * 180 / pi, 2)
box.label(text=f"{axis.upper()} : {angle}°")
col.prop(region, "view_matrix")
col.prop(region, "window_matrix")
col.prop(region, "perspective_matrix") # Per the docs this is readonly and = to window_matrix * view_matrix
col.enabled=False # Comment this if you want to be able to tweak the fields
def register():
bpy.utils.register_class(HelloWorldPanel)
def unregister():
bpy.utils.unregister_class(HelloWorldPanel)
if __name__ == "__main__":
register()

Answering the question I originally thought this was
That is to say, how to tweak the camera zoom when in camera view, with an actual camera object.
As a Script
import bpy
foo = 5
screen = bpy.context.screen
area = next(area for area in screen.areas if area.type == "VIEW_3D")
space = area.spaces.active
region_3d = space.region_3d
region_3d.view_camera_zoom += foo

In a Panel, in the properties editor
import bpy
class HelloWorldPanel(bpy.types.Panel):
"""Creates a Panel in the Object properties window"""
bl_label = "Hello World Panel"
bl_idname = "OBJECT_PT_hello"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "scene"
def draw(self, context):
layout = self.layout
screen = context.screen
area = next(area for area in screen.areas if area.type == "VIEW_3D")
space = area.spaces.active
region_3d = space.region_3d
layout.prop(region_3d, "view_camera_zoom")
def register():
bpy.utils.register_class(HelloWorldPanel)
def unregister():
bpy.utils.unregister_class(HelloWorldPanel)
if __name__ == "__main__":
register()

In a Panel, in the viewport N-panel
import bpy
class HelloWorldPanel(bpy.types.Panel):
"""Creates a Panel in the Object properties window"""
bl_label = "Hello World Panel"
bl_idname = "OBJECT_PT_hello"
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_label = "camera zoom"
def draw(self, context):
layout = self.layout
layout.prop(context.area.spaces.active.region_3d, "view_camera_zoom")
def register():
bpy.utils.register_class(HelloWorldPanel)
def unregister():
bpy.utils.unregister_class(HelloWorldPanel)
if __name__ == "__main__":
register()

Let's find out how to get to this property
Typing "Camera Zoom" in the docs search bar yields a few results, among which we get a view_camera_zoom attribute that's a member of the RegionView3D class.
region_3d.view_camera_zoom += foo
On the very bottom of this class' page, among the References, we get a few links :
bpy.types.RegionView3D

Context.region_data : A property you can get with bpy.context.region_data
. Unfortunately this will only be available if the script is run from an operator executing in the 3D viewport or if the operator has been overriden with an override dictionary which leads to an existing 3D viewport.
Spaceview3D.region_3d and SpaceView3D.region_quadviews : Both are properties available on the SpaceView3D class. The quad views property is actually a collection of 3D viewport regions (usually 4 of them) and can be used to retrieve the perspective view in the quad view (out of scope of this answer).
region_3d = space.region_3d
SpaceView3D is a children class of Space. Again, going to the bottom of the docs page you get :
bpy.types.Spaceview3D

So we can, once again, access the space data from the current context, but it has to correspond to a 3D viewport context so you have to go through hoops to get it unless your operator runs from the N-Panel for instance, in which case it does have a direct access to the space.
However we see that we have two other ways to get to it, and they both are through the Area object.
We arrive to a point were we do have to make a bit of a judgment call and where it's not really explicitely documented.
A View 3D area, as all other areas in Blender, has a spaces
attribute. Luckily, this one only has one. So you are 100% sure area.spaces[0]
and area.spaces.active
are the exact same object.
space = area.spaces.active # = area.spaces[0] too
Now how do you get the right area ? Once again, look at the bottom :
bpy.types.Area

And once again, we can get it from the context, but we won't try to because it's not straightfoward. Or we can get it from a Screen object.
area = next(area for area in screen.areas if area.type == "VIEW_3D")
Ditto, scroll to the bottom :
bpy.types.Screen

So now we do want to access the screen
from Context
because it is accessible from pretty much any context. If you're using multiple screens you might have to use another solution though.
Finally :
import bpy
screen = bpy.context.screen