コード例 #1
0
 internal ApiRequest(UniversalFeedEndpoint endpoint, string relativeUrl, string method = "GET", string contentType = null, Stream requestBody = null)
 {
     this.RelativeUrl = relativeUrl;
     this.Method      = method;
     this.ContentType = contentType;
     this.RequestBody = requestBody;
     this.Endpoint    = endpoint;
 }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UniversalFeedClient"/> class.
        /// </summary>
        /// <param name="endpoint">Connection information for the remote endpoint.</param>
        /// <param name="transport">Transport layer to use for requests. The default is <see cref="DefaultApiTransport"/>.</param>
        /// <exception cref="ArgumentNullException"><paramref name="endpoint"/> is null.</exception>
        public UniversalFeedClient(UniversalFeedEndpoint endpoint, ApiTransport transport)
        {
            this.Endpoint        = endpoint ?? throw new ArgumentNullException(nameof(endpoint));
            this.transport       = transport ?? new DefaultApiTransport();
            this.localRepository = new Lazy <LocalPackageRepository>(initLocalRepository);

            LocalPackageRepository initLocalRepository()
            {
                if (this.Endpoint.IsLocalDirectory)
                {
                    return(new LocalPackageRepository(this.Endpoint.Uri.LocalPath));
                }
                else
                {
                    throw new NotSupportedException();
                }
            }
        }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UniversalFeedClient"/> class.
 /// </summary>
 /// <param name="endpoint">Connection information for the remote endpoint.</param>
 /// <exception cref="ArgumentNullException"><paramref name="endpoint"/> is null.</exception>
 public UniversalFeedClient(UniversalFeedEndpoint endpoint)
     : this(endpoint, null)
 {
 }