From a497abd44dddb86de6001efce3c63b275bda2804 Mon Sep 17 00:00:00 2001 From: Loewy Date: Wed, 9 Jul 2025 11:31:26 -0700 Subject: [PATCH] create sub operations --- src/index.tsx | 178 ++++++++++++++++++++++++++++++++++++ src/operations/payments.gql | 27 ++++++ 2 files changed, 205 insertions(+) diff --git a/src/index.tsx b/src/index.tsx index f75c7a6..39d8c9d 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -3892,6 +3892,47 @@ export type EnsureStripeCustomerExistsMutation = { }; }; +export type CreateSubscriptionMutationVariables = Exact<{ + priceId: Scalars["String"]["input"]; +}>; + +export type CreateSubscriptionMutation = { + __typename?: "Mutation"; + createSubscription: { + __typename?: "CreateSubscriptionResultGQL"; + checkoutUrl: string; + sessionId: string; + }; +}; + +export type GetAvailableSubscriptionOptionsQueryVariables = Exact<{ + [key: string]: never; +}>; + +export type GetAvailableSubscriptionOptionsQuery = { + __typename?: "Query"; + getAvailableSubscriptionOptions: { + __typename?: "StripeSubscriptionOptionsGQL"; + products: Array<{ + __typename?: "StripeProductGQL"; + id: string; + name: string; + description?: string | null; + active: boolean; + prices: Array<{ + __typename?: "StripePriceGQL"; + id: string; + currency: string; + unitAmount?: number | null; + recurringInterval?: string | null; + recurringIntervalCount?: number | null; + type: string; + active: boolean; + }>; + }>; + }; +}; + export type ReactToVideoMutationVariables = Exact<{ videoId: Scalars["Int"]["input"]; reaction?: InputMaybe; @@ -6758,6 +6799,143 @@ export type EnsureStripeCustomerExistsMutationOptions = EnsureStripeCustomerExistsMutation, EnsureStripeCustomerExistsMutationVariables >; +export const CreateSubscriptionDocument = gql` + mutation CreateSubscription($priceId: String!) { + createSubscription(priceId: $priceId) { + checkoutUrl + sessionId + } + } +`; +export type CreateSubscriptionMutationFn = Apollo.MutationFunction< + CreateSubscriptionMutation, + CreateSubscriptionMutationVariables +>; + +/** + * __useCreateSubscriptionMutation__ + * + * To run a mutation, you first call `useCreateSubscriptionMutation` within a React component and pass it any options that fit your needs. + * When your component renders, `useCreateSubscriptionMutation` returns a tuple that includes: + * - A mutate function that you can call at any time to execute the mutation + * - An object with fields that represent the current status of the mutation's execution + * + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; + * + * @example + * const [createSubscriptionMutation, { data, loading, error }] = useCreateSubscriptionMutation({ + * variables: { + * priceId: // value for 'priceId' + * }, + * }); + */ +export function useCreateSubscriptionMutation( + baseOptions?: Apollo.MutationHookOptions< + CreateSubscriptionMutation, + CreateSubscriptionMutationVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useMutation< + CreateSubscriptionMutation, + CreateSubscriptionMutationVariables + >(CreateSubscriptionDocument, options); +} +export type CreateSubscriptionMutationHookResult = ReturnType< + typeof useCreateSubscriptionMutation +>; +export type CreateSubscriptionMutationResult = + Apollo.MutationResult; +export type CreateSubscriptionMutationOptions = Apollo.BaseMutationOptions< + CreateSubscriptionMutation, + CreateSubscriptionMutationVariables +>; +export const GetAvailableSubscriptionOptionsDocument = gql` + query GetAvailableSubscriptionOptions { + getAvailableSubscriptionOptions { + products { + id + name + description + active + prices { + id + currency + unitAmount + recurringInterval + recurringIntervalCount + type + active + } + } + } + } +`; + +/** + * __useGetAvailableSubscriptionOptionsQuery__ + * + * To run a query within a React component, call `useGetAvailableSubscriptionOptionsQuery` and pass it any options that fit your needs. + * When your component renders, `useGetAvailableSubscriptionOptionsQuery` 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 } = useGetAvailableSubscriptionOptionsQuery({ + * variables: { + * }, + * }); + */ +export function useGetAvailableSubscriptionOptionsQuery( + baseOptions?: Apollo.QueryHookOptions< + GetAvailableSubscriptionOptionsQuery, + GetAvailableSubscriptionOptionsQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery< + GetAvailableSubscriptionOptionsQuery, + GetAvailableSubscriptionOptionsQueryVariables + >(GetAvailableSubscriptionOptionsDocument, options); +} +export function useGetAvailableSubscriptionOptionsLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + GetAvailableSubscriptionOptionsQuery, + GetAvailableSubscriptionOptionsQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery< + GetAvailableSubscriptionOptionsQuery, + GetAvailableSubscriptionOptionsQueryVariables + >(GetAvailableSubscriptionOptionsDocument, options); +} +export function useGetAvailableSubscriptionOptionsSuspenseQuery( + baseOptions?: Apollo.SuspenseQueryHookOptions< + GetAvailableSubscriptionOptionsQuery, + GetAvailableSubscriptionOptionsQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useSuspenseQuery< + GetAvailableSubscriptionOptionsQuery, + GetAvailableSubscriptionOptionsQueryVariables + >(GetAvailableSubscriptionOptionsDocument, options); +} +export type GetAvailableSubscriptionOptionsQueryHookResult = ReturnType< + typeof useGetAvailableSubscriptionOptionsQuery +>; +export type GetAvailableSubscriptionOptionsLazyQueryHookResult = ReturnType< + typeof useGetAvailableSubscriptionOptionsLazyQuery +>; +export type GetAvailableSubscriptionOptionsSuspenseQueryHookResult = ReturnType< + typeof useGetAvailableSubscriptionOptionsSuspenseQuery +>; +export type GetAvailableSubscriptionOptionsQueryResult = Apollo.QueryResult< + GetAvailableSubscriptionOptionsQuery, + GetAvailableSubscriptionOptionsQueryVariables +>; export const ReactToVideoDocument = gql` mutation ReactToVideo($videoId: Int!, $reaction: ReactionEnum) { reactToVideo(videoId: $videoId, reaction: $reaction) diff --git a/src/operations/payments.gql b/src/operations/payments.gql index 1648e62..3c39d13 100644 --- a/src/operations/payments.gql +++ b/src/operations/payments.gql @@ -12,3 +12,30 @@ mutation EnsureStripeCustomerExists { updatedAt } } + +mutation CreateSubscription($priceId: String!) { + createSubscription(priceId: $priceId) { + checkoutUrl + sessionId + } +} + +query GetAvailableSubscriptionOptions { + getAvailableSubscriptionOptions { + products { + id + name + description + active + prices { + id + currency + unitAmount + recurringInterval + recurringIntervalCount + type + active + } + } + } +}