DopeSheet/GraphEditor : How to detect/change, with API, displayed frame range
The frame, value from the region coords can be obtained from view2d.region_to_view

import bpy
from mathutils import Vector
context = bpy.context
c = context.copy()
for i, area in enumerate(context.screen.areas):
    if area.type != 'GRAPH_EDITOR':
        continue
    region = area.regions[-1]
    print("SCREEN:", context.screen.name , "[", i, "]")
    c["space_data"] = area.spaces.active
    c["area"] = area
    c["region"] = region

    # region size
    h = region.height # screen
    w = region.width  # 
    bl = region.view2d.region_to_view(0, 0)
    tr = region.view2d.region_to_view(w, h)
    print("region bottom left (frame, value)", bl)
    print("region top right (frame, value)", tr)

    range = Vector(tr) - Vector(bl)


Note from Getting area (region.view2d) pixel coordinates of 2D views (VSE, NLA) how to get the scrollbar width.

As for setting the region to a desired frame value range, I have found using bpy.ops.view2d.anything an absolute nightmare, of finding rhyme or reason, and instead have used the methods outlined here Focusing the graph editor area to a custom [frame, keyframe_value] range using bpy.ops.graph.view* operators in the graph editor, and I expect would work similarly in dope sheet for bpy.ops.action.view*.