diff --git a/src/index.tsx b/src/index.tsx index 6c99799..86dae4a 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -34,6 +34,11 @@ export type Scalars = { Decimal: { input: any; output: any }; }; +export type AggregateInputGql = { + bucketSets: Array; + filterInput?: InputMaybe; +}; + export type AggregateResultGql = { __typename?: "AggregateResultGQL"; featureBuckets: Array; @@ -238,7 +243,7 @@ export type PocketingIntentionFeaturesGql = { export type Query = { __typename?: "Query"; - getAggregateShots: Array; + getAggregatedShotMetrics: Array; getBucketSet?: Maybe; getLoggedInUser?: Maybe; getShots: Array; @@ -248,8 +253,8 @@ export type Query = { getVideoMakePercentageIntervals: Array; }; -export type QueryGetAggregateShotsArgs = { - bucketSets: Array; +export type QueryGetAggregatedShotMetricsArgs = { + aggregateInput: AggregateInputGql; }; export type QueryGetBucketSetArgs = { @@ -424,13 +429,13 @@ export enum WallTypeEnum { Short = "SHORT", } -export type GetAggregateShotsQueryVariables = Exact<{ - bucketSets: Array | BucketSetInputGql; +export type GetAggregatedShotMetricsQueryVariables = Exact<{ + aggregateInput: AggregateInputGql; }>; -export type GetAggregateShotsQuery = { +export type GetAggregatedShotMetricsQuery = { __typename?: "Query"; - getAggregateShots: Array<{ + getAggregatedShotMetrics: Array<{ __typename?: "AggregateResultGQL"; featureBuckets: Array<{ __typename?: "BucketGQL"; @@ -594,9 +599,9 @@ export type TerminateUploadStreamMutation = { terminateUploadStream: boolean; }; -export const GetAggregateShotsDocument = gql` - query GetAggregateShots($bucketSets: [BucketSetInputGQL!]!) { - getAggregateShots(bucketSets: $bucketSets) { +export const GetAggregatedShotMetricsDocument = gql` + query GetAggregatedShotMetrics($aggregateInput: AggregateInputGQL!) { + getAggregatedShotMetrics(aggregateInput: $aggregateInput) { featureBuckets { rangeKey lowerBound @@ -615,69 +620,69 @@ export const GetAggregateShotsDocument = gql` `; /** - * __useGetAggregateShotsQuery__ + * __useGetAggregatedShotMetricsQuery__ * - * To run a query within a React component, call `useGetAggregateShotsQuery` and pass it any options that fit your needs. - * When your component renders, `useGetAggregateShotsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * To run a query within a React component, call `useGetAggregatedShotMetricsQuery` and pass it any options that fit your needs. + * When your component renders, `useGetAggregatedShotMetricsQuery` returns an object from Apollo Client that contains loading, error, and data properties * you can use to render your UI. * * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; * * @example - * const { data, loading, error } = useGetAggregateShotsQuery({ + * const { data, loading, error } = useGetAggregatedShotMetricsQuery({ * variables: { - * bucketSets: // value for 'bucketSets' + * aggregateInput: // value for 'aggregateInput' * }, * }); */ -export function useGetAggregateShotsQuery( +export function useGetAggregatedShotMetricsQuery( baseOptions: Apollo.QueryHookOptions< - GetAggregateShotsQuery, - GetAggregateShotsQueryVariables + GetAggregatedShotMetricsQuery, + GetAggregatedShotMetricsQueryVariables >, ) { const options = { ...defaultOptions, ...baseOptions }; return Apollo.useQuery< - GetAggregateShotsQuery, - GetAggregateShotsQueryVariables - >(GetAggregateShotsDocument, options); + GetAggregatedShotMetricsQuery, + GetAggregatedShotMetricsQueryVariables + >(GetAggregatedShotMetricsDocument, options); } -export function useGetAggregateShotsLazyQuery( +export function useGetAggregatedShotMetricsLazyQuery( baseOptions?: Apollo.LazyQueryHookOptions< - GetAggregateShotsQuery, - GetAggregateShotsQueryVariables + GetAggregatedShotMetricsQuery, + GetAggregatedShotMetricsQueryVariables >, ) { const options = { ...defaultOptions, ...baseOptions }; return Apollo.useLazyQuery< - GetAggregateShotsQuery, - GetAggregateShotsQueryVariables - >(GetAggregateShotsDocument, options); + GetAggregatedShotMetricsQuery, + GetAggregatedShotMetricsQueryVariables + >(GetAggregatedShotMetricsDocument, options); } -export function useGetAggregateShotsSuspenseQuery( +export function useGetAggregatedShotMetricsSuspenseQuery( baseOptions?: Apollo.SuspenseQueryHookOptions< - GetAggregateShotsQuery, - GetAggregateShotsQueryVariables + GetAggregatedShotMetricsQuery, + GetAggregatedShotMetricsQueryVariables >, ) { const options = { ...defaultOptions, ...baseOptions }; return Apollo.useSuspenseQuery< - GetAggregateShotsQuery, - GetAggregateShotsQueryVariables - >(GetAggregateShotsDocument, options); + GetAggregatedShotMetricsQuery, + GetAggregatedShotMetricsQueryVariables + >(GetAggregatedShotMetricsDocument, options); } -export type GetAggregateShotsQueryHookResult = ReturnType< - typeof useGetAggregateShotsQuery +export type GetAggregatedShotMetricsQueryHookResult = ReturnType< + typeof useGetAggregatedShotMetricsQuery >; -export type GetAggregateShotsLazyQueryHookResult = ReturnType< - typeof useGetAggregateShotsLazyQuery +export type GetAggregatedShotMetricsLazyQueryHookResult = ReturnType< + typeof useGetAggregatedShotMetricsLazyQuery >; -export type GetAggregateShotsSuspenseQueryHookResult = ReturnType< - typeof useGetAggregateShotsSuspenseQuery +export type GetAggregatedShotMetricsSuspenseQueryHookResult = ReturnType< + typeof useGetAggregatedShotMetricsSuspenseQuery >; -export type GetAggregateShotsQueryResult = Apollo.QueryResult< - GetAggregateShotsQuery, - GetAggregateShotsQueryVariables +export type GetAggregatedShotMetricsQueryResult = Apollo.QueryResult< + GetAggregatedShotMetricsQuery, + GetAggregatedShotMetricsQueryVariables >; export const GetFeedDocument = gql` query GetFeed($limit: Int! = 5, $after: String = null) { diff --git a/src/operations/bucketed_metrics.gql b/src/operations/aggregate.gql similarity index 60% rename from src/operations/bucketed_metrics.gql rename to src/operations/aggregate.gql index 5d23209..4de1121 100644 --- a/src/operations/bucketed_metrics.gql +++ b/src/operations/aggregate.gql @@ -1,5 +1,5 @@ -query GetAggregateShots($bucketSets: [BucketSetInputGQL!]!) { - getAggregateShots(bucketSets: $bucketSets) { +query GetAggregatedShotMetrics($aggregateInput: AggregateInputGQL!) { + getAggregatedShotMetrics(aggregateInput: $aggregateInput) { featureBuckets { rangeKey lowerBound diff --git a/src/schema.gql b/src/schema.gql index fc1a1f7..56c52b1 100644 --- a/src/schema.gql +++ b/src/schema.gql @@ -1,5 +1,7 @@ type Query { - getAggregateShots(bucketSets: [BucketSetInputGQL!]!): [AggregateResultGQL!]! + getAggregatedShotMetrics( + aggregateInput: AggregateInputGQL! + ): [AggregateResultGQL!]! getUser(userId: Int!): UserGQL getLoggedInUser: UserGQL getVideo(videoId: Int!): VideoGQL! @@ -31,6 +33,11 @@ type TargetFloatFeatureGQL { median: Float } +input AggregateInputGQL { + bucketSets: [BucketSetInputGQL!]! + filterInput: FilterInput +} + input BucketSetInputGQL { feature: String! buckets: [BucketInputGQL!]! @@ -41,6 +48,64 @@ input BucketInputGQL { lowerBound: Float! } +input FilterInput { + andFilters: AndFilter = null + orFilters: OrFilter = null + cueObjectDistance: CueObjectDistanceInput = null + targetPocketDistance: TargetPocketDistanceInput = null + cueObjectAngle: CueObjectAngleInput = null + cueBallSpeed: CueBallSpeedInput = null + intendedPocketType: IntendedPocketTypeInput = null + shotDirection: ShotDirectionInput = null + videoId: InListFilter = null + userId: InListFilter = null +} + +input AndFilter { + filters: [FilterInput!]! +} + +input OrFilter { + filters: [FilterInput!]! +} + +input CueObjectDistanceInput { + value: RangeFilter! +} + +input RangeFilter { + lessThan: Float = null + greaterThanEqualTo: Float = null +} + +input TargetPocketDistanceInput { + value: RangeFilter! +} + +input CueObjectAngleInput { + value: RangeFilter! +} + +input CueBallSpeedInput { + value: RangeFilter! +} + +input IntendedPocketTypeInput { + value: EnumFilter! +} + +input EnumFilter { + equals: String = null +} + +input ShotDirectionInput { + value: EnumFilter! +} + +input InListFilter { + inList: [Int!] = null +} + type UserGQL { id: Int! firebaseUid: String! @@ -189,64 +254,6 @@ type StreamErrorGQL { message: String! } -input FilterInput { - andFilters: AndFilter = null - orFilters: OrFilter = null - cueObjectDistance: CueObjectDistanceInput = null - targetPocketDistance: TargetPocketDistanceInput = null - cueObjectAngle: CueObjectAngleInput = null - cueBallSpeed: CueBallSpeedInput = null - intendedPocketType: IntendedPocketTypeInput = null - shotDirection: ShotDirectionInput = null - videoId: InListFilter = null - userId: InListFilter = null -} - -input AndFilter { - filters: [FilterInput!]! -} - -input OrFilter { - filters: [FilterInput!]! -} - -input CueObjectDistanceInput { - value: RangeFilter! -} - -input RangeFilter { - lessThan: Float = null - greaterThanEqualTo: Float = null -} - -input TargetPocketDistanceInput { - value: RangeFilter! -} - -input CueObjectAngleInput { - value: RangeFilter! -} - -input CueBallSpeedInput { - value: RangeFilter! -} - -input IntendedPocketTypeInput { - value: EnumFilter! -} - -input EnumFilter { - equals: String = null -} - -input ShotDirectionInput { - value: EnumFilter! -} - -input InListFilter { - inList: [Int!] = null -} - type BucketSetGQL { keyName: String! feature: String!