Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to a better GraphQL query for usage #362

Open
ryanw-mobile opened this issue Nov 20, 2024 · 0 comments
Open

Migrate to a better GraphQL query for usage #362

ryanw-mobile opened this issue Nov 20, 2024 · 0 comments
Assignees
Labels
feature A new feature for the user, not a new feature for a build script.

Comments

@ryanw-mobile
Copy link
Owner

From official Octopus GraphQL usage:

query getMeasurements($accountNumber: String!, $first: Int!, $utilityFilters: [UtilityFiltersInput!], $startOn: Date, $endOn: Date, $startAt: DateTime, $endAt: DateTime, $timezone: String, $cursor: String) {
  account(accountNumber: $accountNumber) {
    properties {
      id
      measurements(
        first: $first
        utilityFilters: $utilityFilters
        startOn: $startOn
        endOn: $endOn
        startAt: $startAt
        endAt: $endAt
        timezone: $timezone
        after: $cursor
      ) {
        edges {
          node {
            value
            unit
            ... on IntervalMeasurementType {
              startAt
              endAt
              __typename
            }
            metaData {
              statistics {
                costInclTax {
                  costCurrency
                  estimatedAmount
                  __typename
                }
                value
                description
                label
                type
                __typename
              }
              __typename
            }
            __typename
          }
          __typename
        }
        pageInfo {
          hasNextPage
          hasPreviousPage
          startCursor
          endCursor
          __typename
        }
        __typename
      }
      __typename
    }
    __typename
  }
}

Variables:

accountNumber: "A-******"
endAt: "2024-10-19T22:59:59.999Z"
first: 60
startAt: "2024-10-18T23:00:00.000Z"
timezone: "Europe/London"
utilityFilters: 
{
electricityFilters: {
deviceId: "******"
marketSupplyPointId: "*****"
readingDirection: "CONSUMPTION"
readingFrequencyType: "HOUR_INTERVAL"
}

The returned value contains the parsed standing charge and consumption cost,
so we don't have to fetch and parse the raw readings and lookup tariffs.

@ryanw-mobile ryanw-mobile added the feature A new feature for the user, not a new feature for a build script. label Nov 20, 2024
@ryanw-mobile ryanw-mobile self-assigned this Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature for the user, not a new feature for a build script.
Projects
None yet
Development

No branches or pull requests

1 participant