In this two-part study we investigate the phase behaviour of a fluid spatially confined in a semi-infinite rectangular pore formed by three orthogonal walls and connected to a reservoir maintaining constant values of pressure and temperature in the fluid. Far from the capping wall this prototypical two-dimensional system reduces to a one-dimensional slit pore. However, the broken translational symmetry leads to a wetting behavior strikingly different from that of a slit pore. Using a realistic model of an atomic fluid with long-ranged Lennard-Jones fluid-fluid and fluidsubstrate interactions, we present for the first time detailed computations of full phase diagrams of two-dimensional capped capillaries. Our analysis is based on the statistical mechanics of fluids, in particular density functional theory. We show the existence of capillary wetting temperature, which is a property of the pore, and relatively to the fluid temperature determines whether capillary condensation is a first-order or a continuous phase transition. We also report for the first time a first-order capillary wetting transition, which can be preceded by a first-order capillary prewetting. A full parametric study is undertaken and we support our findings with exhaustive examples of density profiles, adsorption and free energy isotherms, as well as full phase diagrams.