Skip to content

Use @discardableResult consistently on completion-handler methods #466

Open

Description

@nezhyborets

Completion-handler methods return a CancellableRequest, which callers often don't need. Whether discarding it produces an "unused result" warning currently depends on the method:

Protocol Methods returning CancellableRequest With @discardableResult
OpenAIProtocol 27 24 (missing: audioCreateSpeechStream, audioTranscriptionStream, audioTranscriptionsVerbose)
ResponsesEndpointProtocol 4 0
FilesEndpointProtocol (#401) 5 5

Add @discardableResult to every completion-handler method that returns a CancellableRequest, in the protocols and in the concrete implementations (OpenAI, ResponsesEndpoint). Callers that use the concrete types directly get the same behaviour that way.

Adding @discardableResult is source-compatible: it only removes a warning. Run swift package diagnose-api-breaking-changes to confirm it reports nothing.

Activity

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

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