本文整理汇总了C#中Api类的典型用法代码示例。如果您正苦于以下问题:C# Api类的具体用法?C# Api怎么用?C# Api使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Api类属于命名空间,在下文中一共展示了Api类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Job
public Job(Api api, LogsStore logsStore, DroneSettings droneSettings, OmniRecordManager omniRecordManager)
{
_omniRecordManager = omniRecordManager;
_logsStore = logsStore;
_droneSettings = droneSettings;
_api = api;
}
示例2: GetDynamicOptions
public void GetDynamicOptions(string category, Api.IRequest requestObject) {
if (requestObject == null) {
throw new ArgumentNullException("requestObject");
}
requestObject.Debug("Called DummyProvider GetDynamicOptions");
}
示例3: Repository_Authority_AllAuthorities_Returns_All
public async Task Repository_Authority_AllAuthorities_Returns_All()
{
var api = new Api<AuthoritiesViewModel>(new Mock<ILog>().Object);
var result = await api.GetAsync("Authorities", string.Empty);
Assert.IsNotNull(result);
Assert.That(result.Authorities.Any());
}
示例4: InitializeProvider
public void InitializeProvider(Api.IRequest requestObject) {
if (requestObject == null) {
throw new ArgumentNullException("requestObject");
}
requestObject.Debug("Called DummyProvider InitializeProvider");
}
示例5: ResolvePackageSources
public void ResolvePackageSources(Api.IRequest requestObject) {
if (requestObject == null) {
throw new ArgumentNullException("requestObject");
}
requestObject.Debug("Called DummyProvider ResolvePackageSources");
}
示例6: GetById
/// <summary>
/// Gets the edit model for the category with the given id.
/// </summary>
/// <param name="api">The current api</param>
/// <param name="id">The unique id</param>
/// <returns>The edit model</returns>
public static EditModel GetById(Api api, Guid id) {
var category = api.Categories.GetSingle(id);
if (category != null)
return Mapper.Map<Piranha.Models.Category, EditModel>(category);
return null;
}
示例7: ConvertBack
public static FoundOps.Core.Models.CoreEntities.ContactInfo ConvertBack(Api.Models.ContactInfo contactInfoModel)
{
var contactInfo = new FoundOps.Core.Models.CoreEntities.ContactInfo
{
Id = contactInfoModel.Id,
Type = contactInfoModel.Type,
Label = contactInfoModel.Label,
Data = contactInfoModel.Data,
ClientId = contactInfoModel.ClientId,
LocationId = contactInfoModel.LocationId,
CreatedDate = contactInfoModel.CreatedDate,
LastModified = contactInfoModel.LastModified,
LastModifyingUserId = contactInfoModel.LastModifyingUserId
};
//TODO Generalize this everywhere
if (string.IsNullOrEmpty(contactInfo.Type))
contactInfo.Type = "";
if (string.IsNullOrEmpty(contactInfo.Label))
contactInfo.Label = "";
if (string.IsNullOrEmpty(contactInfo.Data))
contactInfo.Data = "";
return contactInfo;
}
示例8: Job
public Job(Api api,DroneSettings droneSettings, OmniRecordManager omniRecordManager,CreativePackagesStore creativePackagesStore)
{
_creativePackagesStore = creativePackagesStore;
_omniRecordManager = omniRecordManager;
_droneSettings = droneSettings;
_api = api;
}
示例9: Functional
public Functional()
{
var appEnv = CallContextServiceLocator.Locator.ServiceProvider.GetService(typeof(IApplicationEnvironment)) as IApplicationEnvironment;
Debug.Assert(appEnv != null, "appEnv != null");
var builder = new ConfigurationBuilder(appEnv.ApplicationBasePath);
builder.AddJsonFile("config.json");
builder.AddJsonFile("config.private.json", true);
var configuration = builder.Build();
var uri = new Uri(configuration["ServerCredentialUri"]);
var username = configuration["ServerCredentialUsername"];
var password = configuration["ServerCredentialPassword"];
_serverCredential = new ServerCredential(uri, username, password);
_freeMusicTorrentFile =
new HttpClient().GetByteArrayAsync(
new Uri("http://bt.etree.org/download.php/582271/hottuna2015-09-11.flac16.torrent")).Result;
_freeMusicTorrentHash = "9ecc7229ff971d27552dd399509e188847dbbbf1";
// Make sure there is no torrents before executing the tests
var api = new Api(_serverCredential);
var torrents = api.GetTorrents().Result;
if (torrents.Any())
{
var result = api.Perform(Action.Removedata, torrents.Select(t => t.InfoHash)).Result;
Assert.True(result);
}
}
示例10: Repository_Establishments_Single_Return_One_Record
public async Task Repository_Establishments_Single_Return_One_Record()
{
var api = new Api<EstablishmentsModel>(new Mock<ILog>().Object);
var result = await api.GetAsync("Establishments/1", string.Empty);
Assert.IsNotNull(result);
Assert.That(!string.IsNullOrEmpty(result.RatingValue));
}
示例11: Repository_Establishments_AllAuthorities_Returns_All
public async Task Repository_Establishments_AllAuthorities_Returns_All()
{
var api = new Api<EstablishmentsViewModel>(new Mock<ILog>().Object);
var result = await api.GetAsync("Establishments?LocalAuthorityId=197", string.Empty);
Assert.IsNotNull(result);
Assert.That(result.Establishments.Any());
}
示例12: PutioFileSystem
public PutioFileSystem(Api putio_api)
{
this.PutioApi = putio_api;
this.OpenHandles = new Dictionary<Guid, PutioFileHandle>();
this.Root = PutioFolder.GetRootFolder(this);
this.DownloadManager = new DownloadManager(Constants.MAX_CONNECTIONS);
}
示例13: Test
public async Task Test()
{
var api = new Api();
var startElysee = new GeoLocation
{
Longitude = 2.316749,
Latitude = 48.870663
};
var endTourEiffel = new GeoLocation
{
Longitude = 2.294555,
Latitude = 48.858465
};
var arrivalTime = DateTimeOffset.Now.AddDays(3);
var networks = new List<Network> {Network.Bus};
var s =
await
api.GetItinerary(startElysee, endTourEiffel, null, arrivalTime, networks, JourneyPreference.MinWait,
false, false, false);
Assert.False(string.IsNullOrWhiteSpace(s));
}
示例14: WebSyncPreferencesWidget
public WebSyncPreferencesWidget (Api.OAuth oauth, string server, EventHandler requiredPrefChanged) : base (false, 5)
{
this.oauth = oauth;
Gtk.Table prefsTable = new Gtk.Table (1, 2, false);
prefsTable.RowSpacing = 5;
prefsTable.ColumnSpacing = 10;
serverEntry = new Gtk.Entry ();
serverEntry.Text = server;
AddRow (prefsTable, serverEntry, Catalog.GetString ("Se_rver:"), 0);
Add (prefsTable);
authButton = new Gtk.Button ();
// TODO: If Auth is valid, this text should change
if (!Auth.IsAccessToken)
authButton.Label = Catalog.GetString ("Connect to Server");
else {
authButton.Label = Catalog.GetString ("Connected");
authButton.Sensitive = false;
}
authButton.Clicked += OnAuthButtonClicked;
serverEntry.Changed += delegate {
Auth = null;
};
serverEntry.Changed += requiredPrefChanged;
Add (authButton);
// TODO: Add a section that shows the user something to verify they put
// in the right URL...something that constructs their user URL, maybe?
ShowAll ();
}
示例15: FullSearch
private static void FullSearch()
{
ParamBuilder oParamBuilder = new ParamBuilder();
SearchResults = new List<Item>();
oParamBuilder.addParam("sid", StaticSessionSettings.sessionID);
oParamBuilder.addParam("q", "");
var oComm = new Api();
var result = oComm.getResponseFromOrb<List<Item>>(Api.mediasearch, oParamBuilder.GetParamList());
List<Item> Temp = new List<Item>();
Temp = result;
SearchResults.Clear();
foreach (var item in Temp)
{
if (!string.IsNullOrWhiteSpace(item.field))
SearchResults.Add(item);
}
iveFullySearched = true;
}