コード例 #1
0
 public ApiController(IInvoiceManager invoiceManager, IApiAuthenticator apiAuthenticator,
                      IModelPatcher <Invoice, ApiEditInvoiceModel> invoicePatcher)
 {
     this._invoiceManager   = invoiceManager;
     this._apiAuthenticator = apiAuthenticator;
     this._invoicePatcher   = invoicePatcher;
 }
コード例 #2
0
ファイル: ApiManager.cs プロジェクト: weiplanet/OneRoster.Net
        public ApiManager(string endpoint, IApiAuthenticator apiAuthenticator = null)
        {
            ApiAuthenticator = apiAuthenticator;

            client = new HttpClient
            {
                BaseAddress = new Uri(endpoint)
            };
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(
                new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
            client.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json");
        }
コード例 #3
0
 /// <summary>
 /// Provides a way for accessing REST api's in a simple and cross-platform way.
 /// </summary>
 /// <param name="auth">The object to use for authenticating a request.</param>
 /// <param name="host">The server host that the service will be calling, such as http://microsoft.com.</param>
 /// <param name="controller">The controller name being accessed. This is excluding the /api/ prefix.</param>
 protected BaseApiService(IApiAuthenticator auth, string host, string controller)
 {
     Host          = host.EndsWith("/") ? host.Substring(host.Length - 1, 1) : host;
     Controller    = controller.Replace("/", string.Empty);
     Authenticator = auth;
 }