@@ -266,18 +266,32 @@ public NetworkingApiBuilder(IServiceType serviceType, IAuthenticationProvider au
266266 /// <summary>
267267 /// Lists all ports associated with the account.
268268 /// </summary>
269+ /// <param name="queryString">Options for filtering.</param>
269270 /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
270271 /// <returns>
271272 /// A collection of port resources associated with the account.
272273 /// </returns>
273- public virtual async Task < PreparedRequest > ListPortsAsync ( CancellationToken cancellationToken = default ( CancellationToken ) )
274+ public virtual async Task < T > ListPortsAsync < T > ( IQueryStringBuilder queryString , CancellationToken cancellationToken = default ( CancellationToken ) )
275+ where T : IEnumerable < IServiceResource >
274276 {
275- Url endpoint = await Endpoint . GetEndpoint ( cancellationToken ) . ConfigureAwait ( false ) ;
277+ return await BuildListPortsRequest ( queryString , cancellationToken )
278+ . SendAsync ( )
279+ . ReceiveJson < T > ( )
280+ . PropogateOwnerToChildren ( this ) . ConfigureAwait ( false ) ;
281+ }
276282
277- return endpoint
278- . AppendPathSegment ( "ports" )
279- . Authenticate ( AuthenticationProvider )
280- . PrepareGet ( cancellationToken ) ;
283+ /// <summary>
284+ /// Builds the <see cref="ListPortsAsync{T}"/> request.
285+ /// </summary>
286+ /// <param name="queryString">Options for filtering.</param>
287+ /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
288+ public virtual async Task < PreparedRequest > BuildListPortsRequest ( IQueryStringBuilder queryString , CancellationToken cancellationToken = default ( CancellationToken ) )
289+ {
290+ PreparedRequest request = await Endpoint . PrepareGetResourceRequest ( "ports" , cancellationToken ) . ConfigureAwait ( false ) ;
291+
292+ request . Url . SetQueryParams ( queryString ? . Build ( ) ) ;
293+
294+ return request ;
281295 }
282296
283297 /// <summary>
0 commit comments