Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jun 25, 2025

This PR updates all input option functions in the qst package to be prefixed with the word 'with', providing a more consistent and descriptive API.

Changes Made

Function Renames

All 28 option functions have been renamed to include the 'with' prefix:

  • RawURLWithRawURL
  • URLWithURL
  • SchemeWithScheme
  • UserWithUser
  • UsernameWithUsername
  • UserPasswordWithUserPassword
  • HostWithHost
  • PathWithPath
  • QueryWithQuery
  • HeaderWithHeader
  • AcceptWithAccept
  • ContentTypeWithContentType
  • RefererWithReferer
  • UserAgentWithUserAgent
  • CookieWithCookie
  • AuthorizationWithAuthorization
  • BasicAuthWithBasicAuth
  • TokenAuthWithTokenAuth
  • BearerAuthWithBearerAuth
  • ContextWithContext
  • ContextValueWithContextValue
  • BodyWithBody
  • BodyReaderWithBodyReader
  • BodyBytesWithBodyBytes
  • BodyStringWithBodyString
  • BodyJSONWithBodyJSON
  • BodyXMLWithBodyXML
  • DumpWithDump

Type Renames

Custom types have also been updated:

  • QueriesWithQueries
  • HeadersWithHeaders
  • BodyFormWithBodyForm

API Usage Examples

Before:

response, err := qst.Patch("https://breakfast.com/api",
    qst.BearerAuth("c0rNfl@k3s"),
    qst.Path("/cereals", cerealID),
    qst.BodyJSON(map[string]string{"name": "Life"}),
)

After:

response, err := qst.Patch("https://breakfast.com/api",
    qst.WithBearerAuth("c0rNfl@k3s"),
    qst.WithPath("/cereals", cerealID),
    qst.WithBodyJSON(map[string]string{"name": "Life"}),
)

Updated Components

  • ✅ All option functions in options.go
  • ✅ All internal function references
  • ✅ All test files and example functions
  • ✅ README.md documentation
  • ✅ All tests pass

Breaking Change Notice

⚠️ This is a breaking change - all existing code using the option functions will need to be updated to use the new 'with' prefixed names.

The new naming convention provides better consistency and makes the API more descriptive and intuitive to use.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: broothie <7990713+broothie@users.noreply.github.com>
Copilot AI changed the title [WIP] Prefix input options with 'with' Add 'with' prefix to all input option functions Jun 25, 2025
Copilot AI requested a review from broothie June 25, 2025 04:06
@broothie broothie marked this pull request as ready for review June 25, 2025 18:19
Copilot AI review requested due to automatic review settings June 25, 2025 18:19
@broothie broothie merged commit ce55881 into main Jun 25, 2025
5 checks passed
@broothie broothie deleted the copilot/fix-96f8a2f5-aef6-44ee-9214-2175824eb71b branch June 25, 2025 18:19
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR renames all input option functions in the qst package by adding a 'with' prefix to improve naming consistency and API descriptiveness.

  • All 28 option functions and 3 custom types have been renamed.
  • Tests, examples, and documentation have been updated to reflect the new names.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
smoke_test.go Updated option function calls to use the new 'With' prefixed names.
qst_test.go Updated API examples to call the 'With' prefixed functions.
options_test.go Updated tests to reflect new function names and type modifications.
options.go Renamed functions and types to consistently use the 'With' prefix.
README.md Documentation examples updated with the new 'With' prefixed functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants