public Observable<ServiceResponse<VideosModel>> searchWithServiceResponseAsync(String query, SearchOptionalParameter searchOptionalParameter) {
        if (query == null) {
            throw new IllegalArgumentException("Parameter query is required and cannot be null.");
        }
        final String acceptLanguage = searchOptionalParameter != null ? searchOptionalParameter.acceptLanguage() : null;
        final String userAgent = searchOptionalParameter != null ? searchOptionalParameter.userAgent() : this.client.userAgent();
        final String clientId = searchOptionalParameter != null ? searchOptionalParameter.clientId() : null;
        final String clientIp = searchOptionalParameter != null ? searchOptionalParameter.clientIp() : null;
        final String location = searchOptionalParameter != null ? searchOptionalParameter.location() : null;
        final String countryCode = searchOptionalParameter != null ? searchOptionalParameter.countryCode() : null;
        final Integer count = searchOptionalParameter != null ? searchOptionalParameter.count() : null;
        final Freshness freshness = searchOptionalParameter != null ? searchOptionalParameter.freshness() : null;
        final String id = searchOptionalParameter != null ? searchOptionalParameter.id() : null;
        final VideoLength length = searchOptionalParameter != null ? searchOptionalParameter.length() : null;
        final String market = searchOptionalParameter != null ? searchOptionalParameter.market() : null;
        final Integer offset = searchOptionalParameter != null ? searchOptionalParameter.offset() : null;
        final VideoPricing pricing = searchOptionalParameter != null ? searchOptionalParameter.pricing() : null;
        final VideoResolution resolution = searchOptionalParameter != null ? searchOptionalParameter.resolution() : null;
        final SafeSearch safeSearch = searchOptionalParameter != null ? searchOptionalParameter.safeSearch() : null;
        final String setLang = searchOptionalParameter != null ? searchOptionalParameter.setLang() : null;
        final Boolean textDecorations = searchOptionalParameter != null ? searchOptionalParameter.textDecorations() : null;
        final TextFormat textFormat = searchOptionalParameter != null ? searchOptionalParameter.textFormat() : null;

        return searchWithServiceResponseAsync(query, acceptLanguage, userAgent, clientId, clientIp, location, countryCode, count, freshness, id, length, market, offset, pricing, resolution, safeSearch, setLang, textDecorations, textFormat);
    }
public Observable < ServiceResponse < VideosModel > > searchWithServiceResponseAsync ( String query , SearchOptionalParameter searchOptionalParameter ) { if ( query == null ) { throw new IllegalArgumentException ( "Parameter query is required and cannot be null." ) ; } final String acceptLanguage = searchOptionalParameter != null ? searchOptionalParameter . acceptLanguage ( ) : null ; final String userAgent = searchOptionalParameter != null ? searchOptionalParameter . userAgent ( ) : this . client . userAgent ( ) ; final String clientId = searchOptionalParameter != null ? searchOptionalParameter . clientId ( ) : null ; final String clientIp = searchOptionalParameter != null ? searchOptionalParameter . clientIp ( ) : null ; final String location = searchOptionalParameter != null ? searchOptionalParameter . location ( ) : null ; final String countryCode = searchOptionalParameter != null ? searchOptionalParameter . countryCode ( ) : null ; final Integer count = searchOptionalParameter != null ? searchOptionalParameter . count ( ) : null ; final Freshness freshness = searchOptionalParameter != null ? searchOptionalParameter . freshness ( ) : null ; final String id = searchOptionalParameter != null ? searchOptionalParameter . id ( ) : null ; final VideoLength length = searchOptionalParameter != null ? searchOptionalParameter . length ( ) : null ; final String market = searchOptionalParameter != null ? searchOptionalParameter . market ( ) : null ; final Integer offset = searchOptionalParameter != null ? searchOptionalParameter . offset ( ) : null ; final VideoPricing pricing = searchOptionalParameter != null ? searchOptionalParameter . pricing ( ) : null ; final VideoResolution resolution = searchOptionalParameter != null ? searchOptionalParameter . resolution ( ) : null ; final SafeSearch safeSearch = searchOptionalParameter != null ? searchOptionalParameter . safeSearch ( ) : null ; final String setLang = searchOptionalParameter != null ? searchOptionalParameter . setLang ( ) : null ; final Boolean textDecorations = searchOptionalParameter != null ? searchOptionalParameter . textDecorations ( ) : null ; final TextFormat textFormat = searchOptionalParameter != null ? searchOptionalParameter . textFormat ( ) : null ; return searchWithServiceResponseAsync ( query , acceptLanguage , userAgent , clientId , clientIp , location , countryCode , count , freshness , id , length , market , offset , pricing , resolution , safeSearch , setLang , textDecorations , textFormat ) ; }
The Video Search API lets you send a search query to Bing and get back a list of videos that are relevant to the search query. This section provides technical details about the query parameters and headers that you use to request videos and the JSON response objects that contain them. For examples that show how to make requests, see [Searching the Web for Videos](https://docs.microsoft.com/azure/cognitive-services/bing-video-search/search-the-web).

@param query The user's search query string. The query string cannot be empty. The query string may contain [Bing Advanced Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to limit videos to a specific domain, use the [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. Use this parameter only with the Video Search API. Do not specify this parameter when calling the Trending Videos API.
@param searchOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VideosModel object