Skip to content

#145 Part 2: Rewrite SamplingFeatures, Properties, Datastreams to build() (25 methods) #159

@Sam-Bolling

Description

@Sam-Bolling

Parent Issue

Split from #145assertResourceAvailable() + buildResourceUrl() two-line pattern repeated 90 times in url_builder.ts — DRY violation.

This is Part 2 of 3. See also: #158 (Part 1 — build() helper + Systems/Deployments/Procedures) and Part 3 (issue to follow).


Scope — Part 2 Only

Rewrite SamplingFeatures (8) + Properties (6) + Datastreams (11) = 25 methods to delegate to the build() helper created in Part 1 (#158).

Context

Part 1 (#158) created the build() helper and established the pattern by rewriting 33 methods. This part continues the same mechanical transformation for the next 3 resource types.

Methods to Rewrite (25)

SamplingFeatures (8): getSamplingFeatures, getSamplingFeature, createSamplingFeature, updateSamplingFeature, deleteSamplingFeature, getSamplingFeatureSystems, plus others — rewrite from this.buildResourceUrl(...) to this.build(...).

Properties (6): getProperties, getProperty, updateProperty, deleteProperty, getPropertyDataStreams, getPropertyControlStreams — rewrite to this.build(...).

Datastreams (11): getDataStreams, getDataStream, createDataStream, updateDataStream, deleteDataStream, getDataStreamSchema, getDataStreamObservations, createObservation, plus others — rewrite to this.build(...).

Pattern

Same as Part 1. Each method body changes from:

return this.buildResourceUrl('samplingFeatures', id, undefined, options);

to:

return this.build('samplingFeatures', id, undefined, options);

For list/create methods that still have the guard:

// Before:
getSamplingFeatures(options?: QueryOptions): string {
  this.assertResourceAvailable('samplingFeatures');
  return this.buildResourceUrl('samplingFeatures', undefined, undefined, options);
}
// After:
getSamplingFeatures(options?: QueryOptions): string {
  return this.build('samplingFeatures', undefined, undefined, options);
}

File to Modify

File Action
src/ogc-api/csapi/url_builder.ts Rewrite 25 methods to delegate to build()

What NOT to Touch

Acceptance Criteria (Part 2)

  • All SamplingFeatures methods (8) delegate to build()
  • All Properties methods (6) delegate to build()
  • All Datastreams methods (11) delegate to build()
  • No direct this.assertResourceAvailable() or direct this.buildResourceUrl() calls remain in these 25 methods
  • Guard behavior preserved for list/create methods
  • tsc --noEmit — zero errors
  • npm test — all tests pass
  • npm run lint — zero errors

Dependencies

Blocked by: #158 (Part 1 — build() helper must exist)
Blocks: Part 3

References


Operational Constraints

⚠️ MANDATORY: Before starting work on this issue, review docs/governance/AI_OPERATIONAL_CONSTRAINTS.md.

Upstream Isolation Constraint

Per the upstream maintainer's comment on PR #136: url_builder.ts is within src/ogc-api/csapi/ — purely internal to the isolated CSAPI module.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions