Skip to content

Commit 2a98183

Browse files
authored
feat(sidekick/swift): propagate deprecated tags (#7472)
If a method is deprecated, then the default implementations of the method should be marked as deprecated. If a service is deprecated, then the extensions to the corresponding protocol should be marked as deprecated too.
1 parent 31da9b2 commit 2a98183

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

‎internal/sidekick/swift/templates/common/client_protocol.mustache‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,31 @@ extension Clients {
9797
}
9898

9999
// Default implementations
100+
{{#Deprecated}}
101+
@available(*, deprecated)
102+
{{/Deprecated}}
100103
extension Clients.{{Codec.StubPrefix}}Protocol {
101104
{{#Codec.Methods}}
102105

106+
{{#Deprecated}}
107+
@available(*, deprecated)
108+
{{/Deprecated}}
103109
public func {{> /templates/common/method_signature/request}} {
104110
try await self.{{Codec.Name}}(request: request, options: .init())
105111
}
106112

113+
{{#Deprecated}}
114+
@available(*, deprecated)
115+
{{/Deprecated}}
107116
public func {{> /templates/common/method_signature/request_options}} {
108117
throw GoogleCloudGax.RequestError.unimplemented
109118
}
110119
{{#Codec.PlainRPC}}
111120
{{#Signatures}}
112121

122+
{{#Deprecated}}
123+
@available(*, deprecated)
124+
{{/Deprecated}}
113125
public func {{> /templates/common/method_signature/overload}} {
114126
let request = {{Method.InputType.Codec.ParameterTypeName}}().with {
115127
{{> /templates/common/method_body/overload_fields}}
@@ -125,10 +137,16 @@ extension Clients.{{Codec.StubPrefix}}Protocol {
125137
{{/Codec.PlainRPC}}
126138
{{#Codec.Pagination}}
127139

140+
{{#Deprecated}}
141+
@available(*, deprecated)
142+
{{/Deprecated}}
128143
public func {{> /templates/common/method_signature/pagination}} {
129144
try self.{{Codec.Name}}(byItem: byItem, options: .init())
130145
}
131146

147+
{{#Deprecated}}
148+
@available(*, deprecated)
149+
{{/Deprecated}}
132150
public func {{> /templates/common/method_signature/pagination_options}} {
133151
let listRpc = { (token: Swift.String) async throws -> {{Codec.ReturnType}} in
134152
throw GoogleCloudGax.RequestError.unimplemented
@@ -137,6 +155,9 @@ extension Clients.{{Codec.StubPrefix}}Protocol {
137155
}
138156
{{#Signatures}}
139157

158+
{{#Deprecated}}
159+
@available(*, deprecated)
160+
{{/Deprecated}}
140161
public func {{> /templates/common/method_signature/pagination_overload}} {
141162
let request = {{Method.InputType.Codec.ParameterTypeName}}().with {
142163
{{> /templates/common/method_body/overload_fields}}
@@ -147,10 +168,16 @@ extension Clients.{{Codec.StubPrefix}}Protocol {
147168
{{/Codec.Pagination}}
148169
{{#Codec.LRO}}
149170

171+
{{#Deprecated}}
172+
@available(*, deprecated)
173+
{{/Deprecated}}
150174
public func {{> /templates/common/method_signature/lro}} {
151175
try await self.{{Codec.Name}}(withPolling: withPolling, options: .init())
152176
}
153177

178+
{{#Deprecated}}
179+
@available(*, deprecated)
180+
{{/Deprecated}}
154181
public func {{> /templates/common/method_signature/lro_options}} {
155182
let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<{{Codec.LRO.ReturnType}}>.State in
156183
throw GoogleCloudGax.RequestError.unimplemented
@@ -159,6 +186,9 @@ extension Clients.{{Codec.StubPrefix}}Protocol {
159186
}
160187
{{#Signatures}}
161188

189+
{{#Deprecated}}
190+
@available(*, deprecated)
191+
{{/Deprecated}}
162192
public func {{> /templates/common/method_signature/lro_overload}} {
163193
let request = {{Method.InputType.Codec.ParameterTypeName}}().with {
164194
{{> /templates/common/method_body/overload_fields}}
@@ -169,10 +199,16 @@ extension Clients.{{Codec.StubPrefix}}Protocol {
169199
{{/Codec.LRO}}
170200
{{#Codec.DiscoveryLRO}}
171201

202+
{{#Deprecated}}
203+
@available(*, deprecated)
204+
{{/Deprecated}}
172205
public func {{> /templates/common/method_signature/discovery_lro}} {
173206
try await self.{{Codec.Name}}(withPolling: withPolling, options: .init())
174207
}
175208

209+
{{#Deprecated}}
210+
@available(*, deprecated)
211+
{{/Deprecated}}
176212
public func {{> /templates/common/method_signature/discovery_lro_options}} {
177213
let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<{{Codec.DiscoveryLRO.ReturnType}}>.State in
178214
throw GoogleCloudGax.RequestError.unimplemented
@@ -181,6 +217,9 @@ extension Clients.{{Codec.StubPrefix}}Protocol {
181217
}
182218
{{#Signatures}}
183219

220+
{{#Deprecated}}
221+
@available(*, deprecated)
222+
{{/Deprecated}}
184223
public func {{> /templates/common/method_signature/discovery_lro_overload}} {
185224
let request = {{Method.InputType.Codec.ParameterTypeName}}().with {
186225
{{> /templates/common/method_body/overload_fields}}

0 commit comments

Comments
 (0)