/// <summary> /// Builds a query for home production. /// </summary> /// <param name="builder"></param> /// <param name="homeId"></param> /// <param name="resolution"></param> /// <param name="lastEntries">how many last entries to fetch; if no value provider a default will be used - hourly: 24; daily: 30; weekly: 4; monthly: 12; annually: 1</param> /// <returns></returns> public static TibberQueryBuilder WithHomeProduction(this TibberQueryBuilder builder, Guid homeId, EnergyResolution resolution, int?lastEntries) => builder.WithViewer( new ViewerQueryBuilder() .WithHome( new HomeQueryBuilder().WithHomeProduction(resolution, lastEntries ?? LastConsumptionEntries(resolution)), homeId ) );
/// <summary> /// Builds a query for customer, homes and their active subscription data. /// </summary> /// <param name="builder"></param> /// <returns></returns> public static TibberQueryBuilder WithHomesAndSubscriptions(this TibberQueryBuilder builder) => builder.WithAllScalarFields() .WithViewer( new ViewerQueryBuilder() .WithAllScalarFields() .WithAccountType() .WithHomes( new HomeQueryBuilder() .WithAllScalarFields() .WithAddress(new AddressQueryBuilder().WithAllFields()) .WithCurrentSubscription( new SubscriptionQueryBuilder() .WithAllScalarFields() .WithSubscriber(new LegalEntityQueryBuilder().WithAllFields()) .WithPriceInfo(new PriceInfoQueryBuilder().WithCurrent(new PriceQueryBuilder().WithAllFields())) ) .WithOwner(new LegalEntityQueryBuilder().WithAllFields()) .WithFeatures(new HomeFeaturesQueryBuilder().WithAllFields()) .WithMeteringPointData(new MeteringPointDataQueryBuilder().WithAllFields()) ) );