Ejemplo n.º 1
0
        /// <summary>
        /// Request product information for a list of apps or packages
        /// Results are returned in a <see cref="PICSProductInfoCallback"/> callback.
        /// </summary>
        /// <param name="apps">List of <see cref="PICSRequest"/> requests for apps.</param>
        /// <param name="packages">List of <see cref="PICSRequest"/> requests for packages.</param>
        /// <param name="metaDataOnly">Whether to send only meta data.</param>
        /// <returns>The Job ID of the request. This can be used to find the appropriate <see cref="SteamClient.JobCallback&lt;T&gt;"/>.</returns>
        public JobID PICSGetProductInfo(IEnumerable <PICSRequest> apps, IEnumerable <PICSRequest> packages, bool metaDataOnly = false)
        {
            var request = new ClientMsgProtobuf <CMsgClientPICSProductInfoRequest>(EMsg.ClientPICSProductInfoRequest);

            request.SourceJobID = Client.GetNextJobID();

            foreach (var app_request in apps)
            {
                var appinfo = new CMsgClientPICSProductInfoRequest.AppInfo();
                appinfo.access_token = app_request.AccessToken;
                appinfo.appid        = app_request.ID;
                appinfo.only_public  = app_request.Public;

                request.Body.apps.Add(appinfo);
            }

            foreach (var package_request in packages)
            {
                var packageinfo = new CMsgClientPICSProductInfoRequest.PackageInfo();
                packageinfo.access_token = package_request.AccessToken;
                packageinfo.packageid    = package_request.ID;

                request.Body.packages.Add(packageinfo);
            }

            request.Body.meta_data_only = metaDataOnly;

            this.Client.Send(request);

            return(request.SourceJobID);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Request product information for a list of apps or packages
        /// Results are returned in a <see cref="PICSProductInfoCallback"/> callback.
        /// The returned <see cref="AsyncJob{T}"/> can also be awaited to retrieve the callback result.
        /// </summary>
        /// <param name="apps">List of <see cref="PICSRequest"/> requests for apps.</param>
        /// <param name="packages">List of <see cref="PICSRequest"/> requests for packages.</param>
        /// <param name="metaDataOnly">Whether to send only meta data.</param>
        /// <returns>The Job ID of the request. This can be used to find the appropriate <see cref="PICSProductInfoCallback"/>.</returns>
        public AsyncJobMultiple <PICSProductInfoCallback> PICSGetProductInfo(IEnumerable <PICSRequest> apps, IEnumerable <PICSRequest> packages, bool metaDataOnly = false)
        {
            if (apps == null)
            {
                throw new ArgumentNullException(nameof(apps));
            }

            if (packages == null)
            {
                throw new ArgumentNullException(nameof(packages));
            }

            var request = new ClientMsgProtobuf <CMsgClientPICSProductInfoRequest>(EMsg.ClientPICSProductInfoRequest);

            request.SourceJobID = Client.GetNextJobID();

            foreach (var app_request in apps)
            {
                var appinfo = new CMsgClientPICSProductInfoRequest.AppInfo();
                appinfo.access_token = app_request.AccessToken;
                appinfo.appid        = app_request.ID;
                appinfo.only_public  = app_request.Public;

                request.Body.apps.Add(appinfo);
            }

            foreach (var package_request in packages)
            {
                var packageinfo = new CMsgClientPICSProductInfoRequest.PackageInfo();
                packageinfo.access_token = package_request.AccessToken;
                packageinfo.packageid    = package_request.ID;

                request.Body.packages.Add(packageinfo);
            }

            request.Body.meta_data_only = metaDataOnly;

            this.Client.Send(request);

            return(new AsyncJobMultiple <PICSProductInfoCallback>(this.Client, request.SourceJobID, callback => !callback.ResponsePending));
        }