A general formalism is developed for calculating the luminosity function and the expected number N of observed gamma-ray bursts (GRBs) above a peak photon flux 5 for an arbitrary GRB jet structure. This formalism directly provides the true GRB rate for any jet model, instead of first calculating the GRB rate assuming isotropic emission and then introducing a "correction factor" to account for effects of the GRB jet structure, as was done in previous works. We apply it to the uniform jet (UJ) and universal structured jet (USJ) models for the structure of GRB jets and perform fits to the observed log N-log S distribution from the GUSBAD catalog, which contains 2204 BATSE bursts. We allow for a scatter in the peak luminosity L for a given jet half-opening angle θj (viewing angle θobs) in the UJ (USJ) model, which is implied by observations. A core angle θc and an outer edge at θmax are introduced for the structured jet, and a finite range of opening angles θmin ≤ θj ≤ θmax is assumed for the uniform jets. The efficiency for producing γ-rays, εγ, and the energy per solid angle in the jet, ε, are allowed to vary with θj (θobs) in the UJ (USJ) model, εγ α θ-b and ε α θ-a. We find that a single power-law luminosity function provides a good fit to the data. Such a luminosity function arises naturally in the USJ model, while in the UJ model it implies a power-law probability distribution for θj, P(θj) α θj-q. The value of q cannot be directly determined from the fit to the observed log N-log S distribution, and an additional assumption on the value of a or b is required. Alternatively, an independent estimate of the true GRB rate would enable one to determine a, b, and q. The implied values of θc (or θmin) and θmax are close to the current observational limits. The true GRB rate for the USJ model is found to be R GRB(z = 0) = 0.86-0.05+0.14 Gpc-3 yr-1 (1 σ), while for the UJ model it is higher by a factor f(q), which strongly depends on the unknown value of q.