Skip to main content
Commonmark migration
Source Link

##Soapi.CS Fluent Configuration

Soapi.CS Fluent Configuration

var ctx = new ApiContext(ApiKey).Options
    // obviates a call to stackauth
    .SerializedSites("{ 'api_sites': [ {'name': 'Stack....")
    // can also be accomplished by seeding the cache
    .SeedCache(new RequestCacheItem
        {
            Uri = new Uri("http://stackauth.com/1.0/sites"),
            ResponseText = "{ 'api_sites': [ {'name': 'Stack....",
            Expiration = DateTime.Now.AddDays(1)
        })
    .UserAgent("SOAPI.APP")
    // 'stub' objects are fetch individually upon access
    .LazyLoadingEnabled(true)
    // all 'stub' objects for a batch are requests as a batch
    // and pre populated
    .EagerLoadingEnabled(true) //
    .Context // fluent terminator
    .Initialize();

##Soapi.CS Fluent Configuration

var ctx = new ApiContext(ApiKey).Options
    // obviates a call to stackauth
    .SerializedSites("{ 'api_sites': [ {'name': 'Stack....")
    // can also be accomplished by seeding the cache
    .SeedCache(new RequestCacheItem
        {
            Uri = new Uri("http://stackauth.com/1.0/sites"),
            ResponseText = "{ 'api_sites': [ {'name': 'Stack....",
            Expiration = DateTime.Now.AddDays(1)
        })
    .UserAgent("SOAPI.APP")
    // 'stub' objects are fetch individually upon access
    .LazyLoadingEnabled(true)
    // all 'stub' objects for a batch are requests as a batch
    // and pre populated
    .EagerLoadingEnabled(true) //
    .Context // fluent terminator
    .Initialize();

Soapi.CS Fluent Configuration

var ctx = new ApiContext(ApiKey).Options
    // obviates a call to stackauth
    .SerializedSites("{ 'api_sites': [ {'name': 'Stack....")
    // can also be accomplished by seeding the cache
    .SeedCache(new RequestCacheItem
        {
            Uri = new Uri("http://stackauth.com/1.0/sites"),
            ResponseText = "{ 'api_sites': [ {'name': 'Stack....",
            Expiration = DateTime.Now.AddDays(1)
        })
    .UserAgent("SOAPI.APP")
    // 'stub' objects are fetch individually upon access
    .LazyLoadingEnabled(true)
    // all 'stub' objects for a batch are requests as a batch
    // and pre populated
    .EagerLoadingEnabled(true) //
    .Context // fluent terminator
    .Initialize();
Post Undeleted by Sky Sanders
added 335 characters in body
Source Link
Sky Sanders
  • 12.1k
  • 3
  • 32
  • 60

##Soapi.CS Fluent APIConfiguration

publicvar voidctx FluentAPI= new ApiContext(ApiKey).Options
{    // obviates a call to stackauth
    .SerializedSites("{ 'api_sites': [ {'name': 'Stack....")
    // Soapi.CScan providesalso abe 'fluent'accomplished apiby inseeding the interestcache
 of compact code .
 SeedCache(new RequestCacheItem
    StatsResponse response =  {
            Uri = new RouteFactoryUri("api"http://stackauth.stackoverflowcom/1.com"0/sites"), 
 ApiKey)           ResponseText = "{ 'api_sites': [ {'name': 'Stack.Stats().GetResponse();
..",
    string siteName       Expiration = responseDateTime.Statistics[0]Now.DisplayName;AddDays(1)
    int totalQuestions = response })
    .Statistics[0]UserAgent("SOAPI.TotalQuestions;APP")
    float// questionsPerMinute'stub' =objects responseare fetch individually upon access
    .Statistics[0]LazyLoadingEnabled(true)
    // all 'stub' objects for a batch are requests as a batch
    // and pre populated
    .QuestionsPerMinute;EagerLoadingEnabled(true) //
    .Context // fluent terminator
}    .Initialize();

##Soapi.CS Fluent API

public void FluentAPI()
{
    
    // Soapi.CS provides a 'fluent' api in the interest of compact code.
 
    StatsResponse response = 
        new RouteFactory("api.stackoverflow.com", ApiKey).Stats().GetResponse();

    string siteName = response.Statistics[0].DisplayName;
    int totalQuestions = response.Statistics[0].TotalQuestions;
    float questionsPerMinute = response.Statistics[0].QuestionsPerMinute;

}

##Soapi.CS Fluent Configuration

var ctx = new ApiContext(ApiKey).Options
    // obviates a call to stackauth
    .SerializedSites("{ 'api_sites': [ {'name': 'Stack....")
    // can also be accomplished by seeding the cache
    .SeedCache(new RequestCacheItem
        {
            Uri = new Uri("http://stackauth.com/1.0/sites"), 
            ResponseText = "{ 'api_sites': [ {'name': 'Stack....",
            Expiration = DateTime.Now.AddDays(1)
        })
    .UserAgent("SOAPI.APP")
    // 'stub' objects are fetch individually upon access
    .LazyLoadingEnabled(true)
    // all 'stub' objects for a batch are requests as a batch
    // and pre populated
    .EagerLoadingEnabled(true) //
    .Context // fluent terminator
    .Initialize();
Post Deleted by Sky Sanders
deleted 211 characters in body
Source Link
Sky Sanders
  • 12.1k
  • 3
  • 32
  • 60

##Soapi.CS Fluent API note: the code samples I am posting refer to Soapi.CS, http://soapi.codeplex.com, which is the evolved version of Salient.StackApps. The question will be updated when I have completed the documentation here.

public void FluentAPI()
{
    
    // Soapi.CS provides a 'fluent' api in the interest of compact code.

    StatsResponse response = 
        new RouteFactory("api.stackoverflow.com", ApiKey).Stats().GetResponse();

    string siteName = response.Statistics[0].DisplayName;
    int totalQuestions = response.Statistics[0].TotalQuestions;
    float questionsPerMinute = response.Statistics[0].QuestionsPerMinute;

}

##Soapi.CS Fluent API note: the code samples I am posting refer to Soapi.CS, http://soapi.codeplex.com, which is the evolved version of Salient.StackApps. The question will be updated when I have completed the documentation here.

public void FluentAPI()
{
    
    // Soapi.CS provides a 'fluent' api in the interest of compact code.

    StatsResponse response = 
        new RouteFactory("api.stackoverflow.com", ApiKey).Stats().GetResponse();

    string siteName = response.Statistics[0].DisplayName;
    int totalQuestions = response.Statistics[0].TotalQuestions;
    float questionsPerMinute = response.Statistics[0].QuestionsPerMinute;

}

##Soapi.CS Fluent API

public void FluentAPI()
{
    
    // Soapi.CS provides a 'fluent' api in the interest of compact code.

    StatsResponse response = 
        new RouteFactory("api.stackoverflow.com", ApiKey).Stats().GetResponse();

    string siteName = response.Statistics[0].DisplayName;
    int totalQuestions = response.Statistics[0].TotalQuestions;
    float questionsPerMinute = response.Statistics[0].QuestionsPerMinute;

}
Source Link
Sky Sanders
  • 12.1k
  • 3
  • 32
  • 60
Loading