Implemented the User Agent middleware (#6)

This PR contains the work done to implement the `UserAgentMiddleware` middleware that includes user agent information into a header of the requests sent by the `Client` type, as defined in the [Discogs documentation](https://www.discogs.com/developers/#page:home,header:home-general-information). For this purpose, the `CamelCaseValidationRule`, `SemanticVersionValidationRule` and `URLValidationRule` types were implemented and integrated into the existing `ValidateInputUseCase` type.

Reviewed-on: #6
Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
This commit was merged in pull request #6.
This commit is contained in:
2025-10-13 00:54:17 +00:00
committed by Javier Cicchelli
parent 24d703b967
commit 791ebf4f78
1988 changed files with 2882 additions and 2010 deletions
@@ -1 +1 @@
{"hierarchy":{"paths":[["doc:\/\/DiscogsService\/documentation\/DiscogsService","doc:\/\/DiscogsService\/documentation\/DiscogsService\/AuthTransport"]]},"variants":[{"traits":[{"interfaceLanguage":"swift"}],"paths":["\/documentation\/discogsservice\/authtransport\/!=(_:_:)"]}],"primaryContentSections":[{"declarations":[{"tokens":[{"kind":"keyword","text":"static"},{"kind":"text","text":" "},{"kind":"keyword","text":"func"},{"kind":"text","text":" "},{"kind":"identifier","text":"!="},{"kind":"text","text":" "},{"kind":"text","text":"("},{"kind":"internalParam","text":"lhs"},{"kind":"text","text":": "},{"kind":"typeIdentifier","text":"Self"},{"kind":"text","text":", "},{"kind":"internalParam","text":"rhs"},{"kind":"text","text":": "},{"kind":"typeIdentifier","text":"Self"},{"kind":"text","text":") -> "},{"preciseIdentifier":"s:Sb","kind":"typeIdentifier","text":"Bool"}],"platforms":["macOS"],"languages":["swift"]}],"kind":"declarations"},{"parameters":[{"name":"lhs","content":[{"inlineContent":[{"type":"text","text":"A value to compare."}],"type":"paragraph"}]},{"name":"rhs","content":[{"inlineContent":[{"type":"text","text":"Another value to compare."}],"type":"paragraph"}]}],"kind":"parameters"},{"content":[{"anchor":"discussion","level":2,"type":"heading","text":"Discussion"},{"inlineContent":[{"type":"text","text":"Inequality is the inverse of equality. For any values "},{"type":"codeVoice","code":"a"},{"type":"text","text":" and "},{"type":"codeVoice","code":"b"},{"type":"text","text":", "},{"type":"codeVoice","code":"a != b"},{"type":"text","text":" "},{"type":"text","text":"implies that "},{"type":"codeVoice","code":"a == b"},{"type":"text","text":" is "},{"type":"codeVoice","code":"false"},{"type":"text","text":"."}],"type":"paragraph"},{"inlineContent":[{"type":"text","text":"This is the default implementation of the not-equal-to operator ("},{"type":"codeVoice","code":"!="},{"type":"text","text":")"},{"type":"text","text":" "},{"type":"text","text":"for any type that conforms to "},{"type":"codeVoice","code":"Equatable"},{"type":"text","text":"."}],"type":"paragraph"}],"kind":"content"}],"metadata":{"roleHeading":"Operator","role":"symbol","externalID":"s:SQsE2neoiySbx_xtFZ::SYNTHESIZED::s:14DiscogsService13AuthTransportO","fragments":[{"text":"static","kind":"keyword"},{"text":" ","kind":"text"},{"text":"func","kind":"keyword"},{"text":" ","kind":"text"},{"text":"!=","kind":"identifier"},{"text":" ","kind":"text"},{"text":"(","kind":"text"},{"text":"Self","kind":"typeIdentifier"},{"text":", ","kind":"text"},{"text":"Self","kind":"typeIdentifier"},{"text":") -> ","kind":"text"},{"preciseIdentifier":"s:Sb","text":"Bool","kind":"typeIdentifier"}],"title":"!=(_:_:)","extendedModule":"Swift","modules":[{"relatedModules":["Swift"],"name":"DiscogsService"}],"symbolKind":"op"},"identifier":{"url":"doc:\/\/DiscogsService\/documentation\/DiscogsService\/AuthTransport\/!=(_:_:)","interfaceLanguage":"swift"},"schemaVersion":{"minor":3,"patch":0,"major":0},"sections":[],"kind":"symbol","abstract":[{"text":"Returns a Boolean value indicating whether two values are not equal.","type":"text"}],"references":{"doc://DiscogsService/documentation/DiscogsService":{"role":"collection","title":"DiscogsService","kind":"symbol","identifier":"doc:\/\/DiscogsService\/documentation\/DiscogsService","abstract":[],"type":"topic","url":"\/documentation\/discogsservice"},"doc://DiscogsService/documentation/DiscogsService/AuthTransport":{"role":"symbol","type":"topic","abstract":[{"text":"A representation of the available transport options to send credentials in authenticated requests.","type":"text"}],"kind":"symbol","identifier":"doc:\/\/DiscogsService\/documentation\/DiscogsService\/AuthTransport","url":"\/documentation\/discogsservice\/authtransport","navigatorTitle":[{"text":"AuthTransport","kind":"identifier"}],"title":"AuthTransport","fragments":[{"text":"enum","kind":"keyword"},{"text":" ","kind":"text"},{"text":"AuthTransport","kind":"identifier"}]},"doc://DiscogsService/documentation/DiscogsService/AuthTransport/!=(_:_:)":{"kind":"symbol","role":"symbol","url":"\/documentation\/discogsservice\/authtransport\/!=(_:_:)","title":"!=(_:_:)","fragments":[{"text":"static","kind":"keyword"},{"text":" ","kind":"text"},{"text":"func","kind":"keyword"},{"text":" ","kind":"text"},{"text":"!=","kind":"identifier"},{"text":" ","kind":"text"},{"text":"(","kind":"text"},{"text":"Self","kind":"typeIdentifier"},{"text":", ","kind":"text"},{"text":"Self","kind":"typeIdentifier"},{"text":") -> ","kind":"text"},{"text":"Bool","kind":"typeIdentifier","preciseIdentifier":"s:Sb"}],"abstract":[{"text":"Returns a Boolean value indicating whether two values are not equal.","type":"text"}],"identifier":"doc:\/\/DiscogsService\/documentation\/DiscogsService\/AuthTransport\/!=(_:_:)","type":"topic"}}}
{"kind":"symbol","identifier":{"interfaceLanguage":"swift","url":"doc:\/\/DiscogsService\/documentation\/DiscogsService\/AuthTransport\/!=(_:_:)"},"hierarchy":{"paths":[["doc:\/\/DiscogsService\/documentation\/DiscogsService","doc:\/\/DiscogsService\/documentation\/DiscogsService\/AuthTransport"]]},"abstract":[{"type":"text","text":"Returns a Boolean value indicating whether two values are not equal."}],"primaryContentSections":[{"declarations":[{"languages":["swift"],"tokens":[{"text":"static","kind":"keyword"},{"text":" ","kind":"text"},{"text":"func","kind":"keyword"},{"text":" ","kind":"text"},{"text":"!=","kind":"identifier"},{"text":" ","kind":"text"},{"text":"(","kind":"text"},{"text":"lhs","kind":"internalParam"},{"text":": ","kind":"text"},{"text":"Self","kind":"typeIdentifier"},{"text":", ","kind":"text"},{"text":"rhs","kind":"internalParam"},{"text":": ","kind":"text"},{"text":"Self","kind":"typeIdentifier"},{"text":") -> ","kind":"text"},{"text":"Bool","preciseIdentifier":"s:Sb","kind":"typeIdentifier"}],"platforms":["macOS"]}],"kind":"declarations"},{"parameters":[{"name":"lhs","content":[{"inlineContent":[{"text":"A value to compare.","type":"text"}],"type":"paragraph"}]},{"name":"rhs","content":[{"inlineContent":[{"text":"Another value to compare.","type":"text"}],"type":"paragraph"}]}],"kind":"parameters"},{"content":[{"type":"heading","text":"Discussion","level":2,"anchor":"discussion"},{"type":"paragraph","inlineContent":[{"text":"Inequality is the inverse of equality. For any values ","type":"text"},{"code":"a","type":"codeVoice"},{"text":" and ","type":"text"},{"code":"b","type":"codeVoice"},{"text":", ","type":"text"},{"code":"a != b","type":"codeVoice"},{"text":" ","type":"text"},{"text":"implies that ","type":"text"},{"code":"a == b","type":"codeVoice"},{"text":" is ","type":"text"},{"code":"false","type":"codeVoice"},{"text":".","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"This is the default implementation of the not-equal-to operator (","type":"text"},{"code":"!=","type":"codeVoice"},{"text":")","type":"text"},{"text":" ","type":"text"},{"text":"for any type that conforms to ","type":"text"},{"code":"Equatable","type":"codeVoice"},{"text":".","type":"text"}]}],"kind":"content"}],"metadata":{"title":"!=(_:_:)","symbolKind":"op","fragments":[{"text":"static","kind":"keyword"},{"text":" ","kind":"text"},{"text":"func","kind":"keyword"},{"text":" ","kind":"text"},{"text":"!=","kind":"identifier"},{"text":" ","kind":"text"},{"text":"(","kind":"text"},{"text":"Self","kind":"typeIdentifier"},{"text":", ","kind":"text"},{"text":"Self","kind":"typeIdentifier"},{"text":") -> ","kind":"text"},{"text":"Bool","preciseIdentifier":"s:Sb","kind":"typeIdentifier"}],"modules":[{"name":"DiscogsService","relatedModules":["Swift"]}],"role":"symbol","extendedModule":"Swift","roleHeading":"Operator","externalID":"s:SQsE2neoiySbx_xtFZ::SYNTHESIZED::s:14DiscogsService13AuthTransportO"},"sections":[],"variants":[{"traits":[{"interfaceLanguage":"swift"}],"paths":["\/documentation\/discogsservice\/authtransport\/!=(_:_:)"]}],"schemaVersion":{"major":0,"minor":3,"patch":0},"references":{"doc://DiscogsService/documentation/DiscogsService":{"title":"DiscogsService","role":"collection","abstract":[],"kind":"symbol","type":"topic","identifier":"doc:\/\/DiscogsService\/documentation\/DiscogsService","url":"\/documentation\/discogsservice"},"doc://DiscogsService/documentation/DiscogsService/AuthTransport/!=(_:_:)":{"type":"topic","kind":"symbol","identifier":"doc:\/\/DiscogsService\/documentation\/DiscogsService\/AuthTransport\/!=(_:_:)","abstract":[{"type":"text","text":"Returns a Boolean value indicating whether two values are not equal."}],"role":"symbol","url":"\/documentation\/discogsservice\/authtransport\/!=(_:_:)","fragments":[{"kind":"keyword","text":"static"},{"kind":"text","text":" "},{"kind":"keyword","text":"func"},{"kind":"text","text":" "},{"kind":"identifier","text":"!="},{"kind":"text","text":" "},{"kind":"text","text":"("},{"kind":"typeIdentifier","text":"Self"},{"kind":"text","text":", "},{"kind":"typeIdentifier","text":"Self"},{"kind":"text","text":") -> "},{"preciseIdentifier":"s:Sb","kind":"typeIdentifier","text":"Bool"}],"title":"!=(_:_:)"},"doc://DiscogsService/documentation/DiscogsService/AuthTransport":{"url":"\/documentation\/discogsservice\/authtransport","fragments":[{"text":"enum","kind":"keyword"},{"text":" ","kind":"text"},{"text":"AuthTransport","kind":"identifier"}],"navigatorTitle":[{"text":"AuthTransport","kind":"identifier"}],"abstract":[{"type":"text","text":"A representation of the available transport options to send credentials in authenticated requests."}],"title":"AuthTransport","identifier":"doc:\/\/DiscogsService\/documentation\/DiscogsService\/AuthTransport","type":"topic","kind":"symbol","role":"symbol"}}}