Skip to content

Breaking Change: Migrate to request model-based API methods (v10.1) #1

@davidnmbond

Description

@davidnmbond

Breaking Change in v10.1

Summary

All API methods that previously accepted loose parameters have been migrated to use strongly-typed request model objects. The old parameter-based overloads are now marked with [Obsolete(..., true)] which produces compile errors, forcing consumers to migrate.

Why

  • Consistency: A single request object per API call is easier to maintain and extend.
  • Extensibility: Adding new query parameters no longer requires method signature changes, avoiding future breaking changes.
  • Discoverability: IntelliSense on the request object surfaces all available parameters in one place.
  • Testability: Request objects can be constructed, inspected, and compared in tests.

What Changed

Every Refit interface method and extension method convenience overload that previously accepted individual parameters now has a primary overload accepting a request model (e.g. GetBillsRequest, SearchMembersRequest). The old overloads remain in place but are decorated with [Obsolete(msg, true)] so they produce compile errors.

Affected interfaces:

  • IBillsApi
  • IMembersApi
  • ICommitteesApi
  • IPetitionsApi
  • ICommonsDivisionsApi / ILordsDivisionsApi
  • IInterestsApi
  • IQuestionsStatementsApi
  • IOralQuestionsMotionsApi
  • ITreatiesApi

Obsoleted helper types:

  • OralQuestionsQueryOptions
  • MotionsQueryOptions
  • WrittenQuestionsQueryOptions

Migration Guide

Before (v10.0.x):

var bills = await client.Bills.GetBillsAsync(searchTerm: "Budget", take: 10);
var members = await client.Members.SearchAsync(name: "Smith", isCurrentMember: true);
var petitions = await client.Petitions.GetAsync(state: "open", pageSize: 20);

After (v10.1):

var bills = await client.Bills.GetBillsAsync(new GetBillsRequest { SearchTerm = "Budget", Take = 10 });
var members = await client.Members.SearchAsync(new SearchMembersRequest { Name = "Smith", IsCurrentMember = true });
var petitions = await client.Petitions.GetAsync(new GetPetitionsRequest { State = "open", PageSize = 20 });

The compiler error message on each obsolete overload contains a ready-to-use example showing the equivalent request model call.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions