Generated React README
This README will guide you through the process of using the generated React SDK package for the connector example. It will also provide examples on how to use your generated SDK to call your Data Connect queries and mutations.
If you're looking for the JavaScript README, you can find it at dataconnect-generated/README.md
NOTE: This README is generated alongside the generated SDK. If you make changes to this file, they will be overwritten when the SDK is regenerated.
You can use this generated SDK by importing from the package @dataconnect/generated/react as shown below. Both CommonJS and ESM imports are supported.
You can also follow the instructions from the Data Connect documentation.
Table of Contents
- Overview
- TanStack Query Firebase & TanStack React Query
- Accessing the connector
- Queries
- listShifts
- getShiftById
- filterShifts
- getShiftsByBusinessId
- getShiftsByVendorId
- listEmergencyContacts
- getEmergencyContactById
- getEmergencyContactsByStaffId
- getMyTasks
- getMemberTaskByIdKey
- getMemberTasksByTaskId
- listCertificates
- getCertificateById
- listCertificatesByStaffId
- listAssignments
- getAssignmentById
- listAssignmentsByWorkforceId
- listAssignmentsByWorkforceIds
- listAssignmentsByShiftRole
- filterAssignments
- listInvoiceTemplates
- getInvoiceTemplateById
- listInvoiceTemplatesByOwnerId
- listInvoiceTemplatesByVendorId
- listInvoiceTemplatesByBusinessId
- listInvoiceTemplatesByOrderId
- searchInvoiceTemplatesByOwnerAndName
- getStaffDocumentByKey
- listStaffDocumentsByStaffId
- listStaffDocumentsByDocumentType
- listStaffDocumentsByStatus
- listAccounts
- getAccountById
- getAccountsByOwnerId
- filterAccounts
- listApplications
- getApplicationById
- getApplicationsByShiftId
- getApplicationsByShiftIdAndStatus
- getApplicationsByStaffId
- vaidateDayStaffApplication
- getApplicationByStaffShiftAndRole
- listAcceptedApplicationsByShiftRoleKey
- listAcceptedApplicationsByBusinessForDay
- listStaffsApplicationsByBusinessForDay
- listCompletedApplicationsByStaffId
- listAttireOptions
- getAttireOptionById
- filterAttireOptions
- listCustomRateCards
- getCustomRateCardById
- listRoleCategories
- getRoleCategoryById
- getRoleCategoriesByCategory
- listStaffAvailabilities
- listStaffAvailabilitiesByStaffId
- getStaffAvailabilityByKey
- listStaffAvailabilitiesByDay
- listRecentPayments
- getRecentPaymentById
- listRecentPaymentsByStaffId
- listRecentPaymentsByApplicationId
- listRecentPaymentsByInvoiceId
- listRecentPaymentsByStatus
- listRecentPaymentsByInvoiceIds
- listRecentPaymentsByBusinessId
- listBusinesses
- getBusinessesByUserId
- getBusinessById
- listConversations
- getConversationById
- listConversationsByType
- listConversationsByStatus
- filterConversations
- listOrders
- getOrderById
- getOrdersByBusinessId
- getOrdersByVendorId
- getOrdersByStatus
- getOrdersByDateRange
- getRapidOrders
- listOrdersByBusinessAndTeamHub
- listStaffRoles
- getStaffRoleByKey
- listStaffRolesByStaffId
- listStaffRolesByRoleId
- filterStaffRoles
- listTaskComments
- getTaskCommentById
- getTaskCommentsByTaskId
- listDocuments
- getDocumentById
- filterDocuments
- listShiftsForCoverage
- listApplicationsForCoverage
- listShiftsForDailyOpsByBusiness
- listShiftsForDailyOpsByVendor
- listApplicationsForDailyOps
- listShiftsForForecastByBusiness
- listShiftsForForecastByVendor
- listShiftsForNoShowRangeByBusiness
- listShiftsForNoShowRangeByVendor
- listApplicationsForNoShowRange
- listStaffForNoShowReport
- listInvoicesForSpendByBusiness
- listInvoicesForSpendByVendor
- listInvoicesForSpendByOrder
- listTimesheetsForSpend
- listShiftsForPerformanceByBusiness
- listShiftsForPerformanceByVendor
- listApplicationsForPerformance
- listStaffForPerformance
- listRoles
- getRoleById
- listRolesByVendorId
- listRolesByroleCategoryId
- getShiftRoleById
- listShiftRolesByShiftId
- listShiftRolesByRoleId
- listShiftRolesByShiftIdAndTimeRange
- listShiftRolesByVendorId
- listShiftRolesByBusinessAndDateRange
- listShiftRolesByBusinessAndOrder
- listShiftRolesByBusinessDateRangeCompletedOrders
- listShiftRolesByBusinessAndDatesSummary
- getCompletedShiftsByBusinessId
- listTaxForms
- getTaxFormById
- getTaxFormsByStaffId
- listTaxFormsWhere
- listFaqDatas
- getFaqDataById
- filterFaqDatas
- getStaffCourseById
- listStaffCoursesByStaffId
- listStaffCoursesByCourseId
- getStaffCourseByStaffAndCourse
- listActivityLogs
- getActivityLogById
- listActivityLogsByUserId
- listUnreadActivityLogsByUserId
- filterActivityLogs
- listBenefitsData
- getBenefitsDataByKey
- listBenefitsDataByStaffId
- listBenefitsDataByVendorBenefitPlanId
- listBenefitsDataByVendorBenefitPlanIds
- listStaff
- getStaffById
- getStaffByUserId
- filterStaff
- listTasks
- getTaskById
- getTasksByOwnerId
- filterTasks
- listTeamHubs
- getTeamHubById
- getTeamHubsByTeamId
- listTeamHubsByOwnerId
- listClientFeedbacks
- getClientFeedbackById
- listClientFeedbacksByBusinessId
- listClientFeedbacksByVendorId
- listClientFeedbacksByBusinessAndVendor
- filterClientFeedbacks
- listClientFeedbackRatingsByVendorId
- listUsers
- getUserById
- filterUsers
- getVendorById
- getVendorByUserId
- listVendors
- listCategories
- getCategoryById
- filterCategories
- listMessages
- getMessageById
- getMessagesByConversationId
- listUserConversations
- getUserConversationByKey
- listUserConversationsByUserId
- listUnreadUserConversationsByUserId
- listUserConversationsByConversationId
- filterUserConversations
- listHubs
- getHubById
- getHubsByOwnerId
- filterHubs
- listInvoices
- getInvoiceById
- listInvoicesByVendorId
- listInvoicesByBusinessId
- listInvoicesByOrderId
- listInvoicesByStatus
- filterInvoices
- listOverdueInvoices
- listCourses
- getCourseById
- filterCourses
- listVendorRates
- getVendorRateById
- getWorkforceById
- getWorkforceByVendorAndStaff
- listWorkforceByVendorId
- listWorkforceByStaffId
- getWorkforceByVendorAndNumber
- listStaffAvailabilityStats
- getStaffAvailabilityStatsByStaffId
- filterStaffAvailabilityStats
- listTeamHudDepartments
- getTeamHudDepartmentById
- listTeamHudDepartmentsByTeamHubId
- listLevels
- getLevelById
- filterLevels
- listTeams
- getTeamById
- getTeamsByOwnerId
- listTeamMembers
- getTeamMemberById
- getTeamMembersByTeamId
- listVendorBenefitPlans
- getVendorBenefitPlanById
- listVendorBenefitPlansByVendorId
- listActiveVendorBenefitPlansByVendorId
- filterVendorBenefitPlans
- Mutations
- createBenefitsData
- updateBenefitsData
- deleteBenefitsData
- createStaffDocument
- updateStaffDocument
- deleteStaffDocument
- createTeamHudDepartment
- updateTeamHudDepartment
- deleteTeamHudDepartment
- createMemberTask
- deleteMemberTask
- createTeam
- updateTeam
- deleteTeam
- createUserConversation
- updateUserConversation
- markConversationAsRead
- incrementUnreadForUser
- deleteUserConversation
- createAttireOption
- updateAttireOption
- deleteAttireOption
- createCourse
- updateCourse
- deleteCourse
- createEmergencyContact
- updateEmergencyContact
- deleteEmergencyContact
- createStaffCourse
- updateStaffCourse
- deleteStaffCourse
- createTask
- updateTask
- deleteTask
- CreateCertificate
- UpdateCertificate
- DeleteCertificate
- createRole
- updateRole
- deleteRole
- createClientFeedback
- updateClientFeedback
- deleteClientFeedback
- createBusiness
- updateBusiness
- deleteBusiness
- createConversation
- updateConversation
- updateConversationLastMessage
- deleteConversation
- createCustomRateCard
- updateCustomRateCard
- deleteCustomRateCard
- createRecentPayment
- updateRecentPayment
- deleteRecentPayment
- CreateUser
- UpdateUser
- DeleteUser
- createVendor
- updateVendor
- deleteVendor
- createDocument
- updateDocument
- deleteDocument
- createTaskComment
- updateTaskComment
- deleteTaskComment
- createVendorBenefitPlan
- updateVendorBenefitPlan
- deleteVendorBenefitPlan
- createMessage
- updateMessage
- deleteMessage
- createWorkforce
- updateWorkforce
- deactivateWorkforce
- createFaqData
- updateFaqData
- deleteFaqData
- createInvoice
- updateInvoice
- deleteInvoice
- createTeamHub
- updateTeamHub
- deleteTeamHub
- createHub
- updateHub
- deleteHub
- createRoleCategory
- updateRoleCategory
- deleteRoleCategory
- createStaffAvailabilityStats
- updateStaffAvailabilityStats
- deleteStaffAvailabilityStats
- createShiftRole
- updateShiftRole
- deleteShiftRole
- createStaffRole
- deleteStaffRole
- createAccount
- updateAccount
- deleteAccount
- createApplication
- updateApplicationStatus
- deleteApplication
- CreateAssignment
- UpdateAssignment
- DeleteAssignment
- createInvoiceTemplate
- updateInvoiceTemplate
- deleteInvoiceTemplate
- createStaffAvailability
- updateStaffAvailability
- deleteStaffAvailability
- createTeamMember
- updateTeamMember
- updateTeamMemberInviteStatus
- acceptInviteByCode
- cancelInviteByCode
- deleteTeamMember
- createLevel
- updateLevel
- deleteLevel
- createOrder
- updateOrder
- deleteOrder
- createCategory
- updateCategory
- deleteCategory
- createTaxForm
- updateTaxForm
- deleteTaxForm
- createVendorRate
- updateVendorRate
- deleteVendorRate
- createActivityLog
- updateActivityLog
- markActivityLogAsRead
- markActivityLogsAsRead
- deleteActivityLog
- createShift
- updateShift
- deleteShift
- CreateStaff
- UpdateStaff
- DeleteStaff
TanStack Query Firebase & TanStack React Query
This SDK provides React hooks generated specific to your application, for the operations found in the connector example. These hooks are generated using TanStack Query Firebase by our partners at Invertase, a library built on top of TanStack React Query v5.
You do not need to be familiar with Tanstack Query or Tanstack Query Firebase to use this SDK. However, you may find it useful to learn more about them, as they will empower you as a user of this Generated React SDK.
Installing TanStack Query Firebase and TanStack React Query Packages
In order to use the React generated SDK, you must install the TanStack React Query and TanStack Query Firebase packages.
npm i --save @tanstack/react-query @tanstack-query-firebase/react
npm i --save firebase@latest # Note: React has a peer dependency on ^11.3.0
You can also follow the installation instructions from the Data Connect documentation, or the TanStack Query Firebase documentation and TanStack React Query documentation.
Configuring TanStack Query
In order to use the React generated SDK in your application, you must wrap your application's component tree in a QueryClientProvider component from TanStack React Query. None of your generated React SDK hooks will work without this provider.
import { QueryClientProvider } from '@tanstack/react-query';
// Create a TanStack Query client instance
const queryClient = new QueryClient()
function App() {
return (
// Provide the client to your App
<QueryClientProvider client={queryClient}>
<MyApplication />
</QueryClientProvider>
)
}
To learn more about QueryClientProvider, see the TanStack React Query documentation and the TanStack Query Firebase documentation.
Accessing the connector
A connector is a collection of Queries and Mutations. One SDK is generated for each connector - this SDK is generated for the connector example.
You can find more information about connectors in the Data Connect documentation.
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
const dataConnect = getDataConnect(connectorConfig);
Connecting to the local Emulator
By default, the connector will connect to the production service.
To connect to the emulator, you can use the following code. You can also follow the emulator instructions from the Data Connect documentation.
import { connectDataConnectEmulator, getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
const dataConnect = getDataConnect(connectorConfig);
connectDataConnectEmulator(dataConnect, 'localhost', 9399);
After it's initialized, you can call your Data Connect queries and mutations using the hooks provided from your generated React SDK.
Queries
The React generated SDK provides Query hook functions that call and return useDataConnectQuery hooks from TanStack Query Firebase.
Calling these hook functions will return a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and the most recent data returned by the Query, among other things. To learn more about these hooks and how to use them, see the TanStack Query Firebase documentation.
TanStack React Query caches the results of your Queries, so using the same Query hook function in multiple places in your application allows the entire application to automatically see updates to that Query's data.
Query hooks execute their Queries automatically when called, and periodically refresh, unless you change the queryOptions for the Query. To learn how to stop a Query from automatically executing, including how to make a query "lazy", see the TanStack React Query documentation.
To learn more about TanStack React Query's Queries, see the TanStack React Query documentation.
Using Query Hooks
Here's a general overview of how to use the generated Query hooks in your code:
- If the Query has no variables, the Query hook function does not require arguments.
- If the Query has any required variables, the Query hook function will require at least one argument: an object that contains all the required variables for the Query.
- If the Query has some required and some optional variables, only required variables are necessary in the variables argument object, and optional variables may be provided as well.
- If all of the Query's variables are optional, the Query hook function does not require any arguments.
- Query hook functions can be called with or without passing in a
DataConnectinstance as an argument. If noDataConnectargument is passed in, then the generated SDK will callgetDataConnect(connectorConfig)behind the scenes for you. - Query hooks functions can be called with or without passing in an
optionsargument of typeuseDataConnectQueryOptions. To learn more about theoptionsargument, see the TanStack React Query documentation.- Special case: If the Query has all optional variables and you would like to provide an
optionsargument to the Query hook function without providing any variables, you must passundefinedwhere you would normally pass the Query's variables, and then may provide theoptionsargument.
- Special case: If the Query has all optional variables and you would like to provide an
Below are examples of how to use the example connector's generated Query hook functions to execute each Query. You can also follow the examples from the Data Connect documentation.
listShifts
You can execute the listShifts Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListShifts(dc: DataConnect, vars?: ListShiftsVariables, options?: useDataConnectQueryOptions<ListShiftsData>): UseDataConnectQueryResult<ListShiftsData, ListShiftsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListShifts(vars?: ListShiftsVariables, options?: useDataConnectQueryOptions<ListShiftsData>): UseDataConnectQueryResult<ListShiftsData, ListShiftsVariables>;
Variables
The listShifts Query has an optional argument of type ListShiftsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftsVariables {
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listShifts Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listShifts Query is of type ListShiftsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftsData {
shifts: ({
id: UUIDString;
title: string;
orderId: UUIDString;
date?: TimestampString | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
cost?: number | null;
location?: string | null;
locationAddress?: string | null;
latitude?: number | null;
longitude?: number | null;
placeId?: string | null;
city?: string | null;
state?: string | null;
street?: string | null;
country?: string | null;
description?: string | null;
status?: ShiftStatus | null;
workersNeeded?: number | null;
filled?: number | null;
filledAt?: TimestampString | null;
managers?: unknown[] | null;
durationDays?: number | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
order: {
id: UUIDString;
eventName?: string | null;
status: OrderStatus;
orderType: OrderType;
businessId: UUIDString;
vendorId?: UUIDString | null;
business: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & Order_Key;
} & Shift_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listShifts's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListShiftsVariables } from '@dataconnect/generated';
import { useListShifts } from '@dataconnect/generated/react'
export default function ListShiftsComponent() {
// The `useListShifts` Query hook has an optional argument of type `ListShiftsVariables`:
const listShiftsVars: ListShiftsVariables = {
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListShifts(listShiftsVars);
// Variables can be defined inline as well.
const query = useListShifts({ offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `ListShiftsVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useListShifts();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListShifts(dataConnect, listShiftsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListShifts(listShiftsVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useListShifts(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListShifts(dataConnect, listShiftsVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.shifts);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getShiftById
You can execute the getShiftById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetShiftById(dc: DataConnect, vars: GetShiftByIdVariables, options?: useDataConnectQueryOptions<GetShiftByIdData>): UseDataConnectQueryResult<GetShiftByIdData, GetShiftByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetShiftById(vars: GetShiftByIdVariables, options?: useDataConnectQueryOptions<GetShiftByIdData>): UseDataConnectQueryResult<GetShiftByIdData, GetShiftByIdVariables>;
Variables
The getShiftById Query requires an argument of type GetShiftByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetShiftByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getShiftById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getShiftById Query is of type GetShiftByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetShiftByIdData {
shift?: {
id: UUIDString;
title: string;
orderId: UUIDString;
date?: TimestampString | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
cost?: number | null;
location?: string | null;
locationAddress?: string | null;
latitude?: number | null;
longitude?: number | null;
placeId?: string | null;
city?: string | null;
state?: string | null;
street?: string | null;
country?: string | null;
description?: string | null;
status?: ShiftStatus | null;
workersNeeded?: number | null;
filled?: number | null;
filledAt?: TimestampString | null;
managers?: unknown[] | null;
durationDays?: number | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
order: {
id: UUIDString;
eventName?: string | null;
status: OrderStatus;
orderType: OrderType;
businessId: UUIDString;
vendorId?: UUIDString | null;
business: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & Order_Key;
} & Shift_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getShiftById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetShiftByIdVariables } from '@dataconnect/generated';
import { useGetShiftById } from '@dataconnect/generated/react'
export default function GetShiftByIdComponent() {
// The `useGetShiftById` Query hook requires an argument of type `GetShiftByIdVariables`:
const getShiftByIdVars: GetShiftByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetShiftById(getShiftByIdVars);
// Variables can be defined inline as well.
const query = useGetShiftById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetShiftById(dataConnect, getShiftByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetShiftById(getShiftByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetShiftById(dataConnect, getShiftByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.shift);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterShifts
You can execute the filterShifts Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterShifts(dc: DataConnect, vars?: FilterShiftsVariables, options?: useDataConnectQueryOptions<FilterShiftsData>): UseDataConnectQueryResult<FilterShiftsData, FilterShiftsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterShifts(vars?: FilterShiftsVariables, options?: useDataConnectQueryOptions<FilterShiftsData>): UseDataConnectQueryResult<FilterShiftsData, FilterShiftsVariables>;
Variables
The filterShifts Query has an optional argument of type FilterShiftsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterShiftsVariables {
status?: ShiftStatus | null;
orderId?: UUIDString | null;
dateFrom?: TimestampString | null;
dateTo?: TimestampString | null;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the filterShifts Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the filterShifts Query is of type FilterShiftsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterShiftsData {
shifts: ({
id: UUIDString;
title: string;
orderId: UUIDString;
date?: TimestampString | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
cost?: number | null;
location?: string | null;
locationAddress?: string | null;
latitude?: number | null;
longitude?: number | null;
placeId?: string | null;
city?: string | null;
state?: string | null;
street?: string | null;
country?: string | null;
description?: string | null;
status?: ShiftStatus | null;
workersNeeded?: number | null;
filled?: number | null;
filledAt?: TimestampString | null;
managers?: unknown[] | null;
durationDays?: number | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
order: {
id: UUIDString;
eventName?: string | null;
status: OrderStatus;
orderType: OrderType;
businessId: UUIDString;
vendorId?: UUIDString | null;
business: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & Order_Key;
} & Shift_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterShifts's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterShiftsVariables } from '@dataconnect/generated';
import { useFilterShifts } from '@dataconnect/generated/react'
export default function FilterShiftsComponent() {
// The `useFilterShifts` Query hook has an optional argument of type `FilterShiftsVariables`:
const filterShiftsVars: FilterShiftsVariables = {
status: ..., // optional
orderId: ..., // optional
dateFrom: ..., // optional
dateTo: ..., // optional
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useFilterShifts(filterShiftsVars);
// Variables can be defined inline as well.
const query = useFilterShifts({ status: ..., orderId: ..., dateFrom: ..., dateTo: ..., offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `FilterShiftsVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterShifts();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterShifts(dataConnect, filterShiftsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterShifts(filterShiftsVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useFilterShifts(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useFilterShifts(dataConnect, filterShiftsVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.shifts);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getShiftsByBusinessId
You can execute the getShiftsByBusinessId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetShiftsByBusinessId(dc: DataConnect, vars: GetShiftsByBusinessIdVariables, options?: useDataConnectQueryOptions<GetShiftsByBusinessIdData>): UseDataConnectQueryResult<GetShiftsByBusinessIdData, GetShiftsByBusinessIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetShiftsByBusinessId(vars: GetShiftsByBusinessIdVariables, options?: useDataConnectQueryOptions<GetShiftsByBusinessIdData>): UseDataConnectQueryResult<GetShiftsByBusinessIdData, GetShiftsByBusinessIdVariables>;
Variables
The getShiftsByBusinessId Query requires an argument of type GetShiftsByBusinessIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetShiftsByBusinessIdVariables {
businessId: UUIDString;
dateFrom?: TimestampString | null;
dateTo?: TimestampString | null;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the getShiftsByBusinessId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getShiftsByBusinessId Query is of type GetShiftsByBusinessIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetShiftsByBusinessIdData {
shifts: ({
id: UUIDString;
title: string;
orderId: UUIDString;
date?: TimestampString | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
cost?: number | null;
location?: string | null;
locationAddress?: string | null;
latitude?: number | null;
longitude?: number | null;
placeId?: string | null;
city?: string | null;
state?: string | null;
street?: string | null;
country?: string | null;
description?: string | null;
status?: ShiftStatus | null;
workersNeeded?: number | null;
filled?: number | null;
filledAt?: TimestampString | null;
managers?: unknown[] | null;
durationDays?: number | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
order: {
id: UUIDString;
eventName?: string | null;
status: OrderStatus;
orderType: OrderType;
businessId: UUIDString;
vendorId?: UUIDString | null;
business: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & Order_Key;
} & Shift_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getShiftsByBusinessId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetShiftsByBusinessIdVariables } from '@dataconnect/generated';
import { useGetShiftsByBusinessId } from '@dataconnect/generated/react'
export default function GetShiftsByBusinessIdComponent() {
// The `useGetShiftsByBusinessId` Query hook requires an argument of type `GetShiftsByBusinessIdVariables`:
const getShiftsByBusinessIdVars: GetShiftsByBusinessIdVariables = {
businessId: ...,
dateFrom: ..., // optional
dateTo: ..., // optional
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetShiftsByBusinessId(getShiftsByBusinessIdVars);
// Variables can be defined inline as well.
const query = useGetShiftsByBusinessId({ businessId: ..., dateFrom: ..., dateTo: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetShiftsByBusinessId(dataConnect, getShiftsByBusinessIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetShiftsByBusinessId(getShiftsByBusinessIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetShiftsByBusinessId(dataConnect, getShiftsByBusinessIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.shifts);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getShiftsByVendorId
You can execute the getShiftsByVendorId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetShiftsByVendorId(dc: DataConnect, vars: GetShiftsByVendorIdVariables, options?: useDataConnectQueryOptions<GetShiftsByVendorIdData>): UseDataConnectQueryResult<GetShiftsByVendorIdData, GetShiftsByVendorIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetShiftsByVendorId(vars: GetShiftsByVendorIdVariables, options?: useDataConnectQueryOptions<GetShiftsByVendorIdData>): UseDataConnectQueryResult<GetShiftsByVendorIdData, GetShiftsByVendorIdVariables>;
Variables
The getShiftsByVendorId Query requires an argument of type GetShiftsByVendorIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetShiftsByVendorIdVariables {
vendorId: UUIDString;
dateFrom?: TimestampString | null;
dateTo?: TimestampString | null;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the getShiftsByVendorId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getShiftsByVendorId Query is of type GetShiftsByVendorIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetShiftsByVendorIdData {
shifts: ({
id: UUIDString;
title: string;
orderId: UUIDString;
date?: TimestampString | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
cost?: number | null;
location?: string | null;
locationAddress?: string | null;
latitude?: number | null;
longitude?: number | null;
placeId?: string | null;
city?: string | null;
state?: string | null;
street?: string | null;
country?: string | null;
description?: string | null;
status?: ShiftStatus | null;
workersNeeded?: number | null;
filled?: number | null;
filledAt?: TimestampString | null;
managers?: unknown[] | null;
durationDays?: number | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
order: {
id: UUIDString;
eventName?: string | null;
status: OrderStatus;
orderType: OrderType;
businessId: UUIDString;
vendorId?: UUIDString | null;
business: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & Order_Key;
} & Shift_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getShiftsByVendorId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetShiftsByVendorIdVariables } from '@dataconnect/generated';
import { useGetShiftsByVendorId } from '@dataconnect/generated/react'
export default function GetShiftsByVendorIdComponent() {
// The `useGetShiftsByVendorId` Query hook requires an argument of type `GetShiftsByVendorIdVariables`:
const getShiftsByVendorIdVars: GetShiftsByVendorIdVariables = {
vendorId: ...,
dateFrom: ..., // optional
dateTo: ..., // optional
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetShiftsByVendorId(getShiftsByVendorIdVars);
// Variables can be defined inline as well.
const query = useGetShiftsByVendorId({ vendorId: ..., dateFrom: ..., dateTo: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetShiftsByVendorId(dataConnect, getShiftsByVendorIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetShiftsByVendorId(getShiftsByVendorIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetShiftsByVendorId(dataConnect, getShiftsByVendorIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.shifts);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listEmergencyContacts
You can execute the listEmergencyContacts Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListEmergencyContacts(dc: DataConnect, options?: useDataConnectQueryOptions<ListEmergencyContactsData>): UseDataConnectQueryResult<ListEmergencyContactsData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListEmergencyContacts(options?: useDataConnectQueryOptions<ListEmergencyContactsData>): UseDataConnectQueryResult<ListEmergencyContactsData, undefined>;
Variables
The listEmergencyContacts Query has no variables.
Return Type
Recall that calling the listEmergencyContacts Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listEmergencyContacts Query is of type ListEmergencyContactsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListEmergencyContactsData {
emergencyContacts: ({
id: UUIDString;
name: string;
phone: string;
relationship: RelationshipType;
staffId: UUIDString;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & EmergencyContact_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listEmergencyContacts's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListEmergencyContacts } from '@dataconnect/generated/react'
export default function ListEmergencyContactsComponent() {
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListEmergencyContacts();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListEmergencyContacts(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListEmergencyContacts(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListEmergencyContacts(dataConnect, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.emergencyContacts);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getEmergencyContactById
You can execute the getEmergencyContactById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetEmergencyContactById(dc: DataConnect, vars: GetEmergencyContactByIdVariables, options?: useDataConnectQueryOptions<GetEmergencyContactByIdData>): UseDataConnectQueryResult<GetEmergencyContactByIdData, GetEmergencyContactByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetEmergencyContactById(vars: GetEmergencyContactByIdVariables, options?: useDataConnectQueryOptions<GetEmergencyContactByIdData>): UseDataConnectQueryResult<GetEmergencyContactByIdData, GetEmergencyContactByIdVariables>;
Variables
The getEmergencyContactById Query requires an argument of type GetEmergencyContactByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetEmergencyContactByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getEmergencyContactById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getEmergencyContactById Query is of type GetEmergencyContactByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetEmergencyContactByIdData {
emergencyContact?: {
id: UUIDString;
name: string;
phone: string;
relationship: RelationshipType;
staffId: UUIDString;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & EmergencyContact_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getEmergencyContactById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetEmergencyContactByIdVariables } from '@dataconnect/generated';
import { useGetEmergencyContactById } from '@dataconnect/generated/react'
export default function GetEmergencyContactByIdComponent() {
// The `useGetEmergencyContactById` Query hook requires an argument of type `GetEmergencyContactByIdVariables`:
const getEmergencyContactByIdVars: GetEmergencyContactByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetEmergencyContactById(getEmergencyContactByIdVars);
// Variables can be defined inline as well.
const query = useGetEmergencyContactById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetEmergencyContactById(dataConnect, getEmergencyContactByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetEmergencyContactById(getEmergencyContactByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetEmergencyContactById(dataConnect, getEmergencyContactByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.emergencyContact);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getEmergencyContactsByStaffId
You can execute the getEmergencyContactsByStaffId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetEmergencyContactsByStaffId(dc: DataConnect, vars: GetEmergencyContactsByStaffIdVariables, options?: useDataConnectQueryOptions<GetEmergencyContactsByStaffIdData>): UseDataConnectQueryResult<GetEmergencyContactsByStaffIdData, GetEmergencyContactsByStaffIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetEmergencyContactsByStaffId(vars: GetEmergencyContactsByStaffIdVariables, options?: useDataConnectQueryOptions<GetEmergencyContactsByStaffIdData>): UseDataConnectQueryResult<GetEmergencyContactsByStaffIdData, GetEmergencyContactsByStaffIdVariables>;
Variables
The getEmergencyContactsByStaffId Query requires an argument of type GetEmergencyContactsByStaffIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetEmergencyContactsByStaffIdVariables {
staffId: UUIDString;
}
Return Type
Recall that calling the getEmergencyContactsByStaffId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getEmergencyContactsByStaffId Query is of type GetEmergencyContactsByStaffIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetEmergencyContactsByStaffIdData {
emergencyContacts: ({
id: UUIDString;
name: string;
phone: string;
relationship: RelationshipType;
staffId: UUIDString;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & EmergencyContact_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getEmergencyContactsByStaffId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetEmergencyContactsByStaffIdVariables } from '@dataconnect/generated';
import { useGetEmergencyContactsByStaffId } from '@dataconnect/generated/react'
export default function GetEmergencyContactsByStaffIdComponent() {
// The `useGetEmergencyContactsByStaffId` Query hook requires an argument of type `GetEmergencyContactsByStaffIdVariables`:
const getEmergencyContactsByStaffIdVars: GetEmergencyContactsByStaffIdVariables = {
staffId: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetEmergencyContactsByStaffId(getEmergencyContactsByStaffIdVars);
// Variables can be defined inline as well.
const query = useGetEmergencyContactsByStaffId({ staffId: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetEmergencyContactsByStaffId(dataConnect, getEmergencyContactsByStaffIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetEmergencyContactsByStaffId(getEmergencyContactsByStaffIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetEmergencyContactsByStaffId(dataConnect, getEmergencyContactsByStaffIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.emergencyContacts);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getMyTasks
You can execute the getMyTasks Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetMyTasks(dc: DataConnect, vars: GetMyTasksVariables, options?: useDataConnectQueryOptions<GetMyTasksData>): UseDataConnectQueryResult<GetMyTasksData, GetMyTasksVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetMyTasks(vars: GetMyTasksVariables, options?: useDataConnectQueryOptions<GetMyTasksData>): UseDataConnectQueryResult<GetMyTasksData, GetMyTasksVariables>;
Variables
The getMyTasks Query requires an argument of type GetMyTasksVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetMyTasksVariables {
teamMemberId: UUIDString;
}
Return Type
Recall that calling the getMyTasks Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getMyTasks Query is of type GetMyTasksData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetMyTasksData {
memberTasks: ({
id: UUIDString;
task: {
id: UUIDString;
taskName: string;
description?: string | null;
status: TaskStatus;
dueDate?: TimestampString | null;
progress?: number | null;
priority: TaskPriority;
} & Task_Key;
teamMember: {
user: {
fullName?: string | null;
email?: string | null;
};
};
})[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getMyTasks's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetMyTasksVariables } from '@dataconnect/generated';
import { useGetMyTasks } from '@dataconnect/generated/react'
export default function GetMyTasksComponent() {
// The `useGetMyTasks` Query hook requires an argument of type `GetMyTasksVariables`:
const getMyTasksVars: GetMyTasksVariables = {
teamMemberId: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetMyTasks(getMyTasksVars);
// Variables can be defined inline as well.
const query = useGetMyTasks({ teamMemberId: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetMyTasks(dataConnect, getMyTasksVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetMyTasks(getMyTasksVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetMyTasks(dataConnect, getMyTasksVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.memberTasks);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getMemberTaskByIdKey
You can execute the getMemberTaskByIdKey Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetMemberTaskByIdKey(dc: DataConnect, vars: GetMemberTaskByIdKeyVariables, options?: useDataConnectQueryOptions<GetMemberTaskByIdKeyData>): UseDataConnectQueryResult<GetMemberTaskByIdKeyData, GetMemberTaskByIdKeyVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetMemberTaskByIdKey(vars: GetMemberTaskByIdKeyVariables, options?: useDataConnectQueryOptions<GetMemberTaskByIdKeyData>): UseDataConnectQueryResult<GetMemberTaskByIdKeyData, GetMemberTaskByIdKeyVariables>;
Variables
The getMemberTaskByIdKey Query requires an argument of type GetMemberTaskByIdKeyVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetMemberTaskByIdKeyVariables {
teamMemberId: UUIDString;
taskId: UUIDString;
}
Return Type
Recall that calling the getMemberTaskByIdKey Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getMemberTaskByIdKey Query is of type GetMemberTaskByIdKeyData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetMemberTaskByIdKeyData {
memberTask?: {
id: UUIDString;
task: {
id: UUIDString;
taskName: string;
description?: string | null;
status: TaskStatus;
dueDate?: TimestampString | null;
progress?: number | null;
priority: TaskPriority;
} & Task_Key;
teamMember: {
user: {
fullName?: string | null;
email?: string | null;
};
};
};
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getMemberTaskByIdKey's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetMemberTaskByIdKeyVariables } from '@dataconnect/generated';
import { useGetMemberTaskByIdKey } from '@dataconnect/generated/react'
export default function GetMemberTaskByIdKeyComponent() {
// The `useGetMemberTaskByIdKey` Query hook requires an argument of type `GetMemberTaskByIdKeyVariables`:
const getMemberTaskByIdKeyVars: GetMemberTaskByIdKeyVariables = {
teamMemberId: ...,
taskId: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetMemberTaskByIdKey(getMemberTaskByIdKeyVars);
// Variables can be defined inline as well.
const query = useGetMemberTaskByIdKey({ teamMemberId: ..., taskId: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetMemberTaskByIdKey(dataConnect, getMemberTaskByIdKeyVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetMemberTaskByIdKey(getMemberTaskByIdKeyVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetMemberTaskByIdKey(dataConnect, getMemberTaskByIdKeyVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.memberTask);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getMemberTasksByTaskId
You can execute the getMemberTasksByTaskId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetMemberTasksByTaskId(dc: DataConnect, vars: GetMemberTasksByTaskIdVariables, options?: useDataConnectQueryOptions<GetMemberTasksByTaskIdData>): UseDataConnectQueryResult<GetMemberTasksByTaskIdData, GetMemberTasksByTaskIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetMemberTasksByTaskId(vars: GetMemberTasksByTaskIdVariables, options?: useDataConnectQueryOptions<GetMemberTasksByTaskIdData>): UseDataConnectQueryResult<GetMemberTasksByTaskIdData, GetMemberTasksByTaskIdVariables>;
Variables
The getMemberTasksByTaskId Query requires an argument of type GetMemberTasksByTaskIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetMemberTasksByTaskIdVariables {
taskId: UUIDString;
}
Return Type
Recall that calling the getMemberTasksByTaskId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getMemberTasksByTaskId Query is of type GetMemberTasksByTaskIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetMemberTasksByTaskIdData {
memberTasks: ({
id: UUIDString;
task: {
id: UUIDString;
taskName: string;
description?: string | null;
status: TaskStatus;
dueDate?: TimestampString | null;
progress?: number | null;
priority: TaskPriority;
} & Task_Key;
teamMember: {
user: {
fullName?: string | null;
email?: string | null;
};
};
})[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getMemberTasksByTaskId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetMemberTasksByTaskIdVariables } from '@dataconnect/generated';
import { useGetMemberTasksByTaskId } from '@dataconnect/generated/react'
export default function GetMemberTasksByTaskIdComponent() {
// The `useGetMemberTasksByTaskId` Query hook requires an argument of type `GetMemberTasksByTaskIdVariables`:
const getMemberTasksByTaskIdVars: GetMemberTasksByTaskIdVariables = {
taskId: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetMemberTasksByTaskId(getMemberTasksByTaskIdVars);
// Variables can be defined inline as well.
const query = useGetMemberTasksByTaskId({ taskId: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetMemberTasksByTaskId(dataConnect, getMemberTasksByTaskIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetMemberTasksByTaskId(getMemberTasksByTaskIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetMemberTasksByTaskId(dataConnect, getMemberTasksByTaskIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.memberTasks);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listCertificates
You can execute the listCertificates Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListCertificates(dc: DataConnect, options?: useDataConnectQueryOptions<ListCertificatesData>): UseDataConnectQueryResult<ListCertificatesData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListCertificates(options?: useDataConnectQueryOptions<ListCertificatesData>): UseDataConnectQueryResult<ListCertificatesData, undefined>;
Variables
The listCertificates Query has no variables.
Return Type
Recall that calling the listCertificates Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listCertificates Query is of type ListCertificatesData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListCertificatesData {
certificates: ({
id: UUIDString;
name: string;
description?: string | null;
expiry?: TimestampString | null;
status: CertificateStatus;
fileUrl?: string | null;
icon?: string | null;
staffId: UUIDString;
certificationType?: ComplianceType | null;
issuer?: string | null;
validationStatus?: ValidationStatus | null;
certificateNumber?: string | null;
createdAt?: TimestampString | null;
staff: {
id: UUIDString;
fullName: string;
} & Staff_Key;
} & Certificate_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listCertificates's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListCertificates } from '@dataconnect/generated/react'
export default function ListCertificatesComponent() {
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListCertificates();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListCertificates(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListCertificates(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListCertificates(dataConnect, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.certificates);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getCertificateById
You can execute the getCertificateById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetCertificateById(dc: DataConnect, vars: GetCertificateByIdVariables, options?: useDataConnectQueryOptions<GetCertificateByIdData>): UseDataConnectQueryResult<GetCertificateByIdData, GetCertificateByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetCertificateById(vars: GetCertificateByIdVariables, options?: useDataConnectQueryOptions<GetCertificateByIdData>): UseDataConnectQueryResult<GetCertificateByIdData, GetCertificateByIdVariables>;
Variables
The getCertificateById Query requires an argument of type GetCertificateByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetCertificateByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getCertificateById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getCertificateById Query is of type GetCertificateByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetCertificateByIdData {
certificate?: {
id: UUIDString;
name: string;
description?: string | null;
expiry?: TimestampString | null;
status: CertificateStatus;
fileUrl?: string | null;
icon?: string | null;
certificationType?: ComplianceType | null;
issuer?: string | null;
staffId: UUIDString;
validationStatus?: ValidationStatus | null;
certificateNumber?: string | null;
updatedAt?: TimestampString | null;
staff: {
id: UUIDString;
fullName: string;
} & Staff_Key;
} & Certificate_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getCertificateById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetCertificateByIdVariables } from '@dataconnect/generated';
import { useGetCertificateById } from '@dataconnect/generated/react'
export default function GetCertificateByIdComponent() {
// The `useGetCertificateById` Query hook requires an argument of type `GetCertificateByIdVariables`:
const getCertificateByIdVars: GetCertificateByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetCertificateById(getCertificateByIdVars);
// Variables can be defined inline as well.
const query = useGetCertificateById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetCertificateById(dataConnect, getCertificateByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetCertificateById(getCertificateByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetCertificateById(dataConnect, getCertificateByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.certificate);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listCertificatesByStaffId
You can execute the listCertificatesByStaffId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListCertificatesByStaffId(dc: DataConnect, vars: ListCertificatesByStaffIdVariables, options?: useDataConnectQueryOptions<ListCertificatesByStaffIdData>): UseDataConnectQueryResult<ListCertificatesByStaffIdData, ListCertificatesByStaffIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListCertificatesByStaffId(vars: ListCertificatesByStaffIdVariables, options?: useDataConnectQueryOptions<ListCertificatesByStaffIdData>): UseDataConnectQueryResult<ListCertificatesByStaffIdData, ListCertificatesByStaffIdVariables>;
Variables
The listCertificatesByStaffId Query requires an argument of type ListCertificatesByStaffIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListCertificatesByStaffIdVariables {
staffId: UUIDString;
}
Return Type
Recall that calling the listCertificatesByStaffId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listCertificatesByStaffId Query is of type ListCertificatesByStaffIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListCertificatesByStaffIdData {
certificates: ({
id: UUIDString;
name: string;
description?: string | null;
expiry?: TimestampString | null;
status: CertificateStatus;
fileUrl?: string | null;
icon?: string | null;
staffId: UUIDString;
certificationType?: ComplianceType | null;
issuer?: string | null;
validationStatus?: ValidationStatus | null;
certificateNumber?: string | null;
createdAt?: TimestampString | null;
staff: {
id: UUIDString;
fullName: string;
} & Staff_Key;
} & Certificate_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listCertificatesByStaffId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListCertificatesByStaffIdVariables } from '@dataconnect/generated';
import { useListCertificatesByStaffId } from '@dataconnect/generated/react'
export default function ListCertificatesByStaffIdComponent() {
// The `useListCertificatesByStaffId` Query hook requires an argument of type `ListCertificatesByStaffIdVariables`:
const listCertificatesByStaffIdVars: ListCertificatesByStaffIdVariables = {
staffId: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListCertificatesByStaffId(listCertificatesByStaffIdVars);
// Variables can be defined inline as well.
const query = useListCertificatesByStaffId({ staffId: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListCertificatesByStaffId(dataConnect, listCertificatesByStaffIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListCertificatesByStaffId(listCertificatesByStaffIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListCertificatesByStaffId(dataConnect, listCertificatesByStaffIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.certificates);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listAssignments
You can execute the listAssignments Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListAssignments(dc: DataConnect, vars?: ListAssignmentsVariables, options?: useDataConnectQueryOptions<ListAssignmentsData>): UseDataConnectQueryResult<ListAssignmentsData, ListAssignmentsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListAssignments(vars?: ListAssignmentsVariables, options?: useDataConnectQueryOptions<ListAssignmentsData>): UseDataConnectQueryResult<ListAssignmentsData, ListAssignmentsVariables>;
Variables
The listAssignments Query has an optional argument of type ListAssignmentsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListAssignmentsVariables {
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listAssignments Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listAssignments Query is of type ListAssignmentsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListAssignmentsData {
assignments: ({
id: UUIDString;
title?: string | null;
status?: AssignmentStatus | null;
createdAt?: TimestampString | null;
workforce: {
id: UUIDString;
workforceNumber: string;
staff: {
id: UUIDString;
fullName: string;
} & Staff_Key;
} & Workforce_Key;
shiftRole: {
id: UUIDString;
count: number;
assigned?: number | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
totalValue?: number | null;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
shift: {
id: UUIDString;
title: string;
date?: TimestampString | null;
location?: string | null;
locationAddress?: string | null;
latitude?: number | null;
longitude?: number | null;
status?: ShiftStatus | null;
order: {
id: UUIDString;
eventName?: string | null;
business: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & Order_Key;
} & Shift_Key;
};
} & Assignment_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listAssignments's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListAssignmentsVariables } from '@dataconnect/generated';
import { useListAssignments } from '@dataconnect/generated/react'
export default function ListAssignmentsComponent() {
// The `useListAssignments` Query hook has an optional argument of type `ListAssignmentsVariables`:
const listAssignmentsVars: ListAssignmentsVariables = {
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListAssignments(listAssignmentsVars);
// Variables can be defined inline as well.
const query = useListAssignments({ offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `ListAssignmentsVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useListAssignments();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListAssignments(dataConnect, listAssignmentsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListAssignments(listAssignmentsVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useListAssignments(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListAssignments(dataConnect, listAssignmentsVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.assignments);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getAssignmentById
You can execute the getAssignmentById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetAssignmentById(dc: DataConnect, vars: GetAssignmentByIdVariables, options?: useDataConnectQueryOptions<GetAssignmentByIdData>): UseDataConnectQueryResult<GetAssignmentByIdData, GetAssignmentByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetAssignmentById(vars: GetAssignmentByIdVariables, options?: useDataConnectQueryOptions<GetAssignmentByIdData>): UseDataConnectQueryResult<GetAssignmentByIdData, GetAssignmentByIdVariables>;
Variables
The getAssignmentById Query requires an argument of type GetAssignmentByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetAssignmentByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getAssignmentById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getAssignmentById Query is of type GetAssignmentByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetAssignmentByIdData {
assignment?: {
id: UUIDString;
title?: string | null;
description?: string | null;
instructions?: string | null;
status?: AssignmentStatus | null;
tipsAvailable?: boolean | null;
travelTime?: boolean | null;
mealProvided?: boolean | null;
parkingAvailable?: boolean | null;
gasCompensation?: boolean | null;
managers?: unknown[] | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
workforce: {
id: UUIDString;
workforceNumber: string;
status?: WorkforceStatus | null;
staff: {
id: UUIDString;
fullName: string;
} & Staff_Key;
} & Workforce_Key;
shiftRole: {
id: UUIDString;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
totalValue?: number | null;
breakType?: BreakDuration | null;
uniform?: string | null;
department?: string | null;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
shift: {
id: UUIDString;
title: string;
date?: TimestampString | null;
location?: string | null;
locationAddress?: string | null;
latitude?: number | null;
longitude?: number | null;
status?: ShiftStatus | null;
managers?: unknown[] | null;
order: {
id: UUIDString;
eventName?: string | null;
orderType: OrderType;
business: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & Order_Key;
} & Shift_Key;
};
} & Assignment_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getAssignmentById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetAssignmentByIdVariables } from '@dataconnect/generated';
import { useGetAssignmentById } from '@dataconnect/generated/react'
export default function GetAssignmentByIdComponent() {
// The `useGetAssignmentById` Query hook requires an argument of type `GetAssignmentByIdVariables`:
const getAssignmentByIdVars: GetAssignmentByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetAssignmentById(getAssignmentByIdVars);
// Variables can be defined inline as well.
const query = useGetAssignmentById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetAssignmentById(dataConnect, getAssignmentByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetAssignmentById(getAssignmentByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetAssignmentById(dataConnect, getAssignmentByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.assignment);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listAssignmentsByWorkforceId
You can execute the listAssignmentsByWorkforceId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListAssignmentsByWorkforceId(dc: DataConnect, vars: ListAssignmentsByWorkforceIdVariables, options?: useDataConnectQueryOptions<ListAssignmentsByWorkforceIdData>): UseDataConnectQueryResult<ListAssignmentsByWorkforceIdData, ListAssignmentsByWorkforceIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListAssignmentsByWorkforceId(vars: ListAssignmentsByWorkforceIdVariables, options?: useDataConnectQueryOptions<ListAssignmentsByWorkforceIdData>): UseDataConnectQueryResult<ListAssignmentsByWorkforceIdData, ListAssignmentsByWorkforceIdVariables>;
Variables
The listAssignmentsByWorkforceId Query requires an argument of type ListAssignmentsByWorkforceIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListAssignmentsByWorkforceIdVariables {
workforceId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listAssignmentsByWorkforceId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listAssignmentsByWorkforceId Query is of type ListAssignmentsByWorkforceIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListAssignmentsByWorkforceIdData {
assignments: ({
id: UUIDString;
title?: string | null;
status?: AssignmentStatus | null;
createdAt?: TimestampString | null;
workforce: {
id: UUIDString;
workforceNumber: string;
staff: {
id: UUIDString;
fullName: string;
} & Staff_Key;
} & Workforce_Key;
shiftRole: {
id: UUIDString;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
totalValue?: number | null;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
shift: {
id: UUIDString;
title: string;
date?: TimestampString | null;
location?: string | null;
status?: ShiftStatus | null;
order: {
id: UUIDString;
eventName?: string | null;
business: {
id: UUIDString;
businessName: string;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & Order_Key;
} & Shift_Key;
};
} & Assignment_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listAssignmentsByWorkforceId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListAssignmentsByWorkforceIdVariables } from '@dataconnect/generated';
import { useListAssignmentsByWorkforceId } from '@dataconnect/generated/react'
export default function ListAssignmentsByWorkforceIdComponent() {
// The `useListAssignmentsByWorkforceId` Query hook requires an argument of type `ListAssignmentsByWorkforceIdVariables`:
const listAssignmentsByWorkforceIdVars: ListAssignmentsByWorkforceIdVariables = {
workforceId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListAssignmentsByWorkforceId(listAssignmentsByWorkforceIdVars);
// Variables can be defined inline as well.
const query = useListAssignmentsByWorkforceId({ workforceId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListAssignmentsByWorkforceId(dataConnect, listAssignmentsByWorkforceIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListAssignmentsByWorkforceId(listAssignmentsByWorkforceIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListAssignmentsByWorkforceId(dataConnect, listAssignmentsByWorkforceIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.assignments);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listAssignmentsByWorkforceIds
You can execute the listAssignmentsByWorkforceIds Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListAssignmentsByWorkforceIds(dc: DataConnect, vars: ListAssignmentsByWorkforceIdsVariables, options?: useDataConnectQueryOptions<ListAssignmentsByWorkforceIdsData>): UseDataConnectQueryResult<ListAssignmentsByWorkforceIdsData, ListAssignmentsByWorkforceIdsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListAssignmentsByWorkforceIds(vars: ListAssignmentsByWorkforceIdsVariables, options?: useDataConnectQueryOptions<ListAssignmentsByWorkforceIdsData>): UseDataConnectQueryResult<ListAssignmentsByWorkforceIdsData, ListAssignmentsByWorkforceIdsVariables>;
Variables
The listAssignmentsByWorkforceIds Query requires an argument of type ListAssignmentsByWorkforceIdsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListAssignmentsByWorkforceIdsVariables {
workforceIds: UUIDString[];
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listAssignmentsByWorkforceIds Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listAssignmentsByWorkforceIds Query is of type ListAssignmentsByWorkforceIdsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListAssignmentsByWorkforceIdsData {
assignments: ({
id: UUIDString;
title?: string | null;
status?: AssignmentStatus | null;
createdAt?: TimestampString | null;
workforce: {
id: UUIDString;
workforceNumber: string;
staff: {
id: UUIDString;
fullName: string;
} & Staff_Key;
} & Workforce_Key;
shiftRole: {
id: UUIDString;
role: {
id: UUIDString;
name: string;
} & Role_Key;
shift: {
id: UUIDString;
title: string;
date?: TimestampString | null;
order: {
id: UUIDString;
eventName?: string | null;
business: {
id: UUIDString;
businessName: string;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & Order_Key;
} & Shift_Key;
};
} & Assignment_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listAssignmentsByWorkforceIds's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListAssignmentsByWorkforceIdsVariables } from '@dataconnect/generated';
import { useListAssignmentsByWorkforceIds } from '@dataconnect/generated/react'
export default function ListAssignmentsByWorkforceIdsComponent() {
// The `useListAssignmentsByWorkforceIds` Query hook requires an argument of type `ListAssignmentsByWorkforceIdsVariables`:
const listAssignmentsByWorkforceIdsVars: ListAssignmentsByWorkforceIdsVariables = {
workforceIds: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListAssignmentsByWorkforceIds(listAssignmentsByWorkforceIdsVars);
// Variables can be defined inline as well.
const query = useListAssignmentsByWorkforceIds({ workforceIds: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListAssignmentsByWorkforceIds(dataConnect, listAssignmentsByWorkforceIdsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListAssignmentsByWorkforceIds(listAssignmentsByWorkforceIdsVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListAssignmentsByWorkforceIds(dataConnect, listAssignmentsByWorkforceIdsVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.assignments);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listAssignmentsByShiftRole
You can execute the listAssignmentsByShiftRole Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListAssignmentsByShiftRole(dc: DataConnect, vars: ListAssignmentsByShiftRoleVariables, options?: useDataConnectQueryOptions<ListAssignmentsByShiftRoleData>): UseDataConnectQueryResult<ListAssignmentsByShiftRoleData, ListAssignmentsByShiftRoleVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListAssignmentsByShiftRole(vars: ListAssignmentsByShiftRoleVariables, options?: useDataConnectQueryOptions<ListAssignmentsByShiftRoleData>): UseDataConnectQueryResult<ListAssignmentsByShiftRoleData, ListAssignmentsByShiftRoleVariables>;
Variables
The listAssignmentsByShiftRole Query requires an argument of type ListAssignmentsByShiftRoleVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListAssignmentsByShiftRoleVariables {
shiftId: UUIDString;
roleId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listAssignmentsByShiftRole Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listAssignmentsByShiftRole Query is of type ListAssignmentsByShiftRoleData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListAssignmentsByShiftRoleData {
assignments: ({
id: UUIDString;
title?: string | null;
status?: AssignmentStatus | null;
createdAt?: TimestampString | null;
workforce: {
id: UUIDString;
workforceNumber: string;
staff: {
id: UUIDString;
fullName: string;
} & Staff_Key;
} & Workforce_Key;
} & Assignment_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listAssignmentsByShiftRole's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListAssignmentsByShiftRoleVariables } from '@dataconnect/generated';
import { useListAssignmentsByShiftRole } from '@dataconnect/generated/react'
export default function ListAssignmentsByShiftRoleComponent() {
// The `useListAssignmentsByShiftRole` Query hook requires an argument of type `ListAssignmentsByShiftRoleVariables`:
const listAssignmentsByShiftRoleVars: ListAssignmentsByShiftRoleVariables = {
shiftId: ...,
roleId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListAssignmentsByShiftRole(listAssignmentsByShiftRoleVars);
// Variables can be defined inline as well.
const query = useListAssignmentsByShiftRole({ shiftId: ..., roleId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListAssignmentsByShiftRole(dataConnect, listAssignmentsByShiftRoleVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListAssignmentsByShiftRole(listAssignmentsByShiftRoleVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListAssignmentsByShiftRole(dataConnect, listAssignmentsByShiftRoleVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.assignments);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterAssignments
You can execute the filterAssignments Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterAssignments(dc: DataConnect, vars: FilterAssignmentsVariables, options?: useDataConnectQueryOptions<FilterAssignmentsData>): UseDataConnectQueryResult<FilterAssignmentsData, FilterAssignmentsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterAssignments(vars: FilterAssignmentsVariables, options?: useDataConnectQueryOptions<FilterAssignmentsData>): UseDataConnectQueryResult<FilterAssignmentsData, FilterAssignmentsVariables>;
Variables
The filterAssignments Query requires an argument of type FilterAssignmentsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterAssignmentsVariables {
shiftIds: UUIDString[];
roleIds: UUIDString[];
status?: AssignmentStatus | null;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the filterAssignments Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the filterAssignments Query is of type FilterAssignmentsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterAssignmentsData {
assignments: ({
id: UUIDString;
title?: string | null;
status?: AssignmentStatus | null;
createdAt?: TimestampString | null;
workforce: {
id: UUIDString;
workforceNumber: string;
staff: {
id: UUIDString;
fullName: string;
} & Staff_Key;
} & Workforce_Key;
shiftRole: {
id: UUIDString;
role: {
id: UUIDString;
name: string;
} & Role_Key;
shift: {
id: UUIDString;
title: string;
date?: TimestampString | null;
location?: string | null;
status?: ShiftStatus | null;
} & Shift_Key;
};
} & Assignment_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterAssignments's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterAssignmentsVariables } from '@dataconnect/generated';
import { useFilterAssignments } from '@dataconnect/generated/react'
export default function FilterAssignmentsComponent() {
// The `useFilterAssignments` Query hook requires an argument of type `FilterAssignmentsVariables`:
const filterAssignmentsVars: FilterAssignmentsVariables = {
shiftIds: ...,
roleIds: ...,
status: ..., // optional
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useFilterAssignments(filterAssignmentsVars);
// Variables can be defined inline as well.
const query = useFilterAssignments({ shiftIds: ..., roleIds: ..., status: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterAssignments(dataConnect, filterAssignmentsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterAssignments(filterAssignmentsVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useFilterAssignments(dataConnect, filterAssignmentsVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.assignments);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listInvoiceTemplates
You can execute the listInvoiceTemplates Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListInvoiceTemplates(dc: DataConnect, vars?: ListInvoiceTemplatesVariables, options?: useDataConnectQueryOptions<ListInvoiceTemplatesData>): UseDataConnectQueryResult<ListInvoiceTemplatesData, ListInvoiceTemplatesVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListInvoiceTemplates(vars?: ListInvoiceTemplatesVariables, options?: useDataConnectQueryOptions<ListInvoiceTemplatesData>): UseDataConnectQueryResult<ListInvoiceTemplatesData, ListInvoiceTemplatesVariables>;
Variables
The listInvoiceTemplates Query has an optional argument of type ListInvoiceTemplatesVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoiceTemplatesVariables {
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listInvoiceTemplates Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listInvoiceTemplates Query is of type ListInvoiceTemplatesData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoiceTemplatesData {
invoiceTemplates: ({
id: UUIDString;
name: string;
ownerId: UUIDString;
vendorId?: UUIDString | null;
businessId?: UUIDString | null;
orderId?: UUIDString | null;
paymentTerms?: InovicePaymentTermsTemp | null;
invoiceNumber?: string | null;
issueDate?: TimestampString | null;
dueDate?: TimestampString | null;
hub?: string | null;
managerName?: string | null;
vendorNumber?: string | null;
roles?: unknown | null;
charges?: unknown | null;
otherCharges?: number | null;
subtotal?: number | null;
amount?: number | null;
notes?: string | null;
staffCount?: number | null;
chargesCount?: number | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
business?: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
} & Business_Key;
order?: {
id: UUIDString;
eventName?: string | null;
status: OrderStatus;
orderType: OrderType;
} & Order_Key;
} & InvoiceTemplate_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listInvoiceTemplates's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListInvoiceTemplatesVariables } from '@dataconnect/generated';
import { useListInvoiceTemplates } from '@dataconnect/generated/react'
export default function ListInvoiceTemplatesComponent() {
// The `useListInvoiceTemplates` Query hook has an optional argument of type `ListInvoiceTemplatesVariables`:
const listInvoiceTemplatesVars: ListInvoiceTemplatesVariables = {
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListInvoiceTemplates(listInvoiceTemplatesVars);
// Variables can be defined inline as well.
const query = useListInvoiceTemplates({ offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `ListInvoiceTemplatesVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useListInvoiceTemplates();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListInvoiceTemplates(dataConnect, listInvoiceTemplatesVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListInvoiceTemplates(listInvoiceTemplatesVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useListInvoiceTemplates(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListInvoiceTemplates(dataConnect, listInvoiceTemplatesVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.invoiceTemplates);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getInvoiceTemplateById
You can execute the getInvoiceTemplateById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetInvoiceTemplateById(dc: DataConnect, vars: GetInvoiceTemplateByIdVariables, options?: useDataConnectQueryOptions<GetInvoiceTemplateByIdData>): UseDataConnectQueryResult<GetInvoiceTemplateByIdData, GetInvoiceTemplateByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetInvoiceTemplateById(vars: GetInvoiceTemplateByIdVariables, options?: useDataConnectQueryOptions<GetInvoiceTemplateByIdData>): UseDataConnectQueryResult<GetInvoiceTemplateByIdData, GetInvoiceTemplateByIdVariables>;
Variables
The getInvoiceTemplateById Query requires an argument of type GetInvoiceTemplateByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetInvoiceTemplateByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getInvoiceTemplateById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getInvoiceTemplateById Query is of type GetInvoiceTemplateByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetInvoiceTemplateByIdData {
invoiceTemplate?: {
id: UUIDString;
name: string;
ownerId: UUIDString;
vendorId?: UUIDString | null;
businessId?: UUIDString | null;
orderId?: UUIDString | null;
paymentTerms?: InovicePaymentTermsTemp | null;
invoiceNumber?: string | null;
issueDate?: TimestampString | null;
dueDate?: TimestampString | null;
hub?: string | null;
managerName?: string | null;
vendorNumber?: string | null;
roles?: unknown | null;
charges?: unknown | null;
otherCharges?: number | null;
subtotal?: number | null;
amount?: number | null;
notes?: string | null;
staffCount?: number | null;
chargesCount?: number | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
business?: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
} & Business_Key;
order?: {
id: UUIDString;
eventName?: string | null;
status: OrderStatus;
orderType: OrderType;
} & Order_Key;
} & InvoiceTemplate_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getInvoiceTemplateById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetInvoiceTemplateByIdVariables } from '@dataconnect/generated';
import { useGetInvoiceTemplateById } from '@dataconnect/generated/react'
export default function GetInvoiceTemplateByIdComponent() {
// The `useGetInvoiceTemplateById` Query hook requires an argument of type `GetInvoiceTemplateByIdVariables`:
const getInvoiceTemplateByIdVars: GetInvoiceTemplateByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetInvoiceTemplateById(getInvoiceTemplateByIdVars);
// Variables can be defined inline as well.
const query = useGetInvoiceTemplateById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetInvoiceTemplateById(dataConnect, getInvoiceTemplateByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetInvoiceTemplateById(getInvoiceTemplateByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetInvoiceTemplateById(dataConnect, getInvoiceTemplateByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.invoiceTemplate);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listInvoiceTemplatesByOwnerId
You can execute the listInvoiceTemplatesByOwnerId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListInvoiceTemplatesByOwnerId(dc: DataConnect, vars: ListInvoiceTemplatesByOwnerIdVariables, options?: useDataConnectQueryOptions<ListInvoiceTemplatesByOwnerIdData>): UseDataConnectQueryResult<ListInvoiceTemplatesByOwnerIdData, ListInvoiceTemplatesByOwnerIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListInvoiceTemplatesByOwnerId(vars: ListInvoiceTemplatesByOwnerIdVariables, options?: useDataConnectQueryOptions<ListInvoiceTemplatesByOwnerIdData>): UseDataConnectQueryResult<ListInvoiceTemplatesByOwnerIdData, ListInvoiceTemplatesByOwnerIdVariables>;
Variables
The listInvoiceTemplatesByOwnerId Query requires an argument of type ListInvoiceTemplatesByOwnerIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoiceTemplatesByOwnerIdVariables {
ownerId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listInvoiceTemplatesByOwnerId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listInvoiceTemplatesByOwnerId Query is of type ListInvoiceTemplatesByOwnerIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoiceTemplatesByOwnerIdData {
invoiceTemplates: ({
id: UUIDString;
name: string;
ownerId: UUIDString;
vendorId?: UUIDString | null;
businessId?: UUIDString | null;
orderId?: UUIDString | null;
paymentTerms?: InovicePaymentTermsTemp | null;
invoiceNumber?: string | null;
issueDate?: TimestampString | null;
dueDate?: TimestampString | null;
hub?: string | null;
managerName?: string | null;
vendorNumber?: string | null;
roles?: unknown | null;
charges?: unknown | null;
otherCharges?: number | null;
subtotal?: number | null;
amount?: number | null;
notes?: string | null;
staffCount?: number | null;
chargesCount?: number | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
business?: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
} & Business_Key;
order?: {
id: UUIDString;
eventName?: string | null;
status: OrderStatus;
orderType: OrderType;
} & Order_Key;
} & InvoiceTemplate_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listInvoiceTemplatesByOwnerId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListInvoiceTemplatesByOwnerIdVariables } from '@dataconnect/generated';
import { useListInvoiceTemplatesByOwnerId } from '@dataconnect/generated/react'
export default function ListInvoiceTemplatesByOwnerIdComponent() {
// The `useListInvoiceTemplatesByOwnerId` Query hook requires an argument of type `ListInvoiceTemplatesByOwnerIdVariables`:
const listInvoiceTemplatesByOwnerIdVars: ListInvoiceTemplatesByOwnerIdVariables = {
ownerId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListInvoiceTemplatesByOwnerId(listInvoiceTemplatesByOwnerIdVars);
// Variables can be defined inline as well.
const query = useListInvoiceTemplatesByOwnerId({ ownerId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListInvoiceTemplatesByOwnerId(dataConnect, listInvoiceTemplatesByOwnerIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListInvoiceTemplatesByOwnerId(listInvoiceTemplatesByOwnerIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListInvoiceTemplatesByOwnerId(dataConnect, listInvoiceTemplatesByOwnerIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.invoiceTemplates);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listInvoiceTemplatesByVendorId
You can execute the listInvoiceTemplatesByVendorId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListInvoiceTemplatesByVendorId(dc: DataConnect, vars: ListInvoiceTemplatesByVendorIdVariables, options?: useDataConnectQueryOptions<ListInvoiceTemplatesByVendorIdData>): UseDataConnectQueryResult<ListInvoiceTemplatesByVendorIdData, ListInvoiceTemplatesByVendorIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListInvoiceTemplatesByVendorId(vars: ListInvoiceTemplatesByVendorIdVariables, options?: useDataConnectQueryOptions<ListInvoiceTemplatesByVendorIdData>): UseDataConnectQueryResult<ListInvoiceTemplatesByVendorIdData, ListInvoiceTemplatesByVendorIdVariables>;
Variables
The listInvoiceTemplatesByVendorId Query requires an argument of type ListInvoiceTemplatesByVendorIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoiceTemplatesByVendorIdVariables {
vendorId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listInvoiceTemplatesByVendorId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listInvoiceTemplatesByVendorId Query is of type ListInvoiceTemplatesByVendorIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoiceTemplatesByVendorIdData {
invoiceTemplates: ({
id: UUIDString;
name: string;
ownerId: UUIDString;
vendorId?: UUIDString | null;
businessId?: UUIDString | null;
orderId?: UUIDString | null;
paymentTerms?: InovicePaymentTermsTemp | null;
invoiceNumber?: string | null;
issueDate?: TimestampString | null;
dueDate?: TimestampString | null;
hub?: string | null;
managerName?: string | null;
vendorNumber?: string | null;
roles?: unknown | null;
charges?: unknown | null;
otherCharges?: number | null;
subtotal?: number | null;
amount?: number | null;
notes?: string | null;
staffCount?: number | null;
chargesCount?: number | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
business?: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
} & Business_Key;
order?: {
id: UUIDString;
eventName?: string | null;
status: OrderStatus;
orderType: OrderType;
} & Order_Key;
} & InvoiceTemplate_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listInvoiceTemplatesByVendorId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListInvoiceTemplatesByVendorIdVariables } from '@dataconnect/generated';
import { useListInvoiceTemplatesByVendorId } from '@dataconnect/generated/react'
export default function ListInvoiceTemplatesByVendorIdComponent() {
// The `useListInvoiceTemplatesByVendorId` Query hook requires an argument of type `ListInvoiceTemplatesByVendorIdVariables`:
const listInvoiceTemplatesByVendorIdVars: ListInvoiceTemplatesByVendorIdVariables = {
vendorId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListInvoiceTemplatesByVendorId(listInvoiceTemplatesByVendorIdVars);
// Variables can be defined inline as well.
const query = useListInvoiceTemplatesByVendorId({ vendorId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListInvoiceTemplatesByVendorId(dataConnect, listInvoiceTemplatesByVendorIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListInvoiceTemplatesByVendorId(listInvoiceTemplatesByVendorIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListInvoiceTemplatesByVendorId(dataConnect, listInvoiceTemplatesByVendorIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.invoiceTemplates);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listInvoiceTemplatesByBusinessId
You can execute the listInvoiceTemplatesByBusinessId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListInvoiceTemplatesByBusinessId(dc: DataConnect, vars: ListInvoiceTemplatesByBusinessIdVariables, options?: useDataConnectQueryOptions<ListInvoiceTemplatesByBusinessIdData>): UseDataConnectQueryResult<ListInvoiceTemplatesByBusinessIdData, ListInvoiceTemplatesByBusinessIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListInvoiceTemplatesByBusinessId(vars: ListInvoiceTemplatesByBusinessIdVariables, options?: useDataConnectQueryOptions<ListInvoiceTemplatesByBusinessIdData>): UseDataConnectQueryResult<ListInvoiceTemplatesByBusinessIdData, ListInvoiceTemplatesByBusinessIdVariables>;
Variables
The listInvoiceTemplatesByBusinessId Query requires an argument of type ListInvoiceTemplatesByBusinessIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoiceTemplatesByBusinessIdVariables {
businessId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listInvoiceTemplatesByBusinessId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listInvoiceTemplatesByBusinessId Query is of type ListInvoiceTemplatesByBusinessIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoiceTemplatesByBusinessIdData {
invoiceTemplates: ({
id: UUIDString;
name: string;
ownerId: UUIDString;
vendorId?: UUIDString | null;
businessId?: UUIDString | null;
orderId?: UUIDString | null;
paymentTerms?: InovicePaymentTermsTemp | null;
invoiceNumber?: string | null;
issueDate?: TimestampString | null;
dueDate?: TimestampString | null;
hub?: string | null;
managerName?: string | null;
vendorNumber?: string | null;
roles?: unknown | null;
charges?: unknown | null;
otherCharges?: number | null;
subtotal?: number | null;
amount?: number | null;
notes?: string | null;
staffCount?: number | null;
chargesCount?: number | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
business?: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
} & Business_Key;
order?: {
id: UUIDString;
eventName?: string | null;
status: OrderStatus;
orderType: OrderType;
} & Order_Key;
} & InvoiceTemplate_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listInvoiceTemplatesByBusinessId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListInvoiceTemplatesByBusinessIdVariables } from '@dataconnect/generated';
import { useListInvoiceTemplatesByBusinessId } from '@dataconnect/generated/react'
export default function ListInvoiceTemplatesByBusinessIdComponent() {
// The `useListInvoiceTemplatesByBusinessId` Query hook requires an argument of type `ListInvoiceTemplatesByBusinessIdVariables`:
const listInvoiceTemplatesByBusinessIdVars: ListInvoiceTemplatesByBusinessIdVariables = {
businessId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListInvoiceTemplatesByBusinessId(listInvoiceTemplatesByBusinessIdVars);
// Variables can be defined inline as well.
const query = useListInvoiceTemplatesByBusinessId({ businessId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListInvoiceTemplatesByBusinessId(dataConnect, listInvoiceTemplatesByBusinessIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListInvoiceTemplatesByBusinessId(listInvoiceTemplatesByBusinessIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListInvoiceTemplatesByBusinessId(dataConnect, listInvoiceTemplatesByBusinessIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.invoiceTemplates);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listInvoiceTemplatesByOrderId
You can execute the listInvoiceTemplatesByOrderId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListInvoiceTemplatesByOrderId(dc: DataConnect, vars: ListInvoiceTemplatesByOrderIdVariables, options?: useDataConnectQueryOptions<ListInvoiceTemplatesByOrderIdData>): UseDataConnectQueryResult<ListInvoiceTemplatesByOrderIdData, ListInvoiceTemplatesByOrderIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListInvoiceTemplatesByOrderId(vars: ListInvoiceTemplatesByOrderIdVariables, options?: useDataConnectQueryOptions<ListInvoiceTemplatesByOrderIdData>): UseDataConnectQueryResult<ListInvoiceTemplatesByOrderIdData, ListInvoiceTemplatesByOrderIdVariables>;
Variables
The listInvoiceTemplatesByOrderId Query requires an argument of type ListInvoiceTemplatesByOrderIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoiceTemplatesByOrderIdVariables {
orderId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listInvoiceTemplatesByOrderId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listInvoiceTemplatesByOrderId Query is of type ListInvoiceTemplatesByOrderIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoiceTemplatesByOrderIdData {
invoiceTemplates: ({
id: UUIDString;
name: string;
ownerId: UUIDString;
vendorId?: UUIDString | null;
businessId?: UUIDString | null;
orderId?: UUIDString | null;
paymentTerms?: InovicePaymentTermsTemp | null;
invoiceNumber?: string | null;
issueDate?: TimestampString | null;
dueDate?: TimestampString | null;
hub?: string | null;
managerName?: string | null;
vendorNumber?: string | null;
roles?: unknown | null;
charges?: unknown | null;
otherCharges?: number | null;
subtotal?: number | null;
amount?: number | null;
notes?: string | null;
staffCount?: number | null;
chargesCount?: number | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
business?: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
} & Business_Key;
order?: {
id: UUIDString;
eventName?: string | null;
status: OrderStatus;
orderType: OrderType;
} & Order_Key;
} & InvoiceTemplate_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listInvoiceTemplatesByOrderId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListInvoiceTemplatesByOrderIdVariables } from '@dataconnect/generated';
import { useListInvoiceTemplatesByOrderId } from '@dataconnect/generated/react'
export default function ListInvoiceTemplatesByOrderIdComponent() {
// The `useListInvoiceTemplatesByOrderId` Query hook requires an argument of type `ListInvoiceTemplatesByOrderIdVariables`:
const listInvoiceTemplatesByOrderIdVars: ListInvoiceTemplatesByOrderIdVariables = {
orderId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListInvoiceTemplatesByOrderId(listInvoiceTemplatesByOrderIdVars);
// Variables can be defined inline as well.
const query = useListInvoiceTemplatesByOrderId({ orderId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListInvoiceTemplatesByOrderId(dataConnect, listInvoiceTemplatesByOrderIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListInvoiceTemplatesByOrderId(listInvoiceTemplatesByOrderIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListInvoiceTemplatesByOrderId(dataConnect, listInvoiceTemplatesByOrderIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.invoiceTemplates);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
searchInvoiceTemplatesByOwnerAndName
You can execute the searchInvoiceTemplatesByOwnerAndName Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useSearchInvoiceTemplatesByOwnerAndName(dc: DataConnect, vars: SearchInvoiceTemplatesByOwnerAndNameVariables, options?: useDataConnectQueryOptions<SearchInvoiceTemplatesByOwnerAndNameData>): UseDataConnectQueryResult<SearchInvoiceTemplatesByOwnerAndNameData, SearchInvoiceTemplatesByOwnerAndNameVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useSearchInvoiceTemplatesByOwnerAndName(vars: SearchInvoiceTemplatesByOwnerAndNameVariables, options?: useDataConnectQueryOptions<SearchInvoiceTemplatesByOwnerAndNameData>): UseDataConnectQueryResult<SearchInvoiceTemplatesByOwnerAndNameData, SearchInvoiceTemplatesByOwnerAndNameVariables>;
Variables
The searchInvoiceTemplatesByOwnerAndName Query requires an argument of type SearchInvoiceTemplatesByOwnerAndNameVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface SearchInvoiceTemplatesByOwnerAndNameVariables {
ownerId: UUIDString;
name: string;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the searchInvoiceTemplatesByOwnerAndName Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the searchInvoiceTemplatesByOwnerAndName Query is of type SearchInvoiceTemplatesByOwnerAndNameData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface SearchInvoiceTemplatesByOwnerAndNameData {
invoiceTemplates: ({
id: UUIDString;
name: string;
ownerId: UUIDString;
vendorId?: UUIDString | null;
businessId?: UUIDString | null;
orderId?: UUIDString | null;
paymentTerms?: InovicePaymentTermsTemp | null;
invoiceNumber?: string | null;
issueDate?: TimestampString | null;
dueDate?: TimestampString | null;
hub?: string | null;
managerName?: string | null;
vendorNumber?: string | null;
roles?: unknown | null;
charges?: unknown | null;
otherCharges?: number | null;
subtotal?: number | null;
amount?: number | null;
notes?: string | null;
staffCount?: number | null;
chargesCount?: number | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
business?: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
} & Business_Key;
order?: {
id: UUIDString;
eventName?: string | null;
status: OrderStatus;
orderType: OrderType;
} & Order_Key;
} & InvoiceTemplate_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using searchInvoiceTemplatesByOwnerAndName's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, SearchInvoiceTemplatesByOwnerAndNameVariables } from '@dataconnect/generated';
import { useSearchInvoiceTemplatesByOwnerAndName } from '@dataconnect/generated/react'
export default function SearchInvoiceTemplatesByOwnerAndNameComponent() {
// The `useSearchInvoiceTemplatesByOwnerAndName` Query hook requires an argument of type `SearchInvoiceTemplatesByOwnerAndNameVariables`:
const searchInvoiceTemplatesByOwnerAndNameVars: SearchInvoiceTemplatesByOwnerAndNameVariables = {
ownerId: ...,
name: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useSearchInvoiceTemplatesByOwnerAndName(searchInvoiceTemplatesByOwnerAndNameVars);
// Variables can be defined inline as well.
const query = useSearchInvoiceTemplatesByOwnerAndName({ ownerId: ..., name: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useSearchInvoiceTemplatesByOwnerAndName(dataConnect, searchInvoiceTemplatesByOwnerAndNameVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useSearchInvoiceTemplatesByOwnerAndName(searchInvoiceTemplatesByOwnerAndNameVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useSearchInvoiceTemplatesByOwnerAndName(dataConnect, searchInvoiceTemplatesByOwnerAndNameVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.invoiceTemplates);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getStaffDocumentByKey
You can execute the getStaffDocumentByKey Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetStaffDocumentByKey(dc: DataConnect, vars: GetStaffDocumentByKeyVariables, options?: useDataConnectQueryOptions<GetStaffDocumentByKeyData>): UseDataConnectQueryResult<GetStaffDocumentByKeyData, GetStaffDocumentByKeyVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetStaffDocumentByKey(vars: GetStaffDocumentByKeyVariables, options?: useDataConnectQueryOptions<GetStaffDocumentByKeyData>): UseDataConnectQueryResult<GetStaffDocumentByKeyData, GetStaffDocumentByKeyVariables>;
Variables
The getStaffDocumentByKey Query requires an argument of type GetStaffDocumentByKeyVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetStaffDocumentByKeyVariables {
staffId: UUIDString;
documentId: UUIDString;
}
Return Type
Recall that calling the getStaffDocumentByKey Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getStaffDocumentByKey Query is of type GetStaffDocumentByKeyData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetStaffDocumentByKeyData {
staffDocument?: {
id: UUIDString;
staffId: UUIDString;
staffName: string;
documentId: UUIDString;
status: DocumentStatus;
documentUrl?: string | null;
expiryDate?: TimestampString | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
document: {
id: UUIDString;
name: string;
documentType: DocumentType;
description?: string | null;
} & Document_Key;
} & StaffDocument_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getStaffDocumentByKey's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetStaffDocumentByKeyVariables } from '@dataconnect/generated';
import { useGetStaffDocumentByKey } from '@dataconnect/generated/react'
export default function GetStaffDocumentByKeyComponent() {
// The `useGetStaffDocumentByKey` Query hook requires an argument of type `GetStaffDocumentByKeyVariables`:
const getStaffDocumentByKeyVars: GetStaffDocumentByKeyVariables = {
staffId: ...,
documentId: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetStaffDocumentByKey(getStaffDocumentByKeyVars);
// Variables can be defined inline as well.
const query = useGetStaffDocumentByKey({ staffId: ..., documentId: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetStaffDocumentByKey(dataConnect, getStaffDocumentByKeyVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetStaffDocumentByKey(getStaffDocumentByKeyVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetStaffDocumentByKey(dataConnect, getStaffDocumentByKeyVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.staffDocument);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listStaffDocumentsByStaffId
You can execute the listStaffDocumentsByStaffId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListStaffDocumentsByStaffId(dc: DataConnect, vars: ListStaffDocumentsByStaffIdVariables, options?: useDataConnectQueryOptions<ListStaffDocumentsByStaffIdData>): UseDataConnectQueryResult<ListStaffDocumentsByStaffIdData, ListStaffDocumentsByStaffIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListStaffDocumentsByStaffId(vars: ListStaffDocumentsByStaffIdVariables, options?: useDataConnectQueryOptions<ListStaffDocumentsByStaffIdData>): UseDataConnectQueryResult<ListStaffDocumentsByStaffIdData, ListStaffDocumentsByStaffIdVariables>;
Variables
The listStaffDocumentsByStaffId Query requires an argument of type ListStaffDocumentsByStaffIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffDocumentsByStaffIdVariables {
staffId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listStaffDocumentsByStaffId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listStaffDocumentsByStaffId Query is of type ListStaffDocumentsByStaffIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffDocumentsByStaffIdData {
staffDocuments: ({
id: UUIDString;
staffId: UUIDString;
staffName: string;
documentId: UUIDString;
status: DocumentStatus;
documentUrl?: string | null;
expiryDate?: TimestampString | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
document: {
id: UUIDString;
name: string;
documentType: DocumentType;
} & Document_Key;
} & StaffDocument_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listStaffDocumentsByStaffId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListStaffDocumentsByStaffIdVariables } from '@dataconnect/generated';
import { useListStaffDocumentsByStaffId } from '@dataconnect/generated/react'
export default function ListStaffDocumentsByStaffIdComponent() {
// The `useListStaffDocumentsByStaffId` Query hook requires an argument of type `ListStaffDocumentsByStaffIdVariables`:
const listStaffDocumentsByStaffIdVars: ListStaffDocumentsByStaffIdVariables = {
staffId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListStaffDocumentsByStaffId(listStaffDocumentsByStaffIdVars);
// Variables can be defined inline as well.
const query = useListStaffDocumentsByStaffId({ staffId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListStaffDocumentsByStaffId(dataConnect, listStaffDocumentsByStaffIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListStaffDocumentsByStaffId(listStaffDocumentsByStaffIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListStaffDocumentsByStaffId(dataConnect, listStaffDocumentsByStaffIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.staffDocuments);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listStaffDocumentsByDocumentType
You can execute the listStaffDocumentsByDocumentType Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListStaffDocumentsByDocumentType(dc: DataConnect, vars: ListStaffDocumentsByDocumentTypeVariables, options?: useDataConnectQueryOptions<ListStaffDocumentsByDocumentTypeData>): UseDataConnectQueryResult<ListStaffDocumentsByDocumentTypeData, ListStaffDocumentsByDocumentTypeVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListStaffDocumentsByDocumentType(vars: ListStaffDocumentsByDocumentTypeVariables, options?: useDataConnectQueryOptions<ListStaffDocumentsByDocumentTypeData>): UseDataConnectQueryResult<ListStaffDocumentsByDocumentTypeData, ListStaffDocumentsByDocumentTypeVariables>;
Variables
The listStaffDocumentsByDocumentType Query requires an argument of type ListStaffDocumentsByDocumentTypeVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffDocumentsByDocumentTypeVariables {
documentType: DocumentType;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listStaffDocumentsByDocumentType Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listStaffDocumentsByDocumentType Query is of type ListStaffDocumentsByDocumentTypeData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffDocumentsByDocumentTypeData {
staffDocuments: ({
id: UUIDString;
staffId: UUIDString;
staffName: string;
documentId: UUIDString;
status: DocumentStatus;
documentUrl?: string | null;
expiryDate?: TimestampString | null;
document: {
id: UUIDString;
name: string;
documentType: DocumentType;
} & Document_Key;
} & StaffDocument_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listStaffDocumentsByDocumentType's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListStaffDocumentsByDocumentTypeVariables } from '@dataconnect/generated';
import { useListStaffDocumentsByDocumentType } from '@dataconnect/generated/react'
export default function ListStaffDocumentsByDocumentTypeComponent() {
// The `useListStaffDocumentsByDocumentType` Query hook requires an argument of type `ListStaffDocumentsByDocumentTypeVariables`:
const listStaffDocumentsByDocumentTypeVars: ListStaffDocumentsByDocumentTypeVariables = {
documentType: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListStaffDocumentsByDocumentType(listStaffDocumentsByDocumentTypeVars);
// Variables can be defined inline as well.
const query = useListStaffDocumentsByDocumentType({ documentType: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListStaffDocumentsByDocumentType(dataConnect, listStaffDocumentsByDocumentTypeVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListStaffDocumentsByDocumentType(listStaffDocumentsByDocumentTypeVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListStaffDocumentsByDocumentType(dataConnect, listStaffDocumentsByDocumentTypeVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.staffDocuments);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listStaffDocumentsByStatus
You can execute the listStaffDocumentsByStatus Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListStaffDocumentsByStatus(dc: DataConnect, vars: ListStaffDocumentsByStatusVariables, options?: useDataConnectQueryOptions<ListStaffDocumentsByStatusData>): UseDataConnectQueryResult<ListStaffDocumentsByStatusData, ListStaffDocumentsByStatusVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListStaffDocumentsByStatus(vars: ListStaffDocumentsByStatusVariables, options?: useDataConnectQueryOptions<ListStaffDocumentsByStatusData>): UseDataConnectQueryResult<ListStaffDocumentsByStatusData, ListStaffDocumentsByStatusVariables>;
Variables
The listStaffDocumentsByStatus Query requires an argument of type ListStaffDocumentsByStatusVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffDocumentsByStatusVariables {
status: DocumentStatus;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listStaffDocumentsByStatus Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listStaffDocumentsByStatus Query is of type ListStaffDocumentsByStatusData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffDocumentsByStatusData {
staffDocuments: ({
id: UUIDString;
staffId: UUIDString;
staffName: string;
documentId: UUIDString;
status: DocumentStatus;
documentUrl?: string | null;
expiryDate?: TimestampString | null;
document: {
id: UUIDString;
name: string;
documentType: DocumentType;
} & Document_Key;
} & StaffDocument_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listStaffDocumentsByStatus's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListStaffDocumentsByStatusVariables } from '@dataconnect/generated';
import { useListStaffDocumentsByStatus } from '@dataconnect/generated/react'
export default function ListStaffDocumentsByStatusComponent() {
// The `useListStaffDocumentsByStatus` Query hook requires an argument of type `ListStaffDocumentsByStatusVariables`:
const listStaffDocumentsByStatusVars: ListStaffDocumentsByStatusVariables = {
status: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListStaffDocumentsByStatus(listStaffDocumentsByStatusVars);
// Variables can be defined inline as well.
const query = useListStaffDocumentsByStatus({ status: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListStaffDocumentsByStatus(dataConnect, listStaffDocumentsByStatusVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListStaffDocumentsByStatus(listStaffDocumentsByStatusVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListStaffDocumentsByStatus(dataConnect, listStaffDocumentsByStatusVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.staffDocuments);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listAccounts
You can execute the listAccounts Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListAccounts(dc: DataConnect, options?: useDataConnectQueryOptions<ListAccountsData>): UseDataConnectQueryResult<ListAccountsData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListAccounts(options?: useDataConnectQueryOptions<ListAccountsData>): UseDataConnectQueryResult<ListAccountsData, undefined>;
Variables
The listAccounts Query has no variables.
Return Type
Recall that calling the listAccounts Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listAccounts Query is of type ListAccountsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListAccountsData {
accounts: ({
id: UUIDString;
bank: string;
type: AccountType;
last4: string;
isPrimary?: boolean | null;
ownerId: UUIDString;
accountNumber?: string | null;
routeNumber?: string | null;
expiryTime?: TimestampString | null;
createdAt?: TimestampString | null;
} & Account_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listAccounts's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListAccounts } from '@dataconnect/generated/react'
export default function ListAccountsComponent() {
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListAccounts();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListAccounts(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListAccounts(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListAccounts(dataConnect, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.accounts);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getAccountById
You can execute the getAccountById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetAccountById(dc: DataConnect, vars: GetAccountByIdVariables, options?: useDataConnectQueryOptions<GetAccountByIdData>): UseDataConnectQueryResult<GetAccountByIdData, GetAccountByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetAccountById(vars: GetAccountByIdVariables, options?: useDataConnectQueryOptions<GetAccountByIdData>): UseDataConnectQueryResult<GetAccountByIdData, GetAccountByIdVariables>;
Variables
The getAccountById Query requires an argument of type GetAccountByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetAccountByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getAccountById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getAccountById Query is of type GetAccountByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetAccountByIdData {
account?: {
id: UUIDString;
bank: string;
type: AccountType;
last4: string;
isPrimary?: boolean | null;
ownerId: UUIDString;
accountNumber?: string | null;
routeNumber?: string | null;
expiryTime?: TimestampString | null;
createdAt?: TimestampString | null;
} & Account_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getAccountById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetAccountByIdVariables } from '@dataconnect/generated';
import { useGetAccountById } from '@dataconnect/generated/react'
export default function GetAccountByIdComponent() {
// The `useGetAccountById` Query hook requires an argument of type `GetAccountByIdVariables`:
const getAccountByIdVars: GetAccountByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetAccountById(getAccountByIdVars);
// Variables can be defined inline as well.
const query = useGetAccountById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetAccountById(dataConnect, getAccountByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetAccountById(getAccountByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetAccountById(dataConnect, getAccountByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.account);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getAccountsByOwnerId
You can execute the getAccountsByOwnerId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetAccountsByOwnerId(dc: DataConnect, vars: GetAccountsByOwnerIdVariables, options?: useDataConnectQueryOptions<GetAccountsByOwnerIdData>): UseDataConnectQueryResult<GetAccountsByOwnerIdData, GetAccountsByOwnerIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetAccountsByOwnerId(vars: GetAccountsByOwnerIdVariables, options?: useDataConnectQueryOptions<GetAccountsByOwnerIdData>): UseDataConnectQueryResult<GetAccountsByOwnerIdData, GetAccountsByOwnerIdVariables>;
Variables
The getAccountsByOwnerId Query requires an argument of type GetAccountsByOwnerIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetAccountsByOwnerIdVariables {
ownerId: UUIDString;
}
Return Type
Recall that calling the getAccountsByOwnerId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getAccountsByOwnerId Query is of type GetAccountsByOwnerIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetAccountsByOwnerIdData {
accounts: ({
id: UUIDString;
bank: string;
type: AccountType;
last4: string;
isPrimary?: boolean | null;
ownerId: UUIDString;
accountNumber?: string | null;
routeNumber?: string | null;
expiryTime?: TimestampString | null;
createdAt?: TimestampString | null;
} & Account_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getAccountsByOwnerId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetAccountsByOwnerIdVariables } from '@dataconnect/generated';
import { useGetAccountsByOwnerId } from '@dataconnect/generated/react'
export default function GetAccountsByOwnerIdComponent() {
// The `useGetAccountsByOwnerId` Query hook requires an argument of type `GetAccountsByOwnerIdVariables`:
const getAccountsByOwnerIdVars: GetAccountsByOwnerIdVariables = {
ownerId: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetAccountsByOwnerId(getAccountsByOwnerIdVars);
// Variables can be defined inline as well.
const query = useGetAccountsByOwnerId({ ownerId: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetAccountsByOwnerId(dataConnect, getAccountsByOwnerIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetAccountsByOwnerId(getAccountsByOwnerIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetAccountsByOwnerId(dataConnect, getAccountsByOwnerIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.accounts);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterAccounts
You can execute the filterAccounts Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterAccounts(dc: DataConnect, vars?: FilterAccountsVariables, options?: useDataConnectQueryOptions<FilterAccountsData>): UseDataConnectQueryResult<FilterAccountsData, FilterAccountsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterAccounts(vars?: FilterAccountsVariables, options?: useDataConnectQueryOptions<FilterAccountsData>): UseDataConnectQueryResult<FilterAccountsData, FilterAccountsVariables>;
Variables
The filterAccounts Query has an optional argument of type FilterAccountsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterAccountsVariables {
bank?: string | null;
type?: AccountType | null;
isPrimary?: boolean | null;
ownerId?: UUIDString | null;
}
Return Type
Recall that calling the filterAccounts Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the filterAccounts Query is of type FilterAccountsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterAccountsData {
accounts: ({
id: UUIDString;
bank: string;
type: AccountType;
last4: string;
isPrimary?: boolean | null;
ownerId: UUIDString;
accountNumber?: string | null;
expiryTime?: TimestampString | null;
routeNumber?: string | null;
} & Account_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterAccounts's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterAccountsVariables } from '@dataconnect/generated';
import { useFilterAccounts } from '@dataconnect/generated/react'
export default function FilterAccountsComponent() {
// The `useFilterAccounts` Query hook has an optional argument of type `FilterAccountsVariables`:
const filterAccountsVars: FilterAccountsVariables = {
bank: ..., // optional
type: ..., // optional
isPrimary: ..., // optional
ownerId: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useFilterAccounts(filterAccountsVars);
// Variables can be defined inline as well.
const query = useFilterAccounts({ bank: ..., type: ..., isPrimary: ..., ownerId: ..., });
// Since all variables are optional for this Query, you can omit the `FilterAccountsVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterAccounts();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterAccounts(dataConnect, filterAccountsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterAccounts(filterAccountsVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useFilterAccounts(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useFilterAccounts(dataConnect, filterAccountsVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.accounts);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listApplications
You can execute the listApplications Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListApplications(dc: DataConnect, options?: useDataConnectQueryOptions<ListApplicationsData>): UseDataConnectQueryResult<ListApplicationsData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListApplications(options?: useDataConnectQueryOptions<ListApplicationsData>): UseDataConnectQueryResult<ListApplicationsData, undefined>;
Variables
The listApplications Query has no variables.
Return Type
Recall that calling the listApplications Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listApplications Query is of type ListApplicationsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListApplicationsData {
applications: ({
id: UUIDString;
shiftId: UUIDString;
staffId: UUIDString;
status: ApplicationStatus;
appliedAt?: TimestampString | null;
checkInTime?: TimestampString | null;
checkOutTime?: TimestampString | null;
origin: ApplicationOrigin;
createdAt?: TimestampString | null;
shift: {
id: UUIDString;
title: string;
date?: TimestampString | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
location?: string | null;
status?: ShiftStatus | null;
order: {
id: UUIDString;
eventName?: string | null;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
business: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & Order_Key;
} & Shift_Key;
shiftRole: {
id: UUIDString;
roleId: UUIDString;
count: number;
assigned?: number | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
totalValue?: number | null;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
};
} & Application_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listApplications's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListApplications } from '@dataconnect/generated/react'
export default function ListApplicationsComponent() {
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListApplications();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListApplications(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListApplications(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListApplications(dataConnect, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.applications);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getApplicationById
You can execute the getApplicationById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetApplicationById(dc: DataConnect, vars: GetApplicationByIdVariables, options?: useDataConnectQueryOptions<GetApplicationByIdData>): UseDataConnectQueryResult<GetApplicationByIdData, GetApplicationByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetApplicationById(vars: GetApplicationByIdVariables, options?: useDataConnectQueryOptions<GetApplicationByIdData>): UseDataConnectQueryResult<GetApplicationByIdData, GetApplicationByIdVariables>;
Variables
The getApplicationById Query requires an argument of type GetApplicationByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetApplicationByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getApplicationById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getApplicationById Query is of type GetApplicationByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetApplicationByIdData {
application?: {
id: UUIDString;
shiftId: UUIDString;
staffId: UUIDString;
status: ApplicationStatus;
appliedAt?: TimestampString | null;
checkInTime?: TimestampString | null;
checkOutTime?: TimestampString | null;
origin: ApplicationOrigin;
createdAt?: TimestampString | null;
shift: {
id: UUIDString;
title: string;
date?: TimestampString | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
location?: string | null;
status?: ShiftStatus | null;
order: {
id: UUIDString;
eventName?: string | null;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
business: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & Order_Key;
} & Shift_Key;
shiftRole: {
id: UUIDString;
roleId: UUIDString;
count: number;
assigned?: number | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
totalValue?: number | null;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
};
} & Application_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getApplicationById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetApplicationByIdVariables } from '@dataconnect/generated';
import { useGetApplicationById } from '@dataconnect/generated/react'
export default function GetApplicationByIdComponent() {
// The `useGetApplicationById` Query hook requires an argument of type `GetApplicationByIdVariables`:
const getApplicationByIdVars: GetApplicationByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetApplicationById(getApplicationByIdVars);
// Variables can be defined inline as well.
const query = useGetApplicationById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetApplicationById(dataConnect, getApplicationByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetApplicationById(getApplicationByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetApplicationById(dataConnect, getApplicationByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.application);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getApplicationsByShiftId
You can execute the getApplicationsByShiftId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetApplicationsByShiftId(dc: DataConnect, vars: GetApplicationsByShiftIdVariables, options?: useDataConnectQueryOptions<GetApplicationsByShiftIdData>): UseDataConnectQueryResult<GetApplicationsByShiftIdData, GetApplicationsByShiftIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetApplicationsByShiftId(vars: GetApplicationsByShiftIdVariables, options?: useDataConnectQueryOptions<GetApplicationsByShiftIdData>): UseDataConnectQueryResult<GetApplicationsByShiftIdData, GetApplicationsByShiftIdVariables>;
Variables
The getApplicationsByShiftId Query requires an argument of type GetApplicationsByShiftIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetApplicationsByShiftIdVariables {
shiftId: UUIDString;
}
Return Type
Recall that calling the getApplicationsByShiftId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getApplicationsByShiftId Query is of type GetApplicationsByShiftIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetApplicationsByShiftIdData {
applications: ({
id: UUIDString;
shiftId: UUIDString;
staffId: UUIDString;
status: ApplicationStatus;
appliedAt?: TimestampString | null;
checkInTime?: TimestampString | null;
checkOutTime?: TimestampString | null;
origin: ApplicationOrigin;
createdAt?: TimestampString | null;
shift: {
id: UUIDString;
title: string;
date?: TimestampString | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
location?: string | null;
status?: ShiftStatus | null;
order: {
id: UUIDString;
eventName?: string | null;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
business: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & Order_Key;
} & Shift_Key;
shiftRole: {
id: UUIDString;
roleId: UUIDString;
count: number;
assigned?: number | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
totalValue?: number | null;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
};
} & Application_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getApplicationsByShiftId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetApplicationsByShiftIdVariables } from '@dataconnect/generated';
import { useGetApplicationsByShiftId } from '@dataconnect/generated/react'
export default function GetApplicationsByShiftIdComponent() {
// The `useGetApplicationsByShiftId` Query hook requires an argument of type `GetApplicationsByShiftIdVariables`:
const getApplicationsByShiftIdVars: GetApplicationsByShiftIdVariables = {
shiftId: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetApplicationsByShiftId(getApplicationsByShiftIdVars);
// Variables can be defined inline as well.
const query = useGetApplicationsByShiftId({ shiftId: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetApplicationsByShiftId(dataConnect, getApplicationsByShiftIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetApplicationsByShiftId(getApplicationsByShiftIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetApplicationsByShiftId(dataConnect, getApplicationsByShiftIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.applications);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getApplicationsByShiftIdAndStatus
You can execute the getApplicationsByShiftIdAndStatus Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetApplicationsByShiftIdAndStatus(dc: DataConnect, vars: GetApplicationsByShiftIdAndStatusVariables, options?: useDataConnectQueryOptions<GetApplicationsByShiftIdAndStatusData>): UseDataConnectQueryResult<GetApplicationsByShiftIdAndStatusData, GetApplicationsByShiftIdAndStatusVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetApplicationsByShiftIdAndStatus(vars: GetApplicationsByShiftIdAndStatusVariables, options?: useDataConnectQueryOptions<GetApplicationsByShiftIdAndStatusData>): UseDataConnectQueryResult<GetApplicationsByShiftIdAndStatusData, GetApplicationsByShiftIdAndStatusVariables>;
Variables
The getApplicationsByShiftIdAndStatus Query requires an argument of type GetApplicationsByShiftIdAndStatusVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetApplicationsByShiftIdAndStatusVariables {
shiftId: UUIDString;
status: ApplicationStatus;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the getApplicationsByShiftIdAndStatus Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getApplicationsByShiftIdAndStatus Query is of type GetApplicationsByShiftIdAndStatusData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetApplicationsByShiftIdAndStatusData {
applications: ({
id: UUIDString;
shiftId: UUIDString;
staffId: UUIDString;
status: ApplicationStatus;
appliedAt?: TimestampString | null;
checkInTime?: TimestampString | null;
checkOutTime?: TimestampString | null;
origin: ApplicationOrigin;
createdAt?: TimestampString | null;
shift: {
id: UUIDString;
title: string;
date?: TimestampString | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
location?: string | null;
status?: ShiftStatus | null;
order: {
id: UUIDString;
eventName?: string | null;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
business: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & Order_Key;
} & Shift_Key;
shiftRole: {
id: UUIDString;
roleId: UUIDString;
count: number;
assigned?: number | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
totalValue?: number | null;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
};
} & Application_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getApplicationsByShiftIdAndStatus's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetApplicationsByShiftIdAndStatusVariables } from '@dataconnect/generated';
import { useGetApplicationsByShiftIdAndStatus } from '@dataconnect/generated/react'
export default function GetApplicationsByShiftIdAndStatusComponent() {
// The `useGetApplicationsByShiftIdAndStatus` Query hook requires an argument of type `GetApplicationsByShiftIdAndStatusVariables`:
const getApplicationsByShiftIdAndStatusVars: GetApplicationsByShiftIdAndStatusVariables = {
shiftId: ...,
status: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetApplicationsByShiftIdAndStatus(getApplicationsByShiftIdAndStatusVars);
// Variables can be defined inline as well.
const query = useGetApplicationsByShiftIdAndStatus({ shiftId: ..., status: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetApplicationsByShiftIdAndStatus(dataConnect, getApplicationsByShiftIdAndStatusVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetApplicationsByShiftIdAndStatus(getApplicationsByShiftIdAndStatusVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetApplicationsByShiftIdAndStatus(dataConnect, getApplicationsByShiftIdAndStatusVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.applications);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getApplicationsByStaffId
You can execute the getApplicationsByStaffId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetApplicationsByStaffId(dc: DataConnect, vars: GetApplicationsByStaffIdVariables, options?: useDataConnectQueryOptions<GetApplicationsByStaffIdData>): UseDataConnectQueryResult<GetApplicationsByStaffIdData, GetApplicationsByStaffIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetApplicationsByStaffId(vars: GetApplicationsByStaffIdVariables, options?: useDataConnectQueryOptions<GetApplicationsByStaffIdData>): UseDataConnectQueryResult<GetApplicationsByStaffIdData, GetApplicationsByStaffIdVariables>;
Variables
The getApplicationsByStaffId Query requires an argument of type GetApplicationsByStaffIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetApplicationsByStaffIdVariables {
staffId: UUIDString;
offset?: number | null;
limit?: number | null;
dayStart?: TimestampString | null;
dayEnd?: TimestampString | null;
}
Return Type
Recall that calling the getApplicationsByStaffId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getApplicationsByStaffId Query is of type GetApplicationsByStaffIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetApplicationsByStaffIdData {
applications: ({
id: UUIDString;
shiftId: UUIDString;
staffId: UUIDString;
status: ApplicationStatus;
appliedAt?: TimestampString | null;
checkInTime?: TimestampString | null;
checkOutTime?: TimestampString | null;
origin: ApplicationOrigin;
createdAt?: TimestampString | null;
shift: {
id: UUIDString;
title: string;
date?: TimestampString | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
location?: string | null;
status?: ShiftStatus | null;
durationDays?: number | null;
description?: string | null;
latitude?: number | null;
longitude?: number | null;
order: {
id: UUIDString;
eventName?: string | null;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
business: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
companyLogoUrl?: string | null;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & Order_Key;
} & Shift_Key;
shiftRole: {
id: UUIDString;
roleId: UUIDString;
count: number;
assigned?: number | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
totalValue?: number | null;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
};
} & Application_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getApplicationsByStaffId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetApplicationsByStaffIdVariables } from '@dataconnect/generated';
import { useGetApplicationsByStaffId } from '@dataconnect/generated/react'
export default function GetApplicationsByStaffIdComponent() {
// The `useGetApplicationsByStaffId` Query hook requires an argument of type `GetApplicationsByStaffIdVariables`:
const getApplicationsByStaffIdVars: GetApplicationsByStaffIdVariables = {
staffId: ...,
offset: ..., // optional
limit: ..., // optional
dayStart: ..., // optional
dayEnd: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetApplicationsByStaffId(getApplicationsByStaffIdVars);
// Variables can be defined inline as well.
const query = useGetApplicationsByStaffId({ staffId: ..., offset: ..., limit: ..., dayStart: ..., dayEnd: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetApplicationsByStaffId(dataConnect, getApplicationsByStaffIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetApplicationsByStaffId(getApplicationsByStaffIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetApplicationsByStaffId(dataConnect, getApplicationsByStaffIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.applications);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
vaidateDayStaffApplication
You can execute the vaidateDayStaffApplication Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useVaidateDayStaffApplication(dc: DataConnect, vars: VaidateDayStaffApplicationVariables, options?: useDataConnectQueryOptions<VaidateDayStaffApplicationData>): UseDataConnectQueryResult<VaidateDayStaffApplicationData, VaidateDayStaffApplicationVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useVaidateDayStaffApplication(vars: VaidateDayStaffApplicationVariables, options?: useDataConnectQueryOptions<VaidateDayStaffApplicationData>): UseDataConnectQueryResult<VaidateDayStaffApplicationData, VaidateDayStaffApplicationVariables>;
Variables
The vaidateDayStaffApplication Query requires an argument of type VaidateDayStaffApplicationVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface VaidateDayStaffApplicationVariables {
staffId: UUIDString;
offset?: number | null;
limit?: number | null;
dayStart?: TimestampString | null;
dayEnd?: TimestampString | null;
}
Return Type
Recall that calling the vaidateDayStaffApplication Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the vaidateDayStaffApplication Query is of type VaidateDayStaffApplicationData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface VaidateDayStaffApplicationData {
applications: ({
id: UUIDString;
shiftId: UUIDString;
staffId: UUIDString;
status: ApplicationStatus;
appliedAt?: TimestampString | null;
checkInTime?: TimestampString | null;
checkOutTime?: TimestampString | null;
origin: ApplicationOrigin;
createdAt?: TimestampString | null;
shift: {
id: UUIDString;
title: string;
date?: TimestampString | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
location?: string | null;
status?: ShiftStatus | null;
durationDays?: number | null;
description?: string | null;
order: {
id: UUIDString;
eventName?: string | null;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
business: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
companyLogoUrl?: string | null;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & Order_Key;
} & Shift_Key;
shiftRole: {
id: UUIDString;
roleId: UUIDString;
count: number;
assigned?: number | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
totalValue?: number | null;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
};
} & Application_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using vaidateDayStaffApplication's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, VaidateDayStaffApplicationVariables } from '@dataconnect/generated';
import { useVaidateDayStaffApplication } from '@dataconnect/generated/react'
export default function VaidateDayStaffApplicationComponent() {
// The `useVaidateDayStaffApplication` Query hook requires an argument of type `VaidateDayStaffApplicationVariables`:
const vaidateDayStaffApplicationVars: VaidateDayStaffApplicationVariables = {
staffId: ...,
offset: ..., // optional
limit: ..., // optional
dayStart: ..., // optional
dayEnd: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useVaidateDayStaffApplication(vaidateDayStaffApplicationVars);
// Variables can be defined inline as well.
const query = useVaidateDayStaffApplication({ staffId: ..., offset: ..., limit: ..., dayStart: ..., dayEnd: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useVaidateDayStaffApplication(dataConnect, vaidateDayStaffApplicationVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useVaidateDayStaffApplication(vaidateDayStaffApplicationVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useVaidateDayStaffApplication(dataConnect, vaidateDayStaffApplicationVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.applications);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getApplicationByStaffShiftAndRole
You can execute the getApplicationByStaffShiftAndRole Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetApplicationByStaffShiftAndRole(dc: DataConnect, vars: GetApplicationByStaffShiftAndRoleVariables, options?: useDataConnectQueryOptions<GetApplicationByStaffShiftAndRoleData>): UseDataConnectQueryResult<GetApplicationByStaffShiftAndRoleData, GetApplicationByStaffShiftAndRoleVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetApplicationByStaffShiftAndRole(vars: GetApplicationByStaffShiftAndRoleVariables, options?: useDataConnectQueryOptions<GetApplicationByStaffShiftAndRoleData>): UseDataConnectQueryResult<GetApplicationByStaffShiftAndRoleData, GetApplicationByStaffShiftAndRoleVariables>;
Variables
The getApplicationByStaffShiftAndRole Query requires an argument of type GetApplicationByStaffShiftAndRoleVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetApplicationByStaffShiftAndRoleVariables {
staffId: UUIDString;
shiftId: UUIDString;
roleId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the getApplicationByStaffShiftAndRole Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getApplicationByStaffShiftAndRole Query is of type GetApplicationByStaffShiftAndRoleData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetApplicationByStaffShiftAndRoleData {
applications: ({
id: UUIDString;
shiftId: UUIDString;
staffId: UUIDString;
status: ApplicationStatus;
appliedAt?: TimestampString | null;
checkInTime?: TimestampString | null;
checkOutTime?: TimestampString | null;
origin: ApplicationOrigin;
createdAt?: TimestampString | null;
shift: {
id: UUIDString;
title: string;
date?: TimestampString | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
location?: string | null;
status?: ShiftStatus | null;
order: {
id: UUIDString;
eventName?: string | null;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
business: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
companyLogoUrl?: string | null;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & Order_Key;
} & Shift_Key;
shiftRole: {
id: UUIDString;
roleId: UUIDString;
count: number;
assigned?: number | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
totalValue?: number | null;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
};
} & Application_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getApplicationByStaffShiftAndRole's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetApplicationByStaffShiftAndRoleVariables } from '@dataconnect/generated';
import { useGetApplicationByStaffShiftAndRole } from '@dataconnect/generated/react'
export default function GetApplicationByStaffShiftAndRoleComponent() {
// The `useGetApplicationByStaffShiftAndRole` Query hook requires an argument of type `GetApplicationByStaffShiftAndRoleVariables`:
const getApplicationByStaffShiftAndRoleVars: GetApplicationByStaffShiftAndRoleVariables = {
staffId: ...,
shiftId: ...,
roleId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetApplicationByStaffShiftAndRole(getApplicationByStaffShiftAndRoleVars);
// Variables can be defined inline as well.
const query = useGetApplicationByStaffShiftAndRole({ staffId: ..., shiftId: ..., roleId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetApplicationByStaffShiftAndRole(dataConnect, getApplicationByStaffShiftAndRoleVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetApplicationByStaffShiftAndRole(getApplicationByStaffShiftAndRoleVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetApplicationByStaffShiftAndRole(dataConnect, getApplicationByStaffShiftAndRoleVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.applications);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listAcceptedApplicationsByShiftRoleKey
You can execute the listAcceptedApplicationsByShiftRoleKey Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListAcceptedApplicationsByShiftRoleKey(dc: DataConnect, vars: ListAcceptedApplicationsByShiftRoleKeyVariables, options?: useDataConnectQueryOptions<ListAcceptedApplicationsByShiftRoleKeyData>): UseDataConnectQueryResult<ListAcceptedApplicationsByShiftRoleKeyData, ListAcceptedApplicationsByShiftRoleKeyVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListAcceptedApplicationsByShiftRoleKey(vars: ListAcceptedApplicationsByShiftRoleKeyVariables, options?: useDataConnectQueryOptions<ListAcceptedApplicationsByShiftRoleKeyData>): UseDataConnectQueryResult<ListAcceptedApplicationsByShiftRoleKeyData, ListAcceptedApplicationsByShiftRoleKeyVariables>;
Variables
The listAcceptedApplicationsByShiftRoleKey Query requires an argument of type ListAcceptedApplicationsByShiftRoleKeyVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListAcceptedApplicationsByShiftRoleKeyVariables {
shiftId: UUIDString;
roleId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listAcceptedApplicationsByShiftRoleKey Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listAcceptedApplicationsByShiftRoleKey Query is of type ListAcceptedApplicationsByShiftRoleKeyData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListAcceptedApplicationsByShiftRoleKeyData {
applications: ({
id: UUIDString;
checkInTime?: TimestampString | null;
checkOutTime?: TimestampString | null;
staff: {
id: UUIDString;
fullName: string;
email?: string | null;
phone?: string | null;
photoUrl?: string | null;
} & Staff_Key;
} & Application_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listAcceptedApplicationsByShiftRoleKey's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListAcceptedApplicationsByShiftRoleKeyVariables } from '@dataconnect/generated';
import { useListAcceptedApplicationsByShiftRoleKey } from '@dataconnect/generated/react'
export default function ListAcceptedApplicationsByShiftRoleKeyComponent() {
// The `useListAcceptedApplicationsByShiftRoleKey` Query hook requires an argument of type `ListAcceptedApplicationsByShiftRoleKeyVariables`:
const listAcceptedApplicationsByShiftRoleKeyVars: ListAcceptedApplicationsByShiftRoleKeyVariables = {
shiftId: ...,
roleId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListAcceptedApplicationsByShiftRoleKey(listAcceptedApplicationsByShiftRoleKeyVars);
// Variables can be defined inline as well.
const query = useListAcceptedApplicationsByShiftRoleKey({ shiftId: ..., roleId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListAcceptedApplicationsByShiftRoleKey(dataConnect, listAcceptedApplicationsByShiftRoleKeyVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListAcceptedApplicationsByShiftRoleKey(listAcceptedApplicationsByShiftRoleKeyVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListAcceptedApplicationsByShiftRoleKey(dataConnect, listAcceptedApplicationsByShiftRoleKeyVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.applications);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listAcceptedApplicationsByBusinessForDay
You can execute the listAcceptedApplicationsByBusinessForDay Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListAcceptedApplicationsByBusinessForDay(dc: DataConnect, vars: ListAcceptedApplicationsByBusinessForDayVariables, options?: useDataConnectQueryOptions<ListAcceptedApplicationsByBusinessForDayData>): UseDataConnectQueryResult<ListAcceptedApplicationsByBusinessForDayData, ListAcceptedApplicationsByBusinessForDayVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListAcceptedApplicationsByBusinessForDay(vars: ListAcceptedApplicationsByBusinessForDayVariables, options?: useDataConnectQueryOptions<ListAcceptedApplicationsByBusinessForDayData>): UseDataConnectQueryResult<ListAcceptedApplicationsByBusinessForDayData, ListAcceptedApplicationsByBusinessForDayVariables>;
Variables
The listAcceptedApplicationsByBusinessForDay Query requires an argument of type ListAcceptedApplicationsByBusinessForDayVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListAcceptedApplicationsByBusinessForDayVariables {
businessId: UUIDString;
dayStart: TimestampString;
dayEnd: TimestampString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listAcceptedApplicationsByBusinessForDay Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listAcceptedApplicationsByBusinessForDay Query is of type ListAcceptedApplicationsByBusinessForDayData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListAcceptedApplicationsByBusinessForDayData {
applications: ({
id: UUIDString;
shiftId: UUIDString;
roleId: UUIDString;
checkInTime?: TimestampString | null;
checkOutTime?: TimestampString | null;
appliedAt?: TimestampString | null;
staff: {
id: UUIDString;
fullName: string;
email?: string | null;
phone?: string | null;
photoUrl?: string | null;
averageRating?: number | null;
} & Staff_Key;
} & Application_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listAcceptedApplicationsByBusinessForDay's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListAcceptedApplicationsByBusinessForDayVariables } from '@dataconnect/generated';
import { useListAcceptedApplicationsByBusinessForDay } from '@dataconnect/generated/react'
export default function ListAcceptedApplicationsByBusinessForDayComponent() {
// The `useListAcceptedApplicationsByBusinessForDay` Query hook requires an argument of type `ListAcceptedApplicationsByBusinessForDayVariables`:
const listAcceptedApplicationsByBusinessForDayVars: ListAcceptedApplicationsByBusinessForDayVariables = {
businessId: ...,
dayStart: ...,
dayEnd: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListAcceptedApplicationsByBusinessForDay(listAcceptedApplicationsByBusinessForDayVars);
// Variables can be defined inline as well.
const query = useListAcceptedApplicationsByBusinessForDay({ businessId: ..., dayStart: ..., dayEnd: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListAcceptedApplicationsByBusinessForDay(dataConnect, listAcceptedApplicationsByBusinessForDayVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListAcceptedApplicationsByBusinessForDay(listAcceptedApplicationsByBusinessForDayVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListAcceptedApplicationsByBusinessForDay(dataConnect, listAcceptedApplicationsByBusinessForDayVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.applications);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listStaffsApplicationsByBusinessForDay
You can execute the listStaffsApplicationsByBusinessForDay Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListStaffsApplicationsByBusinessForDay(dc: DataConnect, vars: ListStaffsApplicationsByBusinessForDayVariables, options?: useDataConnectQueryOptions<ListStaffsApplicationsByBusinessForDayData>): UseDataConnectQueryResult<ListStaffsApplicationsByBusinessForDayData, ListStaffsApplicationsByBusinessForDayVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListStaffsApplicationsByBusinessForDay(vars: ListStaffsApplicationsByBusinessForDayVariables, options?: useDataConnectQueryOptions<ListStaffsApplicationsByBusinessForDayData>): UseDataConnectQueryResult<ListStaffsApplicationsByBusinessForDayData, ListStaffsApplicationsByBusinessForDayVariables>;
Variables
The listStaffsApplicationsByBusinessForDay Query requires an argument of type ListStaffsApplicationsByBusinessForDayVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffsApplicationsByBusinessForDayVariables {
businessId: UUIDString;
dayStart: TimestampString;
dayEnd: TimestampString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listStaffsApplicationsByBusinessForDay Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listStaffsApplicationsByBusinessForDay Query is of type ListStaffsApplicationsByBusinessForDayData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffsApplicationsByBusinessForDayData {
applications: ({
id: UUIDString;
shiftId: UUIDString;
roleId: UUIDString;
checkInTime?: TimestampString | null;
checkOutTime?: TimestampString | null;
appliedAt?: TimestampString | null;
status: ApplicationStatus;
shiftRole: {
shift: {
location?: string | null;
cost?: number | null;
};
count: number;
assigned?: number | null;
hours?: number | null;
role: {
name: string;
};
};
staff: {
id: UUIDString;
fullName: string;
email?: string | null;
phone?: string | null;
photoUrl?: string | null;
} & Staff_Key;
} & Application_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listStaffsApplicationsByBusinessForDay's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListStaffsApplicationsByBusinessForDayVariables } from '@dataconnect/generated';
import { useListStaffsApplicationsByBusinessForDay } from '@dataconnect/generated/react'
export default function ListStaffsApplicationsByBusinessForDayComponent() {
// The `useListStaffsApplicationsByBusinessForDay` Query hook requires an argument of type `ListStaffsApplicationsByBusinessForDayVariables`:
const listStaffsApplicationsByBusinessForDayVars: ListStaffsApplicationsByBusinessForDayVariables = {
businessId: ...,
dayStart: ...,
dayEnd: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListStaffsApplicationsByBusinessForDay(listStaffsApplicationsByBusinessForDayVars);
// Variables can be defined inline as well.
const query = useListStaffsApplicationsByBusinessForDay({ businessId: ..., dayStart: ..., dayEnd: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListStaffsApplicationsByBusinessForDay(dataConnect, listStaffsApplicationsByBusinessForDayVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListStaffsApplicationsByBusinessForDay(listStaffsApplicationsByBusinessForDayVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListStaffsApplicationsByBusinessForDay(dataConnect, listStaffsApplicationsByBusinessForDayVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.applications);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listCompletedApplicationsByStaffId
You can execute the listCompletedApplicationsByStaffId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListCompletedApplicationsByStaffId(dc: DataConnect, vars: ListCompletedApplicationsByStaffIdVariables, options?: useDataConnectQueryOptions<ListCompletedApplicationsByStaffIdData>): UseDataConnectQueryResult<ListCompletedApplicationsByStaffIdData, ListCompletedApplicationsByStaffIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListCompletedApplicationsByStaffId(vars: ListCompletedApplicationsByStaffIdVariables, options?: useDataConnectQueryOptions<ListCompletedApplicationsByStaffIdData>): UseDataConnectQueryResult<ListCompletedApplicationsByStaffIdData, ListCompletedApplicationsByStaffIdVariables>;
Variables
The listCompletedApplicationsByStaffId Query requires an argument of type ListCompletedApplicationsByStaffIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListCompletedApplicationsByStaffIdVariables {
staffId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listCompletedApplicationsByStaffId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listCompletedApplicationsByStaffId Query is of type ListCompletedApplicationsByStaffIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListCompletedApplicationsByStaffIdData {
applications: ({
id: UUIDString;
shiftId: UUIDString;
staffId: UUIDString;
status: ApplicationStatus;
appliedAt?: TimestampString | null;
checkInTime?: TimestampString | null;
checkOutTime?: TimestampString | null;
origin: ApplicationOrigin;
createdAt?: TimestampString | null;
shift: {
id: UUIDString;
title: string;
date?: TimestampString | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
location?: string | null;
status?: ShiftStatus | null;
description?: string | null;
durationDays?: number | null;
order: {
id: UUIDString;
eventName?: string | null;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
business: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
companyLogoUrl?: string | null;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & Order_Key;
} & Shift_Key;
shiftRole: {
id: UUIDString;
roleId: UUIDString;
count: number;
assigned?: number | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
totalValue?: number | null;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
};
} & Application_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listCompletedApplicationsByStaffId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListCompletedApplicationsByStaffIdVariables } from '@dataconnect/generated';
import { useListCompletedApplicationsByStaffId } from '@dataconnect/generated/react'
export default function ListCompletedApplicationsByStaffIdComponent() {
// The `useListCompletedApplicationsByStaffId` Query hook requires an argument of type `ListCompletedApplicationsByStaffIdVariables`:
const listCompletedApplicationsByStaffIdVars: ListCompletedApplicationsByStaffIdVariables = {
staffId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListCompletedApplicationsByStaffId(listCompletedApplicationsByStaffIdVars);
// Variables can be defined inline as well.
const query = useListCompletedApplicationsByStaffId({ staffId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListCompletedApplicationsByStaffId(dataConnect, listCompletedApplicationsByStaffIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListCompletedApplicationsByStaffId(listCompletedApplicationsByStaffIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListCompletedApplicationsByStaffId(dataConnect, listCompletedApplicationsByStaffIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.applications);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listAttireOptions
You can execute the listAttireOptions Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListAttireOptions(dc: DataConnect, options?: useDataConnectQueryOptions<ListAttireOptionsData>): UseDataConnectQueryResult<ListAttireOptionsData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListAttireOptions(options?: useDataConnectQueryOptions<ListAttireOptionsData>): UseDataConnectQueryResult<ListAttireOptionsData, undefined>;
Variables
The listAttireOptions Query has no variables.
Return Type
Recall that calling the listAttireOptions Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listAttireOptions Query is of type ListAttireOptionsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListAttireOptionsData {
attireOptions: ({
id: UUIDString;
itemId: string;
label: string;
icon?: string | null;
imageUrl?: string | null;
isMandatory?: boolean | null;
vendorId?: UUIDString | null;
createdAt?: TimestampString | null;
} & AttireOption_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listAttireOptions's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListAttireOptions } from '@dataconnect/generated/react'
export default function ListAttireOptionsComponent() {
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListAttireOptions();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListAttireOptions(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListAttireOptions(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListAttireOptions(dataConnect, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.attireOptions);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getAttireOptionById
You can execute the getAttireOptionById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetAttireOptionById(dc: DataConnect, vars: GetAttireOptionByIdVariables, options?: useDataConnectQueryOptions<GetAttireOptionByIdData>): UseDataConnectQueryResult<GetAttireOptionByIdData, GetAttireOptionByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetAttireOptionById(vars: GetAttireOptionByIdVariables, options?: useDataConnectQueryOptions<GetAttireOptionByIdData>): UseDataConnectQueryResult<GetAttireOptionByIdData, GetAttireOptionByIdVariables>;
Variables
The getAttireOptionById Query requires an argument of type GetAttireOptionByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetAttireOptionByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getAttireOptionById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getAttireOptionById Query is of type GetAttireOptionByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetAttireOptionByIdData {
attireOption?: {
id: UUIDString;
itemId: string;
label: string;
icon?: string | null;
imageUrl?: string | null;
isMandatory?: boolean | null;
vendorId?: UUIDString | null;
createdAt?: TimestampString | null;
} & AttireOption_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getAttireOptionById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetAttireOptionByIdVariables } from '@dataconnect/generated';
import { useGetAttireOptionById } from '@dataconnect/generated/react'
export default function GetAttireOptionByIdComponent() {
// The `useGetAttireOptionById` Query hook requires an argument of type `GetAttireOptionByIdVariables`:
const getAttireOptionByIdVars: GetAttireOptionByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetAttireOptionById(getAttireOptionByIdVars);
// Variables can be defined inline as well.
const query = useGetAttireOptionById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetAttireOptionById(dataConnect, getAttireOptionByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetAttireOptionById(getAttireOptionByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetAttireOptionById(dataConnect, getAttireOptionByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.attireOption);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterAttireOptions
You can execute the filterAttireOptions Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterAttireOptions(dc: DataConnect, vars?: FilterAttireOptionsVariables, options?: useDataConnectQueryOptions<FilterAttireOptionsData>): UseDataConnectQueryResult<FilterAttireOptionsData, FilterAttireOptionsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterAttireOptions(vars?: FilterAttireOptionsVariables, options?: useDataConnectQueryOptions<FilterAttireOptionsData>): UseDataConnectQueryResult<FilterAttireOptionsData, FilterAttireOptionsVariables>;
Variables
The filterAttireOptions Query has an optional argument of type FilterAttireOptionsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterAttireOptionsVariables {
itemId?: string | null;
isMandatory?: boolean | null;
vendorId?: UUIDString | null;
}
Return Type
Recall that calling the filterAttireOptions Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the filterAttireOptions Query is of type FilterAttireOptionsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterAttireOptionsData {
attireOptions: ({
id: UUIDString;
itemId: string;
label: string;
icon?: string | null;
imageUrl?: string | null;
isMandatory?: boolean | null;
vendorId?: UUIDString | null;
} & AttireOption_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterAttireOptions's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterAttireOptionsVariables } from '@dataconnect/generated';
import { useFilterAttireOptions } from '@dataconnect/generated/react'
export default function FilterAttireOptionsComponent() {
// The `useFilterAttireOptions` Query hook has an optional argument of type `FilterAttireOptionsVariables`:
const filterAttireOptionsVars: FilterAttireOptionsVariables = {
itemId: ..., // optional
isMandatory: ..., // optional
vendorId: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useFilterAttireOptions(filterAttireOptionsVars);
// Variables can be defined inline as well.
const query = useFilterAttireOptions({ itemId: ..., isMandatory: ..., vendorId: ..., });
// Since all variables are optional for this Query, you can omit the `FilterAttireOptionsVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterAttireOptions();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterAttireOptions(dataConnect, filterAttireOptionsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterAttireOptions(filterAttireOptionsVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useFilterAttireOptions(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useFilterAttireOptions(dataConnect, filterAttireOptionsVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.attireOptions);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listCustomRateCards
You can execute the listCustomRateCards Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListCustomRateCards(dc: DataConnect, options?: useDataConnectQueryOptions<ListCustomRateCardsData>): UseDataConnectQueryResult<ListCustomRateCardsData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListCustomRateCards(options?: useDataConnectQueryOptions<ListCustomRateCardsData>): UseDataConnectQueryResult<ListCustomRateCardsData, undefined>;
Variables
The listCustomRateCards Query has no variables.
Return Type
Recall that calling the listCustomRateCards Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listCustomRateCards Query is of type ListCustomRateCardsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListCustomRateCardsData {
customRateCards: ({
id: UUIDString;
name: string;
baseBook?: string | null;
discount?: number | null;
isDefault?: boolean | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
} & CustomRateCard_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listCustomRateCards's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListCustomRateCards } from '@dataconnect/generated/react'
export default function ListCustomRateCardsComponent() {
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListCustomRateCards();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListCustomRateCards(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListCustomRateCards(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListCustomRateCards(dataConnect, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.customRateCards);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getCustomRateCardById
You can execute the getCustomRateCardById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetCustomRateCardById(dc: DataConnect, vars: GetCustomRateCardByIdVariables, options?: useDataConnectQueryOptions<GetCustomRateCardByIdData>): UseDataConnectQueryResult<GetCustomRateCardByIdData, GetCustomRateCardByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetCustomRateCardById(vars: GetCustomRateCardByIdVariables, options?: useDataConnectQueryOptions<GetCustomRateCardByIdData>): UseDataConnectQueryResult<GetCustomRateCardByIdData, GetCustomRateCardByIdVariables>;
Variables
The getCustomRateCardById Query requires an argument of type GetCustomRateCardByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetCustomRateCardByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getCustomRateCardById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getCustomRateCardById Query is of type GetCustomRateCardByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetCustomRateCardByIdData {
customRateCard?: {
id: UUIDString;
name: string;
baseBook?: string | null;
discount?: number | null;
isDefault?: boolean | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
} & CustomRateCard_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getCustomRateCardById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetCustomRateCardByIdVariables } from '@dataconnect/generated';
import { useGetCustomRateCardById } from '@dataconnect/generated/react'
export default function GetCustomRateCardByIdComponent() {
// The `useGetCustomRateCardById` Query hook requires an argument of type `GetCustomRateCardByIdVariables`:
const getCustomRateCardByIdVars: GetCustomRateCardByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetCustomRateCardById(getCustomRateCardByIdVars);
// Variables can be defined inline as well.
const query = useGetCustomRateCardById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetCustomRateCardById(dataConnect, getCustomRateCardByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetCustomRateCardById(getCustomRateCardByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetCustomRateCardById(dataConnect, getCustomRateCardByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.customRateCard);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listRoleCategories
You can execute the listRoleCategories Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListRoleCategories(dc: DataConnect, options?: useDataConnectQueryOptions<ListRoleCategoriesData>): UseDataConnectQueryResult<ListRoleCategoriesData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListRoleCategories(options?: useDataConnectQueryOptions<ListRoleCategoriesData>): UseDataConnectQueryResult<ListRoleCategoriesData, undefined>;
Variables
The listRoleCategories Query has no variables.
Return Type
Recall that calling the listRoleCategories Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listRoleCategories Query is of type ListRoleCategoriesData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListRoleCategoriesData {
roleCategories: ({
id: UUIDString;
roleName: string;
category: RoleCategoryType;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
} & RoleCategory_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listRoleCategories's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListRoleCategories } from '@dataconnect/generated/react'
export default function ListRoleCategoriesComponent() {
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListRoleCategories();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListRoleCategories(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListRoleCategories(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListRoleCategories(dataConnect, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.roleCategories);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getRoleCategoryById
You can execute the getRoleCategoryById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetRoleCategoryById(dc: DataConnect, vars: GetRoleCategoryByIdVariables, options?: useDataConnectQueryOptions<GetRoleCategoryByIdData>): UseDataConnectQueryResult<GetRoleCategoryByIdData, GetRoleCategoryByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetRoleCategoryById(vars: GetRoleCategoryByIdVariables, options?: useDataConnectQueryOptions<GetRoleCategoryByIdData>): UseDataConnectQueryResult<GetRoleCategoryByIdData, GetRoleCategoryByIdVariables>;
Variables
The getRoleCategoryById Query requires an argument of type GetRoleCategoryByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetRoleCategoryByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getRoleCategoryById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getRoleCategoryById Query is of type GetRoleCategoryByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetRoleCategoryByIdData {
roleCategory?: {
id: UUIDString;
roleName: string;
category: RoleCategoryType;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
} & RoleCategory_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getRoleCategoryById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetRoleCategoryByIdVariables } from '@dataconnect/generated';
import { useGetRoleCategoryById } from '@dataconnect/generated/react'
export default function GetRoleCategoryByIdComponent() {
// The `useGetRoleCategoryById` Query hook requires an argument of type `GetRoleCategoryByIdVariables`:
const getRoleCategoryByIdVars: GetRoleCategoryByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetRoleCategoryById(getRoleCategoryByIdVars);
// Variables can be defined inline as well.
const query = useGetRoleCategoryById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetRoleCategoryById(dataConnect, getRoleCategoryByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetRoleCategoryById(getRoleCategoryByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetRoleCategoryById(dataConnect, getRoleCategoryByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.roleCategory);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getRoleCategoriesByCategory
You can execute the getRoleCategoriesByCategory Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetRoleCategoriesByCategory(dc: DataConnect, vars: GetRoleCategoriesByCategoryVariables, options?: useDataConnectQueryOptions<GetRoleCategoriesByCategoryData>): UseDataConnectQueryResult<GetRoleCategoriesByCategoryData, GetRoleCategoriesByCategoryVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetRoleCategoriesByCategory(vars: GetRoleCategoriesByCategoryVariables, options?: useDataConnectQueryOptions<GetRoleCategoriesByCategoryData>): UseDataConnectQueryResult<GetRoleCategoriesByCategoryData, GetRoleCategoriesByCategoryVariables>;
Variables
The getRoleCategoriesByCategory Query requires an argument of type GetRoleCategoriesByCategoryVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetRoleCategoriesByCategoryVariables {
category: RoleCategoryType;
}
Return Type
Recall that calling the getRoleCategoriesByCategory Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getRoleCategoriesByCategory Query is of type GetRoleCategoriesByCategoryData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetRoleCategoriesByCategoryData {
roleCategories: ({
id: UUIDString;
roleName: string;
category: RoleCategoryType;
} & RoleCategory_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getRoleCategoriesByCategory's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetRoleCategoriesByCategoryVariables } from '@dataconnect/generated';
import { useGetRoleCategoriesByCategory } from '@dataconnect/generated/react'
export default function GetRoleCategoriesByCategoryComponent() {
// The `useGetRoleCategoriesByCategory` Query hook requires an argument of type `GetRoleCategoriesByCategoryVariables`:
const getRoleCategoriesByCategoryVars: GetRoleCategoriesByCategoryVariables = {
category: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetRoleCategoriesByCategory(getRoleCategoriesByCategoryVars);
// Variables can be defined inline as well.
const query = useGetRoleCategoriesByCategory({ category: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetRoleCategoriesByCategory(dataConnect, getRoleCategoriesByCategoryVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetRoleCategoriesByCategory(getRoleCategoriesByCategoryVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetRoleCategoriesByCategory(dataConnect, getRoleCategoriesByCategoryVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.roleCategories);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listStaffAvailabilities
You can execute the listStaffAvailabilities Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListStaffAvailabilities(dc: DataConnect, vars?: ListStaffAvailabilitiesVariables, options?: useDataConnectQueryOptions<ListStaffAvailabilitiesData>): UseDataConnectQueryResult<ListStaffAvailabilitiesData, ListStaffAvailabilitiesVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListStaffAvailabilities(vars?: ListStaffAvailabilitiesVariables, options?: useDataConnectQueryOptions<ListStaffAvailabilitiesData>): UseDataConnectQueryResult<ListStaffAvailabilitiesData, ListStaffAvailabilitiesVariables>;
Variables
The listStaffAvailabilities Query has an optional argument of type ListStaffAvailabilitiesVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffAvailabilitiesVariables {
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listStaffAvailabilities Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listStaffAvailabilities Query is of type ListStaffAvailabilitiesData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffAvailabilitiesData {
staffAvailabilities: ({
id: UUIDString;
staffId: UUIDString;
day: DayOfWeek;
slot: AvailabilitySlot;
status: AvailabilityStatus;
notes?: string | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
staff: {
id: UUIDString;
fullName: string;
} & Staff_Key;
} & StaffAvailability_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listStaffAvailabilities's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListStaffAvailabilitiesVariables } from '@dataconnect/generated';
import { useListStaffAvailabilities } from '@dataconnect/generated/react'
export default function ListStaffAvailabilitiesComponent() {
// The `useListStaffAvailabilities` Query hook has an optional argument of type `ListStaffAvailabilitiesVariables`:
const listStaffAvailabilitiesVars: ListStaffAvailabilitiesVariables = {
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListStaffAvailabilities(listStaffAvailabilitiesVars);
// Variables can be defined inline as well.
const query = useListStaffAvailabilities({ offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `ListStaffAvailabilitiesVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useListStaffAvailabilities();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListStaffAvailabilities(dataConnect, listStaffAvailabilitiesVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListStaffAvailabilities(listStaffAvailabilitiesVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useListStaffAvailabilities(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListStaffAvailabilities(dataConnect, listStaffAvailabilitiesVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.staffAvailabilities);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listStaffAvailabilitiesByStaffId
You can execute the listStaffAvailabilitiesByStaffId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListStaffAvailabilitiesByStaffId(dc: DataConnect, vars: ListStaffAvailabilitiesByStaffIdVariables, options?: useDataConnectQueryOptions<ListStaffAvailabilitiesByStaffIdData>): UseDataConnectQueryResult<ListStaffAvailabilitiesByStaffIdData, ListStaffAvailabilitiesByStaffIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListStaffAvailabilitiesByStaffId(vars: ListStaffAvailabilitiesByStaffIdVariables, options?: useDataConnectQueryOptions<ListStaffAvailabilitiesByStaffIdData>): UseDataConnectQueryResult<ListStaffAvailabilitiesByStaffIdData, ListStaffAvailabilitiesByStaffIdVariables>;
Variables
The listStaffAvailabilitiesByStaffId Query requires an argument of type ListStaffAvailabilitiesByStaffIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffAvailabilitiesByStaffIdVariables {
staffId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listStaffAvailabilitiesByStaffId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listStaffAvailabilitiesByStaffId Query is of type ListStaffAvailabilitiesByStaffIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffAvailabilitiesByStaffIdData {
staffAvailabilities: ({
id: UUIDString;
staffId: UUIDString;
day: DayOfWeek;
slot: AvailabilitySlot;
status: AvailabilityStatus;
notes?: string | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
staff: {
id: UUIDString;
fullName: string;
} & Staff_Key;
} & StaffAvailability_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listStaffAvailabilitiesByStaffId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListStaffAvailabilitiesByStaffIdVariables } from '@dataconnect/generated';
import { useListStaffAvailabilitiesByStaffId } from '@dataconnect/generated/react'
export default function ListStaffAvailabilitiesByStaffIdComponent() {
// The `useListStaffAvailabilitiesByStaffId` Query hook requires an argument of type `ListStaffAvailabilitiesByStaffIdVariables`:
const listStaffAvailabilitiesByStaffIdVars: ListStaffAvailabilitiesByStaffIdVariables = {
staffId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListStaffAvailabilitiesByStaffId(listStaffAvailabilitiesByStaffIdVars);
// Variables can be defined inline as well.
const query = useListStaffAvailabilitiesByStaffId({ staffId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListStaffAvailabilitiesByStaffId(dataConnect, listStaffAvailabilitiesByStaffIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListStaffAvailabilitiesByStaffId(listStaffAvailabilitiesByStaffIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListStaffAvailabilitiesByStaffId(dataConnect, listStaffAvailabilitiesByStaffIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.staffAvailabilities);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getStaffAvailabilityByKey
You can execute the getStaffAvailabilityByKey Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetStaffAvailabilityByKey(dc: DataConnect, vars: GetStaffAvailabilityByKeyVariables, options?: useDataConnectQueryOptions<GetStaffAvailabilityByKeyData>): UseDataConnectQueryResult<GetStaffAvailabilityByKeyData, GetStaffAvailabilityByKeyVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetStaffAvailabilityByKey(vars: GetStaffAvailabilityByKeyVariables, options?: useDataConnectQueryOptions<GetStaffAvailabilityByKeyData>): UseDataConnectQueryResult<GetStaffAvailabilityByKeyData, GetStaffAvailabilityByKeyVariables>;
Variables
The getStaffAvailabilityByKey Query requires an argument of type GetStaffAvailabilityByKeyVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetStaffAvailabilityByKeyVariables {
staffId: UUIDString;
day: DayOfWeek;
slot: AvailabilitySlot;
}
Return Type
Recall that calling the getStaffAvailabilityByKey Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getStaffAvailabilityByKey Query is of type GetStaffAvailabilityByKeyData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetStaffAvailabilityByKeyData {
staffAvailability?: {
id: UUIDString;
staffId: UUIDString;
day: DayOfWeek;
slot: AvailabilitySlot;
status: AvailabilityStatus;
notes?: string | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
staff: {
id: UUIDString;
fullName: string;
} & Staff_Key;
} & StaffAvailability_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getStaffAvailabilityByKey's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetStaffAvailabilityByKeyVariables } from '@dataconnect/generated';
import { useGetStaffAvailabilityByKey } from '@dataconnect/generated/react'
export default function GetStaffAvailabilityByKeyComponent() {
// The `useGetStaffAvailabilityByKey` Query hook requires an argument of type `GetStaffAvailabilityByKeyVariables`:
const getStaffAvailabilityByKeyVars: GetStaffAvailabilityByKeyVariables = {
staffId: ...,
day: ...,
slot: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetStaffAvailabilityByKey(getStaffAvailabilityByKeyVars);
// Variables can be defined inline as well.
const query = useGetStaffAvailabilityByKey({ staffId: ..., day: ..., slot: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetStaffAvailabilityByKey(dataConnect, getStaffAvailabilityByKeyVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetStaffAvailabilityByKey(getStaffAvailabilityByKeyVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetStaffAvailabilityByKey(dataConnect, getStaffAvailabilityByKeyVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.staffAvailability);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listStaffAvailabilitiesByDay
You can execute the listStaffAvailabilitiesByDay Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListStaffAvailabilitiesByDay(dc: DataConnect, vars: ListStaffAvailabilitiesByDayVariables, options?: useDataConnectQueryOptions<ListStaffAvailabilitiesByDayData>): UseDataConnectQueryResult<ListStaffAvailabilitiesByDayData, ListStaffAvailabilitiesByDayVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListStaffAvailabilitiesByDay(vars: ListStaffAvailabilitiesByDayVariables, options?: useDataConnectQueryOptions<ListStaffAvailabilitiesByDayData>): UseDataConnectQueryResult<ListStaffAvailabilitiesByDayData, ListStaffAvailabilitiesByDayVariables>;
Variables
The listStaffAvailabilitiesByDay Query requires an argument of type ListStaffAvailabilitiesByDayVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffAvailabilitiesByDayVariables {
day: DayOfWeek;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listStaffAvailabilitiesByDay Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listStaffAvailabilitiesByDay Query is of type ListStaffAvailabilitiesByDayData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffAvailabilitiesByDayData {
staffAvailabilities: ({
id: UUIDString;
staffId: UUIDString;
day: DayOfWeek;
slot: AvailabilitySlot;
status: AvailabilityStatus;
notes?: string | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
staff: {
id: UUIDString;
fullName: string;
} & Staff_Key;
} & StaffAvailability_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listStaffAvailabilitiesByDay's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListStaffAvailabilitiesByDayVariables } from '@dataconnect/generated';
import { useListStaffAvailabilitiesByDay } from '@dataconnect/generated/react'
export default function ListStaffAvailabilitiesByDayComponent() {
// The `useListStaffAvailabilitiesByDay` Query hook requires an argument of type `ListStaffAvailabilitiesByDayVariables`:
const listStaffAvailabilitiesByDayVars: ListStaffAvailabilitiesByDayVariables = {
day: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListStaffAvailabilitiesByDay(listStaffAvailabilitiesByDayVars);
// Variables can be defined inline as well.
const query = useListStaffAvailabilitiesByDay({ day: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListStaffAvailabilitiesByDay(dataConnect, listStaffAvailabilitiesByDayVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListStaffAvailabilitiesByDay(listStaffAvailabilitiesByDayVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListStaffAvailabilitiesByDay(dataConnect, listStaffAvailabilitiesByDayVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.staffAvailabilities);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listRecentPayments
You can execute the listRecentPayments Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListRecentPayments(dc: DataConnect, vars?: ListRecentPaymentsVariables, options?: useDataConnectQueryOptions<ListRecentPaymentsData>): UseDataConnectQueryResult<ListRecentPaymentsData, ListRecentPaymentsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListRecentPayments(vars?: ListRecentPaymentsVariables, options?: useDataConnectQueryOptions<ListRecentPaymentsData>): UseDataConnectQueryResult<ListRecentPaymentsData, ListRecentPaymentsVariables>;
Variables
The listRecentPayments Query has an optional argument of type ListRecentPaymentsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListRecentPaymentsVariables {
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listRecentPayments Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listRecentPayments Query is of type ListRecentPaymentsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListRecentPaymentsData {
recentPayments: ({
id: UUIDString;
workedTime?: string | null;
status?: RecentPaymentStatus | null;
staffId: UUIDString;
applicationId: UUIDString;
invoiceId: UUIDString;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
application: {
checkInTime?: TimestampString | null;
checkOutTime?: TimestampString | null;
shiftRole: {
hours?: number | null;
totalValue?: number | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
role: {
name: string;
costPerHour: number;
};
shift: {
title: string;
date?: TimestampString | null;
location?: string | null;
locationAddress?: string | null;
description?: string | null;
};
};
};
invoice: {
status: InvoiceStatus;
invoiceNumber: string;
issueDate: TimestampString;
business: {
id: UUIDString;
businessName: string;
} & Business_Key;
vendor: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
order: {
id: UUIDString;
eventName?: string | null;
} & Order_Key;
};
} & RecentPayment_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listRecentPayments's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListRecentPaymentsVariables } from '@dataconnect/generated';
import { useListRecentPayments } from '@dataconnect/generated/react'
export default function ListRecentPaymentsComponent() {
// The `useListRecentPayments` Query hook has an optional argument of type `ListRecentPaymentsVariables`:
const listRecentPaymentsVars: ListRecentPaymentsVariables = {
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListRecentPayments(listRecentPaymentsVars);
// Variables can be defined inline as well.
const query = useListRecentPayments({ offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `ListRecentPaymentsVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useListRecentPayments();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListRecentPayments(dataConnect, listRecentPaymentsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListRecentPayments(listRecentPaymentsVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useListRecentPayments(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListRecentPayments(dataConnect, listRecentPaymentsVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.recentPayments);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getRecentPaymentById
You can execute the getRecentPaymentById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetRecentPaymentById(dc: DataConnect, vars: GetRecentPaymentByIdVariables, options?: useDataConnectQueryOptions<GetRecentPaymentByIdData>): UseDataConnectQueryResult<GetRecentPaymentByIdData, GetRecentPaymentByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetRecentPaymentById(vars: GetRecentPaymentByIdVariables, options?: useDataConnectQueryOptions<GetRecentPaymentByIdData>): UseDataConnectQueryResult<GetRecentPaymentByIdData, GetRecentPaymentByIdVariables>;
Variables
The getRecentPaymentById Query requires an argument of type GetRecentPaymentByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetRecentPaymentByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getRecentPaymentById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getRecentPaymentById Query is of type GetRecentPaymentByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetRecentPaymentByIdData {
recentPayment?: {
id: UUIDString;
workedTime?: string | null;
status?: RecentPaymentStatus | null;
staffId: UUIDString;
applicationId: UUIDString;
invoiceId: UUIDString;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
application: {
checkInTime?: TimestampString | null;
checkOutTime?: TimestampString | null;
shiftRole: {
hours?: number | null;
totalValue?: number | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
role: {
name: string;
costPerHour: number;
};
shift: {
title: string;
date?: TimestampString | null;
location?: string | null;
locationAddress?: string | null;
description?: string | null;
};
};
};
invoice: {
status: InvoiceStatus;
invoiceNumber: string;
issueDate: TimestampString;
business: {
id: UUIDString;
businessName: string;
} & Business_Key;
vendor: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
order: {
id: UUIDString;
eventName?: string | null;
} & Order_Key;
};
} & RecentPayment_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getRecentPaymentById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetRecentPaymentByIdVariables } from '@dataconnect/generated';
import { useGetRecentPaymentById } from '@dataconnect/generated/react'
export default function GetRecentPaymentByIdComponent() {
// The `useGetRecentPaymentById` Query hook requires an argument of type `GetRecentPaymentByIdVariables`:
const getRecentPaymentByIdVars: GetRecentPaymentByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetRecentPaymentById(getRecentPaymentByIdVars);
// Variables can be defined inline as well.
const query = useGetRecentPaymentById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetRecentPaymentById(dataConnect, getRecentPaymentByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetRecentPaymentById(getRecentPaymentByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetRecentPaymentById(dataConnect, getRecentPaymentByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.recentPayment);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listRecentPaymentsByStaffId
You can execute the listRecentPaymentsByStaffId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListRecentPaymentsByStaffId(dc: DataConnect, vars: ListRecentPaymentsByStaffIdVariables, options?: useDataConnectQueryOptions<ListRecentPaymentsByStaffIdData>): UseDataConnectQueryResult<ListRecentPaymentsByStaffIdData, ListRecentPaymentsByStaffIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListRecentPaymentsByStaffId(vars: ListRecentPaymentsByStaffIdVariables, options?: useDataConnectQueryOptions<ListRecentPaymentsByStaffIdData>): UseDataConnectQueryResult<ListRecentPaymentsByStaffIdData, ListRecentPaymentsByStaffIdVariables>;
Variables
The listRecentPaymentsByStaffId Query requires an argument of type ListRecentPaymentsByStaffIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListRecentPaymentsByStaffIdVariables {
staffId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listRecentPaymentsByStaffId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listRecentPaymentsByStaffId Query is of type ListRecentPaymentsByStaffIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListRecentPaymentsByStaffIdData {
recentPayments: ({
id: UUIDString;
workedTime?: string | null;
status?: RecentPaymentStatus | null;
staffId: UUIDString;
applicationId: UUIDString;
invoiceId: UUIDString;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
application: {
id: UUIDString;
status: ApplicationStatus;
shiftRole: {
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
totalValue?: number | null;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
shift: {
id: UUIDString;
title: string;
date?: TimestampString | null;
locationAddress?: string | null;
} & Shift_Key;
};
} & Application_Key;
invoice: {
id: UUIDString;
invoiceNumber: string;
status: InvoiceStatus;
issueDate: TimestampString;
dueDate: TimestampString;
amount: number;
business: {
id: UUIDString;
businessName: string;
} & Business_Key;
vendor: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
order: {
id: UUIDString;
eventName?: string | null;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
} & Order_Key;
} & Invoice_Key;
} & RecentPayment_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listRecentPaymentsByStaffId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListRecentPaymentsByStaffIdVariables } from '@dataconnect/generated';
import { useListRecentPaymentsByStaffId } from '@dataconnect/generated/react'
export default function ListRecentPaymentsByStaffIdComponent() {
// The `useListRecentPaymentsByStaffId` Query hook requires an argument of type `ListRecentPaymentsByStaffIdVariables`:
const listRecentPaymentsByStaffIdVars: ListRecentPaymentsByStaffIdVariables = {
staffId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListRecentPaymentsByStaffId(listRecentPaymentsByStaffIdVars);
// Variables can be defined inline as well.
const query = useListRecentPaymentsByStaffId({ staffId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListRecentPaymentsByStaffId(dataConnect, listRecentPaymentsByStaffIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListRecentPaymentsByStaffId(listRecentPaymentsByStaffIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListRecentPaymentsByStaffId(dataConnect, listRecentPaymentsByStaffIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.recentPayments);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listRecentPaymentsByApplicationId
You can execute the listRecentPaymentsByApplicationId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListRecentPaymentsByApplicationId(dc: DataConnect, vars: ListRecentPaymentsByApplicationIdVariables, options?: useDataConnectQueryOptions<ListRecentPaymentsByApplicationIdData>): UseDataConnectQueryResult<ListRecentPaymentsByApplicationIdData, ListRecentPaymentsByApplicationIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListRecentPaymentsByApplicationId(vars: ListRecentPaymentsByApplicationIdVariables, options?: useDataConnectQueryOptions<ListRecentPaymentsByApplicationIdData>): UseDataConnectQueryResult<ListRecentPaymentsByApplicationIdData, ListRecentPaymentsByApplicationIdVariables>;
Variables
The listRecentPaymentsByApplicationId Query requires an argument of type ListRecentPaymentsByApplicationIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListRecentPaymentsByApplicationIdVariables {
applicationId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listRecentPaymentsByApplicationId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listRecentPaymentsByApplicationId Query is of type ListRecentPaymentsByApplicationIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListRecentPaymentsByApplicationIdData {
recentPayments: ({
id: UUIDString;
workedTime?: string | null;
status?: RecentPaymentStatus | null;
staffId: UUIDString;
applicationId: UUIDString;
invoiceId: UUIDString;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
application: {
id: UUIDString;
status: ApplicationStatus;
shiftRole: {
hours?: number | null;
totalValue?: number | null;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
shift: {
id: UUIDString;
title: string;
date?: TimestampString | null;
locationAddress?: string | null;
} & Shift_Key;
};
} & Application_Key;
invoice: {
id: UUIDString;
invoiceNumber: string;
status: InvoiceStatus;
amount: number;
business: {
id: UUIDString;
businessName: string;
} & Business_Key;
vendor: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
order: {
id: UUIDString;
eventName?: string | null;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
} & Order_Key;
} & Invoice_Key;
} & RecentPayment_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listRecentPaymentsByApplicationId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListRecentPaymentsByApplicationIdVariables } from '@dataconnect/generated';
import { useListRecentPaymentsByApplicationId } from '@dataconnect/generated/react'
export default function ListRecentPaymentsByApplicationIdComponent() {
// The `useListRecentPaymentsByApplicationId` Query hook requires an argument of type `ListRecentPaymentsByApplicationIdVariables`:
const listRecentPaymentsByApplicationIdVars: ListRecentPaymentsByApplicationIdVariables = {
applicationId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListRecentPaymentsByApplicationId(listRecentPaymentsByApplicationIdVars);
// Variables can be defined inline as well.
const query = useListRecentPaymentsByApplicationId({ applicationId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListRecentPaymentsByApplicationId(dataConnect, listRecentPaymentsByApplicationIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListRecentPaymentsByApplicationId(listRecentPaymentsByApplicationIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListRecentPaymentsByApplicationId(dataConnect, listRecentPaymentsByApplicationIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.recentPayments);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listRecentPaymentsByInvoiceId
You can execute the listRecentPaymentsByInvoiceId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListRecentPaymentsByInvoiceId(dc: DataConnect, vars: ListRecentPaymentsByInvoiceIdVariables, options?: useDataConnectQueryOptions<ListRecentPaymentsByInvoiceIdData>): UseDataConnectQueryResult<ListRecentPaymentsByInvoiceIdData, ListRecentPaymentsByInvoiceIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListRecentPaymentsByInvoiceId(vars: ListRecentPaymentsByInvoiceIdVariables, options?: useDataConnectQueryOptions<ListRecentPaymentsByInvoiceIdData>): UseDataConnectQueryResult<ListRecentPaymentsByInvoiceIdData, ListRecentPaymentsByInvoiceIdVariables>;
Variables
The listRecentPaymentsByInvoiceId Query requires an argument of type ListRecentPaymentsByInvoiceIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListRecentPaymentsByInvoiceIdVariables {
invoiceId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listRecentPaymentsByInvoiceId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listRecentPaymentsByInvoiceId Query is of type ListRecentPaymentsByInvoiceIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListRecentPaymentsByInvoiceIdData {
recentPayments: ({
id: UUIDString;
workedTime?: string | null;
status?: RecentPaymentStatus | null;
staffId: UUIDString;
applicationId: UUIDString;
invoiceId: UUIDString;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
application: {
id: UUIDString;
staffId: UUIDString;
shiftRole: {
hours?: number | null;
totalValue?: number | null;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
shift: {
id: UUIDString;
title: string;
date?: TimestampString | null;
locationAddress?: string | null;
} & Shift_Key;
};
} & Application_Key;
invoice: {
id: UUIDString;
invoiceNumber: string;
status: InvoiceStatus;
amount: number;
business: {
id: UUIDString;
businessName: string;
} & Business_Key;
vendor: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
order: {
id: UUIDString;
eventName?: string | null;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
} & Order_Key;
} & Invoice_Key;
} & RecentPayment_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listRecentPaymentsByInvoiceId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListRecentPaymentsByInvoiceIdVariables } from '@dataconnect/generated';
import { useListRecentPaymentsByInvoiceId } from '@dataconnect/generated/react'
export default function ListRecentPaymentsByInvoiceIdComponent() {
// The `useListRecentPaymentsByInvoiceId` Query hook requires an argument of type `ListRecentPaymentsByInvoiceIdVariables`:
const listRecentPaymentsByInvoiceIdVars: ListRecentPaymentsByInvoiceIdVariables = {
invoiceId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListRecentPaymentsByInvoiceId(listRecentPaymentsByInvoiceIdVars);
// Variables can be defined inline as well.
const query = useListRecentPaymentsByInvoiceId({ invoiceId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListRecentPaymentsByInvoiceId(dataConnect, listRecentPaymentsByInvoiceIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListRecentPaymentsByInvoiceId(listRecentPaymentsByInvoiceIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListRecentPaymentsByInvoiceId(dataConnect, listRecentPaymentsByInvoiceIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.recentPayments);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listRecentPaymentsByStatus
You can execute the listRecentPaymentsByStatus Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListRecentPaymentsByStatus(dc: DataConnect, vars: ListRecentPaymentsByStatusVariables, options?: useDataConnectQueryOptions<ListRecentPaymentsByStatusData>): UseDataConnectQueryResult<ListRecentPaymentsByStatusData, ListRecentPaymentsByStatusVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListRecentPaymentsByStatus(vars: ListRecentPaymentsByStatusVariables, options?: useDataConnectQueryOptions<ListRecentPaymentsByStatusData>): UseDataConnectQueryResult<ListRecentPaymentsByStatusData, ListRecentPaymentsByStatusVariables>;
Variables
The listRecentPaymentsByStatus Query requires an argument of type ListRecentPaymentsByStatusVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListRecentPaymentsByStatusVariables {
status: RecentPaymentStatus;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listRecentPaymentsByStatus Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listRecentPaymentsByStatus Query is of type ListRecentPaymentsByStatusData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListRecentPaymentsByStatusData {
recentPayments: ({
id: UUIDString;
workedTime?: string | null;
status?: RecentPaymentStatus | null;
staffId: UUIDString;
applicationId: UUIDString;
invoiceId: UUIDString;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
application: {
id: UUIDString;
shiftRole: {
hours?: number | null;
totalValue?: number | null;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
shift: {
id: UUIDString;
title: string;
date?: TimestampString | null;
locationAddress?: string | null;
} & Shift_Key;
};
} & Application_Key;
invoice: {
id: UUIDString;
invoiceNumber: string;
status: InvoiceStatus;
amount: number;
business: {
id: UUIDString;
businessName: string;
} & Business_Key;
vendor: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
order: {
id: UUIDString;
eventName?: string | null;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
} & Order_Key;
} & Invoice_Key;
} & RecentPayment_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listRecentPaymentsByStatus's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListRecentPaymentsByStatusVariables } from '@dataconnect/generated';
import { useListRecentPaymentsByStatus } from '@dataconnect/generated/react'
export default function ListRecentPaymentsByStatusComponent() {
// The `useListRecentPaymentsByStatus` Query hook requires an argument of type `ListRecentPaymentsByStatusVariables`:
const listRecentPaymentsByStatusVars: ListRecentPaymentsByStatusVariables = {
status: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListRecentPaymentsByStatus(listRecentPaymentsByStatusVars);
// Variables can be defined inline as well.
const query = useListRecentPaymentsByStatus({ status: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListRecentPaymentsByStatus(dataConnect, listRecentPaymentsByStatusVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListRecentPaymentsByStatus(listRecentPaymentsByStatusVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListRecentPaymentsByStatus(dataConnect, listRecentPaymentsByStatusVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.recentPayments);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listRecentPaymentsByInvoiceIds
You can execute the listRecentPaymentsByInvoiceIds Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListRecentPaymentsByInvoiceIds(dc: DataConnect, vars: ListRecentPaymentsByInvoiceIdsVariables, options?: useDataConnectQueryOptions<ListRecentPaymentsByInvoiceIdsData>): UseDataConnectQueryResult<ListRecentPaymentsByInvoiceIdsData, ListRecentPaymentsByInvoiceIdsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListRecentPaymentsByInvoiceIds(vars: ListRecentPaymentsByInvoiceIdsVariables, options?: useDataConnectQueryOptions<ListRecentPaymentsByInvoiceIdsData>): UseDataConnectQueryResult<ListRecentPaymentsByInvoiceIdsData, ListRecentPaymentsByInvoiceIdsVariables>;
Variables
The listRecentPaymentsByInvoiceIds Query requires an argument of type ListRecentPaymentsByInvoiceIdsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListRecentPaymentsByInvoiceIdsVariables {
invoiceIds: UUIDString[];
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listRecentPaymentsByInvoiceIds Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listRecentPaymentsByInvoiceIds Query is of type ListRecentPaymentsByInvoiceIdsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListRecentPaymentsByInvoiceIdsData {
recentPayments: ({
id: UUIDString;
workedTime?: string | null;
status?: RecentPaymentStatus | null;
staffId: UUIDString;
applicationId: UUIDString;
invoiceId: UUIDString;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
application: {
id: UUIDString;
shiftRole: {
hours?: number | null;
totalValue?: number | null;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
shift: {
id: UUIDString;
title: string;
date?: TimestampString | null;
locationAddress?: string | null;
} & Shift_Key;
};
} & Application_Key;
invoice: {
id: UUIDString;
invoiceNumber: string;
status: InvoiceStatus;
amount: number;
business: {
id: UUIDString;
businessName: string;
} & Business_Key;
vendor: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
order: {
id: UUIDString;
eventName?: string | null;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
} & Order_Key;
} & Invoice_Key;
} & RecentPayment_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listRecentPaymentsByInvoiceIds's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListRecentPaymentsByInvoiceIdsVariables } from '@dataconnect/generated';
import { useListRecentPaymentsByInvoiceIds } from '@dataconnect/generated/react'
export default function ListRecentPaymentsByInvoiceIdsComponent() {
// The `useListRecentPaymentsByInvoiceIds` Query hook requires an argument of type `ListRecentPaymentsByInvoiceIdsVariables`:
const listRecentPaymentsByInvoiceIdsVars: ListRecentPaymentsByInvoiceIdsVariables = {
invoiceIds: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListRecentPaymentsByInvoiceIds(listRecentPaymentsByInvoiceIdsVars);
// Variables can be defined inline as well.
const query = useListRecentPaymentsByInvoiceIds({ invoiceIds: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListRecentPaymentsByInvoiceIds(dataConnect, listRecentPaymentsByInvoiceIdsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListRecentPaymentsByInvoiceIds(listRecentPaymentsByInvoiceIdsVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListRecentPaymentsByInvoiceIds(dataConnect, listRecentPaymentsByInvoiceIdsVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.recentPayments);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listRecentPaymentsByBusinessId
You can execute the listRecentPaymentsByBusinessId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListRecentPaymentsByBusinessId(dc: DataConnect, vars: ListRecentPaymentsByBusinessIdVariables, options?: useDataConnectQueryOptions<ListRecentPaymentsByBusinessIdData>): UseDataConnectQueryResult<ListRecentPaymentsByBusinessIdData, ListRecentPaymentsByBusinessIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListRecentPaymentsByBusinessId(vars: ListRecentPaymentsByBusinessIdVariables, options?: useDataConnectQueryOptions<ListRecentPaymentsByBusinessIdData>): UseDataConnectQueryResult<ListRecentPaymentsByBusinessIdData, ListRecentPaymentsByBusinessIdVariables>;
Variables
The listRecentPaymentsByBusinessId Query requires an argument of type ListRecentPaymentsByBusinessIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListRecentPaymentsByBusinessIdVariables {
businessId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listRecentPaymentsByBusinessId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listRecentPaymentsByBusinessId Query is of type ListRecentPaymentsByBusinessIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListRecentPaymentsByBusinessIdData {
recentPayments: ({
id: UUIDString;
workedTime?: string | null;
status?: RecentPaymentStatus | null;
staffId: UUIDString;
applicationId: UUIDString;
invoiceId: UUIDString;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
application: {
id: UUIDString;
staffId: UUIDString;
checkInTime?: TimestampString | null;
checkOutTime?: TimestampString | null;
shiftRole: {
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
totalValue?: number | null;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
shift: {
id: UUIDString;
title: string;
date?: TimestampString | null;
location?: string | null;
locationAddress?: string | null;
description?: string | null;
} & Shift_Key;
};
} & Application_Key;
invoice: {
id: UUIDString;
invoiceNumber: string;
status: InvoiceStatus;
issueDate: TimestampString;
dueDate: TimestampString;
amount: number;
business: {
id: UUIDString;
businessName: string;
} & Business_Key;
vendor: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
order: {
id: UUIDString;
eventName?: string | null;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
} & Order_Key;
} & Invoice_Key;
} & RecentPayment_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listRecentPaymentsByBusinessId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListRecentPaymentsByBusinessIdVariables } from '@dataconnect/generated';
import { useListRecentPaymentsByBusinessId } from '@dataconnect/generated/react'
export default function ListRecentPaymentsByBusinessIdComponent() {
// The `useListRecentPaymentsByBusinessId` Query hook requires an argument of type `ListRecentPaymentsByBusinessIdVariables`:
const listRecentPaymentsByBusinessIdVars: ListRecentPaymentsByBusinessIdVariables = {
businessId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListRecentPaymentsByBusinessId(listRecentPaymentsByBusinessIdVars);
// Variables can be defined inline as well.
const query = useListRecentPaymentsByBusinessId({ businessId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListRecentPaymentsByBusinessId(dataConnect, listRecentPaymentsByBusinessIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListRecentPaymentsByBusinessId(listRecentPaymentsByBusinessIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListRecentPaymentsByBusinessId(dataConnect, listRecentPaymentsByBusinessIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.recentPayments);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listBusinesses
You can execute the listBusinesses Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListBusinesses(dc: DataConnect, options?: useDataConnectQueryOptions<ListBusinessesData>): UseDataConnectQueryResult<ListBusinessesData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListBusinesses(options?: useDataConnectQueryOptions<ListBusinessesData>): UseDataConnectQueryResult<ListBusinessesData, undefined>;
Variables
The listBusinesses Query has no variables.
Return Type
Recall that calling the listBusinesses Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listBusinesses Query is of type ListBusinessesData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListBusinessesData {
businesses: ({
id: UUIDString;
businessName: string;
contactName?: string | null;
userId: string;
companyLogoUrl?: string | null;
phone?: string | null;
email?: string | null;
hubBuilding?: string | null;
address?: string | null;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
city?: string | null;
state?: string | null;
street?: string | null;
country?: string | null;
zipCode?: string | null;
area?: BusinessArea | null;
sector?: BusinessSector | null;
rateGroup: BusinessRateGroup;
status: BusinessStatus;
notes?: string | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
} & Business_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listBusinesses's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListBusinesses } from '@dataconnect/generated/react'
export default function ListBusinessesComponent() {
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListBusinesses();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListBusinesses(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListBusinesses(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListBusinesses(dataConnect, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.businesses);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getBusinessesByUserId
You can execute the getBusinessesByUserId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetBusinessesByUserId(dc: DataConnect, vars: GetBusinessesByUserIdVariables, options?: useDataConnectQueryOptions<GetBusinessesByUserIdData>): UseDataConnectQueryResult<GetBusinessesByUserIdData, GetBusinessesByUserIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetBusinessesByUserId(vars: GetBusinessesByUserIdVariables, options?: useDataConnectQueryOptions<GetBusinessesByUserIdData>): UseDataConnectQueryResult<GetBusinessesByUserIdData, GetBusinessesByUserIdVariables>;
Variables
The getBusinessesByUserId Query requires an argument of type GetBusinessesByUserIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetBusinessesByUserIdVariables {
userId: string;
}
Return Type
Recall that calling the getBusinessesByUserId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getBusinessesByUserId Query is of type GetBusinessesByUserIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetBusinessesByUserIdData {
businesses: ({
id: UUIDString;
businessName: string;
contactName?: string | null;
userId: string;
companyLogoUrl?: string | null;
phone?: string | null;
email?: string | null;
hubBuilding?: string | null;
address?: string | null;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
city?: string | null;
state?: string | null;
street?: string | null;
country?: string | null;
zipCode?: string | null;
area?: BusinessArea | null;
sector?: BusinessSector | null;
rateGroup: BusinessRateGroup;
status: BusinessStatus;
notes?: string | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
} & Business_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getBusinessesByUserId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetBusinessesByUserIdVariables } from '@dataconnect/generated';
import { useGetBusinessesByUserId } from '@dataconnect/generated/react'
export default function GetBusinessesByUserIdComponent() {
// The `useGetBusinessesByUserId` Query hook requires an argument of type `GetBusinessesByUserIdVariables`:
const getBusinessesByUserIdVars: GetBusinessesByUserIdVariables = {
userId: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetBusinessesByUserId(getBusinessesByUserIdVars);
// Variables can be defined inline as well.
const query = useGetBusinessesByUserId({ userId: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetBusinessesByUserId(dataConnect, getBusinessesByUserIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetBusinessesByUserId(getBusinessesByUserIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetBusinessesByUserId(dataConnect, getBusinessesByUserIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.businesses);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getBusinessById
You can execute the getBusinessById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetBusinessById(dc: DataConnect, vars: GetBusinessByIdVariables, options?: useDataConnectQueryOptions<GetBusinessByIdData>): UseDataConnectQueryResult<GetBusinessByIdData, GetBusinessByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetBusinessById(vars: GetBusinessByIdVariables, options?: useDataConnectQueryOptions<GetBusinessByIdData>): UseDataConnectQueryResult<GetBusinessByIdData, GetBusinessByIdVariables>;
Variables
The getBusinessById Query requires an argument of type GetBusinessByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetBusinessByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getBusinessById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getBusinessById Query is of type GetBusinessByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetBusinessByIdData {
business?: {
id: UUIDString;
businessName: string;
contactName?: string | null;
userId: string;
companyLogoUrl?: string | null;
phone?: string | null;
email?: string | null;
hubBuilding?: string | null;
address?: string | null;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
city?: string | null;
state?: string | null;
street?: string | null;
country?: string | null;
zipCode?: string | null;
area?: BusinessArea | null;
sector?: BusinessSector | null;
rateGroup: BusinessRateGroup;
status: BusinessStatus;
notes?: string | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
} & Business_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getBusinessById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetBusinessByIdVariables } from '@dataconnect/generated';
import { useGetBusinessById } from '@dataconnect/generated/react'
export default function GetBusinessByIdComponent() {
// The `useGetBusinessById` Query hook requires an argument of type `GetBusinessByIdVariables`:
const getBusinessByIdVars: GetBusinessByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetBusinessById(getBusinessByIdVars);
// Variables can be defined inline as well.
const query = useGetBusinessById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetBusinessById(dataConnect, getBusinessByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetBusinessById(getBusinessByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetBusinessById(dataConnect, getBusinessByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.business);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listConversations
You can execute the listConversations Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListConversations(dc: DataConnect, vars?: ListConversationsVariables, options?: useDataConnectQueryOptions<ListConversationsData>): UseDataConnectQueryResult<ListConversationsData, ListConversationsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListConversations(vars?: ListConversationsVariables, options?: useDataConnectQueryOptions<ListConversationsData>): UseDataConnectQueryResult<ListConversationsData, ListConversationsVariables>;
Variables
The listConversations Query has an optional argument of type ListConversationsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListConversationsVariables {
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listConversations Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listConversations Query is of type ListConversationsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListConversationsData {
conversations: ({
id: UUIDString;
subject?: string | null;
status?: ConversationStatus | null;
conversationType?: ConversationType | null;
isGroup?: boolean | null;
groupName?: string | null;
lastMessage?: string | null;
lastMessageAt?: TimestampString | null;
createdAt?: TimestampString | null;
} & Conversation_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listConversations's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListConversationsVariables } from '@dataconnect/generated';
import { useListConversations } from '@dataconnect/generated/react'
export default function ListConversationsComponent() {
// The `useListConversations` Query hook has an optional argument of type `ListConversationsVariables`:
const listConversationsVars: ListConversationsVariables = {
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListConversations(listConversationsVars);
// Variables can be defined inline as well.
const query = useListConversations({ offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `ListConversationsVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useListConversations();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListConversations(dataConnect, listConversationsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListConversations(listConversationsVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useListConversations(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListConversations(dataConnect, listConversationsVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.conversations);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getConversationById
You can execute the getConversationById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetConversationById(dc: DataConnect, vars: GetConversationByIdVariables, options?: useDataConnectQueryOptions<GetConversationByIdData>): UseDataConnectQueryResult<GetConversationByIdData, GetConversationByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetConversationById(vars: GetConversationByIdVariables, options?: useDataConnectQueryOptions<GetConversationByIdData>): UseDataConnectQueryResult<GetConversationByIdData, GetConversationByIdVariables>;
Variables
The getConversationById Query requires an argument of type GetConversationByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetConversationByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getConversationById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getConversationById Query is of type GetConversationByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetConversationByIdData {
conversation?: {
id: UUIDString;
subject?: string | null;
status?: ConversationStatus | null;
conversationType?: ConversationType | null;
isGroup?: boolean | null;
groupName?: string | null;
lastMessage?: string | null;
lastMessageAt?: TimestampString | null;
createdAt?: TimestampString | null;
} & Conversation_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getConversationById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetConversationByIdVariables } from '@dataconnect/generated';
import { useGetConversationById } from '@dataconnect/generated/react'
export default function GetConversationByIdComponent() {
// The `useGetConversationById` Query hook requires an argument of type `GetConversationByIdVariables`:
const getConversationByIdVars: GetConversationByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetConversationById(getConversationByIdVars);
// Variables can be defined inline as well.
const query = useGetConversationById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetConversationById(dataConnect, getConversationByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetConversationById(getConversationByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetConversationById(dataConnect, getConversationByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.conversation);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listConversationsByType
You can execute the listConversationsByType Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListConversationsByType(dc: DataConnect, vars: ListConversationsByTypeVariables, options?: useDataConnectQueryOptions<ListConversationsByTypeData>): UseDataConnectQueryResult<ListConversationsByTypeData, ListConversationsByTypeVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListConversationsByType(vars: ListConversationsByTypeVariables, options?: useDataConnectQueryOptions<ListConversationsByTypeData>): UseDataConnectQueryResult<ListConversationsByTypeData, ListConversationsByTypeVariables>;
Variables
The listConversationsByType Query requires an argument of type ListConversationsByTypeVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListConversationsByTypeVariables {
conversationType: ConversationType;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listConversationsByType Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listConversationsByType Query is of type ListConversationsByTypeData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListConversationsByTypeData {
conversations: ({
id: UUIDString;
subject?: string | null;
status?: ConversationStatus | null;
conversationType?: ConversationType | null;
isGroup?: boolean | null;
groupName?: string | null;
lastMessage?: string | null;
lastMessageAt?: TimestampString | null;
createdAt?: TimestampString | null;
} & Conversation_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listConversationsByType's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListConversationsByTypeVariables } from '@dataconnect/generated';
import { useListConversationsByType } from '@dataconnect/generated/react'
export default function ListConversationsByTypeComponent() {
// The `useListConversationsByType` Query hook requires an argument of type `ListConversationsByTypeVariables`:
const listConversationsByTypeVars: ListConversationsByTypeVariables = {
conversationType: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListConversationsByType(listConversationsByTypeVars);
// Variables can be defined inline as well.
const query = useListConversationsByType({ conversationType: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListConversationsByType(dataConnect, listConversationsByTypeVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListConversationsByType(listConversationsByTypeVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListConversationsByType(dataConnect, listConversationsByTypeVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.conversations);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listConversationsByStatus
You can execute the listConversationsByStatus Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListConversationsByStatus(dc: DataConnect, vars: ListConversationsByStatusVariables, options?: useDataConnectQueryOptions<ListConversationsByStatusData>): UseDataConnectQueryResult<ListConversationsByStatusData, ListConversationsByStatusVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListConversationsByStatus(vars: ListConversationsByStatusVariables, options?: useDataConnectQueryOptions<ListConversationsByStatusData>): UseDataConnectQueryResult<ListConversationsByStatusData, ListConversationsByStatusVariables>;
Variables
The listConversationsByStatus Query requires an argument of type ListConversationsByStatusVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListConversationsByStatusVariables {
status: ConversationStatus;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listConversationsByStatus Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listConversationsByStatus Query is of type ListConversationsByStatusData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListConversationsByStatusData {
conversations: ({
id: UUIDString;
subject?: string | null;
status?: ConversationStatus | null;
conversationType?: ConversationType | null;
isGroup?: boolean | null;
groupName?: string | null;
lastMessage?: string | null;
lastMessageAt?: TimestampString | null;
createdAt?: TimestampString | null;
} & Conversation_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listConversationsByStatus's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListConversationsByStatusVariables } from '@dataconnect/generated';
import { useListConversationsByStatus } from '@dataconnect/generated/react'
export default function ListConversationsByStatusComponent() {
// The `useListConversationsByStatus` Query hook requires an argument of type `ListConversationsByStatusVariables`:
const listConversationsByStatusVars: ListConversationsByStatusVariables = {
status: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListConversationsByStatus(listConversationsByStatusVars);
// Variables can be defined inline as well.
const query = useListConversationsByStatus({ status: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListConversationsByStatus(dataConnect, listConversationsByStatusVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListConversationsByStatus(listConversationsByStatusVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListConversationsByStatus(dataConnect, listConversationsByStatusVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.conversations);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterConversations
You can execute the filterConversations Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterConversations(dc: DataConnect, vars?: FilterConversationsVariables, options?: useDataConnectQueryOptions<FilterConversationsData>): UseDataConnectQueryResult<FilterConversationsData, FilterConversationsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterConversations(vars?: FilterConversationsVariables, options?: useDataConnectQueryOptions<FilterConversationsData>): UseDataConnectQueryResult<FilterConversationsData, FilterConversationsVariables>;
Variables
The filterConversations Query has an optional argument of type FilterConversationsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterConversationsVariables {
status?: ConversationStatus | null;
conversationType?: ConversationType | null;
isGroup?: boolean | null;
lastMessageAfter?: TimestampString | null;
lastMessageBefore?: TimestampString | null;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the filterConversations Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the filterConversations Query is of type FilterConversationsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterConversationsData {
conversations: ({
id: UUIDString;
subject?: string | null;
status?: ConversationStatus | null;
conversationType?: ConversationType | null;
isGroup?: boolean | null;
groupName?: string | null;
lastMessage?: string | null;
lastMessageAt?: TimestampString | null;
createdAt?: TimestampString | null;
} & Conversation_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterConversations's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterConversationsVariables } from '@dataconnect/generated';
import { useFilterConversations } from '@dataconnect/generated/react'
export default function FilterConversationsComponent() {
// The `useFilterConversations` Query hook has an optional argument of type `FilterConversationsVariables`:
const filterConversationsVars: FilterConversationsVariables = {
status: ..., // optional
conversationType: ..., // optional
isGroup: ..., // optional
lastMessageAfter: ..., // optional
lastMessageBefore: ..., // optional
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useFilterConversations(filterConversationsVars);
// Variables can be defined inline as well.
const query = useFilterConversations({ status: ..., conversationType: ..., isGroup: ..., lastMessageAfter: ..., lastMessageBefore: ..., offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `FilterConversationsVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterConversations();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterConversations(dataConnect, filterConversationsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterConversations(filterConversationsVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useFilterConversations(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useFilterConversations(dataConnect, filterConversationsVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.conversations);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listOrders
You can execute the listOrders Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListOrders(dc: DataConnect, vars?: ListOrdersVariables, options?: useDataConnectQueryOptions<ListOrdersData>): UseDataConnectQueryResult<ListOrdersData, ListOrdersVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListOrders(vars?: ListOrdersVariables, options?: useDataConnectQueryOptions<ListOrdersData>): UseDataConnectQueryResult<ListOrdersData, ListOrdersVariables>;
Variables
The listOrders Query has an optional argument of type ListOrdersVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListOrdersVariables {
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listOrders Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listOrders Query is of type ListOrdersData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListOrdersData {
orders: ({
id: UUIDString;
eventName?: string | null;
vendorId?: UUIDString | null;
businessId: UUIDString;
orderType: OrderType;
status: OrderStatus;
date?: TimestampString | null;
startDate?: TimestampString | null;
endDate?: TimestampString | null;
duration?: OrderDuration | null;
lunchBreak?: number | null;
total?: number | null;
assignedStaff?: unknown | null;
shifts?: unknown | null;
requested?: number | null;
recurringDays?: unknown | null;
permanentDays?: unknown | null;
poReference?: string | null;
detectedConflicts?: unknown | null;
notes?: string | null;
createdAt?: TimestampString | null;
business: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
} & Order_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listOrders's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListOrdersVariables } from '@dataconnect/generated';
import { useListOrders } from '@dataconnect/generated/react'
export default function ListOrdersComponent() {
// The `useListOrders` Query hook has an optional argument of type `ListOrdersVariables`:
const listOrdersVars: ListOrdersVariables = {
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListOrders(listOrdersVars);
// Variables can be defined inline as well.
const query = useListOrders({ offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `ListOrdersVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useListOrders();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListOrders(dataConnect, listOrdersVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListOrders(listOrdersVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useListOrders(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListOrders(dataConnect, listOrdersVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.orders);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getOrderById
You can execute the getOrderById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetOrderById(dc: DataConnect, vars: GetOrderByIdVariables, options?: useDataConnectQueryOptions<GetOrderByIdData>): UseDataConnectQueryResult<GetOrderByIdData, GetOrderByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetOrderById(vars: GetOrderByIdVariables, options?: useDataConnectQueryOptions<GetOrderByIdData>): UseDataConnectQueryResult<GetOrderByIdData, GetOrderByIdVariables>;
Variables
The getOrderById Query requires an argument of type GetOrderByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetOrderByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getOrderById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getOrderById Query is of type GetOrderByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetOrderByIdData {
order?: {
id: UUIDString;
eventName?: string | null;
vendorId?: UUIDString | null;
businessId: UUIDString;
orderType: OrderType;
status: OrderStatus;
date?: TimestampString | null;
startDate?: TimestampString | null;
endDate?: TimestampString | null;
duration?: OrderDuration | null;
lunchBreak?: number | null;
total?: number | null;
assignedStaff?: unknown | null;
shifts?: unknown | null;
requested?: number | null;
recurringDays?: unknown | null;
permanentDays?: unknown | null;
poReference?: string | null;
detectedConflicts?: unknown | null;
notes?: string | null;
createdAt?: TimestampString | null;
business: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
} & Order_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getOrderById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetOrderByIdVariables } from '@dataconnect/generated';
import { useGetOrderById } from '@dataconnect/generated/react'
export default function GetOrderByIdComponent() {
// The `useGetOrderById` Query hook requires an argument of type `GetOrderByIdVariables`:
const getOrderByIdVars: GetOrderByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetOrderById(getOrderByIdVars);
// Variables can be defined inline as well.
const query = useGetOrderById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetOrderById(dataConnect, getOrderByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetOrderById(getOrderByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetOrderById(dataConnect, getOrderByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.order);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getOrdersByBusinessId
You can execute the getOrdersByBusinessId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetOrdersByBusinessId(dc: DataConnect, vars: GetOrdersByBusinessIdVariables, options?: useDataConnectQueryOptions<GetOrdersByBusinessIdData>): UseDataConnectQueryResult<GetOrdersByBusinessIdData, GetOrdersByBusinessIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetOrdersByBusinessId(vars: GetOrdersByBusinessIdVariables, options?: useDataConnectQueryOptions<GetOrdersByBusinessIdData>): UseDataConnectQueryResult<GetOrdersByBusinessIdData, GetOrdersByBusinessIdVariables>;
Variables
The getOrdersByBusinessId Query requires an argument of type GetOrdersByBusinessIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetOrdersByBusinessIdVariables {
businessId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the getOrdersByBusinessId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getOrdersByBusinessId Query is of type GetOrdersByBusinessIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetOrdersByBusinessIdData {
orders: ({
id: UUIDString;
eventName?: string | null;
vendorId?: UUIDString | null;
businessId: UUIDString;
orderType: OrderType;
status: OrderStatus;
date?: TimestampString | null;
startDate?: TimestampString | null;
endDate?: TimestampString | null;
duration?: OrderDuration | null;
lunchBreak?: number | null;
total?: number | null;
assignedStaff?: unknown | null;
shifts?: unknown | null;
requested?: number | null;
recurringDays?: unknown | null;
permanentDays?: unknown | null;
poReference?: string | null;
detectedConflicts?: unknown | null;
notes?: string | null;
createdAt?: TimestampString | null;
business: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
} & Order_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getOrdersByBusinessId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetOrdersByBusinessIdVariables } from '@dataconnect/generated';
import { useGetOrdersByBusinessId } from '@dataconnect/generated/react'
export default function GetOrdersByBusinessIdComponent() {
// The `useGetOrdersByBusinessId` Query hook requires an argument of type `GetOrdersByBusinessIdVariables`:
const getOrdersByBusinessIdVars: GetOrdersByBusinessIdVariables = {
businessId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetOrdersByBusinessId(getOrdersByBusinessIdVars);
// Variables can be defined inline as well.
const query = useGetOrdersByBusinessId({ businessId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetOrdersByBusinessId(dataConnect, getOrdersByBusinessIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetOrdersByBusinessId(getOrdersByBusinessIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetOrdersByBusinessId(dataConnect, getOrdersByBusinessIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.orders);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getOrdersByVendorId
You can execute the getOrdersByVendorId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetOrdersByVendorId(dc: DataConnect, vars: GetOrdersByVendorIdVariables, options?: useDataConnectQueryOptions<GetOrdersByVendorIdData>): UseDataConnectQueryResult<GetOrdersByVendorIdData, GetOrdersByVendorIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetOrdersByVendorId(vars: GetOrdersByVendorIdVariables, options?: useDataConnectQueryOptions<GetOrdersByVendorIdData>): UseDataConnectQueryResult<GetOrdersByVendorIdData, GetOrdersByVendorIdVariables>;
Variables
The getOrdersByVendorId Query requires an argument of type GetOrdersByVendorIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetOrdersByVendorIdVariables {
vendorId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the getOrdersByVendorId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getOrdersByVendorId Query is of type GetOrdersByVendorIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetOrdersByVendorIdData {
orders: ({
id: UUIDString;
eventName?: string | null;
vendorId?: UUIDString | null;
businessId: UUIDString;
orderType: OrderType;
status: OrderStatus;
date?: TimestampString | null;
startDate?: TimestampString | null;
endDate?: TimestampString | null;
duration?: OrderDuration | null;
lunchBreak?: number | null;
total?: number | null;
assignedStaff?: unknown | null;
shifts?: unknown | null;
requested?: number | null;
recurringDays?: unknown | null;
permanentDays?: unknown | null;
poReference?: string | null;
detectedConflicts?: unknown | null;
notes?: string | null;
createdAt?: TimestampString | null;
business: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
} & Order_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getOrdersByVendorId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetOrdersByVendorIdVariables } from '@dataconnect/generated';
import { useGetOrdersByVendorId } from '@dataconnect/generated/react'
export default function GetOrdersByVendorIdComponent() {
// The `useGetOrdersByVendorId` Query hook requires an argument of type `GetOrdersByVendorIdVariables`:
const getOrdersByVendorIdVars: GetOrdersByVendorIdVariables = {
vendorId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetOrdersByVendorId(getOrdersByVendorIdVars);
// Variables can be defined inline as well.
const query = useGetOrdersByVendorId({ vendorId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetOrdersByVendorId(dataConnect, getOrdersByVendorIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetOrdersByVendorId(getOrdersByVendorIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetOrdersByVendorId(dataConnect, getOrdersByVendorIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.orders);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getOrdersByStatus
You can execute the getOrdersByStatus Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetOrdersByStatus(dc: DataConnect, vars: GetOrdersByStatusVariables, options?: useDataConnectQueryOptions<GetOrdersByStatusData>): UseDataConnectQueryResult<GetOrdersByStatusData, GetOrdersByStatusVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetOrdersByStatus(vars: GetOrdersByStatusVariables, options?: useDataConnectQueryOptions<GetOrdersByStatusData>): UseDataConnectQueryResult<GetOrdersByStatusData, GetOrdersByStatusVariables>;
Variables
The getOrdersByStatus Query requires an argument of type GetOrdersByStatusVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetOrdersByStatusVariables {
status: OrderStatus;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the getOrdersByStatus Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getOrdersByStatus Query is of type GetOrdersByStatusData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetOrdersByStatusData {
orders: ({
id: UUIDString;
eventName?: string | null;
vendorId?: UUIDString | null;
businessId: UUIDString;
orderType: OrderType;
status: OrderStatus;
date?: TimestampString | null;
startDate?: TimestampString | null;
endDate?: TimestampString | null;
duration?: OrderDuration | null;
lunchBreak?: number | null;
total?: number | null;
assignedStaff?: unknown | null;
shifts?: unknown | null;
requested?: number | null;
recurringDays?: unknown | null;
permanentDays?: unknown | null;
poReference?: string | null;
detectedConflicts?: unknown | null;
notes?: string | null;
createdAt?: TimestampString | null;
business: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
} & Order_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getOrdersByStatus's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetOrdersByStatusVariables } from '@dataconnect/generated';
import { useGetOrdersByStatus } from '@dataconnect/generated/react'
export default function GetOrdersByStatusComponent() {
// The `useGetOrdersByStatus` Query hook requires an argument of type `GetOrdersByStatusVariables`:
const getOrdersByStatusVars: GetOrdersByStatusVariables = {
status: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetOrdersByStatus(getOrdersByStatusVars);
// Variables can be defined inline as well.
const query = useGetOrdersByStatus({ status: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetOrdersByStatus(dataConnect, getOrdersByStatusVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetOrdersByStatus(getOrdersByStatusVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetOrdersByStatus(dataConnect, getOrdersByStatusVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.orders);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getOrdersByDateRange
You can execute the getOrdersByDateRange Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetOrdersByDateRange(dc: DataConnect, vars: GetOrdersByDateRangeVariables, options?: useDataConnectQueryOptions<GetOrdersByDateRangeData>): UseDataConnectQueryResult<GetOrdersByDateRangeData, GetOrdersByDateRangeVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetOrdersByDateRange(vars: GetOrdersByDateRangeVariables, options?: useDataConnectQueryOptions<GetOrdersByDateRangeData>): UseDataConnectQueryResult<GetOrdersByDateRangeData, GetOrdersByDateRangeVariables>;
Variables
The getOrdersByDateRange Query requires an argument of type GetOrdersByDateRangeVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetOrdersByDateRangeVariables {
start: TimestampString;
end: TimestampString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the getOrdersByDateRange Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getOrdersByDateRange Query is of type GetOrdersByDateRangeData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetOrdersByDateRangeData {
orders: ({
id: UUIDString;
eventName?: string | null;
vendorId?: UUIDString | null;
businessId: UUIDString;
orderType: OrderType;
status: OrderStatus;
date?: TimestampString | null;
startDate?: TimestampString | null;
endDate?: TimestampString | null;
duration?: OrderDuration | null;
lunchBreak?: number | null;
total?: number | null;
assignedStaff?: unknown | null;
shifts?: unknown | null;
requested?: number | null;
recurringDays?: unknown | null;
permanentDays?: unknown | null;
poReference?: string | null;
detectedConflicts?: unknown | null;
notes?: string | null;
createdAt?: TimestampString | null;
business: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
} & Order_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getOrdersByDateRange's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetOrdersByDateRangeVariables } from '@dataconnect/generated';
import { useGetOrdersByDateRange } from '@dataconnect/generated/react'
export default function GetOrdersByDateRangeComponent() {
// The `useGetOrdersByDateRange` Query hook requires an argument of type `GetOrdersByDateRangeVariables`:
const getOrdersByDateRangeVars: GetOrdersByDateRangeVariables = {
start: ...,
end: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetOrdersByDateRange(getOrdersByDateRangeVars);
// Variables can be defined inline as well.
const query = useGetOrdersByDateRange({ start: ..., end: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetOrdersByDateRange(dataConnect, getOrdersByDateRangeVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetOrdersByDateRange(getOrdersByDateRangeVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetOrdersByDateRange(dataConnect, getOrdersByDateRangeVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.orders);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getRapidOrders
You can execute the getRapidOrders Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetRapidOrders(dc: DataConnect, vars?: GetRapidOrdersVariables, options?: useDataConnectQueryOptions<GetRapidOrdersData>): UseDataConnectQueryResult<GetRapidOrdersData, GetRapidOrdersVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetRapidOrders(vars?: GetRapidOrdersVariables, options?: useDataConnectQueryOptions<GetRapidOrdersData>): UseDataConnectQueryResult<GetRapidOrdersData, GetRapidOrdersVariables>;
Variables
The getRapidOrders Query has an optional argument of type GetRapidOrdersVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetRapidOrdersVariables {
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the getRapidOrders Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getRapidOrders Query is of type GetRapidOrdersData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetRapidOrdersData {
orders: ({
id: UUIDString;
eventName?: string | null;
vendorId?: UUIDString | null;
businessId: UUIDString;
orderType: OrderType;
status: OrderStatus;
date?: TimestampString | null;
startDate?: TimestampString | null;
endDate?: TimestampString | null;
duration?: OrderDuration | null;
lunchBreak?: number | null;
total?: number | null;
assignedStaff?: unknown | null;
shifts?: unknown | null;
requested?: number | null;
recurringDays?: unknown | null;
permanentDays?: unknown | null;
poReference?: string | null;
detectedConflicts?: unknown | null;
notes?: string | null;
createdAt?: TimestampString | null;
business: {
id: UUIDString;
businessName: string;
email?: string | null;
contactName?: string | null;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
} & Order_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getRapidOrders's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetRapidOrdersVariables } from '@dataconnect/generated';
import { useGetRapidOrders } from '@dataconnect/generated/react'
export default function GetRapidOrdersComponent() {
// The `useGetRapidOrders` Query hook has an optional argument of type `GetRapidOrdersVariables`:
const getRapidOrdersVars: GetRapidOrdersVariables = {
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetRapidOrders(getRapidOrdersVars);
// Variables can be defined inline as well.
const query = useGetRapidOrders({ offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `GetRapidOrdersVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useGetRapidOrders();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetRapidOrders(dataConnect, getRapidOrdersVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetRapidOrders(getRapidOrdersVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useGetRapidOrders(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetRapidOrders(dataConnect, getRapidOrdersVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.orders);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listOrdersByBusinessAndTeamHub
You can execute the listOrdersByBusinessAndTeamHub Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListOrdersByBusinessAndTeamHub(dc: DataConnect, vars: ListOrdersByBusinessAndTeamHubVariables, options?: useDataConnectQueryOptions<ListOrdersByBusinessAndTeamHubData>): UseDataConnectQueryResult<ListOrdersByBusinessAndTeamHubData, ListOrdersByBusinessAndTeamHubVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListOrdersByBusinessAndTeamHub(vars: ListOrdersByBusinessAndTeamHubVariables, options?: useDataConnectQueryOptions<ListOrdersByBusinessAndTeamHubData>): UseDataConnectQueryResult<ListOrdersByBusinessAndTeamHubData, ListOrdersByBusinessAndTeamHubVariables>;
Variables
The listOrdersByBusinessAndTeamHub Query requires an argument of type ListOrdersByBusinessAndTeamHubVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListOrdersByBusinessAndTeamHubVariables {
businessId: UUIDString;
teamHubId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listOrdersByBusinessAndTeamHub Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listOrdersByBusinessAndTeamHub Query is of type ListOrdersByBusinessAndTeamHubData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListOrdersByBusinessAndTeamHubData {
orders: ({
id: UUIDString;
eventName?: string | null;
orderType: OrderType;
status: OrderStatus;
duration?: OrderDuration | null;
businessId: UUIDString;
vendorId?: UUIDString | null;
teamHubId: UUIDString;
date?: TimestampString | null;
startDate?: TimestampString | null;
endDate?: TimestampString | null;
requested?: number | null;
total?: number | null;
notes?: string | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & Order_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listOrdersByBusinessAndTeamHub's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListOrdersByBusinessAndTeamHubVariables } from '@dataconnect/generated';
import { useListOrdersByBusinessAndTeamHub } from '@dataconnect/generated/react'
export default function ListOrdersByBusinessAndTeamHubComponent() {
// The `useListOrdersByBusinessAndTeamHub` Query hook requires an argument of type `ListOrdersByBusinessAndTeamHubVariables`:
const listOrdersByBusinessAndTeamHubVars: ListOrdersByBusinessAndTeamHubVariables = {
businessId: ...,
teamHubId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListOrdersByBusinessAndTeamHub(listOrdersByBusinessAndTeamHubVars);
// Variables can be defined inline as well.
const query = useListOrdersByBusinessAndTeamHub({ businessId: ..., teamHubId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListOrdersByBusinessAndTeamHub(dataConnect, listOrdersByBusinessAndTeamHubVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListOrdersByBusinessAndTeamHub(listOrdersByBusinessAndTeamHubVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListOrdersByBusinessAndTeamHub(dataConnect, listOrdersByBusinessAndTeamHubVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.orders);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listStaffRoles
You can execute the listStaffRoles Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListStaffRoles(dc: DataConnect, vars?: ListStaffRolesVariables, options?: useDataConnectQueryOptions<ListStaffRolesData>): UseDataConnectQueryResult<ListStaffRolesData, ListStaffRolesVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListStaffRoles(vars?: ListStaffRolesVariables, options?: useDataConnectQueryOptions<ListStaffRolesData>): UseDataConnectQueryResult<ListStaffRolesData, ListStaffRolesVariables>;
Variables
The listStaffRoles Query has an optional argument of type ListStaffRolesVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffRolesVariables {
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listStaffRoles Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listStaffRoles Query is of type ListStaffRolesData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffRolesData {
staffRoles: ({
id: UUIDString;
staffId: UUIDString;
roleId: UUIDString;
createdAt?: TimestampString | null;
roleType?: RoleType | null;
staff: {
id: UUIDString;
fullName: string;
userId: string;
email?: string | null;
phone?: string | null;
} & Staff_Key;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
} & StaffRole_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listStaffRoles's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListStaffRolesVariables } from '@dataconnect/generated';
import { useListStaffRoles } from '@dataconnect/generated/react'
export default function ListStaffRolesComponent() {
// The `useListStaffRoles` Query hook has an optional argument of type `ListStaffRolesVariables`:
const listStaffRolesVars: ListStaffRolesVariables = {
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListStaffRoles(listStaffRolesVars);
// Variables can be defined inline as well.
const query = useListStaffRoles({ offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `ListStaffRolesVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useListStaffRoles();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListStaffRoles(dataConnect, listStaffRolesVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListStaffRoles(listStaffRolesVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useListStaffRoles(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListStaffRoles(dataConnect, listStaffRolesVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.staffRoles);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getStaffRoleByKey
You can execute the getStaffRoleByKey Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetStaffRoleByKey(dc: DataConnect, vars: GetStaffRoleByKeyVariables, options?: useDataConnectQueryOptions<GetStaffRoleByKeyData>): UseDataConnectQueryResult<GetStaffRoleByKeyData, GetStaffRoleByKeyVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetStaffRoleByKey(vars: GetStaffRoleByKeyVariables, options?: useDataConnectQueryOptions<GetStaffRoleByKeyData>): UseDataConnectQueryResult<GetStaffRoleByKeyData, GetStaffRoleByKeyVariables>;
Variables
The getStaffRoleByKey Query requires an argument of type GetStaffRoleByKeyVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetStaffRoleByKeyVariables {
staffId: UUIDString;
roleId: UUIDString;
}
Return Type
Recall that calling the getStaffRoleByKey Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getStaffRoleByKey Query is of type GetStaffRoleByKeyData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetStaffRoleByKeyData {
staffRole?: {
id: UUIDString;
staffId: UUIDString;
roleId: UUIDString;
createdAt?: TimestampString | null;
roleType?: RoleType | null;
staff: {
id: UUIDString;
fullName: string;
userId: string;
email?: string | null;
phone?: string | null;
} & Staff_Key;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
} & StaffRole_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getStaffRoleByKey's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetStaffRoleByKeyVariables } from '@dataconnect/generated';
import { useGetStaffRoleByKey } from '@dataconnect/generated/react'
export default function GetStaffRoleByKeyComponent() {
// The `useGetStaffRoleByKey` Query hook requires an argument of type `GetStaffRoleByKeyVariables`:
const getStaffRoleByKeyVars: GetStaffRoleByKeyVariables = {
staffId: ...,
roleId: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetStaffRoleByKey(getStaffRoleByKeyVars);
// Variables can be defined inline as well.
const query = useGetStaffRoleByKey({ staffId: ..., roleId: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetStaffRoleByKey(dataConnect, getStaffRoleByKeyVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetStaffRoleByKey(getStaffRoleByKeyVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetStaffRoleByKey(dataConnect, getStaffRoleByKeyVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.staffRole);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listStaffRolesByStaffId
You can execute the listStaffRolesByStaffId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListStaffRolesByStaffId(dc: DataConnect, vars: ListStaffRolesByStaffIdVariables, options?: useDataConnectQueryOptions<ListStaffRolesByStaffIdData>): UseDataConnectQueryResult<ListStaffRolesByStaffIdData, ListStaffRolesByStaffIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListStaffRolesByStaffId(vars: ListStaffRolesByStaffIdVariables, options?: useDataConnectQueryOptions<ListStaffRolesByStaffIdData>): UseDataConnectQueryResult<ListStaffRolesByStaffIdData, ListStaffRolesByStaffIdVariables>;
Variables
The listStaffRolesByStaffId Query requires an argument of type ListStaffRolesByStaffIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffRolesByStaffIdVariables {
staffId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listStaffRolesByStaffId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listStaffRolesByStaffId Query is of type ListStaffRolesByStaffIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffRolesByStaffIdData {
staffRoles: ({
id: UUIDString;
staffId: UUIDString;
roleId: UUIDString;
createdAt?: TimestampString | null;
roleType?: RoleType | null;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
} & StaffRole_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listStaffRolesByStaffId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListStaffRolesByStaffIdVariables } from '@dataconnect/generated';
import { useListStaffRolesByStaffId } from '@dataconnect/generated/react'
export default function ListStaffRolesByStaffIdComponent() {
// The `useListStaffRolesByStaffId` Query hook requires an argument of type `ListStaffRolesByStaffIdVariables`:
const listStaffRolesByStaffIdVars: ListStaffRolesByStaffIdVariables = {
staffId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListStaffRolesByStaffId(listStaffRolesByStaffIdVars);
// Variables can be defined inline as well.
const query = useListStaffRolesByStaffId({ staffId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListStaffRolesByStaffId(dataConnect, listStaffRolesByStaffIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListStaffRolesByStaffId(listStaffRolesByStaffIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListStaffRolesByStaffId(dataConnect, listStaffRolesByStaffIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.staffRoles);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listStaffRolesByRoleId
You can execute the listStaffRolesByRoleId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListStaffRolesByRoleId(dc: DataConnect, vars: ListStaffRolesByRoleIdVariables, options?: useDataConnectQueryOptions<ListStaffRolesByRoleIdData>): UseDataConnectQueryResult<ListStaffRolesByRoleIdData, ListStaffRolesByRoleIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListStaffRolesByRoleId(vars: ListStaffRolesByRoleIdVariables, options?: useDataConnectQueryOptions<ListStaffRolesByRoleIdData>): UseDataConnectQueryResult<ListStaffRolesByRoleIdData, ListStaffRolesByRoleIdVariables>;
Variables
The listStaffRolesByRoleId Query requires an argument of type ListStaffRolesByRoleIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffRolesByRoleIdVariables {
roleId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listStaffRolesByRoleId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listStaffRolesByRoleId Query is of type ListStaffRolesByRoleIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffRolesByRoleIdData {
staffRoles: ({
id: UUIDString;
staffId: UUIDString;
roleId: UUIDString;
createdAt?: TimestampString | null;
roleType?: RoleType | null;
staff: {
id: UUIDString;
fullName: string;
userId: string;
email?: string | null;
phone?: string | null;
} & Staff_Key;
} & StaffRole_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listStaffRolesByRoleId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListStaffRolesByRoleIdVariables } from '@dataconnect/generated';
import { useListStaffRolesByRoleId } from '@dataconnect/generated/react'
export default function ListStaffRolesByRoleIdComponent() {
// The `useListStaffRolesByRoleId` Query hook requires an argument of type `ListStaffRolesByRoleIdVariables`:
const listStaffRolesByRoleIdVars: ListStaffRolesByRoleIdVariables = {
roleId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListStaffRolesByRoleId(listStaffRolesByRoleIdVars);
// Variables can be defined inline as well.
const query = useListStaffRolesByRoleId({ roleId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListStaffRolesByRoleId(dataConnect, listStaffRolesByRoleIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListStaffRolesByRoleId(listStaffRolesByRoleIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListStaffRolesByRoleId(dataConnect, listStaffRolesByRoleIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.staffRoles);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterStaffRoles
You can execute the filterStaffRoles Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterStaffRoles(dc: DataConnect, vars?: FilterStaffRolesVariables, options?: useDataConnectQueryOptions<FilterStaffRolesData>): UseDataConnectQueryResult<FilterStaffRolesData, FilterStaffRolesVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterStaffRoles(vars?: FilterStaffRolesVariables, options?: useDataConnectQueryOptions<FilterStaffRolesData>): UseDataConnectQueryResult<FilterStaffRolesData, FilterStaffRolesVariables>;
Variables
The filterStaffRoles Query has an optional argument of type FilterStaffRolesVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterStaffRolesVariables {
staffId?: UUIDString | null;
roleId?: UUIDString | null;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the filterStaffRoles Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the filterStaffRoles Query is of type FilterStaffRolesData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterStaffRolesData {
staffRoles: ({
id: UUIDString;
staffId: UUIDString;
roleId: UUIDString;
createdAt?: TimestampString | null;
roleType?: RoleType | null;
} & StaffRole_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterStaffRoles's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterStaffRolesVariables } from '@dataconnect/generated';
import { useFilterStaffRoles } from '@dataconnect/generated/react'
export default function FilterStaffRolesComponent() {
// The `useFilterStaffRoles` Query hook has an optional argument of type `FilterStaffRolesVariables`:
const filterStaffRolesVars: FilterStaffRolesVariables = {
staffId: ..., // optional
roleId: ..., // optional
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useFilterStaffRoles(filterStaffRolesVars);
// Variables can be defined inline as well.
const query = useFilterStaffRoles({ staffId: ..., roleId: ..., offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `FilterStaffRolesVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterStaffRoles();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterStaffRoles(dataConnect, filterStaffRolesVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterStaffRoles(filterStaffRolesVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useFilterStaffRoles(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useFilterStaffRoles(dataConnect, filterStaffRolesVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.staffRoles);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listTaskComments
You can execute the listTaskComments Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListTaskComments(dc: DataConnect, options?: useDataConnectQueryOptions<ListTaskCommentsData>): UseDataConnectQueryResult<ListTaskCommentsData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListTaskComments(options?: useDataConnectQueryOptions<ListTaskCommentsData>): UseDataConnectQueryResult<ListTaskCommentsData, undefined>;
Variables
The listTaskComments Query has no variables.
Return Type
Recall that calling the listTaskComments Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listTaskComments Query is of type ListTaskCommentsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListTaskCommentsData {
taskComments: ({
id: UUIDString;
taskId: UUIDString;
teamMemberId: UUIDString;
comment: string;
isSystem: boolean;
createdAt?: TimestampString | null;
teamMember: {
user: {
fullName?: string | null;
email?: string | null;
};
};
} & TaskComment_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listTaskComments's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListTaskComments } from '@dataconnect/generated/react'
export default function ListTaskCommentsComponent() {
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListTaskComments();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListTaskComments(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListTaskComments(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListTaskComments(dataConnect, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.taskComments);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getTaskCommentById
You can execute the getTaskCommentById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetTaskCommentById(dc: DataConnect, vars: GetTaskCommentByIdVariables, options?: useDataConnectQueryOptions<GetTaskCommentByIdData>): UseDataConnectQueryResult<GetTaskCommentByIdData, GetTaskCommentByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetTaskCommentById(vars: GetTaskCommentByIdVariables, options?: useDataConnectQueryOptions<GetTaskCommentByIdData>): UseDataConnectQueryResult<GetTaskCommentByIdData, GetTaskCommentByIdVariables>;
Variables
The getTaskCommentById Query requires an argument of type GetTaskCommentByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTaskCommentByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getTaskCommentById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getTaskCommentById Query is of type GetTaskCommentByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTaskCommentByIdData {
taskComment?: {
id: UUIDString;
taskId: UUIDString;
teamMemberId: UUIDString;
comment: string;
isSystem: boolean;
createdAt?: TimestampString | null;
teamMember: {
user: {
fullName?: string | null;
email?: string | null;
};
};
} & TaskComment_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getTaskCommentById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetTaskCommentByIdVariables } from '@dataconnect/generated';
import { useGetTaskCommentById } from '@dataconnect/generated/react'
export default function GetTaskCommentByIdComponent() {
// The `useGetTaskCommentById` Query hook requires an argument of type `GetTaskCommentByIdVariables`:
const getTaskCommentByIdVars: GetTaskCommentByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetTaskCommentById(getTaskCommentByIdVars);
// Variables can be defined inline as well.
const query = useGetTaskCommentById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetTaskCommentById(dataConnect, getTaskCommentByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetTaskCommentById(getTaskCommentByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetTaskCommentById(dataConnect, getTaskCommentByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.taskComment);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getTaskCommentsByTaskId
You can execute the getTaskCommentsByTaskId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetTaskCommentsByTaskId(dc: DataConnect, vars: GetTaskCommentsByTaskIdVariables, options?: useDataConnectQueryOptions<GetTaskCommentsByTaskIdData>): UseDataConnectQueryResult<GetTaskCommentsByTaskIdData, GetTaskCommentsByTaskIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetTaskCommentsByTaskId(vars: GetTaskCommentsByTaskIdVariables, options?: useDataConnectQueryOptions<GetTaskCommentsByTaskIdData>): UseDataConnectQueryResult<GetTaskCommentsByTaskIdData, GetTaskCommentsByTaskIdVariables>;
Variables
The getTaskCommentsByTaskId Query requires an argument of type GetTaskCommentsByTaskIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTaskCommentsByTaskIdVariables {
taskId: UUIDString;
}
Return Type
Recall that calling the getTaskCommentsByTaskId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getTaskCommentsByTaskId Query is of type GetTaskCommentsByTaskIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTaskCommentsByTaskIdData {
taskComments: ({
id: UUIDString;
taskId: UUIDString;
teamMemberId: UUIDString;
comment: string;
isSystem: boolean;
createdAt?: TimestampString | null;
teamMember: {
user: {
fullName?: string | null;
email?: string | null;
};
};
} & TaskComment_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getTaskCommentsByTaskId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetTaskCommentsByTaskIdVariables } from '@dataconnect/generated';
import { useGetTaskCommentsByTaskId } from '@dataconnect/generated/react'
export default function GetTaskCommentsByTaskIdComponent() {
// The `useGetTaskCommentsByTaskId` Query hook requires an argument of type `GetTaskCommentsByTaskIdVariables`:
const getTaskCommentsByTaskIdVars: GetTaskCommentsByTaskIdVariables = {
taskId: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetTaskCommentsByTaskId(getTaskCommentsByTaskIdVars);
// Variables can be defined inline as well.
const query = useGetTaskCommentsByTaskId({ taskId: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetTaskCommentsByTaskId(dataConnect, getTaskCommentsByTaskIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetTaskCommentsByTaskId(getTaskCommentsByTaskIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetTaskCommentsByTaskId(dataConnect, getTaskCommentsByTaskIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.taskComments);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listDocuments
You can execute the listDocuments Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListDocuments(dc: DataConnect, options?: useDataConnectQueryOptions<ListDocumentsData>): UseDataConnectQueryResult<ListDocumentsData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListDocuments(options?: useDataConnectQueryOptions<ListDocumentsData>): UseDataConnectQueryResult<ListDocumentsData, undefined>;
Variables
The listDocuments Query has no variables.
Return Type
Recall that calling the listDocuments Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listDocuments Query is of type ListDocumentsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListDocumentsData {
documents: ({
id: UUIDString;
documentType: DocumentType;
name: string;
description?: string | null;
createdAt?: TimestampString | null;
} & Document_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listDocuments's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListDocuments } from '@dataconnect/generated/react'
export default function ListDocumentsComponent() {
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListDocuments();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListDocuments(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListDocuments(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListDocuments(dataConnect, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.documents);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getDocumentById
You can execute the getDocumentById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetDocumentById(dc: DataConnect, vars: GetDocumentByIdVariables, options?: useDataConnectQueryOptions<GetDocumentByIdData>): UseDataConnectQueryResult<GetDocumentByIdData, GetDocumentByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetDocumentById(vars: GetDocumentByIdVariables, options?: useDataConnectQueryOptions<GetDocumentByIdData>): UseDataConnectQueryResult<GetDocumentByIdData, GetDocumentByIdVariables>;
Variables
The getDocumentById Query requires an argument of type GetDocumentByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetDocumentByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getDocumentById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getDocumentById Query is of type GetDocumentByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetDocumentByIdData {
document?: {
id: UUIDString;
documentType: DocumentType;
name: string;
description?: string | null;
createdAt?: TimestampString | null;
} & Document_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getDocumentById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetDocumentByIdVariables } from '@dataconnect/generated';
import { useGetDocumentById } from '@dataconnect/generated/react'
export default function GetDocumentByIdComponent() {
// The `useGetDocumentById` Query hook requires an argument of type `GetDocumentByIdVariables`:
const getDocumentByIdVars: GetDocumentByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetDocumentById(getDocumentByIdVars);
// Variables can be defined inline as well.
const query = useGetDocumentById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetDocumentById(dataConnect, getDocumentByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetDocumentById(getDocumentByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetDocumentById(dataConnect, getDocumentByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.document);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterDocuments
You can execute the filterDocuments Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterDocuments(dc: DataConnect, vars?: FilterDocumentsVariables, options?: useDataConnectQueryOptions<FilterDocumentsData>): UseDataConnectQueryResult<FilterDocumentsData, FilterDocumentsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterDocuments(vars?: FilterDocumentsVariables, options?: useDataConnectQueryOptions<FilterDocumentsData>): UseDataConnectQueryResult<FilterDocumentsData, FilterDocumentsVariables>;
Variables
The filterDocuments Query has an optional argument of type FilterDocumentsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterDocumentsVariables {
documentType?: DocumentType | null;
}
Return Type
Recall that calling the filterDocuments Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the filterDocuments Query is of type FilterDocumentsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterDocumentsData {
documents: ({
id: UUIDString;
documentType: DocumentType;
name: string;
description?: string | null;
createdAt?: TimestampString | null;
} & Document_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterDocuments's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterDocumentsVariables } from '@dataconnect/generated';
import { useFilterDocuments } from '@dataconnect/generated/react'
export default function FilterDocumentsComponent() {
// The `useFilterDocuments` Query hook has an optional argument of type `FilterDocumentsVariables`:
const filterDocumentsVars: FilterDocumentsVariables = {
documentType: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useFilterDocuments(filterDocumentsVars);
// Variables can be defined inline as well.
const query = useFilterDocuments({ documentType: ..., });
// Since all variables are optional for this Query, you can omit the `FilterDocumentsVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterDocuments();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterDocuments(dataConnect, filterDocumentsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterDocuments(filterDocumentsVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useFilterDocuments(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useFilterDocuments(dataConnect, filterDocumentsVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.documents);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listShiftsForCoverage
You can execute the listShiftsForCoverage Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListShiftsForCoverage(dc: DataConnect, vars: ListShiftsForCoverageVariables, options?: useDataConnectQueryOptions<ListShiftsForCoverageData>): UseDataConnectQueryResult<ListShiftsForCoverageData, ListShiftsForCoverageVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListShiftsForCoverage(vars: ListShiftsForCoverageVariables, options?: useDataConnectQueryOptions<ListShiftsForCoverageData>): UseDataConnectQueryResult<ListShiftsForCoverageData, ListShiftsForCoverageVariables>;
Variables
The listShiftsForCoverage Query requires an argument of type ListShiftsForCoverageVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftsForCoverageVariables {
businessId: UUIDString;
startDate: TimestampString;
endDate: TimestampString;
}
Return Type
Recall that calling the listShiftsForCoverage Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listShiftsForCoverage Query is of type ListShiftsForCoverageData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftsForCoverageData {
shifts: ({
id: UUIDString;
date?: TimestampString | null;
workersNeeded?: number | null;
filled?: number | null;
status?: ShiftStatus | null;
} & Shift_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listShiftsForCoverage's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListShiftsForCoverageVariables } from '@dataconnect/generated';
import { useListShiftsForCoverage } from '@dataconnect/generated/react'
export default function ListShiftsForCoverageComponent() {
// The `useListShiftsForCoverage` Query hook requires an argument of type `ListShiftsForCoverageVariables`:
const listShiftsForCoverageVars: ListShiftsForCoverageVariables = {
businessId: ...,
startDate: ...,
endDate: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListShiftsForCoverage(listShiftsForCoverageVars);
// Variables can be defined inline as well.
const query = useListShiftsForCoverage({ businessId: ..., startDate: ..., endDate: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListShiftsForCoverage(dataConnect, listShiftsForCoverageVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListShiftsForCoverage(listShiftsForCoverageVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListShiftsForCoverage(dataConnect, listShiftsForCoverageVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.shifts);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listApplicationsForCoverage
You can execute the listApplicationsForCoverage Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListApplicationsForCoverage(dc: DataConnect, vars: ListApplicationsForCoverageVariables, options?: useDataConnectQueryOptions<ListApplicationsForCoverageData>): UseDataConnectQueryResult<ListApplicationsForCoverageData, ListApplicationsForCoverageVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListApplicationsForCoverage(vars: ListApplicationsForCoverageVariables, options?: useDataConnectQueryOptions<ListApplicationsForCoverageData>): UseDataConnectQueryResult<ListApplicationsForCoverageData, ListApplicationsForCoverageVariables>;
Variables
The listApplicationsForCoverage Query requires an argument of type ListApplicationsForCoverageVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListApplicationsForCoverageVariables {
shiftIds: UUIDString[];
}
Return Type
Recall that calling the listApplicationsForCoverage Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listApplicationsForCoverage Query is of type ListApplicationsForCoverageData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListApplicationsForCoverageData {
applications: ({
id: UUIDString;
shiftId: UUIDString;
staffId: UUIDString;
status: ApplicationStatus;
} & Application_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listApplicationsForCoverage's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListApplicationsForCoverageVariables } from '@dataconnect/generated';
import { useListApplicationsForCoverage } from '@dataconnect/generated/react'
export default function ListApplicationsForCoverageComponent() {
// The `useListApplicationsForCoverage` Query hook requires an argument of type `ListApplicationsForCoverageVariables`:
const listApplicationsForCoverageVars: ListApplicationsForCoverageVariables = {
shiftIds: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListApplicationsForCoverage(listApplicationsForCoverageVars);
// Variables can be defined inline as well.
const query = useListApplicationsForCoverage({ shiftIds: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListApplicationsForCoverage(dataConnect, listApplicationsForCoverageVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListApplicationsForCoverage(listApplicationsForCoverageVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListApplicationsForCoverage(dataConnect, listApplicationsForCoverageVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.applications);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listShiftsForDailyOpsByBusiness
You can execute the listShiftsForDailyOpsByBusiness Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListShiftsForDailyOpsByBusiness(dc: DataConnect, vars: ListShiftsForDailyOpsByBusinessVariables, options?: useDataConnectQueryOptions<ListShiftsForDailyOpsByBusinessData>): UseDataConnectQueryResult<ListShiftsForDailyOpsByBusinessData, ListShiftsForDailyOpsByBusinessVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListShiftsForDailyOpsByBusiness(vars: ListShiftsForDailyOpsByBusinessVariables, options?: useDataConnectQueryOptions<ListShiftsForDailyOpsByBusinessData>): UseDataConnectQueryResult<ListShiftsForDailyOpsByBusinessData, ListShiftsForDailyOpsByBusinessVariables>;
Variables
The listShiftsForDailyOpsByBusiness Query requires an argument of type ListShiftsForDailyOpsByBusinessVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftsForDailyOpsByBusinessVariables {
businessId: UUIDString;
date: TimestampString;
}
Return Type
Recall that calling the listShiftsForDailyOpsByBusiness Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listShiftsForDailyOpsByBusiness Query is of type ListShiftsForDailyOpsByBusinessData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftsForDailyOpsByBusinessData {
shifts: ({
id: UUIDString;
title: string;
location?: string | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
workersNeeded?: number | null;
filled?: number | null;
status?: ShiftStatus | null;
} & Shift_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listShiftsForDailyOpsByBusiness's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListShiftsForDailyOpsByBusinessVariables } from '@dataconnect/generated';
import { useListShiftsForDailyOpsByBusiness } from '@dataconnect/generated/react'
export default function ListShiftsForDailyOpsByBusinessComponent() {
// The `useListShiftsForDailyOpsByBusiness` Query hook requires an argument of type `ListShiftsForDailyOpsByBusinessVariables`:
const listShiftsForDailyOpsByBusinessVars: ListShiftsForDailyOpsByBusinessVariables = {
businessId: ...,
date: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListShiftsForDailyOpsByBusiness(listShiftsForDailyOpsByBusinessVars);
// Variables can be defined inline as well.
const query = useListShiftsForDailyOpsByBusiness({ businessId: ..., date: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListShiftsForDailyOpsByBusiness(dataConnect, listShiftsForDailyOpsByBusinessVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListShiftsForDailyOpsByBusiness(listShiftsForDailyOpsByBusinessVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListShiftsForDailyOpsByBusiness(dataConnect, listShiftsForDailyOpsByBusinessVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.shifts);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listShiftsForDailyOpsByVendor
You can execute the listShiftsForDailyOpsByVendor Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListShiftsForDailyOpsByVendor(dc: DataConnect, vars: ListShiftsForDailyOpsByVendorVariables, options?: useDataConnectQueryOptions<ListShiftsForDailyOpsByVendorData>): UseDataConnectQueryResult<ListShiftsForDailyOpsByVendorData, ListShiftsForDailyOpsByVendorVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListShiftsForDailyOpsByVendor(vars: ListShiftsForDailyOpsByVendorVariables, options?: useDataConnectQueryOptions<ListShiftsForDailyOpsByVendorData>): UseDataConnectQueryResult<ListShiftsForDailyOpsByVendorData, ListShiftsForDailyOpsByVendorVariables>;
Variables
The listShiftsForDailyOpsByVendor Query requires an argument of type ListShiftsForDailyOpsByVendorVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftsForDailyOpsByVendorVariables {
vendorId: UUIDString;
date: TimestampString;
}
Return Type
Recall that calling the listShiftsForDailyOpsByVendor Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listShiftsForDailyOpsByVendor Query is of type ListShiftsForDailyOpsByVendorData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftsForDailyOpsByVendorData {
shifts: ({
id: UUIDString;
title: string;
location?: string | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
workersNeeded?: number | null;
filled?: number | null;
status?: ShiftStatus | null;
} & Shift_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listShiftsForDailyOpsByVendor's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListShiftsForDailyOpsByVendorVariables } from '@dataconnect/generated';
import { useListShiftsForDailyOpsByVendor } from '@dataconnect/generated/react'
export default function ListShiftsForDailyOpsByVendorComponent() {
// The `useListShiftsForDailyOpsByVendor` Query hook requires an argument of type `ListShiftsForDailyOpsByVendorVariables`:
const listShiftsForDailyOpsByVendorVars: ListShiftsForDailyOpsByVendorVariables = {
vendorId: ...,
date: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListShiftsForDailyOpsByVendor(listShiftsForDailyOpsByVendorVars);
// Variables can be defined inline as well.
const query = useListShiftsForDailyOpsByVendor({ vendorId: ..., date: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListShiftsForDailyOpsByVendor(dataConnect, listShiftsForDailyOpsByVendorVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListShiftsForDailyOpsByVendor(listShiftsForDailyOpsByVendorVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListShiftsForDailyOpsByVendor(dataConnect, listShiftsForDailyOpsByVendorVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.shifts);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listApplicationsForDailyOps
You can execute the listApplicationsForDailyOps Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListApplicationsForDailyOps(dc: DataConnect, vars: ListApplicationsForDailyOpsVariables, options?: useDataConnectQueryOptions<ListApplicationsForDailyOpsData>): UseDataConnectQueryResult<ListApplicationsForDailyOpsData, ListApplicationsForDailyOpsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListApplicationsForDailyOps(vars: ListApplicationsForDailyOpsVariables, options?: useDataConnectQueryOptions<ListApplicationsForDailyOpsData>): UseDataConnectQueryResult<ListApplicationsForDailyOpsData, ListApplicationsForDailyOpsVariables>;
Variables
The listApplicationsForDailyOps Query requires an argument of type ListApplicationsForDailyOpsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListApplicationsForDailyOpsVariables {
shiftIds: UUIDString[];
}
Return Type
Recall that calling the listApplicationsForDailyOps Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listApplicationsForDailyOps Query is of type ListApplicationsForDailyOpsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListApplicationsForDailyOpsData {
applications: ({
id: UUIDString;
shiftId: UUIDString;
staffId: UUIDString;
status: ApplicationStatus;
checkInTime?: TimestampString | null;
checkOutTime?: TimestampString | null;
} & Application_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listApplicationsForDailyOps's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListApplicationsForDailyOpsVariables } from '@dataconnect/generated';
import { useListApplicationsForDailyOps } from '@dataconnect/generated/react'
export default function ListApplicationsForDailyOpsComponent() {
// The `useListApplicationsForDailyOps` Query hook requires an argument of type `ListApplicationsForDailyOpsVariables`:
const listApplicationsForDailyOpsVars: ListApplicationsForDailyOpsVariables = {
shiftIds: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListApplicationsForDailyOps(listApplicationsForDailyOpsVars);
// Variables can be defined inline as well.
const query = useListApplicationsForDailyOps({ shiftIds: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListApplicationsForDailyOps(dataConnect, listApplicationsForDailyOpsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListApplicationsForDailyOps(listApplicationsForDailyOpsVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListApplicationsForDailyOps(dataConnect, listApplicationsForDailyOpsVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.applications);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listShiftsForForecastByBusiness
You can execute the listShiftsForForecastByBusiness Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListShiftsForForecastByBusiness(dc: DataConnect, vars: ListShiftsForForecastByBusinessVariables, options?: useDataConnectQueryOptions<ListShiftsForForecastByBusinessData>): UseDataConnectQueryResult<ListShiftsForForecastByBusinessData, ListShiftsForForecastByBusinessVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListShiftsForForecastByBusiness(vars: ListShiftsForForecastByBusinessVariables, options?: useDataConnectQueryOptions<ListShiftsForForecastByBusinessData>): UseDataConnectQueryResult<ListShiftsForForecastByBusinessData, ListShiftsForForecastByBusinessVariables>;
Variables
The listShiftsForForecastByBusiness Query requires an argument of type ListShiftsForForecastByBusinessVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftsForForecastByBusinessVariables {
businessId: UUIDString;
startDate: TimestampString;
endDate: TimestampString;
}
Return Type
Recall that calling the listShiftsForForecastByBusiness Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listShiftsForForecastByBusiness Query is of type ListShiftsForForecastByBusinessData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftsForForecastByBusinessData {
shifts: ({
id: UUIDString;
date?: TimestampString | null;
workersNeeded?: number | null;
hours?: number | null;
cost?: number | null;
status?: ShiftStatus | null;
} & Shift_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listShiftsForForecastByBusiness's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListShiftsForForecastByBusinessVariables } from '@dataconnect/generated';
import { useListShiftsForForecastByBusiness } from '@dataconnect/generated/react'
export default function ListShiftsForForecastByBusinessComponent() {
// The `useListShiftsForForecastByBusiness` Query hook requires an argument of type `ListShiftsForForecastByBusinessVariables`:
const listShiftsForForecastByBusinessVars: ListShiftsForForecastByBusinessVariables = {
businessId: ...,
startDate: ...,
endDate: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListShiftsForForecastByBusiness(listShiftsForForecastByBusinessVars);
// Variables can be defined inline as well.
const query = useListShiftsForForecastByBusiness({ businessId: ..., startDate: ..., endDate: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListShiftsForForecastByBusiness(dataConnect, listShiftsForForecastByBusinessVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListShiftsForForecastByBusiness(listShiftsForForecastByBusinessVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListShiftsForForecastByBusiness(dataConnect, listShiftsForForecastByBusinessVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.shifts);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listShiftsForForecastByVendor
You can execute the listShiftsForForecastByVendor Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListShiftsForForecastByVendor(dc: DataConnect, vars: ListShiftsForForecastByVendorVariables, options?: useDataConnectQueryOptions<ListShiftsForForecastByVendorData>): UseDataConnectQueryResult<ListShiftsForForecastByVendorData, ListShiftsForForecastByVendorVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListShiftsForForecastByVendor(vars: ListShiftsForForecastByVendorVariables, options?: useDataConnectQueryOptions<ListShiftsForForecastByVendorData>): UseDataConnectQueryResult<ListShiftsForForecastByVendorData, ListShiftsForForecastByVendorVariables>;
Variables
The listShiftsForForecastByVendor Query requires an argument of type ListShiftsForForecastByVendorVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftsForForecastByVendorVariables {
vendorId: UUIDString;
startDate: TimestampString;
endDate: TimestampString;
}
Return Type
Recall that calling the listShiftsForForecastByVendor Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listShiftsForForecastByVendor Query is of type ListShiftsForForecastByVendorData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftsForForecastByVendorData {
shifts: ({
id: UUIDString;
date?: TimestampString | null;
workersNeeded?: number | null;
hours?: number | null;
cost?: number | null;
status?: ShiftStatus | null;
} & Shift_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listShiftsForForecastByVendor's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListShiftsForForecastByVendorVariables } from '@dataconnect/generated';
import { useListShiftsForForecastByVendor } from '@dataconnect/generated/react'
export default function ListShiftsForForecastByVendorComponent() {
// The `useListShiftsForForecastByVendor` Query hook requires an argument of type `ListShiftsForForecastByVendorVariables`:
const listShiftsForForecastByVendorVars: ListShiftsForForecastByVendorVariables = {
vendorId: ...,
startDate: ...,
endDate: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListShiftsForForecastByVendor(listShiftsForForecastByVendorVars);
// Variables can be defined inline as well.
const query = useListShiftsForForecastByVendor({ vendorId: ..., startDate: ..., endDate: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListShiftsForForecastByVendor(dataConnect, listShiftsForForecastByVendorVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListShiftsForForecastByVendor(listShiftsForForecastByVendorVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListShiftsForForecastByVendor(dataConnect, listShiftsForForecastByVendorVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.shifts);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listShiftsForNoShowRangeByBusiness
You can execute the listShiftsForNoShowRangeByBusiness Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListShiftsForNoShowRangeByBusiness(dc: DataConnect, vars: ListShiftsForNoShowRangeByBusinessVariables, options?: useDataConnectQueryOptions<ListShiftsForNoShowRangeByBusinessData>): UseDataConnectQueryResult<ListShiftsForNoShowRangeByBusinessData, ListShiftsForNoShowRangeByBusinessVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListShiftsForNoShowRangeByBusiness(vars: ListShiftsForNoShowRangeByBusinessVariables, options?: useDataConnectQueryOptions<ListShiftsForNoShowRangeByBusinessData>): UseDataConnectQueryResult<ListShiftsForNoShowRangeByBusinessData, ListShiftsForNoShowRangeByBusinessVariables>;
Variables
The listShiftsForNoShowRangeByBusiness Query requires an argument of type ListShiftsForNoShowRangeByBusinessVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftsForNoShowRangeByBusinessVariables {
businessId: UUIDString;
startDate: TimestampString;
endDate: TimestampString;
}
Return Type
Recall that calling the listShiftsForNoShowRangeByBusiness Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listShiftsForNoShowRangeByBusiness Query is of type ListShiftsForNoShowRangeByBusinessData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftsForNoShowRangeByBusinessData {
shifts: ({
id: UUIDString;
date?: TimestampString | null;
} & Shift_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listShiftsForNoShowRangeByBusiness's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListShiftsForNoShowRangeByBusinessVariables } from '@dataconnect/generated';
import { useListShiftsForNoShowRangeByBusiness } from '@dataconnect/generated/react'
export default function ListShiftsForNoShowRangeByBusinessComponent() {
// The `useListShiftsForNoShowRangeByBusiness` Query hook requires an argument of type `ListShiftsForNoShowRangeByBusinessVariables`:
const listShiftsForNoShowRangeByBusinessVars: ListShiftsForNoShowRangeByBusinessVariables = {
businessId: ...,
startDate: ...,
endDate: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListShiftsForNoShowRangeByBusiness(listShiftsForNoShowRangeByBusinessVars);
// Variables can be defined inline as well.
const query = useListShiftsForNoShowRangeByBusiness({ businessId: ..., startDate: ..., endDate: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListShiftsForNoShowRangeByBusiness(dataConnect, listShiftsForNoShowRangeByBusinessVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListShiftsForNoShowRangeByBusiness(listShiftsForNoShowRangeByBusinessVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListShiftsForNoShowRangeByBusiness(dataConnect, listShiftsForNoShowRangeByBusinessVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.shifts);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listShiftsForNoShowRangeByVendor
You can execute the listShiftsForNoShowRangeByVendor Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListShiftsForNoShowRangeByVendor(dc: DataConnect, vars: ListShiftsForNoShowRangeByVendorVariables, options?: useDataConnectQueryOptions<ListShiftsForNoShowRangeByVendorData>): UseDataConnectQueryResult<ListShiftsForNoShowRangeByVendorData, ListShiftsForNoShowRangeByVendorVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListShiftsForNoShowRangeByVendor(vars: ListShiftsForNoShowRangeByVendorVariables, options?: useDataConnectQueryOptions<ListShiftsForNoShowRangeByVendorData>): UseDataConnectQueryResult<ListShiftsForNoShowRangeByVendorData, ListShiftsForNoShowRangeByVendorVariables>;
Variables
The listShiftsForNoShowRangeByVendor Query requires an argument of type ListShiftsForNoShowRangeByVendorVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftsForNoShowRangeByVendorVariables {
vendorId: UUIDString;
startDate: TimestampString;
endDate: TimestampString;
}
Return Type
Recall that calling the listShiftsForNoShowRangeByVendor Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listShiftsForNoShowRangeByVendor Query is of type ListShiftsForNoShowRangeByVendorData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftsForNoShowRangeByVendorData {
shifts: ({
id: UUIDString;
date?: TimestampString | null;
} & Shift_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listShiftsForNoShowRangeByVendor's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListShiftsForNoShowRangeByVendorVariables } from '@dataconnect/generated';
import { useListShiftsForNoShowRangeByVendor } from '@dataconnect/generated/react'
export default function ListShiftsForNoShowRangeByVendorComponent() {
// The `useListShiftsForNoShowRangeByVendor` Query hook requires an argument of type `ListShiftsForNoShowRangeByVendorVariables`:
const listShiftsForNoShowRangeByVendorVars: ListShiftsForNoShowRangeByVendorVariables = {
vendorId: ...,
startDate: ...,
endDate: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListShiftsForNoShowRangeByVendor(listShiftsForNoShowRangeByVendorVars);
// Variables can be defined inline as well.
const query = useListShiftsForNoShowRangeByVendor({ vendorId: ..., startDate: ..., endDate: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListShiftsForNoShowRangeByVendor(dataConnect, listShiftsForNoShowRangeByVendorVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListShiftsForNoShowRangeByVendor(listShiftsForNoShowRangeByVendorVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListShiftsForNoShowRangeByVendor(dataConnect, listShiftsForNoShowRangeByVendorVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.shifts);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listApplicationsForNoShowRange
You can execute the listApplicationsForNoShowRange Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListApplicationsForNoShowRange(dc: DataConnect, vars: ListApplicationsForNoShowRangeVariables, options?: useDataConnectQueryOptions<ListApplicationsForNoShowRangeData>): UseDataConnectQueryResult<ListApplicationsForNoShowRangeData, ListApplicationsForNoShowRangeVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListApplicationsForNoShowRange(vars: ListApplicationsForNoShowRangeVariables, options?: useDataConnectQueryOptions<ListApplicationsForNoShowRangeData>): UseDataConnectQueryResult<ListApplicationsForNoShowRangeData, ListApplicationsForNoShowRangeVariables>;
Variables
The listApplicationsForNoShowRange Query requires an argument of type ListApplicationsForNoShowRangeVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListApplicationsForNoShowRangeVariables {
shiftIds: UUIDString[];
}
Return Type
Recall that calling the listApplicationsForNoShowRange Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listApplicationsForNoShowRange Query is of type ListApplicationsForNoShowRangeData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListApplicationsForNoShowRangeData {
applications: ({
id: UUIDString;
shiftId: UUIDString;
staffId: UUIDString;
status: ApplicationStatus;
} & Application_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listApplicationsForNoShowRange's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListApplicationsForNoShowRangeVariables } from '@dataconnect/generated';
import { useListApplicationsForNoShowRange } from '@dataconnect/generated/react'
export default function ListApplicationsForNoShowRangeComponent() {
// The `useListApplicationsForNoShowRange` Query hook requires an argument of type `ListApplicationsForNoShowRangeVariables`:
const listApplicationsForNoShowRangeVars: ListApplicationsForNoShowRangeVariables = {
shiftIds: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListApplicationsForNoShowRange(listApplicationsForNoShowRangeVars);
// Variables can be defined inline as well.
const query = useListApplicationsForNoShowRange({ shiftIds: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListApplicationsForNoShowRange(dataConnect, listApplicationsForNoShowRangeVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListApplicationsForNoShowRange(listApplicationsForNoShowRangeVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListApplicationsForNoShowRange(dataConnect, listApplicationsForNoShowRangeVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.applications);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listStaffForNoShowReport
You can execute the listStaffForNoShowReport Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListStaffForNoShowReport(dc: DataConnect, vars: ListStaffForNoShowReportVariables, options?: useDataConnectQueryOptions<ListStaffForNoShowReportData>): UseDataConnectQueryResult<ListStaffForNoShowReportData, ListStaffForNoShowReportVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListStaffForNoShowReport(vars: ListStaffForNoShowReportVariables, options?: useDataConnectQueryOptions<ListStaffForNoShowReportData>): UseDataConnectQueryResult<ListStaffForNoShowReportData, ListStaffForNoShowReportVariables>;
Variables
The listStaffForNoShowReport Query requires an argument of type ListStaffForNoShowReportVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffForNoShowReportVariables {
staffIds: UUIDString[];
}
Return Type
Recall that calling the listStaffForNoShowReport Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listStaffForNoShowReport Query is of type ListStaffForNoShowReportData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffForNoShowReportData {
staffs: ({
id: UUIDString;
fullName: string;
noShowCount?: number | null;
reliabilityScore?: number | null;
} & Staff_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listStaffForNoShowReport's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListStaffForNoShowReportVariables } from '@dataconnect/generated';
import { useListStaffForNoShowReport } from '@dataconnect/generated/react'
export default function ListStaffForNoShowReportComponent() {
// The `useListStaffForNoShowReport` Query hook requires an argument of type `ListStaffForNoShowReportVariables`:
const listStaffForNoShowReportVars: ListStaffForNoShowReportVariables = {
staffIds: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListStaffForNoShowReport(listStaffForNoShowReportVars);
// Variables can be defined inline as well.
const query = useListStaffForNoShowReport({ staffIds: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListStaffForNoShowReport(dataConnect, listStaffForNoShowReportVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListStaffForNoShowReport(listStaffForNoShowReportVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListStaffForNoShowReport(dataConnect, listStaffForNoShowReportVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.staffs);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listInvoicesForSpendByBusiness
You can execute the listInvoicesForSpendByBusiness Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListInvoicesForSpendByBusiness(dc: DataConnect, vars: ListInvoicesForSpendByBusinessVariables, options?: useDataConnectQueryOptions<ListInvoicesForSpendByBusinessData>): UseDataConnectQueryResult<ListInvoicesForSpendByBusinessData, ListInvoicesForSpendByBusinessVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListInvoicesForSpendByBusiness(vars: ListInvoicesForSpendByBusinessVariables, options?: useDataConnectQueryOptions<ListInvoicesForSpendByBusinessData>): UseDataConnectQueryResult<ListInvoicesForSpendByBusinessData, ListInvoicesForSpendByBusinessVariables>;
Variables
The listInvoicesForSpendByBusiness Query requires an argument of type ListInvoicesForSpendByBusinessVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoicesForSpendByBusinessVariables {
businessId: UUIDString;
startDate: TimestampString;
endDate: TimestampString;
}
Return Type
Recall that calling the listInvoicesForSpendByBusiness Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listInvoicesForSpendByBusiness Query is of type ListInvoicesForSpendByBusinessData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoicesForSpendByBusinessData {
invoices: ({
id: UUIDString;
issueDate: TimestampString;
dueDate: TimestampString;
amount: number;
status: InvoiceStatus;
invoiceNumber: string;
vendor: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
business: {
id: UUIDString;
businessName: string;
} & Business_Key;
order: {
id: UUIDString;
eventName?: string | null;
} & Order_Key;
} & Invoice_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listInvoicesForSpendByBusiness's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListInvoicesForSpendByBusinessVariables } from '@dataconnect/generated';
import { useListInvoicesForSpendByBusiness } from '@dataconnect/generated/react'
export default function ListInvoicesForSpendByBusinessComponent() {
// The `useListInvoicesForSpendByBusiness` Query hook requires an argument of type `ListInvoicesForSpendByBusinessVariables`:
const listInvoicesForSpendByBusinessVars: ListInvoicesForSpendByBusinessVariables = {
businessId: ...,
startDate: ...,
endDate: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListInvoicesForSpendByBusiness(listInvoicesForSpendByBusinessVars);
// Variables can be defined inline as well.
const query = useListInvoicesForSpendByBusiness({ businessId: ..., startDate: ..., endDate: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListInvoicesForSpendByBusiness(dataConnect, listInvoicesForSpendByBusinessVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListInvoicesForSpendByBusiness(listInvoicesForSpendByBusinessVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListInvoicesForSpendByBusiness(dataConnect, listInvoicesForSpendByBusinessVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.invoices);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listInvoicesForSpendByVendor
You can execute the listInvoicesForSpendByVendor Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListInvoicesForSpendByVendor(dc: DataConnect, vars: ListInvoicesForSpendByVendorVariables, options?: useDataConnectQueryOptions<ListInvoicesForSpendByVendorData>): UseDataConnectQueryResult<ListInvoicesForSpendByVendorData, ListInvoicesForSpendByVendorVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListInvoicesForSpendByVendor(vars: ListInvoicesForSpendByVendorVariables, options?: useDataConnectQueryOptions<ListInvoicesForSpendByVendorData>): UseDataConnectQueryResult<ListInvoicesForSpendByVendorData, ListInvoicesForSpendByVendorVariables>;
Variables
The listInvoicesForSpendByVendor Query requires an argument of type ListInvoicesForSpendByVendorVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoicesForSpendByVendorVariables {
vendorId: UUIDString;
startDate: TimestampString;
endDate: TimestampString;
}
Return Type
Recall that calling the listInvoicesForSpendByVendor Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listInvoicesForSpendByVendor Query is of type ListInvoicesForSpendByVendorData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoicesForSpendByVendorData {
invoices: ({
id: UUIDString;
issueDate: TimestampString;
dueDate: TimestampString;
amount: number;
status: InvoiceStatus;
invoiceNumber: string;
vendor: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
business: {
id: UUIDString;
businessName: string;
} & Business_Key;
order: {
id: UUIDString;
eventName?: string | null;
} & Order_Key;
} & Invoice_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listInvoicesForSpendByVendor's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListInvoicesForSpendByVendorVariables } from '@dataconnect/generated';
import { useListInvoicesForSpendByVendor } from '@dataconnect/generated/react'
export default function ListInvoicesForSpendByVendorComponent() {
// The `useListInvoicesForSpendByVendor` Query hook requires an argument of type `ListInvoicesForSpendByVendorVariables`:
const listInvoicesForSpendByVendorVars: ListInvoicesForSpendByVendorVariables = {
vendorId: ...,
startDate: ...,
endDate: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListInvoicesForSpendByVendor(listInvoicesForSpendByVendorVars);
// Variables can be defined inline as well.
const query = useListInvoicesForSpendByVendor({ vendorId: ..., startDate: ..., endDate: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListInvoicesForSpendByVendor(dataConnect, listInvoicesForSpendByVendorVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListInvoicesForSpendByVendor(listInvoicesForSpendByVendorVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListInvoicesForSpendByVendor(dataConnect, listInvoicesForSpendByVendorVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.invoices);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listInvoicesForSpendByOrder
You can execute the listInvoicesForSpendByOrder Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListInvoicesForSpendByOrder(dc: DataConnect, vars: ListInvoicesForSpendByOrderVariables, options?: useDataConnectQueryOptions<ListInvoicesForSpendByOrderData>): UseDataConnectQueryResult<ListInvoicesForSpendByOrderData, ListInvoicesForSpendByOrderVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListInvoicesForSpendByOrder(vars: ListInvoicesForSpendByOrderVariables, options?: useDataConnectQueryOptions<ListInvoicesForSpendByOrderData>): UseDataConnectQueryResult<ListInvoicesForSpendByOrderData, ListInvoicesForSpendByOrderVariables>;
Variables
The listInvoicesForSpendByOrder Query requires an argument of type ListInvoicesForSpendByOrderVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoicesForSpendByOrderVariables {
orderId: UUIDString;
startDate: TimestampString;
endDate: TimestampString;
}
Return Type
Recall that calling the listInvoicesForSpendByOrder Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listInvoicesForSpendByOrder Query is of type ListInvoicesForSpendByOrderData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoicesForSpendByOrderData {
invoices: ({
id: UUIDString;
issueDate: TimestampString;
dueDate: TimestampString;
amount: number;
status: InvoiceStatus;
invoiceNumber: string;
vendor: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
business: {
id: UUIDString;
businessName: string;
} & Business_Key;
order: {
id: UUIDString;
eventName?: string | null;
} & Order_Key;
} & Invoice_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listInvoicesForSpendByOrder's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListInvoicesForSpendByOrderVariables } from '@dataconnect/generated';
import { useListInvoicesForSpendByOrder } from '@dataconnect/generated/react'
export default function ListInvoicesForSpendByOrderComponent() {
// The `useListInvoicesForSpendByOrder` Query hook requires an argument of type `ListInvoicesForSpendByOrderVariables`:
const listInvoicesForSpendByOrderVars: ListInvoicesForSpendByOrderVariables = {
orderId: ...,
startDate: ...,
endDate: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListInvoicesForSpendByOrder(listInvoicesForSpendByOrderVars);
// Variables can be defined inline as well.
const query = useListInvoicesForSpendByOrder({ orderId: ..., startDate: ..., endDate: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListInvoicesForSpendByOrder(dataConnect, listInvoicesForSpendByOrderVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListInvoicesForSpendByOrder(listInvoicesForSpendByOrderVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListInvoicesForSpendByOrder(dataConnect, listInvoicesForSpendByOrderVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.invoices);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listTimesheetsForSpend
You can execute the listTimesheetsForSpend Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListTimesheetsForSpend(dc: DataConnect, vars: ListTimesheetsForSpendVariables, options?: useDataConnectQueryOptions<ListTimesheetsForSpendData>): UseDataConnectQueryResult<ListTimesheetsForSpendData, ListTimesheetsForSpendVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListTimesheetsForSpend(vars: ListTimesheetsForSpendVariables, options?: useDataConnectQueryOptions<ListTimesheetsForSpendData>): UseDataConnectQueryResult<ListTimesheetsForSpendData, ListTimesheetsForSpendVariables>;
Variables
The listTimesheetsForSpend Query requires an argument of type ListTimesheetsForSpendVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListTimesheetsForSpendVariables {
startTime: TimestampString;
endTime: TimestampString;
}
Return Type
Recall that calling the listTimesheetsForSpend Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listTimesheetsForSpend Query is of type ListTimesheetsForSpendData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListTimesheetsForSpendData {
shiftRoles: ({
id: UUIDString;
hours?: number | null;
totalValue?: number | null;
shift: {
title: string;
location?: string | null;
status?: ShiftStatus | null;
date?: TimestampString | null;
order: {
business: {
businessName: string;
};
};
};
role: {
costPerHour: number;
};
})[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listTimesheetsForSpend's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListTimesheetsForSpendVariables } from '@dataconnect/generated';
import { useListTimesheetsForSpend } from '@dataconnect/generated/react'
export default function ListTimesheetsForSpendComponent() {
// The `useListTimesheetsForSpend` Query hook requires an argument of type `ListTimesheetsForSpendVariables`:
const listTimesheetsForSpendVars: ListTimesheetsForSpendVariables = {
startTime: ...,
endTime: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListTimesheetsForSpend(listTimesheetsForSpendVars);
// Variables can be defined inline as well.
const query = useListTimesheetsForSpend({ startTime: ..., endTime: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListTimesheetsForSpend(dataConnect, listTimesheetsForSpendVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListTimesheetsForSpend(listTimesheetsForSpendVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListTimesheetsForSpend(dataConnect, listTimesheetsForSpendVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.shiftRoles);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listShiftsForPerformanceByBusiness
You can execute the listShiftsForPerformanceByBusiness Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListShiftsForPerformanceByBusiness(dc: DataConnect, vars: ListShiftsForPerformanceByBusinessVariables, options?: useDataConnectQueryOptions<ListShiftsForPerformanceByBusinessData>): UseDataConnectQueryResult<ListShiftsForPerformanceByBusinessData, ListShiftsForPerformanceByBusinessVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListShiftsForPerformanceByBusiness(vars: ListShiftsForPerformanceByBusinessVariables, options?: useDataConnectQueryOptions<ListShiftsForPerformanceByBusinessData>): UseDataConnectQueryResult<ListShiftsForPerformanceByBusinessData, ListShiftsForPerformanceByBusinessVariables>;
Variables
The listShiftsForPerformanceByBusiness Query requires an argument of type ListShiftsForPerformanceByBusinessVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftsForPerformanceByBusinessVariables {
businessId: UUIDString;
startDate: TimestampString;
endDate: TimestampString;
}
Return Type
Recall that calling the listShiftsForPerformanceByBusiness Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listShiftsForPerformanceByBusiness Query is of type ListShiftsForPerformanceByBusinessData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftsForPerformanceByBusinessData {
shifts: ({
id: UUIDString;
workersNeeded?: number | null;
filled?: number | null;
status?: ShiftStatus | null;
createdAt?: TimestampString | null;
filledAt?: TimestampString | null;
} & Shift_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listShiftsForPerformanceByBusiness's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListShiftsForPerformanceByBusinessVariables } from '@dataconnect/generated';
import { useListShiftsForPerformanceByBusiness } from '@dataconnect/generated/react'
export default function ListShiftsForPerformanceByBusinessComponent() {
// The `useListShiftsForPerformanceByBusiness` Query hook requires an argument of type `ListShiftsForPerformanceByBusinessVariables`:
const listShiftsForPerformanceByBusinessVars: ListShiftsForPerformanceByBusinessVariables = {
businessId: ...,
startDate: ...,
endDate: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListShiftsForPerformanceByBusiness(listShiftsForPerformanceByBusinessVars);
// Variables can be defined inline as well.
const query = useListShiftsForPerformanceByBusiness({ businessId: ..., startDate: ..., endDate: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListShiftsForPerformanceByBusiness(dataConnect, listShiftsForPerformanceByBusinessVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListShiftsForPerformanceByBusiness(listShiftsForPerformanceByBusinessVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListShiftsForPerformanceByBusiness(dataConnect, listShiftsForPerformanceByBusinessVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.shifts);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listShiftsForPerformanceByVendor
You can execute the listShiftsForPerformanceByVendor Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListShiftsForPerformanceByVendor(dc: DataConnect, vars: ListShiftsForPerformanceByVendorVariables, options?: useDataConnectQueryOptions<ListShiftsForPerformanceByVendorData>): UseDataConnectQueryResult<ListShiftsForPerformanceByVendorData, ListShiftsForPerformanceByVendorVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListShiftsForPerformanceByVendor(vars: ListShiftsForPerformanceByVendorVariables, options?: useDataConnectQueryOptions<ListShiftsForPerformanceByVendorData>): UseDataConnectQueryResult<ListShiftsForPerformanceByVendorData, ListShiftsForPerformanceByVendorVariables>;
Variables
The listShiftsForPerformanceByVendor Query requires an argument of type ListShiftsForPerformanceByVendorVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftsForPerformanceByVendorVariables {
vendorId: UUIDString;
startDate: TimestampString;
endDate: TimestampString;
}
Return Type
Recall that calling the listShiftsForPerformanceByVendor Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listShiftsForPerformanceByVendor Query is of type ListShiftsForPerformanceByVendorData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftsForPerformanceByVendorData {
shifts: ({
id: UUIDString;
workersNeeded?: number | null;
filled?: number | null;
status?: ShiftStatus | null;
createdAt?: TimestampString | null;
filledAt?: TimestampString | null;
} & Shift_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listShiftsForPerformanceByVendor's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListShiftsForPerformanceByVendorVariables } from '@dataconnect/generated';
import { useListShiftsForPerformanceByVendor } from '@dataconnect/generated/react'
export default function ListShiftsForPerformanceByVendorComponent() {
// The `useListShiftsForPerformanceByVendor` Query hook requires an argument of type `ListShiftsForPerformanceByVendorVariables`:
const listShiftsForPerformanceByVendorVars: ListShiftsForPerformanceByVendorVariables = {
vendorId: ...,
startDate: ...,
endDate: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListShiftsForPerformanceByVendor(listShiftsForPerformanceByVendorVars);
// Variables can be defined inline as well.
const query = useListShiftsForPerformanceByVendor({ vendorId: ..., startDate: ..., endDate: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListShiftsForPerformanceByVendor(dataConnect, listShiftsForPerformanceByVendorVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListShiftsForPerformanceByVendor(listShiftsForPerformanceByVendorVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListShiftsForPerformanceByVendor(dataConnect, listShiftsForPerformanceByVendorVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.shifts);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listApplicationsForPerformance
You can execute the listApplicationsForPerformance Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListApplicationsForPerformance(dc: DataConnect, vars: ListApplicationsForPerformanceVariables, options?: useDataConnectQueryOptions<ListApplicationsForPerformanceData>): UseDataConnectQueryResult<ListApplicationsForPerformanceData, ListApplicationsForPerformanceVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListApplicationsForPerformance(vars: ListApplicationsForPerformanceVariables, options?: useDataConnectQueryOptions<ListApplicationsForPerformanceData>): UseDataConnectQueryResult<ListApplicationsForPerformanceData, ListApplicationsForPerformanceVariables>;
Variables
The listApplicationsForPerformance Query requires an argument of type ListApplicationsForPerformanceVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListApplicationsForPerformanceVariables {
shiftIds: UUIDString[];
}
Return Type
Recall that calling the listApplicationsForPerformance Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listApplicationsForPerformance Query is of type ListApplicationsForPerformanceData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListApplicationsForPerformanceData {
applications: ({
id: UUIDString;
shiftId: UUIDString;
staffId: UUIDString;
status: ApplicationStatus;
checkInTime?: TimestampString | null;
checkOutTime?: TimestampString | null;
} & Application_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listApplicationsForPerformance's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListApplicationsForPerformanceVariables } from '@dataconnect/generated';
import { useListApplicationsForPerformance } from '@dataconnect/generated/react'
export default function ListApplicationsForPerformanceComponent() {
// The `useListApplicationsForPerformance` Query hook requires an argument of type `ListApplicationsForPerformanceVariables`:
const listApplicationsForPerformanceVars: ListApplicationsForPerformanceVariables = {
shiftIds: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListApplicationsForPerformance(listApplicationsForPerformanceVars);
// Variables can be defined inline as well.
const query = useListApplicationsForPerformance({ shiftIds: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListApplicationsForPerformance(dataConnect, listApplicationsForPerformanceVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListApplicationsForPerformance(listApplicationsForPerformanceVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListApplicationsForPerformance(dataConnect, listApplicationsForPerformanceVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.applications);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listStaffForPerformance
You can execute the listStaffForPerformance Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListStaffForPerformance(dc: DataConnect, vars: ListStaffForPerformanceVariables, options?: useDataConnectQueryOptions<ListStaffForPerformanceData>): UseDataConnectQueryResult<ListStaffForPerformanceData, ListStaffForPerformanceVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListStaffForPerformance(vars: ListStaffForPerformanceVariables, options?: useDataConnectQueryOptions<ListStaffForPerformanceData>): UseDataConnectQueryResult<ListStaffForPerformanceData, ListStaffForPerformanceVariables>;
Variables
The listStaffForPerformance Query requires an argument of type ListStaffForPerformanceVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffForPerformanceVariables {
staffIds: UUIDString[];
}
Return Type
Recall that calling the listStaffForPerformance Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listStaffForPerformance Query is of type ListStaffForPerformanceData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffForPerformanceData {
staffs: ({
id: UUIDString;
averageRating?: number | null;
onTimeRate?: number | null;
noShowCount?: number | null;
reliabilityScore?: number | null;
} & Staff_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listStaffForPerformance's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListStaffForPerformanceVariables } from '@dataconnect/generated';
import { useListStaffForPerformance } from '@dataconnect/generated/react'
export default function ListStaffForPerformanceComponent() {
// The `useListStaffForPerformance` Query hook requires an argument of type `ListStaffForPerformanceVariables`:
const listStaffForPerformanceVars: ListStaffForPerformanceVariables = {
staffIds: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListStaffForPerformance(listStaffForPerformanceVars);
// Variables can be defined inline as well.
const query = useListStaffForPerformance({ staffIds: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListStaffForPerformance(dataConnect, listStaffForPerformanceVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListStaffForPerformance(listStaffForPerformanceVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListStaffForPerformance(dataConnect, listStaffForPerformanceVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.staffs);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listRoles
You can execute the listRoles Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListRoles(dc: DataConnect, options?: useDataConnectQueryOptions<ListRolesData>): UseDataConnectQueryResult<ListRolesData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListRoles(options?: useDataConnectQueryOptions<ListRolesData>): UseDataConnectQueryResult<ListRolesData, undefined>;
Variables
The listRoles Query has no variables.
Return Type
Recall that calling the listRoles Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listRoles Query is of type ListRolesData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListRolesData {
roles: ({
id: UUIDString;
name: string;
costPerHour: number;
vendorId: UUIDString;
roleCategoryId: UUIDString;
createdAt?: TimestampString | null;
} & Role_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listRoles's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListRoles } from '@dataconnect/generated/react'
export default function ListRolesComponent() {
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListRoles();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListRoles(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListRoles(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListRoles(dataConnect, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.roles);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getRoleById
You can execute the getRoleById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetRoleById(dc: DataConnect, vars: GetRoleByIdVariables, options?: useDataConnectQueryOptions<GetRoleByIdData>): UseDataConnectQueryResult<GetRoleByIdData, GetRoleByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetRoleById(vars: GetRoleByIdVariables, options?: useDataConnectQueryOptions<GetRoleByIdData>): UseDataConnectQueryResult<GetRoleByIdData, GetRoleByIdVariables>;
Variables
The getRoleById Query requires an argument of type GetRoleByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetRoleByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getRoleById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getRoleById Query is of type GetRoleByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetRoleByIdData {
role?: {
id: UUIDString;
name: string;
costPerHour: number;
vendorId: UUIDString;
roleCategoryId: UUIDString;
createdAt?: TimestampString | null;
} & Role_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getRoleById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetRoleByIdVariables } from '@dataconnect/generated';
import { useGetRoleById } from '@dataconnect/generated/react'
export default function GetRoleByIdComponent() {
// The `useGetRoleById` Query hook requires an argument of type `GetRoleByIdVariables`:
const getRoleByIdVars: GetRoleByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetRoleById(getRoleByIdVars);
// Variables can be defined inline as well.
const query = useGetRoleById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetRoleById(dataConnect, getRoleByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetRoleById(getRoleByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetRoleById(dataConnect, getRoleByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.role);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listRolesByVendorId
You can execute the listRolesByVendorId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListRolesByVendorId(dc: DataConnect, vars: ListRolesByVendorIdVariables, options?: useDataConnectQueryOptions<ListRolesByVendorIdData>): UseDataConnectQueryResult<ListRolesByVendorIdData, ListRolesByVendorIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListRolesByVendorId(vars: ListRolesByVendorIdVariables, options?: useDataConnectQueryOptions<ListRolesByVendorIdData>): UseDataConnectQueryResult<ListRolesByVendorIdData, ListRolesByVendorIdVariables>;
Variables
The listRolesByVendorId Query requires an argument of type ListRolesByVendorIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListRolesByVendorIdVariables {
vendorId: UUIDString;
}
Return Type
Recall that calling the listRolesByVendorId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listRolesByVendorId Query is of type ListRolesByVendorIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListRolesByVendorIdData {
roles: ({
id: UUIDString;
name: string;
costPerHour: number;
vendorId: UUIDString;
roleCategoryId: UUIDString;
createdAt?: TimestampString | null;
} & Role_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listRolesByVendorId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListRolesByVendorIdVariables } from '@dataconnect/generated';
import { useListRolesByVendorId } from '@dataconnect/generated/react'
export default function ListRolesByVendorIdComponent() {
// The `useListRolesByVendorId` Query hook requires an argument of type `ListRolesByVendorIdVariables`:
const listRolesByVendorIdVars: ListRolesByVendorIdVariables = {
vendorId: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListRolesByVendorId(listRolesByVendorIdVars);
// Variables can be defined inline as well.
const query = useListRolesByVendorId({ vendorId: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListRolesByVendorId(dataConnect, listRolesByVendorIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListRolesByVendorId(listRolesByVendorIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListRolesByVendorId(dataConnect, listRolesByVendorIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.roles);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listRolesByroleCategoryId
You can execute the listRolesByroleCategoryId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListRolesByroleCategoryId(dc: DataConnect, vars: ListRolesByroleCategoryIdVariables, options?: useDataConnectQueryOptions<ListRolesByroleCategoryIdData>): UseDataConnectQueryResult<ListRolesByroleCategoryIdData, ListRolesByroleCategoryIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListRolesByroleCategoryId(vars: ListRolesByroleCategoryIdVariables, options?: useDataConnectQueryOptions<ListRolesByroleCategoryIdData>): UseDataConnectQueryResult<ListRolesByroleCategoryIdData, ListRolesByroleCategoryIdVariables>;
Variables
The listRolesByroleCategoryId Query requires an argument of type ListRolesByroleCategoryIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListRolesByroleCategoryIdVariables {
roleCategoryId: UUIDString;
}
Return Type
Recall that calling the listRolesByroleCategoryId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listRolesByroleCategoryId Query is of type ListRolesByroleCategoryIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListRolesByroleCategoryIdData {
roles: ({
id: UUIDString;
name: string;
costPerHour: number;
vendorId: UUIDString;
roleCategoryId: UUIDString;
createdAt?: TimestampString | null;
} & Role_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listRolesByroleCategoryId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListRolesByroleCategoryIdVariables } from '@dataconnect/generated';
import { useListRolesByroleCategoryId } from '@dataconnect/generated/react'
export default function ListRolesByroleCategoryIdComponent() {
// The `useListRolesByroleCategoryId` Query hook requires an argument of type `ListRolesByroleCategoryIdVariables`:
const listRolesByroleCategoryIdVars: ListRolesByroleCategoryIdVariables = {
roleCategoryId: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListRolesByroleCategoryId(listRolesByroleCategoryIdVars);
// Variables can be defined inline as well.
const query = useListRolesByroleCategoryId({ roleCategoryId: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListRolesByroleCategoryId(dataConnect, listRolesByroleCategoryIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListRolesByroleCategoryId(listRolesByroleCategoryIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListRolesByroleCategoryId(dataConnect, listRolesByroleCategoryIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.roles);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getShiftRoleById
You can execute the getShiftRoleById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetShiftRoleById(dc: DataConnect, vars: GetShiftRoleByIdVariables, options?: useDataConnectQueryOptions<GetShiftRoleByIdData>): UseDataConnectQueryResult<GetShiftRoleByIdData, GetShiftRoleByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetShiftRoleById(vars: GetShiftRoleByIdVariables, options?: useDataConnectQueryOptions<GetShiftRoleByIdData>): UseDataConnectQueryResult<GetShiftRoleByIdData, GetShiftRoleByIdVariables>;
Variables
The getShiftRoleById Query requires an argument of type GetShiftRoleByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetShiftRoleByIdVariables {
shiftId: UUIDString;
roleId: UUIDString;
}
Return Type
Recall that calling the getShiftRoleById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getShiftRoleById Query is of type GetShiftRoleByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetShiftRoleByIdData {
shiftRole?: {
id: UUIDString;
shiftId: UUIDString;
roleId: UUIDString;
count: number;
assigned?: number | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
department?: string | null;
uniform?: string | null;
breakType?: BreakDuration | null;
totalValue?: number | null;
createdAt?: TimestampString | null;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
shift: {
location?: string | null;
locationAddress?: string | null;
description?: string | null;
orderId: UUIDString;
order: {
recurringDays?: unknown | null;
permanentDays?: unknown | null;
notes?: string | null;
business: {
id: UUIDString;
businessName: string;
companyLogoUrl?: string | null;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
teamHub: {
hubName: string;
};
};
};
} & ShiftRole_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getShiftRoleById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetShiftRoleByIdVariables } from '@dataconnect/generated';
import { useGetShiftRoleById } from '@dataconnect/generated/react'
export default function GetShiftRoleByIdComponent() {
// The `useGetShiftRoleById` Query hook requires an argument of type `GetShiftRoleByIdVariables`:
const getShiftRoleByIdVars: GetShiftRoleByIdVariables = {
shiftId: ...,
roleId: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetShiftRoleById(getShiftRoleByIdVars);
// Variables can be defined inline as well.
const query = useGetShiftRoleById({ shiftId: ..., roleId: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetShiftRoleById(dataConnect, getShiftRoleByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetShiftRoleById(getShiftRoleByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetShiftRoleById(dataConnect, getShiftRoleByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.shiftRole);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listShiftRolesByShiftId
You can execute the listShiftRolesByShiftId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListShiftRolesByShiftId(dc: DataConnect, vars: ListShiftRolesByShiftIdVariables, options?: useDataConnectQueryOptions<ListShiftRolesByShiftIdData>): UseDataConnectQueryResult<ListShiftRolesByShiftIdData, ListShiftRolesByShiftIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListShiftRolesByShiftId(vars: ListShiftRolesByShiftIdVariables, options?: useDataConnectQueryOptions<ListShiftRolesByShiftIdData>): UseDataConnectQueryResult<ListShiftRolesByShiftIdData, ListShiftRolesByShiftIdVariables>;
Variables
The listShiftRolesByShiftId Query requires an argument of type ListShiftRolesByShiftIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftRolesByShiftIdVariables {
shiftId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listShiftRolesByShiftId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listShiftRolesByShiftId Query is of type ListShiftRolesByShiftIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftRolesByShiftIdData {
shiftRoles: ({
id: UUIDString;
shiftId: UUIDString;
roleId: UUIDString;
count: number;
assigned?: number | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
department?: string | null;
uniform?: string | null;
breakType?: BreakDuration | null;
totalValue?: number | null;
createdAt?: TimestampString | null;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
shift: {
location?: string | null;
locationAddress?: string | null;
description?: string | null;
orderId: UUIDString;
order: {
recurringDays?: unknown | null;
permanentDays?: unknown | null;
notes?: string | null;
business: {
id: UUIDString;
businessName: string;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
};
};
} & ShiftRole_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listShiftRolesByShiftId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListShiftRolesByShiftIdVariables } from '@dataconnect/generated';
import { useListShiftRolesByShiftId } from '@dataconnect/generated/react'
export default function ListShiftRolesByShiftIdComponent() {
// The `useListShiftRolesByShiftId` Query hook requires an argument of type `ListShiftRolesByShiftIdVariables`:
const listShiftRolesByShiftIdVars: ListShiftRolesByShiftIdVariables = {
shiftId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListShiftRolesByShiftId(listShiftRolesByShiftIdVars);
// Variables can be defined inline as well.
const query = useListShiftRolesByShiftId({ shiftId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListShiftRolesByShiftId(dataConnect, listShiftRolesByShiftIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListShiftRolesByShiftId(listShiftRolesByShiftIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListShiftRolesByShiftId(dataConnect, listShiftRolesByShiftIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.shiftRoles);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listShiftRolesByRoleId
You can execute the listShiftRolesByRoleId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListShiftRolesByRoleId(dc: DataConnect, vars: ListShiftRolesByRoleIdVariables, options?: useDataConnectQueryOptions<ListShiftRolesByRoleIdData>): UseDataConnectQueryResult<ListShiftRolesByRoleIdData, ListShiftRolesByRoleIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListShiftRolesByRoleId(vars: ListShiftRolesByRoleIdVariables, options?: useDataConnectQueryOptions<ListShiftRolesByRoleIdData>): UseDataConnectQueryResult<ListShiftRolesByRoleIdData, ListShiftRolesByRoleIdVariables>;
Variables
The listShiftRolesByRoleId Query requires an argument of type ListShiftRolesByRoleIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftRolesByRoleIdVariables {
roleId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listShiftRolesByRoleId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listShiftRolesByRoleId Query is of type ListShiftRolesByRoleIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftRolesByRoleIdData {
shiftRoles: ({
id: UUIDString;
shiftId: UUIDString;
roleId: UUIDString;
count: number;
assigned?: number | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
department?: string | null;
uniform?: string | null;
breakType?: BreakDuration | null;
totalValue?: number | null;
createdAt?: TimestampString | null;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
shift: {
location?: string | null;
locationAddress?: string | null;
description?: string | null;
orderId: UUIDString;
order: {
recurringDays?: unknown | null;
permanentDays?: unknown | null;
notes?: string | null;
business: {
id: UUIDString;
businessName: string;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
};
};
} & ShiftRole_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listShiftRolesByRoleId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListShiftRolesByRoleIdVariables } from '@dataconnect/generated';
import { useListShiftRolesByRoleId } from '@dataconnect/generated/react'
export default function ListShiftRolesByRoleIdComponent() {
// The `useListShiftRolesByRoleId` Query hook requires an argument of type `ListShiftRolesByRoleIdVariables`:
const listShiftRolesByRoleIdVars: ListShiftRolesByRoleIdVariables = {
roleId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListShiftRolesByRoleId(listShiftRolesByRoleIdVars);
// Variables can be defined inline as well.
const query = useListShiftRolesByRoleId({ roleId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListShiftRolesByRoleId(dataConnect, listShiftRolesByRoleIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListShiftRolesByRoleId(listShiftRolesByRoleIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListShiftRolesByRoleId(dataConnect, listShiftRolesByRoleIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.shiftRoles);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listShiftRolesByShiftIdAndTimeRange
You can execute the listShiftRolesByShiftIdAndTimeRange Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListShiftRolesByShiftIdAndTimeRange(dc: DataConnect, vars: ListShiftRolesByShiftIdAndTimeRangeVariables, options?: useDataConnectQueryOptions<ListShiftRolesByShiftIdAndTimeRangeData>): UseDataConnectQueryResult<ListShiftRolesByShiftIdAndTimeRangeData, ListShiftRolesByShiftIdAndTimeRangeVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListShiftRolesByShiftIdAndTimeRange(vars: ListShiftRolesByShiftIdAndTimeRangeVariables, options?: useDataConnectQueryOptions<ListShiftRolesByShiftIdAndTimeRangeData>): UseDataConnectQueryResult<ListShiftRolesByShiftIdAndTimeRangeData, ListShiftRolesByShiftIdAndTimeRangeVariables>;
Variables
The listShiftRolesByShiftIdAndTimeRange Query requires an argument of type ListShiftRolesByShiftIdAndTimeRangeVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftRolesByShiftIdAndTimeRangeVariables {
shiftId: UUIDString;
start: TimestampString;
end: TimestampString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listShiftRolesByShiftIdAndTimeRange Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listShiftRolesByShiftIdAndTimeRange Query is of type ListShiftRolesByShiftIdAndTimeRangeData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftRolesByShiftIdAndTimeRangeData {
shiftRoles: ({
id: UUIDString;
shiftId: UUIDString;
roleId: UUIDString;
count: number;
assigned?: number | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
department?: string | null;
uniform?: string | null;
breakType?: BreakDuration | null;
totalValue?: number | null;
createdAt?: TimestampString | null;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
shift: {
location?: string | null;
locationAddress?: string | null;
description?: string | null;
orderId: UUIDString;
order: {
recurringDays?: unknown | null;
permanentDays?: unknown | null;
notes?: string | null;
business: {
id: UUIDString;
businessName: string;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
};
};
} & ShiftRole_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listShiftRolesByShiftIdAndTimeRange's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListShiftRolesByShiftIdAndTimeRangeVariables } from '@dataconnect/generated';
import { useListShiftRolesByShiftIdAndTimeRange } from '@dataconnect/generated/react'
export default function ListShiftRolesByShiftIdAndTimeRangeComponent() {
// The `useListShiftRolesByShiftIdAndTimeRange` Query hook requires an argument of type `ListShiftRolesByShiftIdAndTimeRangeVariables`:
const listShiftRolesByShiftIdAndTimeRangeVars: ListShiftRolesByShiftIdAndTimeRangeVariables = {
shiftId: ...,
start: ...,
end: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListShiftRolesByShiftIdAndTimeRange(listShiftRolesByShiftIdAndTimeRangeVars);
// Variables can be defined inline as well.
const query = useListShiftRolesByShiftIdAndTimeRange({ shiftId: ..., start: ..., end: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListShiftRolesByShiftIdAndTimeRange(dataConnect, listShiftRolesByShiftIdAndTimeRangeVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListShiftRolesByShiftIdAndTimeRange(listShiftRolesByShiftIdAndTimeRangeVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListShiftRolesByShiftIdAndTimeRange(dataConnect, listShiftRolesByShiftIdAndTimeRangeVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.shiftRoles);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listShiftRolesByVendorId
You can execute the listShiftRolesByVendorId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListShiftRolesByVendorId(dc: DataConnect, vars: ListShiftRolesByVendorIdVariables, options?: useDataConnectQueryOptions<ListShiftRolesByVendorIdData>): UseDataConnectQueryResult<ListShiftRolesByVendorIdData, ListShiftRolesByVendorIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListShiftRolesByVendorId(vars: ListShiftRolesByVendorIdVariables, options?: useDataConnectQueryOptions<ListShiftRolesByVendorIdData>): UseDataConnectQueryResult<ListShiftRolesByVendorIdData, ListShiftRolesByVendorIdVariables>;
Variables
The listShiftRolesByVendorId Query requires an argument of type ListShiftRolesByVendorIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftRolesByVendorIdVariables {
vendorId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listShiftRolesByVendorId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listShiftRolesByVendorId Query is of type ListShiftRolesByVendorIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftRolesByVendorIdData {
shiftRoles: ({
id: UUIDString;
shiftId: UUIDString;
roleId: UUIDString;
count: number;
assigned?: number | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
department?: string | null;
uniform?: string | null;
breakType?: BreakDuration | null;
totalValue?: number | null;
createdAt?: TimestampString | null;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
shift: {
id: UUIDString;
title: string;
date?: TimestampString | null;
location?: string | null;
locationAddress?: string | null;
description?: string | null;
orderId: UUIDString;
status?: ShiftStatus | null;
durationDays?: number | null;
order: {
id: UUIDString;
eventName?: string | null;
vendorId?: UUIDString | null;
businessId: UUIDString;
orderType: OrderType;
status: OrderStatus;
date?: TimestampString | null;
recurringDays?: unknown | null;
permanentDays?: unknown | null;
notes?: string | null;
business: {
id: UUIDString;
businessName: string;
} & Business_Key;
vendor?: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & Order_Key;
} & Shift_Key;
} & ShiftRole_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listShiftRolesByVendorId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListShiftRolesByVendorIdVariables } from '@dataconnect/generated';
import { useListShiftRolesByVendorId } from '@dataconnect/generated/react'
export default function ListShiftRolesByVendorIdComponent() {
// The `useListShiftRolesByVendorId` Query hook requires an argument of type `ListShiftRolesByVendorIdVariables`:
const listShiftRolesByVendorIdVars: ListShiftRolesByVendorIdVariables = {
vendorId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListShiftRolesByVendorId(listShiftRolesByVendorIdVars);
// Variables can be defined inline as well.
const query = useListShiftRolesByVendorId({ vendorId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListShiftRolesByVendorId(dataConnect, listShiftRolesByVendorIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListShiftRolesByVendorId(listShiftRolesByVendorIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListShiftRolesByVendorId(dataConnect, listShiftRolesByVendorIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.shiftRoles);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listShiftRolesByBusinessAndDateRange
You can execute the listShiftRolesByBusinessAndDateRange Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListShiftRolesByBusinessAndDateRange(dc: DataConnect, vars: ListShiftRolesByBusinessAndDateRangeVariables, options?: useDataConnectQueryOptions<ListShiftRolesByBusinessAndDateRangeData>): UseDataConnectQueryResult<ListShiftRolesByBusinessAndDateRangeData, ListShiftRolesByBusinessAndDateRangeVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListShiftRolesByBusinessAndDateRange(vars: ListShiftRolesByBusinessAndDateRangeVariables, options?: useDataConnectQueryOptions<ListShiftRolesByBusinessAndDateRangeData>): UseDataConnectQueryResult<ListShiftRolesByBusinessAndDateRangeData, ListShiftRolesByBusinessAndDateRangeVariables>;
Variables
The listShiftRolesByBusinessAndDateRange Query requires an argument of type ListShiftRolesByBusinessAndDateRangeVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftRolesByBusinessAndDateRangeVariables {
businessId: UUIDString;
start: TimestampString;
end: TimestampString;
offset?: number | null;
limit?: number | null;
status?: ShiftStatus | null;
}
Return Type
Recall that calling the listShiftRolesByBusinessAndDateRange Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listShiftRolesByBusinessAndDateRange Query is of type ListShiftRolesByBusinessAndDateRangeData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftRolesByBusinessAndDateRangeData {
shiftRoles: ({
shiftId: UUIDString;
roleId: UUIDString;
count: number;
assigned?: number | null;
hours?: number | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
totalValue?: number | null;
role: {
id: UUIDString;
name: string;
} & Role_Key;
shift: {
id: UUIDString;
date?: TimestampString | null;
location?: string | null;
locationAddress?: string | null;
title: string;
status?: ShiftStatus | null;
order: {
id: UUIDString;
eventName?: string | null;
} & Order_Key;
} & Shift_Key;
} & ShiftRole_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listShiftRolesByBusinessAndDateRange's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListShiftRolesByBusinessAndDateRangeVariables } from '@dataconnect/generated';
import { useListShiftRolesByBusinessAndDateRange } from '@dataconnect/generated/react'
export default function ListShiftRolesByBusinessAndDateRangeComponent() {
// The `useListShiftRolesByBusinessAndDateRange` Query hook requires an argument of type `ListShiftRolesByBusinessAndDateRangeVariables`:
const listShiftRolesByBusinessAndDateRangeVars: ListShiftRolesByBusinessAndDateRangeVariables = {
businessId: ...,
start: ...,
end: ...,
offset: ..., // optional
limit: ..., // optional
status: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListShiftRolesByBusinessAndDateRange(listShiftRolesByBusinessAndDateRangeVars);
// Variables can be defined inline as well.
const query = useListShiftRolesByBusinessAndDateRange({ businessId: ..., start: ..., end: ..., offset: ..., limit: ..., status: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListShiftRolesByBusinessAndDateRange(dataConnect, listShiftRolesByBusinessAndDateRangeVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListShiftRolesByBusinessAndDateRange(listShiftRolesByBusinessAndDateRangeVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListShiftRolesByBusinessAndDateRange(dataConnect, listShiftRolesByBusinessAndDateRangeVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.shiftRoles);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listShiftRolesByBusinessAndOrder
You can execute the listShiftRolesByBusinessAndOrder Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListShiftRolesByBusinessAndOrder(dc: DataConnect, vars: ListShiftRolesByBusinessAndOrderVariables, options?: useDataConnectQueryOptions<ListShiftRolesByBusinessAndOrderData>): UseDataConnectQueryResult<ListShiftRolesByBusinessAndOrderData, ListShiftRolesByBusinessAndOrderVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListShiftRolesByBusinessAndOrder(vars: ListShiftRolesByBusinessAndOrderVariables, options?: useDataConnectQueryOptions<ListShiftRolesByBusinessAndOrderData>): UseDataConnectQueryResult<ListShiftRolesByBusinessAndOrderData, ListShiftRolesByBusinessAndOrderVariables>;
Variables
The listShiftRolesByBusinessAndOrder Query requires an argument of type ListShiftRolesByBusinessAndOrderVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftRolesByBusinessAndOrderVariables {
businessId: UUIDString;
orderId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listShiftRolesByBusinessAndOrder Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listShiftRolesByBusinessAndOrder Query is of type ListShiftRolesByBusinessAndOrderData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftRolesByBusinessAndOrderData {
shiftRoles: ({
id: UUIDString;
shiftId: UUIDString;
roleId: UUIDString;
count: number;
assigned?: number | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
breakType?: BreakDuration | null;
totalValue?: number | null;
createdAt?: TimestampString | null;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
shift: {
id: UUIDString;
title: string;
date?: TimestampString | null;
orderId: UUIDString;
location?: string | null;
locationAddress?: string | null;
order: {
vendorId?: UUIDString | null;
eventName?: string | null;
date?: TimestampString | null;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
};
} & Shift_Key;
} & ShiftRole_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listShiftRolesByBusinessAndOrder's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListShiftRolesByBusinessAndOrderVariables } from '@dataconnect/generated';
import { useListShiftRolesByBusinessAndOrder } from '@dataconnect/generated/react'
export default function ListShiftRolesByBusinessAndOrderComponent() {
// The `useListShiftRolesByBusinessAndOrder` Query hook requires an argument of type `ListShiftRolesByBusinessAndOrderVariables`:
const listShiftRolesByBusinessAndOrderVars: ListShiftRolesByBusinessAndOrderVariables = {
businessId: ...,
orderId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListShiftRolesByBusinessAndOrder(listShiftRolesByBusinessAndOrderVars);
// Variables can be defined inline as well.
const query = useListShiftRolesByBusinessAndOrder({ businessId: ..., orderId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListShiftRolesByBusinessAndOrder(dataConnect, listShiftRolesByBusinessAndOrderVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListShiftRolesByBusinessAndOrder(listShiftRolesByBusinessAndOrderVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListShiftRolesByBusinessAndOrder(dataConnect, listShiftRolesByBusinessAndOrderVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.shiftRoles);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listShiftRolesByBusinessDateRangeCompletedOrders
You can execute the listShiftRolesByBusinessDateRangeCompletedOrders Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListShiftRolesByBusinessDateRangeCompletedOrders(dc: DataConnect, vars: ListShiftRolesByBusinessDateRangeCompletedOrdersVariables, options?: useDataConnectQueryOptions<ListShiftRolesByBusinessDateRangeCompletedOrdersData>): UseDataConnectQueryResult<ListShiftRolesByBusinessDateRangeCompletedOrdersData, ListShiftRolesByBusinessDateRangeCompletedOrdersVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListShiftRolesByBusinessDateRangeCompletedOrders(vars: ListShiftRolesByBusinessDateRangeCompletedOrdersVariables, options?: useDataConnectQueryOptions<ListShiftRolesByBusinessDateRangeCompletedOrdersData>): UseDataConnectQueryResult<ListShiftRolesByBusinessDateRangeCompletedOrdersData, ListShiftRolesByBusinessDateRangeCompletedOrdersVariables>;
Variables
The listShiftRolesByBusinessDateRangeCompletedOrders Query requires an argument of type ListShiftRolesByBusinessDateRangeCompletedOrdersVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftRolesByBusinessDateRangeCompletedOrdersVariables {
businessId: UUIDString;
start: TimestampString;
end: TimestampString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listShiftRolesByBusinessDateRangeCompletedOrders Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listShiftRolesByBusinessDateRangeCompletedOrders Query is of type ListShiftRolesByBusinessDateRangeCompletedOrdersData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftRolesByBusinessDateRangeCompletedOrdersData {
shiftRoles: ({
shiftId: UUIDString;
roleId: UUIDString;
count: number;
assigned?: number | null;
hours?: number | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
totalValue?: number | null;
role: {
id: UUIDString;
name: string;
costPerHour: number;
} & Role_Key;
shift: {
id: UUIDString;
date?: TimestampString | null;
location?: string | null;
locationAddress?: string | null;
title: string;
status?: ShiftStatus | null;
order: {
id: UUIDString;
orderType: OrderType;
} & Order_Key;
} & Shift_Key;
} & ShiftRole_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listShiftRolesByBusinessDateRangeCompletedOrders's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListShiftRolesByBusinessDateRangeCompletedOrdersVariables } from '@dataconnect/generated';
import { useListShiftRolesByBusinessDateRangeCompletedOrders } from '@dataconnect/generated/react'
export default function ListShiftRolesByBusinessDateRangeCompletedOrdersComponent() {
// The `useListShiftRolesByBusinessDateRangeCompletedOrders` Query hook requires an argument of type `ListShiftRolesByBusinessDateRangeCompletedOrdersVariables`:
const listShiftRolesByBusinessDateRangeCompletedOrdersVars: ListShiftRolesByBusinessDateRangeCompletedOrdersVariables = {
businessId: ...,
start: ...,
end: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListShiftRolesByBusinessDateRangeCompletedOrders(listShiftRolesByBusinessDateRangeCompletedOrdersVars);
// Variables can be defined inline as well.
const query = useListShiftRolesByBusinessDateRangeCompletedOrders({ businessId: ..., start: ..., end: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListShiftRolesByBusinessDateRangeCompletedOrders(dataConnect, listShiftRolesByBusinessDateRangeCompletedOrdersVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListShiftRolesByBusinessDateRangeCompletedOrders(listShiftRolesByBusinessDateRangeCompletedOrdersVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListShiftRolesByBusinessDateRangeCompletedOrders(dataConnect, listShiftRolesByBusinessDateRangeCompletedOrdersVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.shiftRoles);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listShiftRolesByBusinessAndDatesSummary
You can execute the listShiftRolesByBusinessAndDatesSummary Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListShiftRolesByBusinessAndDatesSummary(dc: DataConnect, vars: ListShiftRolesByBusinessAndDatesSummaryVariables, options?: useDataConnectQueryOptions<ListShiftRolesByBusinessAndDatesSummaryData>): UseDataConnectQueryResult<ListShiftRolesByBusinessAndDatesSummaryData, ListShiftRolesByBusinessAndDatesSummaryVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListShiftRolesByBusinessAndDatesSummary(vars: ListShiftRolesByBusinessAndDatesSummaryVariables, options?: useDataConnectQueryOptions<ListShiftRolesByBusinessAndDatesSummaryData>): UseDataConnectQueryResult<ListShiftRolesByBusinessAndDatesSummaryData, ListShiftRolesByBusinessAndDatesSummaryVariables>;
Variables
The listShiftRolesByBusinessAndDatesSummary Query requires an argument of type ListShiftRolesByBusinessAndDatesSummaryVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftRolesByBusinessAndDatesSummaryVariables {
businessId: UUIDString;
start: TimestampString;
end: TimestampString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listShiftRolesByBusinessAndDatesSummary Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listShiftRolesByBusinessAndDatesSummary Query is of type ListShiftRolesByBusinessAndDatesSummaryData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftRolesByBusinessAndDatesSummaryData {
shiftRoles: ({
roleId: UUIDString;
hours?: number | null;
totalValue?: number | null;
role: {
id: UUIDString;
name: string;
} & Role_Key;
})[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listShiftRolesByBusinessAndDatesSummary's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListShiftRolesByBusinessAndDatesSummaryVariables } from '@dataconnect/generated';
import { useListShiftRolesByBusinessAndDatesSummary } from '@dataconnect/generated/react'
export default function ListShiftRolesByBusinessAndDatesSummaryComponent() {
// The `useListShiftRolesByBusinessAndDatesSummary` Query hook requires an argument of type `ListShiftRolesByBusinessAndDatesSummaryVariables`:
const listShiftRolesByBusinessAndDatesSummaryVars: ListShiftRolesByBusinessAndDatesSummaryVariables = {
businessId: ...,
start: ...,
end: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListShiftRolesByBusinessAndDatesSummary(listShiftRolesByBusinessAndDatesSummaryVars);
// Variables can be defined inline as well.
const query = useListShiftRolesByBusinessAndDatesSummary({ businessId: ..., start: ..., end: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListShiftRolesByBusinessAndDatesSummary(dataConnect, listShiftRolesByBusinessAndDatesSummaryVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListShiftRolesByBusinessAndDatesSummary(listShiftRolesByBusinessAndDatesSummaryVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListShiftRolesByBusinessAndDatesSummary(dataConnect, listShiftRolesByBusinessAndDatesSummaryVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.shiftRoles);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getCompletedShiftsByBusinessId
You can execute the getCompletedShiftsByBusinessId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetCompletedShiftsByBusinessId(dc: DataConnect, vars: GetCompletedShiftsByBusinessIdVariables, options?: useDataConnectQueryOptions<GetCompletedShiftsByBusinessIdData>): UseDataConnectQueryResult<GetCompletedShiftsByBusinessIdData, GetCompletedShiftsByBusinessIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetCompletedShiftsByBusinessId(vars: GetCompletedShiftsByBusinessIdVariables, options?: useDataConnectQueryOptions<GetCompletedShiftsByBusinessIdData>): UseDataConnectQueryResult<GetCompletedShiftsByBusinessIdData, GetCompletedShiftsByBusinessIdVariables>;
Variables
The getCompletedShiftsByBusinessId Query requires an argument of type GetCompletedShiftsByBusinessIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetCompletedShiftsByBusinessIdVariables {
businessId: UUIDString;
dateFrom: TimestampString;
dateTo: TimestampString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the getCompletedShiftsByBusinessId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getCompletedShiftsByBusinessId Query is of type GetCompletedShiftsByBusinessIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetCompletedShiftsByBusinessIdData {
shifts: ({
id: UUIDString;
date?: TimestampString | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
cost?: number | null;
workersNeeded?: number | null;
filled?: number | null;
createdAt?: TimestampString | null;
order: {
status: OrderStatus;
};
} & Shift_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getCompletedShiftsByBusinessId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetCompletedShiftsByBusinessIdVariables } from '@dataconnect/generated';
import { useGetCompletedShiftsByBusinessId } from '@dataconnect/generated/react'
export default function GetCompletedShiftsByBusinessIdComponent() {
// The `useGetCompletedShiftsByBusinessId` Query hook requires an argument of type `GetCompletedShiftsByBusinessIdVariables`:
const getCompletedShiftsByBusinessIdVars: GetCompletedShiftsByBusinessIdVariables = {
businessId: ...,
dateFrom: ...,
dateTo: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetCompletedShiftsByBusinessId(getCompletedShiftsByBusinessIdVars);
// Variables can be defined inline as well.
const query = useGetCompletedShiftsByBusinessId({ businessId: ..., dateFrom: ..., dateTo: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetCompletedShiftsByBusinessId(dataConnect, getCompletedShiftsByBusinessIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetCompletedShiftsByBusinessId(getCompletedShiftsByBusinessIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetCompletedShiftsByBusinessId(dataConnect, getCompletedShiftsByBusinessIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.shifts);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listTaxForms
You can execute the listTaxForms Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListTaxForms(dc: DataConnect, vars?: ListTaxFormsVariables, options?: useDataConnectQueryOptions<ListTaxFormsData>): UseDataConnectQueryResult<ListTaxFormsData, ListTaxFormsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListTaxForms(vars?: ListTaxFormsVariables, options?: useDataConnectQueryOptions<ListTaxFormsData>): UseDataConnectQueryResult<ListTaxFormsData, ListTaxFormsVariables>;
Variables
The listTaxForms Query has an optional argument of type ListTaxFormsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListTaxFormsVariables {
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listTaxForms Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listTaxForms Query is of type ListTaxFormsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListTaxFormsData {
taxForms: ({
id: UUIDString;
formType: TaxFormType;
firstName: string;
lastName: string;
mInitial?: string | null;
oLastName?: string | null;
dob?: TimestampString | null;
socialSN: number;
email?: string | null;
phone?: string | null;
address: string;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
city?: string | null;
street?: string | null;
country?: string | null;
apt?: string | null;
state?: string | null;
zipCode?: string | null;
marital?: MaritalStatus | null;
multipleJob?: boolean | null;
childrens?: number | null;
otherDeps?: number | null;
totalCredits?: number | null;
otherInconme?: number | null;
deductions?: number | null;
extraWithholding?: number | null;
citizen?: CitizenshipStatus | null;
uscis?: string | null;
passportNumber?: string | null;
countryIssue?: string | null;
prepartorOrTranslator?: boolean | null;
signature?: string | null;
date?: TimestampString | null;
status: TaxFormStatus;
staffId: UUIDString;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & TaxForm_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listTaxForms's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListTaxFormsVariables } from '@dataconnect/generated';
import { useListTaxForms } from '@dataconnect/generated/react'
export default function ListTaxFormsComponent() {
// The `useListTaxForms` Query hook has an optional argument of type `ListTaxFormsVariables`:
const listTaxFormsVars: ListTaxFormsVariables = {
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListTaxForms(listTaxFormsVars);
// Variables can be defined inline as well.
const query = useListTaxForms({ offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `ListTaxFormsVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useListTaxForms();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListTaxForms(dataConnect, listTaxFormsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListTaxForms(listTaxFormsVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useListTaxForms(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListTaxForms(dataConnect, listTaxFormsVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.taxForms);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getTaxFormById
You can execute the getTaxFormById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetTaxFormById(dc: DataConnect, vars: GetTaxFormByIdVariables, options?: useDataConnectQueryOptions<GetTaxFormByIdData>): UseDataConnectQueryResult<GetTaxFormByIdData, GetTaxFormByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetTaxFormById(vars: GetTaxFormByIdVariables, options?: useDataConnectQueryOptions<GetTaxFormByIdData>): UseDataConnectQueryResult<GetTaxFormByIdData, GetTaxFormByIdVariables>;
Variables
The getTaxFormById Query requires an argument of type GetTaxFormByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTaxFormByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getTaxFormById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getTaxFormById Query is of type GetTaxFormByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTaxFormByIdData {
taxForm?: {
id: UUIDString;
formType: TaxFormType;
firstName: string;
lastName: string;
mInitial?: string | null;
oLastName?: string | null;
dob?: TimestampString | null;
socialSN: number;
email?: string | null;
phone?: string | null;
address: string;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
city?: string | null;
street?: string | null;
country?: string | null;
apt?: string | null;
state?: string | null;
zipCode?: string | null;
marital?: MaritalStatus | null;
multipleJob?: boolean | null;
childrens?: number | null;
otherDeps?: number | null;
totalCredits?: number | null;
otherInconme?: number | null;
deductions?: number | null;
extraWithholding?: number | null;
citizen?: CitizenshipStatus | null;
uscis?: string | null;
passportNumber?: string | null;
countryIssue?: string | null;
prepartorOrTranslator?: boolean | null;
signature?: string | null;
date?: TimestampString | null;
status: TaxFormStatus;
staffId: UUIDString;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & TaxForm_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getTaxFormById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetTaxFormByIdVariables } from '@dataconnect/generated';
import { useGetTaxFormById } from '@dataconnect/generated/react'
export default function GetTaxFormByIdComponent() {
// The `useGetTaxFormById` Query hook requires an argument of type `GetTaxFormByIdVariables`:
const getTaxFormByIdVars: GetTaxFormByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetTaxFormById(getTaxFormByIdVars);
// Variables can be defined inline as well.
const query = useGetTaxFormById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetTaxFormById(dataConnect, getTaxFormByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetTaxFormById(getTaxFormByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetTaxFormById(dataConnect, getTaxFormByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.taxForm);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getTaxFormsByStaffId
You can execute the getTaxFormsByStaffId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetTaxFormsByStaffId(dc: DataConnect, vars: GetTaxFormsByStaffIdVariables, options?: useDataConnectQueryOptions<GetTaxFormsByStaffIdData>): UseDataConnectQueryResult<GetTaxFormsByStaffIdData, GetTaxFormsByStaffIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetTaxFormsByStaffId(vars: GetTaxFormsByStaffIdVariables, options?: useDataConnectQueryOptions<GetTaxFormsByStaffIdData>): UseDataConnectQueryResult<GetTaxFormsByStaffIdData, GetTaxFormsByStaffIdVariables>;
Variables
The getTaxFormsByStaffId Query requires an argument of type GetTaxFormsByStaffIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTaxFormsByStaffIdVariables {
staffId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the getTaxFormsByStaffId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getTaxFormsByStaffId Query is of type GetTaxFormsByStaffIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTaxFormsByStaffIdData {
taxForms: ({
id: UUIDString;
formType: TaxFormType;
firstName: string;
lastName: string;
mInitial?: string | null;
oLastName?: string | null;
dob?: TimestampString | null;
socialSN: number;
email?: string | null;
phone?: string | null;
address: string;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
city?: string | null;
street?: string | null;
country?: string | null;
apt?: string | null;
state?: string | null;
zipCode?: string | null;
marital?: MaritalStatus | null;
multipleJob?: boolean | null;
childrens?: number | null;
otherDeps?: number | null;
totalCredits?: number | null;
otherInconme?: number | null;
deductions?: number | null;
extraWithholding?: number | null;
citizen?: CitizenshipStatus | null;
uscis?: string | null;
passportNumber?: string | null;
countryIssue?: string | null;
prepartorOrTranslator?: boolean | null;
signature?: string | null;
date?: TimestampString | null;
status: TaxFormStatus;
staffId: UUIDString;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & TaxForm_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getTaxFormsByStaffId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetTaxFormsByStaffIdVariables } from '@dataconnect/generated';
import { useGetTaxFormsByStaffId } from '@dataconnect/generated/react'
export default function GetTaxFormsByStaffIdComponent() {
// The `useGetTaxFormsByStaffId` Query hook requires an argument of type `GetTaxFormsByStaffIdVariables`:
const getTaxFormsByStaffIdVars: GetTaxFormsByStaffIdVariables = {
staffId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetTaxFormsByStaffId(getTaxFormsByStaffIdVars);
// Variables can be defined inline as well.
const query = useGetTaxFormsByStaffId({ staffId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetTaxFormsByStaffId(dataConnect, getTaxFormsByStaffIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetTaxFormsByStaffId(getTaxFormsByStaffIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetTaxFormsByStaffId(dataConnect, getTaxFormsByStaffIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.taxForms);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listTaxFormsWhere
You can execute the listTaxFormsWhere Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListTaxFormsWhere(dc: DataConnect, vars?: ListTaxFormsWhereVariables, options?: useDataConnectQueryOptions<ListTaxFormsWhereData>): UseDataConnectQueryResult<ListTaxFormsWhereData, ListTaxFormsWhereVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListTaxFormsWhere(vars?: ListTaxFormsWhereVariables, options?: useDataConnectQueryOptions<ListTaxFormsWhereData>): UseDataConnectQueryResult<ListTaxFormsWhereData, ListTaxFormsWhereVariables>;
Variables
The listTaxFormsWhere Query has an optional argument of type ListTaxFormsWhereVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListTaxFormsWhereVariables {
formType?: TaxFormType | null;
status?: TaxFormStatus | null;
staffId?: UUIDString | null;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listTaxFormsWhere Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listTaxFormsWhere Query is of type ListTaxFormsWhereData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListTaxFormsWhereData {
taxForms: ({
id: UUIDString;
formType: TaxFormType;
firstName: string;
lastName: string;
mInitial?: string | null;
oLastName?: string | null;
dob?: TimestampString | null;
socialSN: number;
email?: string | null;
phone?: string | null;
address: string;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
city?: string | null;
street?: string | null;
country?: string | null;
apt?: string | null;
state?: string | null;
zipCode?: string | null;
marital?: MaritalStatus | null;
multipleJob?: boolean | null;
childrens?: number | null;
otherDeps?: number | null;
totalCredits?: number | null;
otherInconme?: number | null;
deductions?: number | null;
extraWithholding?: number | null;
citizen?: CitizenshipStatus | null;
uscis?: string | null;
passportNumber?: string | null;
countryIssue?: string | null;
prepartorOrTranslator?: boolean | null;
signature?: string | null;
date?: TimestampString | null;
status: TaxFormStatus;
staffId: UUIDString;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & TaxForm_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listTaxFormsWhere's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListTaxFormsWhereVariables } from '@dataconnect/generated';
import { useListTaxFormsWhere } from '@dataconnect/generated/react'
export default function ListTaxFormsWhereComponent() {
// The `useListTaxFormsWhere` Query hook has an optional argument of type `ListTaxFormsWhereVariables`:
const listTaxFormsWhereVars: ListTaxFormsWhereVariables = {
formType: ..., // optional
status: ..., // optional
staffId: ..., // optional
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListTaxFormsWhere(listTaxFormsWhereVars);
// Variables can be defined inline as well.
const query = useListTaxFormsWhere({ formType: ..., status: ..., staffId: ..., offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `ListTaxFormsWhereVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useListTaxFormsWhere();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListTaxFormsWhere(dataConnect, listTaxFormsWhereVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListTaxFormsWhere(listTaxFormsWhereVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useListTaxFormsWhere(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListTaxFormsWhere(dataConnect, listTaxFormsWhereVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.taxForms);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listFaqDatas
You can execute the listFaqDatas Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListFaqDatas(dc: DataConnect, options?: useDataConnectQueryOptions<ListFaqDatasData>): UseDataConnectQueryResult<ListFaqDatasData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListFaqDatas(options?: useDataConnectQueryOptions<ListFaqDatasData>): UseDataConnectQueryResult<ListFaqDatasData, undefined>;
Variables
The listFaqDatas Query has no variables.
Return Type
Recall that calling the listFaqDatas Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listFaqDatas Query is of type ListFaqDatasData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListFaqDatasData {
faqDatas: ({
id: UUIDString;
category: string;
questions?: unknown[] | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & FaqData_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listFaqDatas's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListFaqDatas } from '@dataconnect/generated/react'
export default function ListFaqDatasComponent() {
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListFaqDatas();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListFaqDatas(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListFaqDatas(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListFaqDatas(dataConnect, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.faqDatas);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getFaqDataById
You can execute the getFaqDataById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetFaqDataById(dc: DataConnect, vars: GetFaqDataByIdVariables, options?: useDataConnectQueryOptions<GetFaqDataByIdData>): UseDataConnectQueryResult<GetFaqDataByIdData, GetFaqDataByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetFaqDataById(vars: GetFaqDataByIdVariables, options?: useDataConnectQueryOptions<GetFaqDataByIdData>): UseDataConnectQueryResult<GetFaqDataByIdData, GetFaqDataByIdVariables>;
Variables
The getFaqDataById Query requires an argument of type GetFaqDataByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetFaqDataByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getFaqDataById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getFaqDataById Query is of type GetFaqDataByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetFaqDataByIdData {
faqData?: {
id: UUIDString;
category: string;
questions?: unknown[] | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & FaqData_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getFaqDataById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetFaqDataByIdVariables } from '@dataconnect/generated';
import { useGetFaqDataById } from '@dataconnect/generated/react'
export default function GetFaqDataByIdComponent() {
// The `useGetFaqDataById` Query hook requires an argument of type `GetFaqDataByIdVariables`:
const getFaqDataByIdVars: GetFaqDataByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetFaqDataById(getFaqDataByIdVars);
// Variables can be defined inline as well.
const query = useGetFaqDataById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetFaqDataById(dataConnect, getFaqDataByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetFaqDataById(getFaqDataByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetFaqDataById(dataConnect, getFaqDataByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.faqData);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterFaqDatas
You can execute the filterFaqDatas Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterFaqDatas(dc: DataConnect, vars?: FilterFaqDatasVariables, options?: useDataConnectQueryOptions<FilterFaqDatasData>): UseDataConnectQueryResult<FilterFaqDatasData, FilterFaqDatasVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterFaqDatas(vars?: FilterFaqDatasVariables, options?: useDataConnectQueryOptions<FilterFaqDatasData>): UseDataConnectQueryResult<FilterFaqDatasData, FilterFaqDatasVariables>;
Variables
The filterFaqDatas Query has an optional argument of type FilterFaqDatasVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterFaqDatasVariables {
category?: string | null;
}
Return Type
Recall that calling the filterFaqDatas Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the filterFaqDatas Query is of type FilterFaqDatasData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterFaqDatasData {
faqDatas: ({
id: UUIDString;
category: string;
questions?: unknown[] | null;
} & FaqData_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterFaqDatas's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterFaqDatasVariables } from '@dataconnect/generated';
import { useFilterFaqDatas } from '@dataconnect/generated/react'
export default function FilterFaqDatasComponent() {
// The `useFilterFaqDatas` Query hook has an optional argument of type `FilterFaqDatasVariables`:
const filterFaqDatasVars: FilterFaqDatasVariables = {
category: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useFilterFaqDatas(filterFaqDatasVars);
// Variables can be defined inline as well.
const query = useFilterFaqDatas({ category: ..., });
// Since all variables are optional for this Query, you can omit the `FilterFaqDatasVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterFaqDatas();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterFaqDatas(dataConnect, filterFaqDatasVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterFaqDatas(filterFaqDatasVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useFilterFaqDatas(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useFilterFaqDatas(dataConnect, filterFaqDatasVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.faqDatas);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getStaffCourseById
You can execute the getStaffCourseById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetStaffCourseById(dc: DataConnect, vars: GetStaffCourseByIdVariables, options?: useDataConnectQueryOptions<GetStaffCourseByIdData>): UseDataConnectQueryResult<GetStaffCourseByIdData, GetStaffCourseByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetStaffCourseById(vars: GetStaffCourseByIdVariables, options?: useDataConnectQueryOptions<GetStaffCourseByIdData>): UseDataConnectQueryResult<GetStaffCourseByIdData, GetStaffCourseByIdVariables>;
Variables
The getStaffCourseById Query requires an argument of type GetStaffCourseByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetStaffCourseByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getStaffCourseById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getStaffCourseById Query is of type GetStaffCourseByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetStaffCourseByIdData {
staffCourse?: {
id: UUIDString;
staffId: UUIDString;
courseId: UUIDString;
progressPercent?: number | null;
completed?: boolean | null;
completedAt?: TimestampString | null;
startedAt?: TimestampString | null;
lastAccessedAt?: TimestampString | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
} & StaffCourse_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getStaffCourseById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetStaffCourseByIdVariables } from '@dataconnect/generated';
import { useGetStaffCourseById } from '@dataconnect/generated/react'
export default function GetStaffCourseByIdComponent() {
// The `useGetStaffCourseById` Query hook requires an argument of type `GetStaffCourseByIdVariables`:
const getStaffCourseByIdVars: GetStaffCourseByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetStaffCourseById(getStaffCourseByIdVars);
// Variables can be defined inline as well.
const query = useGetStaffCourseById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetStaffCourseById(dataConnect, getStaffCourseByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetStaffCourseById(getStaffCourseByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetStaffCourseById(dataConnect, getStaffCourseByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.staffCourse);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listStaffCoursesByStaffId
You can execute the listStaffCoursesByStaffId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListStaffCoursesByStaffId(dc: DataConnect, vars: ListStaffCoursesByStaffIdVariables, options?: useDataConnectQueryOptions<ListStaffCoursesByStaffIdData>): UseDataConnectQueryResult<ListStaffCoursesByStaffIdData, ListStaffCoursesByStaffIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListStaffCoursesByStaffId(vars: ListStaffCoursesByStaffIdVariables, options?: useDataConnectQueryOptions<ListStaffCoursesByStaffIdData>): UseDataConnectQueryResult<ListStaffCoursesByStaffIdData, ListStaffCoursesByStaffIdVariables>;
Variables
The listStaffCoursesByStaffId Query requires an argument of type ListStaffCoursesByStaffIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffCoursesByStaffIdVariables {
staffId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listStaffCoursesByStaffId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listStaffCoursesByStaffId Query is of type ListStaffCoursesByStaffIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffCoursesByStaffIdData {
staffCourses: ({
id: UUIDString;
staffId: UUIDString;
courseId: UUIDString;
progressPercent?: number | null;
completed?: boolean | null;
completedAt?: TimestampString | null;
startedAt?: TimestampString | null;
lastAccessedAt?: TimestampString | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
} & StaffCourse_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listStaffCoursesByStaffId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListStaffCoursesByStaffIdVariables } from '@dataconnect/generated';
import { useListStaffCoursesByStaffId } from '@dataconnect/generated/react'
export default function ListStaffCoursesByStaffIdComponent() {
// The `useListStaffCoursesByStaffId` Query hook requires an argument of type `ListStaffCoursesByStaffIdVariables`:
const listStaffCoursesByStaffIdVars: ListStaffCoursesByStaffIdVariables = {
staffId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListStaffCoursesByStaffId(listStaffCoursesByStaffIdVars);
// Variables can be defined inline as well.
const query = useListStaffCoursesByStaffId({ staffId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListStaffCoursesByStaffId(dataConnect, listStaffCoursesByStaffIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListStaffCoursesByStaffId(listStaffCoursesByStaffIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListStaffCoursesByStaffId(dataConnect, listStaffCoursesByStaffIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.staffCourses);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listStaffCoursesByCourseId
You can execute the listStaffCoursesByCourseId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListStaffCoursesByCourseId(dc: DataConnect, vars: ListStaffCoursesByCourseIdVariables, options?: useDataConnectQueryOptions<ListStaffCoursesByCourseIdData>): UseDataConnectQueryResult<ListStaffCoursesByCourseIdData, ListStaffCoursesByCourseIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListStaffCoursesByCourseId(vars: ListStaffCoursesByCourseIdVariables, options?: useDataConnectQueryOptions<ListStaffCoursesByCourseIdData>): UseDataConnectQueryResult<ListStaffCoursesByCourseIdData, ListStaffCoursesByCourseIdVariables>;
Variables
The listStaffCoursesByCourseId Query requires an argument of type ListStaffCoursesByCourseIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffCoursesByCourseIdVariables {
courseId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listStaffCoursesByCourseId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listStaffCoursesByCourseId Query is of type ListStaffCoursesByCourseIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffCoursesByCourseIdData {
staffCourses: ({
id: UUIDString;
staffId: UUIDString;
courseId: UUIDString;
progressPercent?: number | null;
completed?: boolean | null;
completedAt?: TimestampString | null;
startedAt?: TimestampString | null;
lastAccessedAt?: TimestampString | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
} & StaffCourse_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listStaffCoursesByCourseId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListStaffCoursesByCourseIdVariables } from '@dataconnect/generated';
import { useListStaffCoursesByCourseId } from '@dataconnect/generated/react'
export default function ListStaffCoursesByCourseIdComponent() {
// The `useListStaffCoursesByCourseId` Query hook requires an argument of type `ListStaffCoursesByCourseIdVariables`:
const listStaffCoursesByCourseIdVars: ListStaffCoursesByCourseIdVariables = {
courseId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListStaffCoursesByCourseId(listStaffCoursesByCourseIdVars);
// Variables can be defined inline as well.
const query = useListStaffCoursesByCourseId({ courseId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListStaffCoursesByCourseId(dataConnect, listStaffCoursesByCourseIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListStaffCoursesByCourseId(listStaffCoursesByCourseIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListStaffCoursesByCourseId(dataConnect, listStaffCoursesByCourseIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.staffCourses);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getStaffCourseByStaffAndCourse
You can execute the getStaffCourseByStaffAndCourse Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetStaffCourseByStaffAndCourse(dc: DataConnect, vars: GetStaffCourseByStaffAndCourseVariables, options?: useDataConnectQueryOptions<GetStaffCourseByStaffAndCourseData>): UseDataConnectQueryResult<GetStaffCourseByStaffAndCourseData, GetStaffCourseByStaffAndCourseVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetStaffCourseByStaffAndCourse(vars: GetStaffCourseByStaffAndCourseVariables, options?: useDataConnectQueryOptions<GetStaffCourseByStaffAndCourseData>): UseDataConnectQueryResult<GetStaffCourseByStaffAndCourseData, GetStaffCourseByStaffAndCourseVariables>;
Variables
The getStaffCourseByStaffAndCourse Query requires an argument of type GetStaffCourseByStaffAndCourseVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetStaffCourseByStaffAndCourseVariables {
staffId: UUIDString;
courseId: UUIDString;
}
Return Type
Recall that calling the getStaffCourseByStaffAndCourse Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getStaffCourseByStaffAndCourse Query is of type GetStaffCourseByStaffAndCourseData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetStaffCourseByStaffAndCourseData {
staffCourses: ({
id: UUIDString;
staffId: UUIDString;
courseId: UUIDString;
progressPercent?: number | null;
completed?: boolean | null;
completedAt?: TimestampString | null;
startedAt?: TimestampString | null;
lastAccessedAt?: TimestampString | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
} & StaffCourse_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getStaffCourseByStaffAndCourse's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetStaffCourseByStaffAndCourseVariables } from '@dataconnect/generated';
import { useGetStaffCourseByStaffAndCourse } from '@dataconnect/generated/react'
export default function GetStaffCourseByStaffAndCourseComponent() {
// The `useGetStaffCourseByStaffAndCourse` Query hook requires an argument of type `GetStaffCourseByStaffAndCourseVariables`:
const getStaffCourseByStaffAndCourseVars: GetStaffCourseByStaffAndCourseVariables = {
staffId: ...,
courseId: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetStaffCourseByStaffAndCourse(getStaffCourseByStaffAndCourseVars);
// Variables can be defined inline as well.
const query = useGetStaffCourseByStaffAndCourse({ staffId: ..., courseId: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetStaffCourseByStaffAndCourse(dataConnect, getStaffCourseByStaffAndCourseVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetStaffCourseByStaffAndCourse(getStaffCourseByStaffAndCourseVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetStaffCourseByStaffAndCourse(dataConnect, getStaffCourseByStaffAndCourseVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.staffCourses);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listActivityLogs
You can execute the listActivityLogs Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListActivityLogs(dc: DataConnect, vars?: ListActivityLogsVariables, options?: useDataConnectQueryOptions<ListActivityLogsData>): UseDataConnectQueryResult<ListActivityLogsData, ListActivityLogsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListActivityLogs(vars?: ListActivityLogsVariables, options?: useDataConnectQueryOptions<ListActivityLogsData>): UseDataConnectQueryResult<ListActivityLogsData, ListActivityLogsVariables>;
Variables
The listActivityLogs Query has an optional argument of type ListActivityLogsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListActivityLogsVariables {
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listActivityLogs Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listActivityLogs Query is of type ListActivityLogsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListActivityLogsData {
activityLogs: ({
id: UUIDString;
userId: string;
date: TimestampString;
hourStart?: string | null;
hourEnd?: string | null;
totalhours?: string | null;
iconType?: ActivityIconType | null;
iconColor?: string | null;
title: string;
description: string;
isRead?: boolean | null;
activityType: ActivityType;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & ActivityLog_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listActivityLogs's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListActivityLogsVariables } from '@dataconnect/generated';
import { useListActivityLogs } from '@dataconnect/generated/react'
export default function ListActivityLogsComponent() {
// The `useListActivityLogs` Query hook has an optional argument of type `ListActivityLogsVariables`:
const listActivityLogsVars: ListActivityLogsVariables = {
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListActivityLogs(listActivityLogsVars);
// Variables can be defined inline as well.
const query = useListActivityLogs({ offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `ListActivityLogsVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useListActivityLogs();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListActivityLogs(dataConnect, listActivityLogsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListActivityLogs(listActivityLogsVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useListActivityLogs(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListActivityLogs(dataConnect, listActivityLogsVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.activityLogs);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getActivityLogById
You can execute the getActivityLogById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetActivityLogById(dc: DataConnect, vars: GetActivityLogByIdVariables, options?: useDataConnectQueryOptions<GetActivityLogByIdData>): UseDataConnectQueryResult<GetActivityLogByIdData, GetActivityLogByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetActivityLogById(vars: GetActivityLogByIdVariables, options?: useDataConnectQueryOptions<GetActivityLogByIdData>): UseDataConnectQueryResult<GetActivityLogByIdData, GetActivityLogByIdVariables>;
Variables
The getActivityLogById Query requires an argument of type GetActivityLogByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetActivityLogByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getActivityLogById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getActivityLogById Query is of type GetActivityLogByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetActivityLogByIdData {
activityLog?: {
id: UUIDString;
userId: string;
date: TimestampString;
hourStart?: string | null;
hourEnd?: string | null;
totalhours?: string | null;
iconType?: ActivityIconType | null;
iconColor?: string | null;
title: string;
description: string;
isRead?: boolean | null;
activityType: ActivityType;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & ActivityLog_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getActivityLogById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetActivityLogByIdVariables } from '@dataconnect/generated';
import { useGetActivityLogById } from '@dataconnect/generated/react'
export default function GetActivityLogByIdComponent() {
// The `useGetActivityLogById` Query hook requires an argument of type `GetActivityLogByIdVariables`:
const getActivityLogByIdVars: GetActivityLogByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetActivityLogById(getActivityLogByIdVars);
// Variables can be defined inline as well.
const query = useGetActivityLogById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetActivityLogById(dataConnect, getActivityLogByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetActivityLogById(getActivityLogByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetActivityLogById(dataConnect, getActivityLogByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.activityLog);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listActivityLogsByUserId
You can execute the listActivityLogsByUserId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListActivityLogsByUserId(dc: DataConnect, vars: ListActivityLogsByUserIdVariables, options?: useDataConnectQueryOptions<ListActivityLogsByUserIdData>): UseDataConnectQueryResult<ListActivityLogsByUserIdData, ListActivityLogsByUserIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListActivityLogsByUserId(vars: ListActivityLogsByUserIdVariables, options?: useDataConnectQueryOptions<ListActivityLogsByUserIdData>): UseDataConnectQueryResult<ListActivityLogsByUserIdData, ListActivityLogsByUserIdVariables>;
Variables
The listActivityLogsByUserId Query requires an argument of type ListActivityLogsByUserIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListActivityLogsByUserIdVariables {
userId: string;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listActivityLogsByUserId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listActivityLogsByUserId Query is of type ListActivityLogsByUserIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListActivityLogsByUserIdData {
activityLogs: ({
id: UUIDString;
userId: string;
date: TimestampString;
hourStart?: string | null;
hourEnd?: string | null;
totalhours?: string | null;
iconType?: ActivityIconType | null;
iconColor?: string | null;
title: string;
description: string;
isRead?: boolean | null;
activityType: ActivityType;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & ActivityLog_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listActivityLogsByUserId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListActivityLogsByUserIdVariables } from '@dataconnect/generated';
import { useListActivityLogsByUserId } from '@dataconnect/generated/react'
export default function ListActivityLogsByUserIdComponent() {
// The `useListActivityLogsByUserId` Query hook requires an argument of type `ListActivityLogsByUserIdVariables`:
const listActivityLogsByUserIdVars: ListActivityLogsByUserIdVariables = {
userId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListActivityLogsByUserId(listActivityLogsByUserIdVars);
// Variables can be defined inline as well.
const query = useListActivityLogsByUserId({ userId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListActivityLogsByUserId(dataConnect, listActivityLogsByUserIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListActivityLogsByUserId(listActivityLogsByUserIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListActivityLogsByUserId(dataConnect, listActivityLogsByUserIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.activityLogs);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listUnreadActivityLogsByUserId
You can execute the listUnreadActivityLogsByUserId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListUnreadActivityLogsByUserId(dc: DataConnect, vars: ListUnreadActivityLogsByUserIdVariables, options?: useDataConnectQueryOptions<ListUnreadActivityLogsByUserIdData>): UseDataConnectQueryResult<ListUnreadActivityLogsByUserIdData, ListUnreadActivityLogsByUserIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListUnreadActivityLogsByUserId(vars: ListUnreadActivityLogsByUserIdVariables, options?: useDataConnectQueryOptions<ListUnreadActivityLogsByUserIdData>): UseDataConnectQueryResult<ListUnreadActivityLogsByUserIdData, ListUnreadActivityLogsByUserIdVariables>;
Variables
The listUnreadActivityLogsByUserId Query requires an argument of type ListUnreadActivityLogsByUserIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListUnreadActivityLogsByUserIdVariables {
userId: string;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listUnreadActivityLogsByUserId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listUnreadActivityLogsByUserId Query is of type ListUnreadActivityLogsByUserIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListUnreadActivityLogsByUserIdData {
activityLogs: ({
id: UUIDString;
userId: string;
date: TimestampString;
hourStart?: string | null;
hourEnd?: string | null;
totalhours?: string | null;
iconType?: ActivityIconType | null;
iconColor?: string | null;
title: string;
description: string;
isRead?: boolean | null;
activityType: ActivityType;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & ActivityLog_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listUnreadActivityLogsByUserId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListUnreadActivityLogsByUserIdVariables } from '@dataconnect/generated';
import { useListUnreadActivityLogsByUserId } from '@dataconnect/generated/react'
export default function ListUnreadActivityLogsByUserIdComponent() {
// The `useListUnreadActivityLogsByUserId` Query hook requires an argument of type `ListUnreadActivityLogsByUserIdVariables`:
const listUnreadActivityLogsByUserIdVars: ListUnreadActivityLogsByUserIdVariables = {
userId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListUnreadActivityLogsByUserId(listUnreadActivityLogsByUserIdVars);
// Variables can be defined inline as well.
const query = useListUnreadActivityLogsByUserId({ userId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListUnreadActivityLogsByUserId(dataConnect, listUnreadActivityLogsByUserIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListUnreadActivityLogsByUserId(listUnreadActivityLogsByUserIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListUnreadActivityLogsByUserId(dataConnect, listUnreadActivityLogsByUserIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.activityLogs);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterActivityLogs
You can execute the filterActivityLogs Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterActivityLogs(dc: DataConnect, vars?: FilterActivityLogsVariables, options?: useDataConnectQueryOptions<FilterActivityLogsData>): UseDataConnectQueryResult<FilterActivityLogsData, FilterActivityLogsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterActivityLogs(vars?: FilterActivityLogsVariables, options?: useDataConnectQueryOptions<FilterActivityLogsData>): UseDataConnectQueryResult<FilterActivityLogsData, FilterActivityLogsVariables>;
Variables
The filterActivityLogs Query has an optional argument of type FilterActivityLogsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterActivityLogsVariables {
userId?: string | null;
dateFrom?: TimestampString | null;
dateTo?: TimestampString | null;
isRead?: boolean | null;
activityType?: ActivityType | null;
iconType?: ActivityIconType | null;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the filterActivityLogs Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the filterActivityLogs Query is of type FilterActivityLogsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterActivityLogsData {
activityLogs: ({
id: UUIDString;
userId: string;
date: TimestampString;
hourStart?: string | null;
hourEnd?: string | null;
totalhours?: string | null;
iconType?: ActivityIconType | null;
iconColor?: string | null;
title: string;
description: string;
isRead?: boolean | null;
activityType: ActivityType;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & ActivityLog_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterActivityLogs's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterActivityLogsVariables } from '@dataconnect/generated';
import { useFilterActivityLogs } from '@dataconnect/generated/react'
export default function FilterActivityLogsComponent() {
// The `useFilterActivityLogs` Query hook has an optional argument of type `FilterActivityLogsVariables`:
const filterActivityLogsVars: FilterActivityLogsVariables = {
userId: ..., // optional
dateFrom: ..., // optional
dateTo: ..., // optional
isRead: ..., // optional
activityType: ..., // optional
iconType: ..., // optional
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useFilterActivityLogs(filterActivityLogsVars);
// Variables can be defined inline as well.
const query = useFilterActivityLogs({ userId: ..., dateFrom: ..., dateTo: ..., isRead: ..., activityType: ..., iconType: ..., offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `FilterActivityLogsVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterActivityLogs();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterActivityLogs(dataConnect, filterActivityLogsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterActivityLogs(filterActivityLogsVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useFilterActivityLogs(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useFilterActivityLogs(dataConnect, filterActivityLogsVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.activityLogs);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listBenefitsData
You can execute the listBenefitsData Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListBenefitsData(dc: DataConnect, vars?: ListBenefitsDataVariables, options?: useDataConnectQueryOptions<ListBenefitsDataData>): UseDataConnectQueryResult<ListBenefitsDataData, ListBenefitsDataVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListBenefitsData(vars?: ListBenefitsDataVariables, options?: useDataConnectQueryOptions<ListBenefitsDataData>): UseDataConnectQueryResult<ListBenefitsDataData, ListBenefitsDataVariables>;
Variables
The listBenefitsData Query has an optional argument of type ListBenefitsDataVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListBenefitsDataVariables {
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listBenefitsData Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listBenefitsData Query is of type ListBenefitsDataData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListBenefitsDataData {
benefitsDatas: ({
id: UUIDString;
vendorBenefitPlanId: UUIDString;
current: number;
staffId: UUIDString;
staff: {
id: UUIDString;
fullName: string;
} & Staff_Key;
vendorBenefitPlan: {
id: UUIDString;
vendorId: UUIDString;
title: string;
description?: string | null;
requestLabel?: string | null;
total?: number | null;
isActive?: boolean | null;
} & VendorBenefitPlan_Key;
} & BenefitsData_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listBenefitsData's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListBenefitsDataVariables } from '@dataconnect/generated';
import { useListBenefitsData } from '@dataconnect/generated/react'
export default function ListBenefitsDataComponent() {
// The `useListBenefitsData` Query hook has an optional argument of type `ListBenefitsDataVariables`:
const listBenefitsDataVars: ListBenefitsDataVariables = {
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListBenefitsData(listBenefitsDataVars);
// Variables can be defined inline as well.
const query = useListBenefitsData({ offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `ListBenefitsDataVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useListBenefitsData();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListBenefitsData(dataConnect, listBenefitsDataVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListBenefitsData(listBenefitsDataVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useListBenefitsData(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListBenefitsData(dataConnect, listBenefitsDataVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.benefitsDatas);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getBenefitsDataByKey
You can execute the getBenefitsDataByKey Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetBenefitsDataByKey(dc: DataConnect, vars: GetBenefitsDataByKeyVariables, options?: useDataConnectQueryOptions<GetBenefitsDataByKeyData>): UseDataConnectQueryResult<GetBenefitsDataByKeyData, GetBenefitsDataByKeyVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetBenefitsDataByKey(vars: GetBenefitsDataByKeyVariables, options?: useDataConnectQueryOptions<GetBenefitsDataByKeyData>): UseDataConnectQueryResult<GetBenefitsDataByKeyData, GetBenefitsDataByKeyVariables>;
Variables
The getBenefitsDataByKey Query requires an argument of type GetBenefitsDataByKeyVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetBenefitsDataByKeyVariables {
staffId: UUIDString;
vendorBenefitPlanId: UUIDString;
}
Return Type
Recall that calling the getBenefitsDataByKey Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getBenefitsDataByKey Query is of type GetBenefitsDataByKeyData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetBenefitsDataByKeyData {
benefitsData?: {
id: UUIDString;
vendorBenefitPlanId: UUIDString;
current: number;
staffId: UUIDString;
staff: {
id: UUIDString;
fullName: string;
} & Staff_Key;
vendorBenefitPlan: {
id: UUIDString;
vendorId: UUIDString;
title: string;
description?: string | null;
requestLabel?: string | null;
total?: number | null;
isActive?: boolean | null;
} & VendorBenefitPlan_Key;
} & BenefitsData_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getBenefitsDataByKey's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetBenefitsDataByKeyVariables } from '@dataconnect/generated';
import { useGetBenefitsDataByKey } from '@dataconnect/generated/react'
export default function GetBenefitsDataByKeyComponent() {
// The `useGetBenefitsDataByKey` Query hook requires an argument of type `GetBenefitsDataByKeyVariables`:
const getBenefitsDataByKeyVars: GetBenefitsDataByKeyVariables = {
staffId: ...,
vendorBenefitPlanId: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetBenefitsDataByKey(getBenefitsDataByKeyVars);
// Variables can be defined inline as well.
const query = useGetBenefitsDataByKey({ staffId: ..., vendorBenefitPlanId: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetBenefitsDataByKey(dataConnect, getBenefitsDataByKeyVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetBenefitsDataByKey(getBenefitsDataByKeyVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetBenefitsDataByKey(dataConnect, getBenefitsDataByKeyVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.benefitsData);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listBenefitsDataByStaffId
You can execute the listBenefitsDataByStaffId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListBenefitsDataByStaffId(dc: DataConnect, vars: ListBenefitsDataByStaffIdVariables, options?: useDataConnectQueryOptions<ListBenefitsDataByStaffIdData>): UseDataConnectQueryResult<ListBenefitsDataByStaffIdData, ListBenefitsDataByStaffIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListBenefitsDataByStaffId(vars: ListBenefitsDataByStaffIdVariables, options?: useDataConnectQueryOptions<ListBenefitsDataByStaffIdData>): UseDataConnectQueryResult<ListBenefitsDataByStaffIdData, ListBenefitsDataByStaffIdVariables>;
Variables
The listBenefitsDataByStaffId Query requires an argument of type ListBenefitsDataByStaffIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListBenefitsDataByStaffIdVariables {
staffId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listBenefitsDataByStaffId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listBenefitsDataByStaffId Query is of type ListBenefitsDataByStaffIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListBenefitsDataByStaffIdData {
benefitsDatas: ({
id: UUIDString;
vendorBenefitPlanId: UUIDString;
current: number;
staffId: UUIDString;
staff: {
id: UUIDString;
fullName: string;
} & Staff_Key;
vendorBenefitPlan: {
id: UUIDString;
vendorId: UUIDString;
title: string;
description?: string | null;
requestLabel?: string | null;
total?: number | null;
isActive?: boolean | null;
} & VendorBenefitPlan_Key;
} & BenefitsData_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listBenefitsDataByStaffId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListBenefitsDataByStaffIdVariables } from '@dataconnect/generated';
import { useListBenefitsDataByStaffId } from '@dataconnect/generated/react'
export default function ListBenefitsDataByStaffIdComponent() {
// The `useListBenefitsDataByStaffId` Query hook requires an argument of type `ListBenefitsDataByStaffIdVariables`:
const listBenefitsDataByStaffIdVars: ListBenefitsDataByStaffIdVariables = {
staffId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListBenefitsDataByStaffId(listBenefitsDataByStaffIdVars);
// Variables can be defined inline as well.
const query = useListBenefitsDataByStaffId({ staffId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListBenefitsDataByStaffId(dataConnect, listBenefitsDataByStaffIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListBenefitsDataByStaffId(listBenefitsDataByStaffIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListBenefitsDataByStaffId(dataConnect, listBenefitsDataByStaffIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.benefitsDatas);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listBenefitsDataByVendorBenefitPlanId
You can execute the listBenefitsDataByVendorBenefitPlanId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListBenefitsDataByVendorBenefitPlanId(dc: DataConnect, vars: ListBenefitsDataByVendorBenefitPlanIdVariables, options?: useDataConnectQueryOptions<ListBenefitsDataByVendorBenefitPlanIdData>): UseDataConnectQueryResult<ListBenefitsDataByVendorBenefitPlanIdData, ListBenefitsDataByVendorBenefitPlanIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListBenefitsDataByVendorBenefitPlanId(vars: ListBenefitsDataByVendorBenefitPlanIdVariables, options?: useDataConnectQueryOptions<ListBenefitsDataByVendorBenefitPlanIdData>): UseDataConnectQueryResult<ListBenefitsDataByVendorBenefitPlanIdData, ListBenefitsDataByVendorBenefitPlanIdVariables>;
Variables
The listBenefitsDataByVendorBenefitPlanId Query requires an argument of type ListBenefitsDataByVendorBenefitPlanIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListBenefitsDataByVendorBenefitPlanIdVariables {
vendorBenefitPlanId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listBenefitsDataByVendorBenefitPlanId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listBenefitsDataByVendorBenefitPlanId Query is of type ListBenefitsDataByVendorBenefitPlanIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListBenefitsDataByVendorBenefitPlanIdData {
benefitsDatas: ({
id: UUIDString;
vendorBenefitPlanId: UUIDString;
current: number;
staffId: UUIDString;
staff: {
id: UUIDString;
fullName: string;
} & Staff_Key;
vendorBenefitPlan: {
id: UUIDString;
vendorId: UUIDString;
title: string;
description?: string | null;
requestLabel?: string | null;
total?: number | null;
isActive?: boolean | null;
} & VendorBenefitPlan_Key;
} & BenefitsData_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listBenefitsDataByVendorBenefitPlanId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListBenefitsDataByVendorBenefitPlanIdVariables } from '@dataconnect/generated';
import { useListBenefitsDataByVendorBenefitPlanId } from '@dataconnect/generated/react'
export default function ListBenefitsDataByVendorBenefitPlanIdComponent() {
// The `useListBenefitsDataByVendorBenefitPlanId` Query hook requires an argument of type `ListBenefitsDataByVendorBenefitPlanIdVariables`:
const listBenefitsDataByVendorBenefitPlanIdVars: ListBenefitsDataByVendorBenefitPlanIdVariables = {
vendorBenefitPlanId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListBenefitsDataByVendorBenefitPlanId(listBenefitsDataByVendorBenefitPlanIdVars);
// Variables can be defined inline as well.
const query = useListBenefitsDataByVendorBenefitPlanId({ vendorBenefitPlanId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListBenefitsDataByVendorBenefitPlanId(dataConnect, listBenefitsDataByVendorBenefitPlanIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListBenefitsDataByVendorBenefitPlanId(listBenefitsDataByVendorBenefitPlanIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListBenefitsDataByVendorBenefitPlanId(dataConnect, listBenefitsDataByVendorBenefitPlanIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.benefitsDatas);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listBenefitsDataByVendorBenefitPlanIds
You can execute the listBenefitsDataByVendorBenefitPlanIds Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListBenefitsDataByVendorBenefitPlanIds(dc: DataConnect, vars: ListBenefitsDataByVendorBenefitPlanIdsVariables, options?: useDataConnectQueryOptions<ListBenefitsDataByVendorBenefitPlanIdsData>): UseDataConnectQueryResult<ListBenefitsDataByVendorBenefitPlanIdsData, ListBenefitsDataByVendorBenefitPlanIdsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListBenefitsDataByVendorBenefitPlanIds(vars: ListBenefitsDataByVendorBenefitPlanIdsVariables, options?: useDataConnectQueryOptions<ListBenefitsDataByVendorBenefitPlanIdsData>): UseDataConnectQueryResult<ListBenefitsDataByVendorBenefitPlanIdsData, ListBenefitsDataByVendorBenefitPlanIdsVariables>;
Variables
The listBenefitsDataByVendorBenefitPlanIds Query requires an argument of type ListBenefitsDataByVendorBenefitPlanIdsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListBenefitsDataByVendorBenefitPlanIdsVariables {
vendorBenefitPlanIds: UUIDString[];
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listBenefitsDataByVendorBenefitPlanIds Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listBenefitsDataByVendorBenefitPlanIds Query is of type ListBenefitsDataByVendorBenefitPlanIdsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListBenefitsDataByVendorBenefitPlanIdsData {
benefitsDatas: ({
id: UUIDString;
vendorBenefitPlanId: UUIDString;
current: number;
staffId: UUIDString;
staff: {
id: UUIDString;
fullName: string;
} & Staff_Key;
vendorBenefitPlan: {
id: UUIDString;
vendorId: UUIDString;
title: string;
description?: string | null;
requestLabel?: string | null;
total?: number | null;
isActive?: boolean | null;
} & VendorBenefitPlan_Key;
} & BenefitsData_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listBenefitsDataByVendorBenefitPlanIds's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListBenefitsDataByVendorBenefitPlanIdsVariables } from '@dataconnect/generated';
import { useListBenefitsDataByVendorBenefitPlanIds } from '@dataconnect/generated/react'
export default function ListBenefitsDataByVendorBenefitPlanIdsComponent() {
// The `useListBenefitsDataByVendorBenefitPlanIds` Query hook requires an argument of type `ListBenefitsDataByVendorBenefitPlanIdsVariables`:
const listBenefitsDataByVendorBenefitPlanIdsVars: ListBenefitsDataByVendorBenefitPlanIdsVariables = {
vendorBenefitPlanIds: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListBenefitsDataByVendorBenefitPlanIds(listBenefitsDataByVendorBenefitPlanIdsVars);
// Variables can be defined inline as well.
const query = useListBenefitsDataByVendorBenefitPlanIds({ vendorBenefitPlanIds: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListBenefitsDataByVendorBenefitPlanIds(dataConnect, listBenefitsDataByVendorBenefitPlanIdsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListBenefitsDataByVendorBenefitPlanIds(listBenefitsDataByVendorBenefitPlanIdsVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListBenefitsDataByVendorBenefitPlanIds(dataConnect, listBenefitsDataByVendorBenefitPlanIdsVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.benefitsDatas);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listStaff
You can execute the listStaff Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListStaff(dc: DataConnect, options?: useDataConnectQueryOptions<ListStaffData>): UseDataConnectQueryResult<ListStaffData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListStaff(options?: useDataConnectQueryOptions<ListStaffData>): UseDataConnectQueryResult<ListStaffData, undefined>;
Variables
The listStaff Query has no variables.
Return Type
Recall that calling the listStaff Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listStaff Query is of type ListStaffData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffData {
staffs: ({
id: UUIDString;
userId: string;
fullName: string;
level?: string | null;
role?: string | null;
phone?: string | null;
email?: string | null;
photoUrl?: string | null;
totalShifts?: number | null;
averageRating?: number | null;
onTimeRate?: number | null;
noShowCount?: number | null;
cancellationCount?: number | null;
reliabilityScore?: number | null;
xp?: number | null;
badges?: unknown | null;
isRecommended?: boolean | null;
bio?: string | null;
skills?: string[] | null;
industries?: string[] | null;
preferredLocations?: string[] | null;
maxDistanceMiles?: number | null;
languages?: unknown | null;
itemsAttire?: unknown | null;
ownerId?: UUIDString | null;
createdAt?: TimestampString | null;
department?: DepartmentType | null;
hubId?: UUIDString | null;
manager?: UUIDString | null;
english?: EnglishProficiency | null;
backgroundCheckStatus?: BackgroundCheckStatus | null;
employmentType?: EmploymentType | null;
initial?: string | null;
englishRequired?: boolean | null;
city?: string | null;
addres?: string | null;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
state?: string | null;
street?: string | null;
country?: string | null;
zipCode?: string | null;
} & Staff_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listStaff's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListStaff } from '@dataconnect/generated/react'
export default function ListStaffComponent() {
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListStaff();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListStaff(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListStaff(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListStaff(dataConnect, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.staffs);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getStaffById
You can execute the getStaffById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetStaffById(dc: DataConnect, vars: GetStaffByIdVariables, options?: useDataConnectQueryOptions<GetStaffByIdData>): UseDataConnectQueryResult<GetStaffByIdData, GetStaffByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetStaffById(vars: GetStaffByIdVariables, options?: useDataConnectQueryOptions<GetStaffByIdData>): UseDataConnectQueryResult<GetStaffByIdData, GetStaffByIdVariables>;
Variables
The getStaffById Query requires an argument of type GetStaffByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetStaffByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getStaffById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getStaffById Query is of type GetStaffByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetStaffByIdData {
staff?: {
id: UUIDString;
userId: string;
fullName: string;
role?: string | null;
level?: string | null;
phone?: string | null;
email?: string | null;
photoUrl?: string | null;
totalShifts?: number | null;
averageRating?: number | null;
onTimeRate?: number | null;
noShowCount?: number | null;
cancellationCount?: number | null;
reliabilityScore?: number | null;
xp?: number | null;
badges?: unknown | null;
isRecommended?: boolean | null;
bio?: string | null;
skills?: string[] | null;
industries?: string[] | null;
preferredLocations?: string[] | null;
maxDistanceMiles?: number | null;
languages?: unknown | null;
itemsAttire?: unknown | null;
ownerId?: UUIDString | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
department?: DepartmentType | null;
hubId?: UUIDString | null;
manager?: UUIDString | null;
english?: EnglishProficiency | null;
backgroundCheckStatus?: BackgroundCheckStatus | null;
employmentType?: EmploymentType | null;
initial?: string | null;
englishRequired?: boolean | null;
city?: string | null;
addres?: string | null;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
state?: string | null;
street?: string | null;
country?: string | null;
zipCode?: string | null;
} & Staff_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getStaffById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetStaffByIdVariables } from '@dataconnect/generated';
import { useGetStaffById } from '@dataconnect/generated/react'
export default function GetStaffByIdComponent() {
// The `useGetStaffById` Query hook requires an argument of type `GetStaffByIdVariables`:
const getStaffByIdVars: GetStaffByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetStaffById(getStaffByIdVars);
// Variables can be defined inline as well.
const query = useGetStaffById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetStaffById(dataConnect, getStaffByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetStaffById(getStaffByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetStaffById(dataConnect, getStaffByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.staff);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getStaffByUserId
You can execute the getStaffByUserId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetStaffByUserId(dc: DataConnect, vars: GetStaffByUserIdVariables, options?: useDataConnectQueryOptions<GetStaffByUserIdData>): UseDataConnectQueryResult<GetStaffByUserIdData, GetStaffByUserIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetStaffByUserId(vars: GetStaffByUserIdVariables, options?: useDataConnectQueryOptions<GetStaffByUserIdData>): UseDataConnectQueryResult<GetStaffByUserIdData, GetStaffByUserIdVariables>;
Variables
The getStaffByUserId Query requires an argument of type GetStaffByUserIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetStaffByUserIdVariables {
userId: string;
}
Return Type
Recall that calling the getStaffByUserId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getStaffByUserId Query is of type GetStaffByUserIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetStaffByUserIdData {
staffs: ({
id: UUIDString;
userId: string;
fullName: string;
level?: string | null;
phone?: string | null;
email?: string | null;
photoUrl?: string | null;
totalShifts?: number | null;
averageRating?: number | null;
onTimeRate?: number | null;
noShowCount?: number | null;
cancellationCount?: number | null;
reliabilityScore?: number | null;
xp?: number | null;
badges?: unknown | null;
isRecommended?: boolean | null;
bio?: string | null;
skills?: string[] | null;
industries?: string[] | null;
preferredLocations?: string[] | null;
maxDistanceMiles?: number | null;
languages?: unknown | null;
itemsAttire?: unknown | null;
ownerId?: UUIDString | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
department?: DepartmentType | null;
hubId?: UUIDString | null;
manager?: UUIDString | null;
english?: EnglishProficiency | null;
backgroundCheckStatus?: BackgroundCheckStatus | null;
employmentType?: EmploymentType | null;
initial?: string | null;
englishRequired?: boolean | null;
city?: string | null;
addres?: string | null;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
state?: string | null;
street?: string | null;
country?: string | null;
zipCode?: string | null;
} & Staff_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getStaffByUserId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetStaffByUserIdVariables } from '@dataconnect/generated';
import { useGetStaffByUserId } from '@dataconnect/generated/react'
export default function GetStaffByUserIdComponent() {
// The `useGetStaffByUserId` Query hook requires an argument of type `GetStaffByUserIdVariables`:
const getStaffByUserIdVars: GetStaffByUserIdVariables = {
userId: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetStaffByUserId(getStaffByUserIdVars);
// Variables can be defined inline as well.
const query = useGetStaffByUserId({ userId: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetStaffByUserId(dataConnect, getStaffByUserIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetStaffByUserId(getStaffByUserIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetStaffByUserId(dataConnect, getStaffByUserIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.staffs);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterStaff
You can execute the filterStaff Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterStaff(dc: DataConnect, vars?: FilterStaffVariables, options?: useDataConnectQueryOptions<FilterStaffData>): UseDataConnectQueryResult<FilterStaffData, FilterStaffVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterStaff(vars?: FilterStaffVariables, options?: useDataConnectQueryOptions<FilterStaffData>): UseDataConnectQueryResult<FilterStaffData, FilterStaffVariables>;
Variables
The filterStaff Query has an optional argument of type FilterStaffVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterStaffVariables {
ownerId?: UUIDString | null;
fullName?: string | null;
level?: string | null;
email?: string | null;
}
Return Type
Recall that calling the filterStaff Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the filterStaff Query is of type FilterStaffData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterStaffData {
staffs: ({
id: UUIDString;
userId: string;
fullName: string;
level?: string | null;
phone?: string | null;
email?: string | null;
photoUrl?: string | null;
averageRating?: number | null;
reliabilityScore?: number | null;
totalShifts?: number | null;
ownerId?: UUIDString | null;
isRecommended?: boolean | null;
skills?: string[] | null;
industries?: string[] | null;
backgroundCheckStatus?: BackgroundCheckStatus | null;
employmentType?: EmploymentType | null;
initial?: string | null;
englishRequired?: boolean | null;
city?: string | null;
addres?: string | null;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
state?: string | null;
street?: string | null;
country?: string | null;
zipCode?: string | null;
} & Staff_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterStaff's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterStaffVariables } from '@dataconnect/generated';
import { useFilterStaff } from '@dataconnect/generated/react'
export default function FilterStaffComponent() {
// The `useFilterStaff` Query hook has an optional argument of type `FilterStaffVariables`:
const filterStaffVars: FilterStaffVariables = {
ownerId: ..., // optional
fullName: ..., // optional
level: ..., // optional
email: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useFilterStaff(filterStaffVars);
// Variables can be defined inline as well.
const query = useFilterStaff({ ownerId: ..., fullName: ..., level: ..., email: ..., });
// Since all variables are optional for this Query, you can omit the `FilterStaffVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterStaff();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterStaff(dataConnect, filterStaffVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterStaff(filterStaffVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useFilterStaff(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useFilterStaff(dataConnect, filterStaffVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.staffs);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listTasks
You can execute the listTasks Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListTasks(dc: DataConnect, options?: useDataConnectQueryOptions<ListTasksData>): UseDataConnectQueryResult<ListTasksData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListTasks(options?: useDataConnectQueryOptions<ListTasksData>): UseDataConnectQueryResult<ListTasksData, undefined>;
Variables
The listTasks Query has no variables.
Return Type
Recall that calling the listTasks Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listTasks Query is of type ListTasksData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListTasksData {
tasks: ({
id: UUIDString;
taskName: string;
description?: string | null;
priority: TaskPriority;
status: TaskStatus;
dueDate?: TimestampString | null;
progress?: number | null;
orderIndex?: number | null;
commentCount?: number | null;
attachmentCount?: number | null;
files?: unknown | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & Task_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listTasks's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListTasks } from '@dataconnect/generated/react'
export default function ListTasksComponent() {
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListTasks();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListTasks(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListTasks(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListTasks(dataConnect, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.tasks);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getTaskById
You can execute the getTaskById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetTaskById(dc: DataConnect, vars: GetTaskByIdVariables, options?: useDataConnectQueryOptions<GetTaskByIdData>): UseDataConnectQueryResult<GetTaskByIdData, GetTaskByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetTaskById(vars: GetTaskByIdVariables, options?: useDataConnectQueryOptions<GetTaskByIdData>): UseDataConnectQueryResult<GetTaskByIdData, GetTaskByIdVariables>;
Variables
The getTaskById Query requires an argument of type GetTaskByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTaskByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getTaskById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getTaskById Query is of type GetTaskByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTaskByIdData {
task?: {
id: UUIDString;
taskName: string;
description?: string | null;
priority: TaskPriority;
status: TaskStatus;
dueDate?: TimestampString | null;
progress?: number | null;
orderIndex?: number | null;
commentCount?: number | null;
attachmentCount?: number | null;
files?: unknown | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & Task_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getTaskById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetTaskByIdVariables } from '@dataconnect/generated';
import { useGetTaskById } from '@dataconnect/generated/react'
export default function GetTaskByIdComponent() {
// The `useGetTaskById` Query hook requires an argument of type `GetTaskByIdVariables`:
const getTaskByIdVars: GetTaskByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetTaskById(getTaskByIdVars);
// Variables can be defined inline as well.
const query = useGetTaskById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetTaskById(dataConnect, getTaskByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetTaskById(getTaskByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetTaskById(dataConnect, getTaskByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.task);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getTasksByOwnerId
You can execute the getTasksByOwnerId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetTasksByOwnerId(dc: DataConnect, vars: GetTasksByOwnerIdVariables, options?: useDataConnectQueryOptions<GetTasksByOwnerIdData>): UseDataConnectQueryResult<GetTasksByOwnerIdData, GetTasksByOwnerIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetTasksByOwnerId(vars: GetTasksByOwnerIdVariables, options?: useDataConnectQueryOptions<GetTasksByOwnerIdData>): UseDataConnectQueryResult<GetTasksByOwnerIdData, GetTasksByOwnerIdVariables>;
Variables
The getTasksByOwnerId Query requires an argument of type GetTasksByOwnerIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTasksByOwnerIdVariables {
ownerId: UUIDString;
}
Return Type
Recall that calling the getTasksByOwnerId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getTasksByOwnerId Query is of type GetTasksByOwnerIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTasksByOwnerIdData {
tasks: ({
id: UUIDString;
taskName: string;
description?: string | null;
priority: TaskPriority;
status: TaskStatus;
dueDate?: TimestampString | null;
progress?: number | null;
orderIndex?: number | null;
commentCount?: number | null;
attachmentCount?: number | null;
files?: unknown | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & Task_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getTasksByOwnerId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetTasksByOwnerIdVariables } from '@dataconnect/generated';
import { useGetTasksByOwnerId } from '@dataconnect/generated/react'
export default function GetTasksByOwnerIdComponent() {
// The `useGetTasksByOwnerId` Query hook requires an argument of type `GetTasksByOwnerIdVariables`:
const getTasksByOwnerIdVars: GetTasksByOwnerIdVariables = {
ownerId: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetTasksByOwnerId(getTasksByOwnerIdVars);
// Variables can be defined inline as well.
const query = useGetTasksByOwnerId({ ownerId: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetTasksByOwnerId(dataConnect, getTasksByOwnerIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetTasksByOwnerId(getTasksByOwnerIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetTasksByOwnerId(dataConnect, getTasksByOwnerIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.tasks);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterTasks
You can execute the filterTasks Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterTasks(dc: DataConnect, vars?: FilterTasksVariables, options?: useDataConnectQueryOptions<FilterTasksData>): UseDataConnectQueryResult<FilterTasksData, FilterTasksVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterTasks(vars?: FilterTasksVariables, options?: useDataConnectQueryOptions<FilterTasksData>): UseDataConnectQueryResult<FilterTasksData, FilterTasksVariables>;
Variables
The filterTasks Query has an optional argument of type FilterTasksVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterTasksVariables {
status?: TaskStatus | null;
priority?: TaskPriority | null;
}
Return Type
Recall that calling the filterTasks Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the filterTasks Query is of type FilterTasksData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterTasksData {
tasks: ({
id: UUIDString;
taskName: string;
description?: string | null;
priority: TaskPriority;
status: TaskStatus;
dueDate?: TimestampString | null;
progress?: number | null;
orderIndex?: number | null;
commentCount?: number | null;
attachmentCount?: number | null;
files?: unknown | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & Task_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterTasks's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterTasksVariables } from '@dataconnect/generated';
import { useFilterTasks } from '@dataconnect/generated/react'
export default function FilterTasksComponent() {
// The `useFilterTasks` Query hook has an optional argument of type `FilterTasksVariables`:
const filterTasksVars: FilterTasksVariables = {
status: ..., // optional
priority: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useFilterTasks(filterTasksVars);
// Variables can be defined inline as well.
const query = useFilterTasks({ status: ..., priority: ..., });
// Since all variables are optional for this Query, you can omit the `FilterTasksVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterTasks();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterTasks(dataConnect, filterTasksVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterTasks(filterTasksVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useFilterTasks(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useFilterTasks(dataConnect, filterTasksVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.tasks);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listTeamHubs
You can execute the listTeamHubs Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListTeamHubs(dc: DataConnect, vars?: ListTeamHubsVariables, options?: useDataConnectQueryOptions<ListTeamHubsData>): UseDataConnectQueryResult<ListTeamHubsData, ListTeamHubsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListTeamHubs(vars?: ListTeamHubsVariables, options?: useDataConnectQueryOptions<ListTeamHubsData>): UseDataConnectQueryResult<ListTeamHubsData, ListTeamHubsVariables>;
Variables
The listTeamHubs Query has an optional argument of type ListTeamHubsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListTeamHubsVariables {
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listTeamHubs Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listTeamHubs Query is of type ListTeamHubsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListTeamHubsData {
teamHubs: ({
id: UUIDString;
teamId: UUIDString;
hubName: string;
address: string;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
city?: string | null;
state?: string | null;
street?: string | null;
country?: string | null;
zipCode?: string | null;
managerName?: string | null;
isActive: boolean;
departments?: unknown | null;
} & TeamHub_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listTeamHubs's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListTeamHubsVariables } from '@dataconnect/generated';
import { useListTeamHubs } from '@dataconnect/generated/react'
export default function ListTeamHubsComponent() {
// The `useListTeamHubs` Query hook has an optional argument of type `ListTeamHubsVariables`:
const listTeamHubsVars: ListTeamHubsVariables = {
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListTeamHubs(listTeamHubsVars);
// Variables can be defined inline as well.
const query = useListTeamHubs({ offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `ListTeamHubsVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useListTeamHubs();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListTeamHubs(dataConnect, listTeamHubsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListTeamHubs(listTeamHubsVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useListTeamHubs(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListTeamHubs(dataConnect, listTeamHubsVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.teamHubs);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getTeamHubById
You can execute the getTeamHubById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetTeamHubById(dc: DataConnect, vars: GetTeamHubByIdVariables, options?: useDataConnectQueryOptions<GetTeamHubByIdData>): UseDataConnectQueryResult<GetTeamHubByIdData, GetTeamHubByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetTeamHubById(vars: GetTeamHubByIdVariables, options?: useDataConnectQueryOptions<GetTeamHubByIdData>): UseDataConnectQueryResult<GetTeamHubByIdData, GetTeamHubByIdVariables>;
Variables
The getTeamHubById Query requires an argument of type GetTeamHubByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTeamHubByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getTeamHubById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getTeamHubById Query is of type GetTeamHubByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTeamHubByIdData {
teamHub?: {
id: UUIDString;
teamId: UUIDString;
hubName: string;
address: string;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
city?: string | null;
state?: string | null;
street?: string | null;
country?: string | null;
zipCode?: string | null;
managerName?: string | null;
isActive: boolean;
departments?: unknown | null;
} & TeamHub_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getTeamHubById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetTeamHubByIdVariables } from '@dataconnect/generated';
import { useGetTeamHubById } from '@dataconnect/generated/react'
export default function GetTeamHubByIdComponent() {
// The `useGetTeamHubById` Query hook requires an argument of type `GetTeamHubByIdVariables`:
const getTeamHubByIdVars: GetTeamHubByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetTeamHubById(getTeamHubByIdVars);
// Variables can be defined inline as well.
const query = useGetTeamHubById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetTeamHubById(dataConnect, getTeamHubByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetTeamHubById(getTeamHubByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetTeamHubById(dataConnect, getTeamHubByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.teamHub);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getTeamHubsByTeamId
You can execute the getTeamHubsByTeamId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetTeamHubsByTeamId(dc: DataConnect, vars: GetTeamHubsByTeamIdVariables, options?: useDataConnectQueryOptions<GetTeamHubsByTeamIdData>): UseDataConnectQueryResult<GetTeamHubsByTeamIdData, GetTeamHubsByTeamIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetTeamHubsByTeamId(vars: GetTeamHubsByTeamIdVariables, options?: useDataConnectQueryOptions<GetTeamHubsByTeamIdData>): UseDataConnectQueryResult<GetTeamHubsByTeamIdData, GetTeamHubsByTeamIdVariables>;
Variables
The getTeamHubsByTeamId Query requires an argument of type GetTeamHubsByTeamIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTeamHubsByTeamIdVariables {
teamId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the getTeamHubsByTeamId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getTeamHubsByTeamId Query is of type GetTeamHubsByTeamIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTeamHubsByTeamIdData {
teamHubs: ({
id: UUIDString;
teamId: UUIDString;
hubName: string;
address: string;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
city?: string | null;
state?: string | null;
street?: string | null;
country?: string | null;
zipCode?: string | null;
managerName?: string | null;
isActive: boolean;
departments?: unknown | null;
} & TeamHub_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getTeamHubsByTeamId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetTeamHubsByTeamIdVariables } from '@dataconnect/generated';
import { useGetTeamHubsByTeamId } from '@dataconnect/generated/react'
export default function GetTeamHubsByTeamIdComponent() {
// The `useGetTeamHubsByTeamId` Query hook requires an argument of type `GetTeamHubsByTeamIdVariables`:
const getTeamHubsByTeamIdVars: GetTeamHubsByTeamIdVariables = {
teamId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetTeamHubsByTeamId(getTeamHubsByTeamIdVars);
// Variables can be defined inline as well.
const query = useGetTeamHubsByTeamId({ teamId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetTeamHubsByTeamId(dataConnect, getTeamHubsByTeamIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetTeamHubsByTeamId(getTeamHubsByTeamIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetTeamHubsByTeamId(dataConnect, getTeamHubsByTeamIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.teamHubs);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listTeamHubsByOwnerId
You can execute the listTeamHubsByOwnerId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListTeamHubsByOwnerId(dc: DataConnect, vars: ListTeamHubsByOwnerIdVariables, options?: useDataConnectQueryOptions<ListTeamHubsByOwnerIdData>): UseDataConnectQueryResult<ListTeamHubsByOwnerIdData, ListTeamHubsByOwnerIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListTeamHubsByOwnerId(vars: ListTeamHubsByOwnerIdVariables, options?: useDataConnectQueryOptions<ListTeamHubsByOwnerIdData>): UseDataConnectQueryResult<ListTeamHubsByOwnerIdData, ListTeamHubsByOwnerIdVariables>;
Variables
The listTeamHubsByOwnerId Query requires an argument of type ListTeamHubsByOwnerIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListTeamHubsByOwnerIdVariables {
ownerId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listTeamHubsByOwnerId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listTeamHubsByOwnerId Query is of type ListTeamHubsByOwnerIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListTeamHubsByOwnerIdData {
teamHubs: ({
id: UUIDString;
teamId: UUIDString;
hubName: string;
address: string;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
city?: string | null;
state?: string | null;
street?: string | null;
country?: string | null;
zipCode?: string | null;
managerName?: string | null;
isActive: boolean;
departments?: unknown | null;
} & TeamHub_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listTeamHubsByOwnerId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListTeamHubsByOwnerIdVariables } from '@dataconnect/generated';
import { useListTeamHubsByOwnerId } from '@dataconnect/generated/react'
export default function ListTeamHubsByOwnerIdComponent() {
// The `useListTeamHubsByOwnerId` Query hook requires an argument of type `ListTeamHubsByOwnerIdVariables`:
const listTeamHubsByOwnerIdVars: ListTeamHubsByOwnerIdVariables = {
ownerId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListTeamHubsByOwnerId(listTeamHubsByOwnerIdVars);
// Variables can be defined inline as well.
const query = useListTeamHubsByOwnerId({ ownerId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListTeamHubsByOwnerId(dataConnect, listTeamHubsByOwnerIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListTeamHubsByOwnerId(listTeamHubsByOwnerIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListTeamHubsByOwnerId(dataConnect, listTeamHubsByOwnerIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.teamHubs);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listClientFeedbacks
You can execute the listClientFeedbacks Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListClientFeedbacks(dc: DataConnect, vars?: ListClientFeedbacksVariables, options?: useDataConnectQueryOptions<ListClientFeedbacksData>): UseDataConnectQueryResult<ListClientFeedbacksData, ListClientFeedbacksVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListClientFeedbacks(vars?: ListClientFeedbacksVariables, options?: useDataConnectQueryOptions<ListClientFeedbacksData>): UseDataConnectQueryResult<ListClientFeedbacksData, ListClientFeedbacksVariables>;
Variables
The listClientFeedbacks Query has an optional argument of type ListClientFeedbacksVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListClientFeedbacksVariables {
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listClientFeedbacks Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listClientFeedbacks Query is of type ListClientFeedbacksData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListClientFeedbacksData {
clientFeedbacks: ({
id: UUIDString;
businessId: UUIDString;
vendorId: UUIDString;
rating?: number | null;
comment?: string | null;
date?: TimestampString | null;
createdAt?: TimestampString | null;
business: {
id: UUIDString;
businessName: string;
} & Business_Key;
vendor: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & ClientFeedback_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listClientFeedbacks's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListClientFeedbacksVariables } from '@dataconnect/generated';
import { useListClientFeedbacks } from '@dataconnect/generated/react'
export default function ListClientFeedbacksComponent() {
// The `useListClientFeedbacks` Query hook has an optional argument of type `ListClientFeedbacksVariables`:
const listClientFeedbacksVars: ListClientFeedbacksVariables = {
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListClientFeedbacks(listClientFeedbacksVars);
// Variables can be defined inline as well.
const query = useListClientFeedbacks({ offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `ListClientFeedbacksVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useListClientFeedbacks();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListClientFeedbacks(dataConnect, listClientFeedbacksVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListClientFeedbacks(listClientFeedbacksVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useListClientFeedbacks(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListClientFeedbacks(dataConnect, listClientFeedbacksVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.clientFeedbacks);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getClientFeedbackById
You can execute the getClientFeedbackById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetClientFeedbackById(dc: DataConnect, vars: GetClientFeedbackByIdVariables, options?: useDataConnectQueryOptions<GetClientFeedbackByIdData>): UseDataConnectQueryResult<GetClientFeedbackByIdData, GetClientFeedbackByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetClientFeedbackById(vars: GetClientFeedbackByIdVariables, options?: useDataConnectQueryOptions<GetClientFeedbackByIdData>): UseDataConnectQueryResult<GetClientFeedbackByIdData, GetClientFeedbackByIdVariables>;
Variables
The getClientFeedbackById Query requires an argument of type GetClientFeedbackByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetClientFeedbackByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getClientFeedbackById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getClientFeedbackById Query is of type GetClientFeedbackByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetClientFeedbackByIdData {
clientFeedback?: {
id: UUIDString;
businessId: UUIDString;
vendorId: UUIDString;
rating?: number | null;
comment?: string | null;
date?: TimestampString | null;
createdAt?: TimestampString | null;
business: {
id: UUIDString;
businessName: string;
} & Business_Key;
vendor: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & ClientFeedback_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getClientFeedbackById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetClientFeedbackByIdVariables } from '@dataconnect/generated';
import { useGetClientFeedbackById } from '@dataconnect/generated/react'
export default function GetClientFeedbackByIdComponent() {
// The `useGetClientFeedbackById` Query hook requires an argument of type `GetClientFeedbackByIdVariables`:
const getClientFeedbackByIdVars: GetClientFeedbackByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetClientFeedbackById(getClientFeedbackByIdVars);
// Variables can be defined inline as well.
const query = useGetClientFeedbackById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetClientFeedbackById(dataConnect, getClientFeedbackByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetClientFeedbackById(getClientFeedbackByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetClientFeedbackById(dataConnect, getClientFeedbackByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.clientFeedback);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listClientFeedbacksByBusinessId
You can execute the listClientFeedbacksByBusinessId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListClientFeedbacksByBusinessId(dc: DataConnect, vars: ListClientFeedbacksByBusinessIdVariables, options?: useDataConnectQueryOptions<ListClientFeedbacksByBusinessIdData>): UseDataConnectQueryResult<ListClientFeedbacksByBusinessIdData, ListClientFeedbacksByBusinessIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListClientFeedbacksByBusinessId(vars: ListClientFeedbacksByBusinessIdVariables, options?: useDataConnectQueryOptions<ListClientFeedbacksByBusinessIdData>): UseDataConnectQueryResult<ListClientFeedbacksByBusinessIdData, ListClientFeedbacksByBusinessIdVariables>;
Variables
The listClientFeedbacksByBusinessId Query requires an argument of type ListClientFeedbacksByBusinessIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListClientFeedbacksByBusinessIdVariables {
businessId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listClientFeedbacksByBusinessId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listClientFeedbacksByBusinessId Query is of type ListClientFeedbacksByBusinessIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListClientFeedbacksByBusinessIdData {
clientFeedbacks: ({
id: UUIDString;
businessId: UUIDString;
vendorId: UUIDString;
rating?: number | null;
comment?: string | null;
date?: TimestampString | null;
createdAt?: TimestampString | null;
business: {
id: UUIDString;
businessName: string;
} & Business_Key;
vendor: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & ClientFeedback_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listClientFeedbacksByBusinessId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListClientFeedbacksByBusinessIdVariables } from '@dataconnect/generated';
import { useListClientFeedbacksByBusinessId } from '@dataconnect/generated/react'
export default function ListClientFeedbacksByBusinessIdComponent() {
// The `useListClientFeedbacksByBusinessId` Query hook requires an argument of type `ListClientFeedbacksByBusinessIdVariables`:
const listClientFeedbacksByBusinessIdVars: ListClientFeedbacksByBusinessIdVariables = {
businessId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListClientFeedbacksByBusinessId(listClientFeedbacksByBusinessIdVars);
// Variables can be defined inline as well.
const query = useListClientFeedbacksByBusinessId({ businessId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListClientFeedbacksByBusinessId(dataConnect, listClientFeedbacksByBusinessIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListClientFeedbacksByBusinessId(listClientFeedbacksByBusinessIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListClientFeedbacksByBusinessId(dataConnect, listClientFeedbacksByBusinessIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.clientFeedbacks);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listClientFeedbacksByVendorId
You can execute the listClientFeedbacksByVendorId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListClientFeedbacksByVendorId(dc: DataConnect, vars: ListClientFeedbacksByVendorIdVariables, options?: useDataConnectQueryOptions<ListClientFeedbacksByVendorIdData>): UseDataConnectQueryResult<ListClientFeedbacksByVendorIdData, ListClientFeedbacksByVendorIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListClientFeedbacksByVendorId(vars: ListClientFeedbacksByVendorIdVariables, options?: useDataConnectQueryOptions<ListClientFeedbacksByVendorIdData>): UseDataConnectQueryResult<ListClientFeedbacksByVendorIdData, ListClientFeedbacksByVendorIdVariables>;
Variables
The listClientFeedbacksByVendorId Query requires an argument of type ListClientFeedbacksByVendorIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListClientFeedbacksByVendorIdVariables {
vendorId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listClientFeedbacksByVendorId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listClientFeedbacksByVendorId Query is of type ListClientFeedbacksByVendorIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListClientFeedbacksByVendorIdData {
clientFeedbacks: ({
id: UUIDString;
businessId: UUIDString;
vendorId: UUIDString;
rating?: number | null;
comment?: string | null;
date?: TimestampString | null;
createdAt?: TimestampString | null;
business: {
id: UUIDString;
businessName: string;
} & Business_Key;
vendor: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & ClientFeedback_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listClientFeedbacksByVendorId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListClientFeedbacksByVendorIdVariables } from '@dataconnect/generated';
import { useListClientFeedbacksByVendorId } from '@dataconnect/generated/react'
export default function ListClientFeedbacksByVendorIdComponent() {
// The `useListClientFeedbacksByVendorId` Query hook requires an argument of type `ListClientFeedbacksByVendorIdVariables`:
const listClientFeedbacksByVendorIdVars: ListClientFeedbacksByVendorIdVariables = {
vendorId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListClientFeedbacksByVendorId(listClientFeedbacksByVendorIdVars);
// Variables can be defined inline as well.
const query = useListClientFeedbacksByVendorId({ vendorId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListClientFeedbacksByVendorId(dataConnect, listClientFeedbacksByVendorIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListClientFeedbacksByVendorId(listClientFeedbacksByVendorIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListClientFeedbacksByVendorId(dataConnect, listClientFeedbacksByVendorIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.clientFeedbacks);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listClientFeedbacksByBusinessAndVendor
You can execute the listClientFeedbacksByBusinessAndVendor Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListClientFeedbacksByBusinessAndVendor(dc: DataConnect, vars: ListClientFeedbacksByBusinessAndVendorVariables, options?: useDataConnectQueryOptions<ListClientFeedbacksByBusinessAndVendorData>): UseDataConnectQueryResult<ListClientFeedbacksByBusinessAndVendorData, ListClientFeedbacksByBusinessAndVendorVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListClientFeedbacksByBusinessAndVendor(vars: ListClientFeedbacksByBusinessAndVendorVariables, options?: useDataConnectQueryOptions<ListClientFeedbacksByBusinessAndVendorData>): UseDataConnectQueryResult<ListClientFeedbacksByBusinessAndVendorData, ListClientFeedbacksByBusinessAndVendorVariables>;
Variables
The listClientFeedbacksByBusinessAndVendor Query requires an argument of type ListClientFeedbacksByBusinessAndVendorVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListClientFeedbacksByBusinessAndVendorVariables {
businessId: UUIDString;
vendorId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listClientFeedbacksByBusinessAndVendor Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listClientFeedbacksByBusinessAndVendor Query is of type ListClientFeedbacksByBusinessAndVendorData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListClientFeedbacksByBusinessAndVendorData {
clientFeedbacks: ({
id: UUIDString;
businessId: UUIDString;
vendorId: UUIDString;
rating?: number | null;
comment?: string | null;
date?: TimestampString | null;
createdAt?: TimestampString | null;
business: {
id: UUIDString;
businessName: string;
} & Business_Key;
vendor: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & ClientFeedback_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listClientFeedbacksByBusinessAndVendor's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListClientFeedbacksByBusinessAndVendorVariables } from '@dataconnect/generated';
import { useListClientFeedbacksByBusinessAndVendor } from '@dataconnect/generated/react'
export default function ListClientFeedbacksByBusinessAndVendorComponent() {
// The `useListClientFeedbacksByBusinessAndVendor` Query hook requires an argument of type `ListClientFeedbacksByBusinessAndVendorVariables`:
const listClientFeedbacksByBusinessAndVendorVars: ListClientFeedbacksByBusinessAndVendorVariables = {
businessId: ...,
vendorId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListClientFeedbacksByBusinessAndVendor(listClientFeedbacksByBusinessAndVendorVars);
// Variables can be defined inline as well.
const query = useListClientFeedbacksByBusinessAndVendor({ businessId: ..., vendorId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListClientFeedbacksByBusinessAndVendor(dataConnect, listClientFeedbacksByBusinessAndVendorVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListClientFeedbacksByBusinessAndVendor(listClientFeedbacksByBusinessAndVendorVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListClientFeedbacksByBusinessAndVendor(dataConnect, listClientFeedbacksByBusinessAndVendorVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.clientFeedbacks);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterClientFeedbacks
You can execute the filterClientFeedbacks Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterClientFeedbacks(dc: DataConnect, vars?: FilterClientFeedbacksVariables, options?: useDataConnectQueryOptions<FilterClientFeedbacksData>): UseDataConnectQueryResult<FilterClientFeedbacksData, FilterClientFeedbacksVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterClientFeedbacks(vars?: FilterClientFeedbacksVariables, options?: useDataConnectQueryOptions<FilterClientFeedbacksData>): UseDataConnectQueryResult<FilterClientFeedbacksData, FilterClientFeedbacksVariables>;
Variables
The filterClientFeedbacks Query has an optional argument of type FilterClientFeedbacksVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterClientFeedbacksVariables {
businessId?: UUIDString | null;
vendorId?: UUIDString | null;
ratingMin?: number | null;
ratingMax?: number | null;
dateFrom?: TimestampString | null;
dateTo?: TimestampString | null;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the filterClientFeedbacks Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the filterClientFeedbacks Query is of type FilterClientFeedbacksData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterClientFeedbacksData {
clientFeedbacks: ({
id: UUIDString;
businessId: UUIDString;
vendorId: UUIDString;
rating?: number | null;
comment?: string | null;
date?: TimestampString | null;
business: {
id: UUIDString;
businessName: string;
} & Business_Key;
vendor: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & ClientFeedback_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterClientFeedbacks's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterClientFeedbacksVariables } from '@dataconnect/generated';
import { useFilterClientFeedbacks } from '@dataconnect/generated/react'
export default function FilterClientFeedbacksComponent() {
// The `useFilterClientFeedbacks` Query hook has an optional argument of type `FilterClientFeedbacksVariables`:
const filterClientFeedbacksVars: FilterClientFeedbacksVariables = {
businessId: ..., // optional
vendorId: ..., // optional
ratingMin: ..., // optional
ratingMax: ..., // optional
dateFrom: ..., // optional
dateTo: ..., // optional
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useFilterClientFeedbacks(filterClientFeedbacksVars);
// Variables can be defined inline as well.
const query = useFilterClientFeedbacks({ businessId: ..., vendorId: ..., ratingMin: ..., ratingMax: ..., dateFrom: ..., dateTo: ..., offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `FilterClientFeedbacksVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterClientFeedbacks();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterClientFeedbacks(dataConnect, filterClientFeedbacksVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterClientFeedbacks(filterClientFeedbacksVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useFilterClientFeedbacks(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useFilterClientFeedbacks(dataConnect, filterClientFeedbacksVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.clientFeedbacks);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listClientFeedbackRatingsByVendorId
You can execute the listClientFeedbackRatingsByVendorId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListClientFeedbackRatingsByVendorId(dc: DataConnect, vars: ListClientFeedbackRatingsByVendorIdVariables, options?: useDataConnectQueryOptions<ListClientFeedbackRatingsByVendorIdData>): UseDataConnectQueryResult<ListClientFeedbackRatingsByVendorIdData, ListClientFeedbackRatingsByVendorIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListClientFeedbackRatingsByVendorId(vars: ListClientFeedbackRatingsByVendorIdVariables, options?: useDataConnectQueryOptions<ListClientFeedbackRatingsByVendorIdData>): UseDataConnectQueryResult<ListClientFeedbackRatingsByVendorIdData, ListClientFeedbackRatingsByVendorIdVariables>;
Variables
The listClientFeedbackRatingsByVendorId Query requires an argument of type ListClientFeedbackRatingsByVendorIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListClientFeedbackRatingsByVendorIdVariables {
vendorId: UUIDString;
dateFrom?: TimestampString | null;
dateTo?: TimestampString | null;
}
Return Type
Recall that calling the listClientFeedbackRatingsByVendorId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listClientFeedbackRatingsByVendorId Query is of type ListClientFeedbackRatingsByVendorIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListClientFeedbackRatingsByVendorIdData {
clientFeedbacks: ({
id: UUIDString;
rating?: number | null;
comment?: string | null;
date?: TimestampString | null;
business: {
id: UUIDString;
businessName: string;
} & Business_Key;
vendor: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & ClientFeedback_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listClientFeedbackRatingsByVendorId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListClientFeedbackRatingsByVendorIdVariables } from '@dataconnect/generated';
import { useListClientFeedbackRatingsByVendorId } from '@dataconnect/generated/react'
export default function ListClientFeedbackRatingsByVendorIdComponent() {
// The `useListClientFeedbackRatingsByVendorId` Query hook requires an argument of type `ListClientFeedbackRatingsByVendorIdVariables`:
const listClientFeedbackRatingsByVendorIdVars: ListClientFeedbackRatingsByVendorIdVariables = {
vendorId: ...,
dateFrom: ..., // optional
dateTo: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListClientFeedbackRatingsByVendorId(listClientFeedbackRatingsByVendorIdVars);
// Variables can be defined inline as well.
const query = useListClientFeedbackRatingsByVendorId({ vendorId: ..., dateFrom: ..., dateTo: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListClientFeedbackRatingsByVendorId(dataConnect, listClientFeedbackRatingsByVendorIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListClientFeedbackRatingsByVendorId(listClientFeedbackRatingsByVendorIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListClientFeedbackRatingsByVendorId(dataConnect, listClientFeedbackRatingsByVendorIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.clientFeedbacks);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listUsers
You can execute the listUsers Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListUsers(dc: DataConnect, options?: useDataConnectQueryOptions<ListUsersData>): UseDataConnectQueryResult<ListUsersData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListUsers(options?: useDataConnectQueryOptions<ListUsersData>): UseDataConnectQueryResult<ListUsersData, undefined>;
Variables
The listUsers Query has no variables.
Return Type
Recall that calling the listUsers Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listUsers Query is of type ListUsersData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListUsersData {
users: ({
id: string;
email?: string | null;
fullName?: string | null;
role: UserBaseRole;
userRole?: string | null;
photoUrl?: string | null;
createdDate?: TimestampString | null;
updatedDate?: TimestampString | null;
} & User_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listUsers's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListUsers } from '@dataconnect/generated/react'
export default function ListUsersComponent() {
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListUsers();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListUsers(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListUsers(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListUsers(dataConnect, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.users);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getUserById
You can execute the getUserById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetUserById(dc: DataConnect, vars: GetUserByIdVariables, options?: useDataConnectQueryOptions<GetUserByIdData>): UseDataConnectQueryResult<GetUserByIdData, GetUserByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetUserById(vars: GetUserByIdVariables, options?: useDataConnectQueryOptions<GetUserByIdData>): UseDataConnectQueryResult<GetUserByIdData, GetUserByIdVariables>;
Variables
The getUserById Query requires an argument of type GetUserByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetUserByIdVariables {
id: string;
}
Return Type
Recall that calling the getUserById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getUserById Query is of type GetUserByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetUserByIdData {
user?: {
id: string;
email?: string | null;
fullName?: string | null;
role: UserBaseRole;
userRole?: string | null;
photoUrl?: string | null;
} & User_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getUserById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetUserByIdVariables } from '@dataconnect/generated';
import { useGetUserById } from '@dataconnect/generated/react'
export default function GetUserByIdComponent() {
// The `useGetUserById` Query hook requires an argument of type `GetUserByIdVariables`:
const getUserByIdVars: GetUserByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetUserById(getUserByIdVars);
// Variables can be defined inline as well.
const query = useGetUserById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetUserById(dataConnect, getUserByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetUserById(getUserByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetUserById(dataConnect, getUserByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.user);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterUsers
You can execute the filterUsers Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterUsers(dc: DataConnect, vars?: FilterUsersVariables, options?: useDataConnectQueryOptions<FilterUsersData>): UseDataConnectQueryResult<FilterUsersData, FilterUsersVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterUsers(vars?: FilterUsersVariables, options?: useDataConnectQueryOptions<FilterUsersData>): UseDataConnectQueryResult<FilterUsersData, FilterUsersVariables>;
Variables
The filterUsers Query has an optional argument of type FilterUsersVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterUsersVariables {
id?: string | null;
email?: string | null;
role?: UserBaseRole | null;
userRole?: string | null;
}
Return Type
Recall that calling the filterUsers Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the filterUsers Query is of type FilterUsersData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterUsersData {
users: ({
id: string;
email?: string | null;
fullName?: string | null;
role: UserBaseRole;
userRole?: string | null;
photoUrl?: string | null;
} & User_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterUsers's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterUsersVariables } from '@dataconnect/generated';
import { useFilterUsers } from '@dataconnect/generated/react'
export default function FilterUsersComponent() {
// The `useFilterUsers` Query hook has an optional argument of type `FilterUsersVariables`:
const filterUsersVars: FilterUsersVariables = {
id: ..., // optional
email: ..., // optional
role: ..., // optional
userRole: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useFilterUsers(filterUsersVars);
// Variables can be defined inline as well.
const query = useFilterUsers({ id: ..., email: ..., role: ..., userRole: ..., });
// Since all variables are optional for this Query, you can omit the `FilterUsersVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterUsers();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterUsers(dataConnect, filterUsersVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterUsers(filterUsersVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useFilterUsers(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useFilterUsers(dataConnect, filterUsersVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.users);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getVendorById
You can execute the getVendorById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetVendorById(dc: DataConnect, vars: GetVendorByIdVariables, options?: useDataConnectQueryOptions<GetVendorByIdData>): UseDataConnectQueryResult<GetVendorByIdData, GetVendorByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetVendorById(vars: GetVendorByIdVariables, options?: useDataConnectQueryOptions<GetVendorByIdData>): UseDataConnectQueryResult<GetVendorByIdData, GetVendorByIdVariables>;
Variables
The getVendorById Query requires an argument of type GetVendorByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetVendorByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getVendorById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getVendorById Query is of type GetVendorByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetVendorByIdData {
vendor?: {
id: UUIDString;
userId: string;
companyName: string;
email?: string | null;
phone?: string | null;
photoUrl?: string | null;
address?: string | null;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
street?: string | null;
country?: string | null;
zipCode?: string | null;
billingAddress?: string | null;
timezone?: string | null;
legalName?: string | null;
doingBusinessAs?: string | null;
region?: string | null;
state?: string | null;
city?: string | null;
serviceSpecialty?: string | null;
approvalStatus?: ApprovalStatus | null;
isActive?: boolean | null;
markup?: number | null;
fee?: number | null;
csat?: number | null;
tier?: VendorTier | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & Vendor_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getVendorById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetVendorByIdVariables } from '@dataconnect/generated';
import { useGetVendorById } from '@dataconnect/generated/react'
export default function GetVendorByIdComponent() {
// The `useGetVendorById` Query hook requires an argument of type `GetVendorByIdVariables`:
const getVendorByIdVars: GetVendorByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetVendorById(getVendorByIdVars);
// Variables can be defined inline as well.
const query = useGetVendorById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetVendorById(dataConnect, getVendorByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetVendorById(getVendorByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetVendorById(dataConnect, getVendorByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.vendor);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getVendorByUserId
You can execute the getVendorByUserId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetVendorByUserId(dc: DataConnect, vars: GetVendorByUserIdVariables, options?: useDataConnectQueryOptions<GetVendorByUserIdData>): UseDataConnectQueryResult<GetVendorByUserIdData, GetVendorByUserIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetVendorByUserId(vars: GetVendorByUserIdVariables, options?: useDataConnectQueryOptions<GetVendorByUserIdData>): UseDataConnectQueryResult<GetVendorByUserIdData, GetVendorByUserIdVariables>;
Variables
The getVendorByUserId Query requires an argument of type GetVendorByUserIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetVendorByUserIdVariables {
userId: string;
}
Return Type
Recall that calling the getVendorByUserId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getVendorByUserId Query is of type GetVendorByUserIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetVendorByUserIdData {
vendors: ({
id: UUIDString;
userId: string;
companyName: string;
email?: string | null;
phone?: string | null;
photoUrl?: string | null;
address?: string | null;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
street?: string | null;
country?: string | null;
zipCode?: string | null;
billingAddress?: string | null;
timezone?: string | null;
legalName?: string | null;
doingBusinessAs?: string | null;
region?: string | null;
state?: string | null;
city?: string | null;
serviceSpecialty?: string | null;
approvalStatus?: ApprovalStatus | null;
isActive?: boolean | null;
markup?: number | null;
fee?: number | null;
csat?: number | null;
tier?: VendorTier | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & Vendor_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getVendorByUserId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetVendorByUserIdVariables } from '@dataconnect/generated';
import { useGetVendorByUserId } from '@dataconnect/generated/react'
export default function GetVendorByUserIdComponent() {
// The `useGetVendorByUserId` Query hook requires an argument of type `GetVendorByUserIdVariables`:
const getVendorByUserIdVars: GetVendorByUserIdVariables = {
userId: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetVendorByUserId(getVendorByUserIdVars);
// Variables can be defined inline as well.
const query = useGetVendorByUserId({ userId: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetVendorByUserId(dataConnect, getVendorByUserIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetVendorByUserId(getVendorByUserIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetVendorByUserId(dataConnect, getVendorByUserIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.vendors);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listVendors
You can execute the listVendors Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListVendors(dc: DataConnect, options?: useDataConnectQueryOptions<ListVendorsData>): UseDataConnectQueryResult<ListVendorsData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListVendors(options?: useDataConnectQueryOptions<ListVendorsData>): UseDataConnectQueryResult<ListVendorsData, undefined>;
Variables
The listVendors Query has no variables.
Return Type
Recall that calling the listVendors Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listVendors Query is of type ListVendorsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListVendorsData {
vendors: ({
id: UUIDString;
userId: string;
companyName: string;
email?: string | null;
phone?: string | null;
photoUrl?: string | null;
address?: string | null;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
street?: string | null;
country?: string | null;
zipCode?: string | null;
billingAddress?: string | null;
timezone?: string | null;
legalName?: string | null;
doingBusinessAs?: string | null;
region?: string | null;
state?: string | null;
city?: string | null;
serviceSpecialty?: string | null;
approvalStatus?: ApprovalStatus | null;
isActive?: boolean | null;
markup?: number | null;
fee?: number | null;
csat?: number | null;
tier?: VendorTier | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & Vendor_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listVendors's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListVendors } from '@dataconnect/generated/react'
export default function ListVendorsComponent() {
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListVendors();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListVendors(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListVendors(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListVendors(dataConnect, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.vendors);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listCategories
You can execute the listCategories Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListCategories(dc: DataConnect, options?: useDataConnectQueryOptions<ListCategoriesData>): UseDataConnectQueryResult<ListCategoriesData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListCategories(options?: useDataConnectQueryOptions<ListCategoriesData>): UseDataConnectQueryResult<ListCategoriesData, undefined>;
Variables
The listCategories Query has no variables.
Return Type
Recall that calling the listCategories Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listCategories Query is of type ListCategoriesData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListCategoriesData {
categories: ({
id: UUIDString;
categoryId: string;
label: string;
icon?: string | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & Category_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listCategories's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListCategories } from '@dataconnect/generated/react'
export default function ListCategoriesComponent() {
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListCategories();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListCategories(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListCategories(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListCategories(dataConnect, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.categories);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getCategoryById
You can execute the getCategoryById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetCategoryById(dc: DataConnect, vars: GetCategoryByIdVariables, options?: useDataConnectQueryOptions<GetCategoryByIdData>): UseDataConnectQueryResult<GetCategoryByIdData, GetCategoryByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetCategoryById(vars: GetCategoryByIdVariables, options?: useDataConnectQueryOptions<GetCategoryByIdData>): UseDataConnectQueryResult<GetCategoryByIdData, GetCategoryByIdVariables>;
Variables
The getCategoryById Query requires an argument of type GetCategoryByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetCategoryByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getCategoryById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getCategoryById Query is of type GetCategoryByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetCategoryByIdData {
category?: {
id: UUIDString;
categoryId: string;
label: string;
icon?: string | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & Category_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getCategoryById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetCategoryByIdVariables } from '@dataconnect/generated';
import { useGetCategoryById } from '@dataconnect/generated/react'
export default function GetCategoryByIdComponent() {
// The `useGetCategoryById` Query hook requires an argument of type `GetCategoryByIdVariables`:
const getCategoryByIdVars: GetCategoryByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetCategoryById(getCategoryByIdVars);
// Variables can be defined inline as well.
const query = useGetCategoryById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetCategoryById(dataConnect, getCategoryByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetCategoryById(getCategoryByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetCategoryById(dataConnect, getCategoryByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.category);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterCategories
You can execute the filterCategories Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterCategories(dc: DataConnect, vars?: FilterCategoriesVariables, options?: useDataConnectQueryOptions<FilterCategoriesData>): UseDataConnectQueryResult<FilterCategoriesData, FilterCategoriesVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterCategories(vars?: FilterCategoriesVariables, options?: useDataConnectQueryOptions<FilterCategoriesData>): UseDataConnectQueryResult<FilterCategoriesData, FilterCategoriesVariables>;
Variables
The filterCategories Query has an optional argument of type FilterCategoriesVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterCategoriesVariables {
categoryId?: string | null;
label?: string | null;
}
Return Type
Recall that calling the filterCategories Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the filterCategories Query is of type FilterCategoriesData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterCategoriesData {
categories: ({
id: UUIDString;
categoryId: string;
label: string;
icon?: string | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & Category_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterCategories's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterCategoriesVariables } from '@dataconnect/generated';
import { useFilterCategories } from '@dataconnect/generated/react'
export default function FilterCategoriesComponent() {
// The `useFilterCategories` Query hook has an optional argument of type `FilterCategoriesVariables`:
const filterCategoriesVars: FilterCategoriesVariables = {
categoryId: ..., // optional
label: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useFilterCategories(filterCategoriesVars);
// Variables can be defined inline as well.
const query = useFilterCategories({ categoryId: ..., label: ..., });
// Since all variables are optional for this Query, you can omit the `FilterCategoriesVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterCategories();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterCategories(dataConnect, filterCategoriesVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterCategories(filterCategoriesVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useFilterCategories(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useFilterCategories(dataConnect, filterCategoriesVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.categories);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listMessages
You can execute the listMessages Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListMessages(dc: DataConnect, options?: useDataConnectQueryOptions<ListMessagesData>): UseDataConnectQueryResult<ListMessagesData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListMessages(options?: useDataConnectQueryOptions<ListMessagesData>): UseDataConnectQueryResult<ListMessagesData, undefined>;
Variables
The listMessages Query has no variables.
Return Type
Recall that calling the listMessages Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listMessages Query is of type ListMessagesData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListMessagesData {
messages: ({
id: UUIDString;
conversationId: UUIDString;
senderId: string;
content: string;
isSystem?: boolean | null;
createdAt?: TimestampString | null;
user: {
fullName?: string | null;
};
} & Message_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listMessages's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListMessages } from '@dataconnect/generated/react'
export default function ListMessagesComponent() {
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListMessages();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListMessages(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListMessages(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListMessages(dataConnect, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.messages);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getMessageById
You can execute the getMessageById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetMessageById(dc: DataConnect, vars: GetMessageByIdVariables, options?: useDataConnectQueryOptions<GetMessageByIdData>): UseDataConnectQueryResult<GetMessageByIdData, GetMessageByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetMessageById(vars: GetMessageByIdVariables, options?: useDataConnectQueryOptions<GetMessageByIdData>): UseDataConnectQueryResult<GetMessageByIdData, GetMessageByIdVariables>;
Variables
The getMessageById Query requires an argument of type GetMessageByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetMessageByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getMessageById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getMessageById Query is of type GetMessageByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetMessageByIdData {
message?: {
id: UUIDString;
conversationId: UUIDString;
senderId: string;
content: string;
isSystem?: boolean | null;
createdAt?: TimestampString | null;
user: {
fullName?: string | null;
};
} & Message_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getMessageById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetMessageByIdVariables } from '@dataconnect/generated';
import { useGetMessageById } from '@dataconnect/generated/react'
export default function GetMessageByIdComponent() {
// The `useGetMessageById` Query hook requires an argument of type `GetMessageByIdVariables`:
const getMessageByIdVars: GetMessageByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetMessageById(getMessageByIdVars);
// Variables can be defined inline as well.
const query = useGetMessageById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetMessageById(dataConnect, getMessageByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetMessageById(getMessageByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetMessageById(dataConnect, getMessageByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.message);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getMessagesByConversationId
You can execute the getMessagesByConversationId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetMessagesByConversationId(dc: DataConnect, vars: GetMessagesByConversationIdVariables, options?: useDataConnectQueryOptions<GetMessagesByConversationIdData>): UseDataConnectQueryResult<GetMessagesByConversationIdData, GetMessagesByConversationIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetMessagesByConversationId(vars: GetMessagesByConversationIdVariables, options?: useDataConnectQueryOptions<GetMessagesByConversationIdData>): UseDataConnectQueryResult<GetMessagesByConversationIdData, GetMessagesByConversationIdVariables>;
Variables
The getMessagesByConversationId Query requires an argument of type GetMessagesByConversationIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetMessagesByConversationIdVariables {
conversationId: UUIDString;
}
Return Type
Recall that calling the getMessagesByConversationId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getMessagesByConversationId Query is of type GetMessagesByConversationIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetMessagesByConversationIdData {
messages: ({
id: UUIDString;
conversationId: UUIDString;
senderId: string;
content: string;
isSystem?: boolean | null;
createdAt?: TimestampString | null;
user: {
fullName?: string | null;
};
} & Message_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getMessagesByConversationId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetMessagesByConversationIdVariables } from '@dataconnect/generated';
import { useGetMessagesByConversationId } from '@dataconnect/generated/react'
export default function GetMessagesByConversationIdComponent() {
// The `useGetMessagesByConversationId` Query hook requires an argument of type `GetMessagesByConversationIdVariables`:
const getMessagesByConversationIdVars: GetMessagesByConversationIdVariables = {
conversationId: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetMessagesByConversationId(getMessagesByConversationIdVars);
// Variables can be defined inline as well.
const query = useGetMessagesByConversationId({ conversationId: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetMessagesByConversationId(dataConnect, getMessagesByConversationIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetMessagesByConversationId(getMessagesByConversationIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetMessagesByConversationId(dataConnect, getMessagesByConversationIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.messages);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listUserConversations
You can execute the listUserConversations Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListUserConversations(dc: DataConnect, vars?: ListUserConversationsVariables, options?: useDataConnectQueryOptions<ListUserConversationsData>): UseDataConnectQueryResult<ListUserConversationsData, ListUserConversationsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListUserConversations(vars?: ListUserConversationsVariables, options?: useDataConnectQueryOptions<ListUserConversationsData>): UseDataConnectQueryResult<ListUserConversationsData, ListUserConversationsVariables>;
Variables
The listUserConversations Query has an optional argument of type ListUserConversationsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListUserConversationsVariables {
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listUserConversations Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listUserConversations Query is of type ListUserConversationsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListUserConversationsData {
userConversations: ({
id: UUIDString;
conversationId: UUIDString;
userId: string;
unreadCount?: number | null;
lastReadAt?: TimestampString | null;
createdAt?: TimestampString | null;
conversation: {
id: UUIDString;
subject?: string | null;
status?: ConversationStatus | null;
conversationType?: ConversationType | null;
isGroup?: boolean | null;
groupName?: string | null;
lastMessage?: string | null;
lastMessageAt?: TimestampString | null;
createdAt?: TimestampString | null;
} & Conversation_Key;
user: {
id: string;
fullName?: string | null;
photoUrl?: string | null;
} & User_Key;
} & UserConversation_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listUserConversations's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListUserConversationsVariables } from '@dataconnect/generated';
import { useListUserConversations } from '@dataconnect/generated/react'
export default function ListUserConversationsComponent() {
// The `useListUserConversations` Query hook has an optional argument of type `ListUserConversationsVariables`:
const listUserConversationsVars: ListUserConversationsVariables = {
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListUserConversations(listUserConversationsVars);
// Variables can be defined inline as well.
const query = useListUserConversations({ offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `ListUserConversationsVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useListUserConversations();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListUserConversations(dataConnect, listUserConversationsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListUserConversations(listUserConversationsVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useListUserConversations(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListUserConversations(dataConnect, listUserConversationsVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.userConversations);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getUserConversationByKey
You can execute the getUserConversationByKey Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetUserConversationByKey(dc: DataConnect, vars: GetUserConversationByKeyVariables, options?: useDataConnectQueryOptions<GetUserConversationByKeyData>): UseDataConnectQueryResult<GetUserConversationByKeyData, GetUserConversationByKeyVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetUserConversationByKey(vars: GetUserConversationByKeyVariables, options?: useDataConnectQueryOptions<GetUserConversationByKeyData>): UseDataConnectQueryResult<GetUserConversationByKeyData, GetUserConversationByKeyVariables>;
Variables
The getUserConversationByKey Query requires an argument of type GetUserConversationByKeyVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetUserConversationByKeyVariables {
conversationId: UUIDString;
userId: string;
}
Return Type
Recall that calling the getUserConversationByKey Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getUserConversationByKey Query is of type GetUserConversationByKeyData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetUserConversationByKeyData {
userConversation?: {
id: UUIDString;
conversationId: UUIDString;
userId: string;
unreadCount?: number | null;
lastReadAt?: TimestampString | null;
createdAt?: TimestampString | null;
conversation: {
id: UUIDString;
subject?: string | null;
status?: ConversationStatus | null;
conversationType?: ConversationType | null;
isGroup?: boolean | null;
groupName?: string | null;
lastMessage?: string | null;
lastMessageAt?: TimestampString | null;
createdAt?: TimestampString | null;
} & Conversation_Key;
user: {
id: string;
fullName?: string | null;
photoUrl?: string | null;
} & User_Key;
} & UserConversation_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getUserConversationByKey's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetUserConversationByKeyVariables } from '@dataconnect/generated';
import { useGetUserConversationByKey } from '@dataconnect/generated/react'
export default function GetUserConversationByKeyComponent() {
// The `useGetUserConversationByKey` Query hook requires an argument of type `GetUserConversationByKeyVariables`:
const getUserConversationByKeyVars: GetUserConversationByKeyVariables = {
conversationId: ...,
userId: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetUserConversationByKey(getUserConversationByKeyVars);
// Variables can be defined inline as well.
const query = useGetUserConversationByKey({ conversationId: ..., userId: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetUserConversationByKey(dataConnect, getUserConversationByKeyVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetUserConversationByKey(getUserConversationByKeyVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetUserConversationByKey(dataConnect, getUserConversationByKeyVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.userConversation);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listUserConversationsByUserId
You can execute the listUserConversationsByUserId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListUserConversationsByUserId(dc: DataConnect, vars: ListUserConversationsByUserIdVariables, options?: useDataConnectQueryOptions<ListUserConversationsByUserIdData>): UseDataConnectQueryResult<ListUserConversationsByUserIdData, ListUserConversationsByUserIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListUserConversationsByUserId(vars: ListUserConversationsByUserIdVariables, options?: useDataConnectQueryOptions<ListUserConversationsByUserIdData>): UseDataConnectQueryResult<ListUserConversationsByUserIdData, ListUserConversationsByUserIdVariables>;
Variables
The listUserConversationsByUserId Query requires an argument of type ListUserConversationsByUserIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListUserConversationsByUserIdVariables {
userId: string;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listUserConversationsByUserId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listUserConversationsByUserId Query is of type ListUserConversationsByUserIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListUserConversationsByUserIdData {
userConversations: ({
id: UUIDString;
conversationId: UUIDString;
userId: string;
unreadCount?: number | null;
lastReadAt?: TimestampString | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
conversation: {
id: UUIDString;
subject?: string | null;
status?: ConversationStatus | null;
conversationType?: ConversationType | null;
isGroup?: boolean | null;
groupName?: string | null;
lastMessage?: string | null;
lastMessageAt?: TimestampString | null;
createdAt?: TimestampString | null;
} & Conversation_Key;
user: {
id: string;
fullName?: string | null;
photoUrl?: string | null;
} & User_Key;
} & UserConversation_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listUserConversationsByUserId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListUserConversationsByUserIdVariables } from '@dataconnect/generated';
import { useListUserConversationsByUserId } from '@dataconnect/generated/react'
export default function ListUserConversationsByUserIdComponent() {
// The `useListUserConversationsByUserId` Query hook requires an argument of type `ListUserConversationsByUserIdVariables`:
const listUserConversationsByUserIdVars: ListUserConversationsByUserIdVariables = {
userId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListUserConversationsByUserId(listUserConversationsByUserIdVars);
// Variables can be defined inline as well.
const query = useListUserConversationsByUserId({ userId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListUserConversationsByUserId(dataConnect, listUserConversationsByUserIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListUserConversationsByUserId(listUserConversationsByUserIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListUserConversationsByUserId(dataConnect, listUserConversationsByUserIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.userConversations);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listUnreadUserConversationsByUserId
You can execute the listUnreadUserConversationsByUserId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListUnreadUserConversationsByUserId(dc: DataConnect, vars: ListUnreadUserConversationsByUserIdVariables, options?: useDataConnectQueryOptions<ListUnreadUserConversationsByUserIdData>): UseDataConnectQueryResult<ListUnreadUserConversationsByUserIdData, ListUnreadUserConversationsByUserIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListUnreadUserConversationsByUserId(vars: ListUnreadUserConversationsByUserIdVariables, options?: useDataConnectQueryOptions<ListUnreadUserConversationsByUserIdData>): UseDataConnectQueryResult<ListUnreadUserConversationsByUserIdData, ListUnreadUserConversationsByUserIdVariables>;
Variables
The listUnreadUserConversationsByUserId Query requires an argument of type ListUnreadUserConversationsByUserIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListUnreadUserConversationsByUserIdVariables {
userId: string;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listUnreadUserConversationsByUserId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listUnreadUserConversationsByUserId Query is of type ListUnreadUserConversationsByUserIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListUnreadUserConversationsByUserIdData {
userConversations: ({
id: UUIDString;
conversationId: UUIDString;
userId: string;
unreadCount?: number | null;
lastReadAt?: TimestampString | null;
createdAt?: TimestampString | null;
conversation: {
id: UUIDString;
subject?: string | null;
status?: ConversationStatus | null;
conversationType?: ConversationType | null;
isGroup?: boolean | null;
groupName?: string | null;
lastMessage?: string | null;
lastMessageAt?: TimestampString | null;
} & Conversation_Key;
} & UserConversation_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listUnreadUserConversationsByUserId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListUnreadUserConversationsByUserIdVariables } from '@dataconnect/generated';
import { useListUnreadUserConversationsByUserId } from '@dataconnect/generated/react'
export default function ListUnreadUserConversationsByUserIdComponent() {
// The `useListUnreadUserConversationsByUserId` Query hook requires an argument of type `ListUnreadUserConversationsByUserIdVariables`:
const listUnreadUserConversationsByUserIdVars: ListUnreadUserConversationsByUserIdVariables = {
userId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListUnreadUserConversationsByUserId(listUnreadUserConversationsByUserIdVars);
// Variables can be defined inline as well.
const query = useListUnreadUserConversationsByUserId({ userId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListUnreadUserConversationsByUserId(dataConnect, listUnreadUserConversationsByUserIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListUnreadUserConversationsByUserId(listUnreadUserConversationsByUserIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListUnreadUserConversationsByUserId(dataConnect, listUnreadUserConversationsByUserIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.userConversations);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listUserConversationsByConversationId
You can execute the listUserConversationsByConversationId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListUserConversationsByConversationId(dc: DataConnect, vars: ListUserConversationsByConversationIdVariables, options?: useDataConnectQueryOptions<ListUserConversationsByConversationIdData>): UseDataConnectQueryResult<ListUserConversationsByConversationIdData, ListUserConversationsByConversationIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListUserConversationsByConversationId(vars: ListUserConversationsByConversationIdVariables, options?: useDataConnectQueryOptions<ListUserConversationsByConversationIdData>): UseDataConnectQueryResult<ListUserConversationsByConversationIdData, ListUserConversationsByConversationIdVariables>;
Variables
The listUserConversationsByConversationId Query requires an argument of type ListUserConversationsByConversationIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListUserConversationsByConversationIdVariables {
conversationId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listUserConversationsByConversationId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listUserConversationsByConversationId Query is of type ListUserConversationsByConversationIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListUserConversationsByConversationIdData {
userConversations: ({
id: UUIDString;
conversationId: UUIDString;
userId: string;
unreadCount?: number | null;
lastReadAt?: TimestampString | null;
createdAt?: TimestampString | null;
user: {
id: string;
fullName?: string | null;
photoUrl?: string | null;
} & User_Key;
} & UserConversation_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listUserConversationsByConversationId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListUserConversationsByConversationIdVariables } from '@dataconnect/generated';
import { useListUserConversationsByConversationId } from '@dataconnect/generated/react'
export default function ListUserConversationsByConversationIdComponent() {
// The `useListUserConversationsByConversationId` Query hook requires an argument of type `ListUserConversationsByConversationIdVariables`:
const listUserConversationsByConversationIdVars: ListUserConversationsByConversationIdVariables = {
conversationId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListUserConversationsByConversationId(listUserConversationsByConversationIdVars);
// Variables can be defined inline as well.
const query = useListUserConversationsByConversationId({ conversationId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListUserConversationsByConversationId(dataConnect, listUserConversationsByConversationIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListUserConversationsByConversationId(listUserConversationsByConversationIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListUserConversationsByConversationId(dataConnect, listUserConversationsByConversationIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.userConversations);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterUserConversations
You can execute the filterUserConversations Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterUserConversations(dc: DataConnect, vars?: FilterUserConversationsVariables, options?: useDataConnectQueryOptions<FilterUserConversationsData>): UseDataConnectQueryResult<FilterUserConversationsData, FilterUserConversationsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterUserConversations(vars?: FilterUserConversationsVariables, options?: useDataConnectQueryOptions<FilterUserConversationsData>): UseDataConnectQueryResult<FilterUserConversationsData, FilterUserConversationsVariables>;
Variables
The filterUserConversations Query has an optional argument of type FilterUserConversationsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterUserConversationsVariables {
userId?: string | null;
conversationId?: UUIDString | null;
unreadMin?: number | null;
unreadMax?: number | null;
lastReadAfter?: TimestampString | null;
lastReadBefore?: TimestampString | null;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the filterUserConversations Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the filterUserConversations Query is of type FilterUserConversationsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterUserConversationsData {
userConversations: ({
id: UUIDString;
conversationId: UUIDString;
userId: string;
unreadCount?: number | null;
lastReadAt?: TimestampString | null;
createdAt?: TimestampString | null;
conversation: {
id: UUIDString;
subject?: string | null;
status?: ConversationStatus | null;
conversationType?: ConversationType | null;
isGroup?: boolean | null;
groupName?: string | null;
lastMessage?: string | null;
lastMessageAt?: TimestampString | null;
createdAt?: TimestampString | null;
} & Conversation_Key;
user: {
id: string;
fullName?: string | null;
photoUrl?: string | null;
} & User_Key;
} & UserConversation_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterUserConversations's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterUserConversationsVariables } from '@dataconnect/generated';
import { useFilterUserConversations } from '@dataconnect/generated/react'
export default function FilterUserConversationsComponent() {
// The `useFilterUserConversations` Query hook has an optional argument of type `FilterUserConversationsVariables`:
const filterUserConversationsVars: FilterUserConversationsVariables = {
userId: ..., // optional
conversationId: ..., // optional
unreadMin: ..., // optional
unreadMax: ..., // optional
lastReadAfter: ..., // optional
lastReadBefore: ..., // optional
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useFilterUserConversations(filterUserConversationsVars);
// Variables can be defined inline as well.
const query = useFilterUserConversations({ userId: ..., conversationId: ..., unreadMin: ..., unreadMax: ..., lastReadAfter: ..., lastReadBefore: ..., offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `FilterUserConversationsVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterUserConversations();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterUserConversations(dataConnect, filterUserConversationsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterUserConversations(filterUserConversationsVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useFilterUserConversations(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useFilterUserConversations(dataConnect, filterUserConversationsVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.userConversations);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listHubs
You can execute the listHubs Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListHubs(dc: DataConnect, options?: useDataConnectQueryOptions<ListHubsData>): UseDataConnectQueryResult<ListHubsData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListHubs(options?: useDataConnectQueryOptions<ListHubsData>): UseDataConnectQueryResult<ListHubsData, undefined>;
Variables
The listHubs Query has no variables.
Return Type
Recall that calling the listHubs Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listHubs Query is of type ListHubsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListHubsData {
hubs: ({
id: UUIDString;
name: string;
locationName?: string | null;
address?: string | null;
nfcTagId?: string | null;
ownerId: UUIDString;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & Hub_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listHubs's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListHubs } from '@dataconnect/generated/react'
export default function ListHubsComponent() {
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListHubs();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListHubs(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListHubs(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListHubs(dataConnect, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.hubs);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getHubById
You can execute the getHubById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetHubById(dc: DataConnect, vars: GetHubByIdVariables, options?: useDataConnectQueryOptions<GetHubByIdData>): UseDataConnectQueryResult<GetHubByIdData, GetHubByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetHubById(vars: GetHubByIdVariables, options?: useDataConnectQueryOptions<GetHubByIdData>): UseDataConnectQueryResult<GetHubByIdData, GetHubByIdVariables>;
Variables
The getHubById Query requires an argument of type GetHubByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetHubByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getHubById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getHubById Query is of type GetHubByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetHubByIdData {
hub?: {
id: UUIDString;
name: string;
locationName?: string | null;
address?: string | null;
nfcTagId?: string | null;
ownerId: UUIDString;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & Hub_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getHubById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetHubByIdVariables } from '@dataconnect/generated';
import { useGetHubById } from '@dataconnect/generated/react'
export default function GetHubByIdComponent() {
// The `useGetHubById` Query hook requires an argument of type `GetHubByIdVariables`:
const getHubByIdVars: GetHubByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetHubById(getHubByIdVars);
// Variables can be defined inline as well.
const query = useGetHubById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetHubById(dataConnect, getHubByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetHubById(getHubByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetHubById(dataConnect, getHubByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.hub);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getHubsByOwnerId
You can execute the getHubsByOwnerId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetHubsByOwnerId(dc: DataConnect, vars: GetHubsByOwnerIdVariables, options?: useDataConnectQueryOptions<GetHubsByOwnerIdData>): UseDataConnectQueryResult<GetHubsByOwnerIdData, GetHubsByOwnerIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetHubsByOwnerId(vars: GetHubsByOwnerIdVariables, options?: useDataConnectQueryOptions<GetHubsByOwnerIdData>): UseDataConnectQueryResult<GetHubsByOwnerIdData, GetHubsByOwnerIdVariables>;
Variables
The getHubsByOwnerId Query requires an argument of type GetHubsByOwnerIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetHubsByOwnerIdVariables {
ownerId: UUIDString;
}
Return Type
Recall that calling the getHubsByOwnerId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getHubsByOwnerId Query is of type GetHubsByOwnerIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetHubsByOwnerIdData {
hubs: ({
id: UUIDString;
name: string;
locationName?: string | null;
address?: string | null;
nfcTagId?: string | null;
ownerId: UUIDString;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & Hub_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getHubsByOwnerId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetHubsByOwnerIdVariables } from '@dataconnect/generated';
import { useGetHubsByOwnerId } from '@dataconnect/generated/react'
export default function GetHubsByOwnerIdComponent() {
// The `useGetHubsByOwnerId` Query hook requires an argument of type `GetHubsByOwnerIdVariables`:
const getHubsByOwnerIdVars: GetHubsByOwnerIdVariables = {
ownerId: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetHubsByOwnerId(getHubsByOwnerIdVars);
// Variables can be defined inline as well.
const query = useGetHubsByOwnerId({ ownerId: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetHubsByOwnerId(dataConnect, getHubsByOwnerIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetHubsByOwnerId(getHubsByOwnerIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetHubsByOwnerId(dataConnect, getHubsByOwnerIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.hubs);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterHubs
You can execute the filterHubs Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterHubs(dc: DataConnect, vars?: FilterHubsVariables, options?: useDataConnectQueryOptions<FilterHubsData>): UseDataConnectQueryResult<FilterHubsData, FilterHubsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterHubs(vars?: FilterHubsVariables, options?: useDataConnectQueryOptions<FilterHubsData>): UseDataConnectQueryResult<FilterHubsData, FilterHubsVariables>;
Variables
The filterHubs Query has an optional argument of type FilterHubsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterHubsVariables {
ownerId?: UUIDString | null;
name?: string | null;
nfcTagId?: string | null;
}
Return Type
Recall that calling the filterHubs Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the filterHubs Query is of type FilterHubsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterHubsData {
hubs: ({
id: UUIDString;
name: string;
locationName?: string | null;
address?: string | null;
nfcTagId?: string | null;
ownerId: UUIDString;
} & Hub_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterHubs's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterHubsVariables } from '@dataconnect/generated';
import { useFilterHubs } from '@dataconnect/generated/react'
export default function FilterHubsComponent() {
// The `useFilterHubs` Query hook has an optional argument of type `FilterHubsVariables`:
const filterHubsVars: FilterHubsVariables = {
ownerId: ..., // optional
name: ..., // optional
nfcTagId: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useFilterHubs(filterHubsVars);
// Variables can be defined inline as well.
const query = useFilterHubs({ ownerId: ..., name: ..., nfcTagId: ..., });
// Since all variables are optional for this Query, you can omit the `FilterHubsVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterHubs();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterHubs(dataConnect, filterHubsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterHubs(filterHubsVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useFilterHubs(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useFilterHubs(dataConnect, filterHubsVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.hubs);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listInvoices
You can execute the listInvoices Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListInvoices(dc: DataConnect, vars?: ListInvoicesVariables, options?: useDataConnectQueryOptions<ListInvoicesData>): UseDataConnectQueryResult<ListInvoicesData, ListInvoicesVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListInvoices(vars?: ListInvoicesVariables, options?: useDataConnectQueryOptions<ListInvoicesData>): UseDataConnectQueryResult<ListInvoicesData, ListInvoicesVariables>;
Variables
The listInvoices Query has an optional argument of type ListInvoicesVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoicesVariables {
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listInvoices Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listInvoices Query is of type ListInvoicesData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoicesData {
invoices: ({
id: UUIDString;
status: InvoiceStatus;
vendorId: UUIDString;
businessId: UUIDString;
orderId: UUIDString;
paymentTerms?: InovicePaymentTerms | null;
invoiceNumber: string;
issueDate: TimestampString;
dueDate: TimestampString;
hub?: string | null;
managerName?: string | null;
vendorNumber?: string | null;
roles?: unknown | null;
charges?: unknown | null;
otherCharges?: number | null;
subtotal?: number | null;
amount: number;
notes?: string | null;
staffCount?: number | null;
chargesCount?: number | null;
disputedItems?: unknown | null;
disputeReason?: string | null;
disputeDetails?: string | null;
vendor: {
companyName: string;
address?: string | null;
email?: string | null;
phone?: string | null;
};
business: {
businessName: string;
address?: string | null;
phone?: string | null;
email?: string | null;
};
order: {
eventName?: string | null;
deparment?: string | null;
poReference?: string | null;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
};
} & Invoice_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listInvoices's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListInvoicesVariables } from '@dataconnect/generated';
import { useListInvoices } from '@dataconnect/generated/react'
export default function ListInvoicesComponent() {
// The `useListInvoices` Query hook has an optional argument of type `ListInvoicesVariables`:
const listInvoicesVars: ListInvoicesVariables = {
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListInvoices(listInvoicesVars);
// Variables can be defined inline as well.
const query = useListInvoices({ offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `ListInvoicesVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useListInvoices();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListInvoices(dataConnect, listInvoicesVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListInvoices(listInvoicesVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useListInvoices(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListInvoices(dataConnect, listInvoicesVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.invoices);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getInvoiceById
You can execute the getInvoiceById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetInvoiceById(dc: DataConnect, vars: GetInvoiceByIdVariables, options?: useDataConnectQueryOptions<GetInvoiceByIdData>): UseDataConnectQueryResult<GetInvoiceByIdData, GetInvoiceByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetInvoiceById(vars: GetInvoiceByIdVariables, options?: useDataConnectQueryOptions<GetInvoiceByIdData>): UseDataConnectQueryResult<GetInvoiceByIdData, GetInvoiceByIdVariables>;
Variables
The getInvoiceById Query requires an argument of type GetInvoiceByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetInvoiceByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getInvoiceById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getInvoiceById Query is of type GetInvoiceByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetInvoiceByIdData {
invoice?: {
id: UUIDString;
status: InvoiceStatus;
vendorId: UUIDString;
businessId: UUIDString;
orderId: UUIDString;
paymentTerms?: InovicePaymentTerms | null;
invoiceNumber: string;
issueDate: TimestampString;
dueDate: TimestampString;
hub?: string | null;
managerName?: string | null;
vendorNumber?: string | null;
roles?: unknown | null;
charges?: unknown | null;
otherCharges?: number | null;
subtotal?: number | null;
amount: number;
notes?: string | null;
staffCount?: number | null;
chargesCount?: number | null;
disputedItems?: unknown | null;
disputeReason?: string | null;
disputeDetails?: string | null;
vendor: {
companyName: string;
address?: string | null;
email?: string | null;
phone?: string | null;
};
business: {
businessName: string;
address?: string | null;
phone?: string | null;
email?: string | null;
};
order: {
eventName?: string | null;
deparment?: string | null;
poReference?: string | null;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
};
} & Invoice_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getInvoiceById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetInvoiceByIdVariables } from '@dataconnect/generated';
import { useGetInvoiceById } from '@dataconnect/generated/react'
export default function GetInvoiceByIdComponent() {
// The `useGetInvoiceById` Query hook requires an argument of type `GetInvoiceByIdVariables`:
const getInvoiceByIdVars: GetInvoiceByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetInvoiceById(getInvoiceByIdVars);
// Variables can be defined inline as well.
const query = useGetInvoiceById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetInvoiceById(dataConnect, getInvoiceByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetInvoiceById(getInvoiceByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetInvoiceById(dataConnect, getInvoiceByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.invoice);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listInvoicesByVendorId
You can execute the listInvoicesByVendorId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListInvoicesByVendorId(dc: DataConnect, vars: ListInvoicesByVendorIdVariables, options?: useDataConnectQueryOptions<ListInvoicesByVendorIdData>): UseDataConnectQueryResult<ListInvoicesByVendorIdData, ListInvoicesByVendorIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListInvoicesByVendorId(vars: ListInvoicesByVendorIdVariables, options?: useDataConnectQueryOptions<ListInvoicesByVendorIdData>): UseDataConnectQueryResult<ListInvoicesByVendorIdData, ListInvoicesByVendorIdVariables>;
Variables
The listInvoicesByVendorId Query requires an argument of type ListInvoicesByVendorIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoicesByVendorIdVariables {
vendorId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listInvoicesByVendorId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listInvoicesByVendorId Query is of type ListInvoicesByVendorIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoicesByVendorIdData {
invoices: ({
id: UUIDString;
status: InvoiceStatus;
vendorId: UUIDString;
businessId: UUIDString;
orderId: UUIDString;
paymentTerms?: InovicePaymentTerms | null;
invoiceNumber: string;
issueDate: TimestampString;
dueDate: TimestampString;
hub?: string | null;
managerName?: string | null;
vendorNumber?: string | null;
roles?: unknown | null;
charges?: unknown | null;
otherCharges?: number | null;
subtotal?: number | null;
amount: number;
notes?: string | null;
staffCount?: number | null;
chargesCount?: number | null;
disputedItems?: unknown | null;
disputeReason?: string | null;
disputeDetails?: string | null;
vendor: {
companyName: string;
address?: string | null;
email?: string | null;
phone?: string | null;
};
business: {
businessName: string;
address?: string | null;
phone?: string | null;
email?: string | null;
};
order: {
eventName?: string | null;
deparment?: string | null;
poReference?: string | null;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
};
} & Invoice_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listInvoicesByVendorId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListInvoicesByVendorIdVariables } from '@dataconnect/generated';
import { useListInvoicesByVendorId } from '@dataconnect/generated/react'
export default function ListInvoicesByVendorIdComponent() {
// The `useListInvoicesByVendorId` Query hook requires an argument of type `ListInvoicesByVendorIdVariables`:
const listInvoicesByVendorIdVars: ListInvoicesByVendorIdVariables = {
vendorId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListInvoicesByVendorId(listInvoicesByVendorIdVars);
// Variables can be defined inline as well.
const query = useListInvoicesByVendorId({ vendorId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListInvoicesByVendorId(dataConnect, listInvoicesByVendorIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListInvoicesByVendorId(listInvoicesByVendorIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListInvoicesByVendorId(dataConnect, listInvoicesByVendorIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.invoices);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listInvoicesByBusinessId
You can execute the listInvoicesByBusinessId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListInvoicesByBusinessId(dc: DataConnect, vars: ListInvoicesByBusinessIdVariables, options?: useDataConnectQueryOptions<ListInvoicesByBusinessIdData>): UseDataConnectQueryResult<ListInvoicesByBusinessIdData, ListInvoicesByBusinessIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListInvoicesByBusinessId(vars: ListInvoicesByBusinessIdVariables, options?: useDataConnectQueryOptions<ListInvoicesByBusinessIdData>): UseDataConnectQueryResult<ListInvoicesByBusinessIdData, ListInvoicesByBusinessIdVariables>;
Variables
The listInvoicesByBusinessId Query requires an argument of type ListInvoicesByBusinessIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoicesByBusinessIdVariables {
businessId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listInvoicesByBusinessId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listInvoicesByBusinessId Query is of type ListInvoicesByBusinessIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoicesByBusinessIdData {
invoices: ({
id: UUIDString;
status: InvoiceStatus;
vendorId: UUIDString;
businessId: UUIDString;
orderId: UUIDString;
paymentTerms?: InovicePaymentTerms | null;
invoiceNumber: string;
issueDate: TimestampString;
dueDate: TimestampString;
hub?: string | null;
managerName?: string | null;
vendorNumber?: string | null;
roles?: unknown | null;
charges?: unknown | null;
otherCharges?: number | null;
subtotal?: number | null;
amount: number;
notes?: string | null;
staffCount?: number | null;
chargesCount?: number | null;
disputedItems?: unknown | null;
disputeReason?: string | null;
disputeDetails?: string | null;
vendor: {
companyName: string;
address?: string | null;
email?: string | null;
phone?: string | null;
};
business: {
businessName: string;
address?: string | null;
phone?: string | null;
email?: string | null;
};
order: {
eventName?: string | null;
deparment?: string | null;
poReference?: string | null;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
};
} & Invoice_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listInvoicesByBusinessId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListInvoicesByBusinessIdVariables } from '@dataconnect/generated';
import { useListInvoicesByBusinessId } from '@dataconnect/generated/react'
export default function ListInvoicesByBusinessIdComponent() {
// The `useListInvoicesByBusinessId` Query hook requires an argument of type `ListInvoicesByBusinessIdVariables`:
const listInvoicesByBusinessIdVars: ListInvoicesByBusinessIdVariables = {
businessId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListInvoicesByBusinessId(listInvoicesByBusinessIdVars);
// Variables can be defined inline as well.
const query = useListInvoicesByBusinessId({ businessId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListInvoicesByBusinessId(dataConnect, listInvoicesByBusinessIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListInvoicesByBusinessId(listInvoicesByBusinessIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListInvoicesByBusinessId(dataConnect, listInvoicesByBusinessIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.invoices);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listInvoicesByOrderId
You can execute the listInvoicesByOrderId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListInvoicesByOrderId(dc: DataConnect, vars: ListInvoicesByOrderIdVariables, options?: useDataConnectQueryOptions<ListInvoicesByOrderIdData>): UseDataConnectQueryResult<ListInvoicesByOrderIdData, ListInvoicesByOrderIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListInvoicesByOrderId(vars: ListInvoicesByOrderIdVariables, options?: useDataConnectQueryOptions<ListInvoicesByOrderIdData>): UseDataConnectQueryResult<ListInvoicesByOrderIdData, ListInvoicesByOrderIdVariables>;
Variables
The listInvoicesByOrderId Query requires an argument of type ListInvoicesByOrderIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoicesByOrderIdVariables {
orderId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listInvoicesByOrderId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listInvoicesByOrderId Query is of type ListInvoicesByOrderIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoicesByOrderIdData {
invoices: ({
id: UUIDString;
status: InvoiceStatus;
vendorId: UUIDString;
businessId: UUIDString;
orderId: UUIDString;
paymentTerms?: InovicePaymentTerms | null;
invoiceNumber: string;
issueDate: TimestampString;
dueDate: TimestampString;
hub?: string | null;
managerName?: string | null;
vendorNumber?: string | null;
roles?: unknown | null;
charges?: unknown | null;
otherCharges?: number | null;
subtotal?: number | null;
amount: number;
notes?: string | null;
staffCount?: number | null;
chargesCount?: number | null;
disputedItems?: unknown | null;
disputeReason?: string | null;
disputeDetails?: string | null;
vendor: {
companyName: string;
address?: string | null;
email?: string | null;
phone?: string | null;
};
business: {
businessName: string;
address?: string | null;
phone?: string | null;
email?: string | null;
};
order: {
eventName?: string | null;
deparment?: string | null;
poReference?: string | null;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
};
} & Invoice_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listInvoicesByOrderId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListInvoicesByOrderIdVariables } from '@dataconnect/generated';
import { useListInvoicesByOrderId } from '@dataconnect/generated/react'
export default function ListInvoicesByOrderIdComponent() {
// The `useListInvoicesByOrderId` Query hook requires an argument of type `ListInvoicesByOrderIdVariables`:
const listInvoicesByOrderIdVars: ListInvoicesByOrderIdVariables = {
orderId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListInvoicesByOrderId(listInvoicesByOrderIdVars);
// Variables can be defined inline as well.
const query = useListInvoicesByOrderId({ orderId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListInvoicesByOrderId(dataConnect, listInvoicesByOrderIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListInvoicesByOrderId(listInvoicesByOrderIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListInvoicesByOrderId(dataConnect, listInvoicesByOrderIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.invoices);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listInvoicesByStatus
You can execute the listInvoicesByStatus Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListInvoicesByStatus(dc: DataConnect, vars: ListInvoicesByStatusVariables, options?: useDataConnectQueryOptions<ListInvoicesByStatusData>): UseDataConnectQueryResult<ListInvoicesByStatusData, ListInvoicesByStatusVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListInvoicesByStatus(vars: ListInvoicesByStatusVariables, options?: useDataConnectQueryOptions<ListInvoicesByStatusData>): UseDataConnectQueryResult<ListInvoicesByStatusData, ListInvoicesByStatusVariables>;
Variables
The listInvoicesByStatus Query requires an argument of type ListInvoicesByStatusVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoicesByStatusVariables {
status: InvoiceStatus;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listInvoicesByStatus Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listInvoicesByStatus Query is of type ListInvoicesByStatusData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoicesByStatusData {
invoices: ({
id: UUIDString;
status: InvoiceStatus;
vendorId: UUIDString;
businessId: UUIDString;
orderId: UUIDString;
paymentTerms?: InovicePaymentTerms | null;
invoiceNumber: string;
issueDate: TimestampString;
dueDate: TimestampString;
hub?: string | null;
managerName?: string | null;
vendorNumber?: string | null;
roles?: unknown | null;
charges?: unknown | null;
otherCharges?: number | null;
subtotal?: number | null;
amount: number;
notes?: string | null;
staffCount?: number | null;
chargesCount?: number | null;
disputedItems?: unknown | null;
disputeReason?: string | null;
disputeDetails?: string | null;
vendor: {
companyName: string;
address?: string | null;
email?: string | null;
phone?: string | null;
};
business: {
businessName: string;
address?: string | null;
phone?: string | null;
email?: string | null;
};
order: {
eventName?: string | null;
deparment?: string | null;
poReference?: string | null;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
};
} & Invoice_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listInvoicesByStatus's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListInvoicesByStatusVariables } from '@dataconnect/generated';
import { useListInvoicesByStatus } from '@dataconnect/generated/react'
export default function ListInvoicesByStatusComponent() {
// The `useListInvoicesByStatus` Query hook requires an argument of type `ListInvoicesByStatusVariables`:
const listInvoicesByStatusVars: ListInvoicesByStatusVariables = {
status: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListInvoicesByStatus(listInvoicesByStatusVars);
// Variables can be defined inline as well.
const query = useListInvoicesByStatus({ status: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListInvoicesByStatus(dataConnect, listInvoicesByStatusVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListInvoicesByStatus(listInvoicesByStatusVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListInvoicesByStatus(dataConnect, listInvoicesByStatusVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.invoices);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterInvoices
You can execute the filterInvoices Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterInvoices(dc: DataConnect, vars?: FilterInvoicesVariables, options?: useDataConnectQueryOptions<FilterInvoicesData>): UseDataConnectQueryResult<FilterInvoicesData, FilterInvoicesVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterInvoices(vars?: FilterInvoicesVariables, options?: useDataConnectQueryOptions<FilterInvoicesData>): UseDataConnectQueryResult<FilterInvoicesData, FilterInvoicesVariables>;
Variables
The filterInvoices Query has an optional argument of type FilterInvoicesVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterInvoicesVariables {
vendorId?: UUIDString | null;
businessId?: UUIDString | null;
orderId?: UUIDString | null;
status?: InvoiceStatus | null;
issueDateFrom?: TimestampString | null;
issueDateTo?: TimestampString | null;
dueDateFrom?: TimestampString | null;
dueDateTo?: TimestampString | null;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the filterInvoices Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the filterInvoices Query is of type FilterInvoicesData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterInvoicesData {
invoices: ({
id: UUIDString;
status: InvoiceStatus;
vendorId: UUIDString;
businessId: UUIDString;
orderId: UUIDString;
paymentTerms?: InovicePaymentTerms | null;
invoiceNumber: string;
issueDate: TimestampString;
dueDate: TimestampString;
hub?: string | null;
managerName?: string | null;
vendorNumber?: string | null;
roles?: unknown | null;
charges?: unknown | null;
otherCharges?: number | null;
subtotal?: number | null;
amount: number;
notes?: string | null;
staffCount?: number | null;
chargesCount?: number | null;
disputedItems?: unknown | null;
disputeReason?: string | null;
disputeDetails?: string | null;
vendor: {
companyName: string;
address?: string | null;
email?: string | null;
phone?: string | null;
};
business: {
businessName: string;
address?: string | null;
phone?: string | null;
email?: string | null;
};
order: {
eventName?: string | null;
deparment?: string | null;
poReference?: string | null;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
};
} & Invoice_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterInvoices's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterInvoicesVariables } from '@dataconnect/generated';
import { useFilterInvoices } from '@dataconnect/generated/react'
export default function FilterInvoicesComponent() {
// The `useFilterInvoices` Query hook has an optional argument of type `FilterInvoicesVariables`:
const filterInvoicesVars: FilterInvoicesVariables = {
vendorId: ..., // optional
businessId: ..., // optional
orderId: ..., // optional
status: ..., // optional
issueDateFrom: ..., // optional
issueDateTo: ..., // optional
dueDateFrom: ..., // optional
dueDateTo: ..., // optional
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useFilterInvoices(filterInvoicesVars);
// Variables can be defined inline as well.
const query = useFilterInvoices({ vendorId: ..., businessId: ..., orderId: ..., status: ..., issueDateFrom: ..., issueDateTo: ..., dueDateFrom: ..., dueDateTo: ..., offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `FilterInvoicesVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterInvoices();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterInvoices(dataConnect, filterInvoicesVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterInvoices(filterInvoicesVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useFilterInvoices(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useFilterInvoices(dataConnect, filterInvoicesVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.invoices);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listOverdueInvoices
You can execute the listOverdueInvoices Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListOverdueInvoices(dc: DataConnect, vars: ListOverdueInvoicesVariables, options?: useDataConnectQueryOptions<ListOverdueInvoicesData>): UseDataConnectQueryResult<ListOverdueInvoicesData, ListOverdueInvoicesVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListOverdueInvoices(vars: ListOverdueInvoicesVariables, options?: useDataConnectQueryOptions<ListOverdueInvoicesData>): UseDataConnectQueryResult<ListOverdueInvoicesData, ListOverdueInvoicesVariables>;
Variables
The listOverdueInvoices Query requires an argument of type ListOverdueInvoicesVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListOverdueInvoicesVariables {
now: TimestampString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listOverdueInvoices Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listOverdueInvoices Query is of type ListOverdueInvoicesData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListOverdueInvoicesData {
invoices: ({
id: UUIDString;
status: InvoiceStatus;
vendorId: UUIDString;
businessId: UUIDString;
orderId: UUIDString;
paymentTerms?: InovicePaymentTerms | null;
invoiceNumber: string;
issueDate: TimestampString;
dueDate: TimestampString;
hub?: string | null;
managerName?: string | null;
vendorNumber?: string | null;
roles?: unknown | null;
charges?: unknown | null;
otherCharges?: number | null;
subtotal?: number | null;
amount: number;
notes?: string | null;
staffCount?: number | null;
chargesCount?: number | null;
disputedItems?: unknown | null;
disputeReason?: string | null;
disputeDetails?: string | null;
vendor: {
companyName: string;
address?: string | null;
email?: string | null;
phone?: string | null;
};
business: {
businessName: string;
address?: string | null;
phone?: string | null;
email?: string | null;
};
order: {
eventName?: string | null;
deparment?: string | null;
poReference?: string | null;
teamHub: {
address: string;
placeId?: string | null;
hubName: string;
};
};
} & Invoice_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listOverdueInvoices's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListOverdueInvoicesVariables } from '@dataconnect/generated';
import { useListOverdueInvoices } from '@dataconnect/generated/react'
export default function ListOverdueInvoicesComponent() {
// The `useListOverdueInvoices` Query hook requires an argument of type `ListOverdueInvoicesVariables`:
const listOverdueInvoicesVars: ListOverdueInvoicesVariables = {
now: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListOverdueInvoices(listOverdueInvoicesVars);
// Variables can be defined inline as well.
const query = useListOverdueInvoices({ now: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListOverdueInvoices(dataConnect, listOverdueInvoicesVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListOverdueInvoices(listOverdueInvoicesVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListOverdueInvoices(dataConnect, listOverdueInvoicesVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.invoices);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listCourses
You can execute the listCourses Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListCourses(dc: DataConnect, options?: useDataConnectQueryOptions<ListCoursesData>): UseDataConnectQueryResult<ListCoursesData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListCourses(options?: useDataConnectQueryOptions<ListCoursesData>): UseDataConnectQueryResult<ListCoursesData, undefined>;
Variables
The listCourses Query has no variables.
Return Type
Recall that calling the listCourses Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listCourses Query is of type ListCoursesData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListCoursesData {
courses: ({
id: UUIDString;
title?: string | null;
description?: string | null;
thumbnailUrl?: string | null;
durationMinutes?: number | null;
xpReward?: number | null;
categoryId: UUIDString;
levelRequired?: string | null;
isCertification?: boolean | null;
createdAt?: TimestampString | null;
category: {
id: UUIDString;
label: string;
} & Category_Key;
} & Course_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listCourses's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListCourses } from '@dataconnect/generated/react'
export default function ListCoursesComponent() {
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListCourses();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListCourses(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListCourses(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListCourses(dataConnect, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.courses);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getCourseById
You can execute the getCourseById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetCourseById(dc: DataConnect, vars: GetCourseByIdVariables, options?: useDataConnectQueryOptions<GetCourseByIdData>): UseDataConnectQueryResult<GetCourseByIdData, GetCourseByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetCourseById(vars: GetCourseByIdVariables, options?: useDataConnectQueryOptions<GetCourseByIdData>): UseDataConnectQueryResult<GetCourseByIdData, GetCourseByIdVariables>;
Variables
The getCourseById Query requires an argument of type GetCourseByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetCourseByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getCourseById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getCourseById Query is of type GetCourseByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetCourseByIdData {
course?: {
id: UUIDString;
title?: string | null;
description?: string | null;
thumbnailUrl?: string | null;
durationMinutes?: number | null;
xpReward?: number | null;
categoryId: UUIDString;
levelRequired?: string | null;
isCertification?: boolean | null;
createdAt?: TimestampString | null;
category: {
id: UUIDString;
label: string;
} & Category_Key;
} & Course_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getCourseById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetCourseByIdVariables } from '@dataconnect/generated';
import { useGetCourseById } from '@dataconnect/generated/react'
export default function GetCourseByIdComponent() {
// The `useGetCourseById` Query hook requires an argument of type `GetCourseByIdVariables`:
const getCourseByIdVars: GetCourseByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetCourseById(getCourseByIdVars);
// Variables can be defined inline as well.
const query = useGetCourseById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetCourseById(dataConnect, getCourseByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetCourseById(getCourseByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetCourseById(dataConnect, getCourseByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.course);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterCourses
You can execute the filterCourses Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterCourses(dc: DataConnect, vars?: FilterCoursesVariables, options?: useDataConnectQueryOptions<FilterCoursesData>): UseDataConnectQueryResult<FilterCoursesData, FilterCoursesVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterCourses(vars?: FilterCoursesVariables, options?: useDataConnectQueryOptions<FilterCoursesData>): UseDataConnectQueryResult<FilterCoursesData, FilterCoursesVariables>;
Variables
The filterCourses Query has an optional argument of type FilterCoursesVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterCoursesVariables {
categoryId?: UUIDString | null;
isCertification?: boolean | null;
levelRequired?: string | null;
completed?: boolean | null;
}
Return Type
Recall that calling the filterCourses Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the filterCourses Query is of type FilterCoursesData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterCoursesData {
courses: ({
id: UUIDString;
title?: string | null;
categoryId: UUIDString;
levelRequired?: string | null;
isCertification?: boolean | null;
category: {
id: UUIDString;
label: string;
} & Category_Key;
} & Course_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterCourses's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterCoursesVariables } from '@dataconnect/generated';
import { useFilterCourses } from '@dataconnect/generated/react'
export default function FilterCoursesComponent() {
// The `useFilterCourses` Query hook has an optional argument of type `FilterCoursesVariables`:
const filterCoursesVars: FilterCoursesVariables = {
categoryId: ..., // optional
isCertification: ..., // optional
levelRequired: ..., // optional
completed: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useFilterCourses(filterCoursesVars);
// Variables can be defined inline as well.
const query = useFilterCourses({ categoryId: ..., isCertification: ..., levelRequired: ..., completed: ..., });
// Since all variables are optional for this Query, you can omit the `FilterCoursesVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterCourses();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterCourses(dataConnect, filterCoursesVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterCourses(filterCoursesVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useFilterCourses(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useFilterCourses(dataConnect, filterCoursesVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.courses);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listVendorRates
You can execute the listVendorRates Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListVendorRates(dc: DataConnect, options?: useDataConnectQueryOptions<ListVendorRatesData>): UseDataConnectQueryResult<ListVendorRatesData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListVendorRates(options?: useDataConnectQueryOptions<ListVendorRatesData>): UseDataConnectQueryResult<ListVendorRatesData, undefined>;
Variables
The listVendorRates Query has no variables.
Return Type
Recall that calling the listVendorRates Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listVendorRates Query is of type ListVendorRatesData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListVendorRatesData {
vendorRates: ({
id: UUIDString;
vendorId: UUIDString;
roleName?: string | null;
category?: CategoryType | null;
clientRate?: number | null;
employeeWage?: number | null;
markupPercentage?: number | null;
vendorFeePercentage?: number | null;
isActive?: boolean | null;
notes?: string | null;
createdAt?: TimestampString | null;
vendor: {
companyName: string;
region?: string | null;
};
} & VendorRate_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listVendorRates's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListVendorRates } from '@dataconnect/generated/react'
export default function ListVendorRatesComponent() {
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListVendorRates();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListVendorRates(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListVendorRates(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListVendorRates(dataConnect, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.vendorRates);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getVendorRateById
You can execute the getVendorRateById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetVendorRateById(dc: DataConnect, vars: GetVendorRateByIdVariables, options?: useDataConnectQueryOptions<GetVendorRateByIdData>): UseDataConnectQueryResult<GetVendorRateByIdData, GetVendorRateByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetVendorRateById(vars: GetVendorRateByIdVariables, options?: useDataConnectQueryOptions<GetVendorRateByIdData>): UseDataConnectQueryResult<GetVendorRateByIdData, GetVendorRateByIdVariables>;
Variables
The getVendorRateById Query requires an argument of type GetVendorRateByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetVendorRateByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getVendorRateById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getVendorRateById Query is of type GetVendorRateByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetVendorRateByIdData {
vendorRate?: {
id: UUIDString;
vendorId: UUIDString;
roleName?: string | null;
category?: CategoryType | null;
clientRate?: number | null;
employeeWage?: number | null;
markupPercentage?: number | null;
vendorFeePercentage?: number | null;
isActive?: boolean | null;
notes?: string | null;
createdAt?: TimestampString | null;
vendor: {
companyName: string;
region?: string | null;
};
} & VendorRate_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getVendorRateById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetVendorRateByIdVariables } from '@dataconnect/generated';
import { useGetVendorRateById } from '@dataconnect/generated/react'
export default function GetVendorRateByIdComponent() {
// The `useGetVendorRateById` Query hook requires an argument of type `GetVendorRateByIdVariables`:
const getVendorRateByIdVars: GetVendorRateByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetVendorRateById(getVendorRateByIdVars);
// Variables can be defined inline as well.
const query = useGetVendorRateById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetVendorRateById(dataConnect, getVendorRateByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetVendorRateById(getVendorRateByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetVendorRateById(dataConnect, getVendorRateByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.vendorRate);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getWorkforceById
You can execute the getWorkforceById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetWorkforceById(dc: DataConnect, vars: GetWorkforceByIdVariables, options?: useDataConnectQueryOptions<GetWorkforceByIdData>): UseDataConnectQueryResult<GetWorkforceByIdData, GetWorkforceByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetWorkforceById(vars: GetWorkforceByIdVariables, options?: useDataConnectQueryOptions<GetWorkforceByIdData>): UseDataConnectQueryResult<GetWorkforceByIdData, GetWorkforceByIdVariables>;
Variables
The getWorkforceById Query requires an argument of type GetWorkforceByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetWorkforceByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getWorkforceById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getWorkforceById Query is of type GetWorkforceByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetWorkforceByIdData {
workforce?: {
id: UUIDString;
vendorId: UUIDString;
staffId: UUIDString;
workforceNumber: string;
employmentType?: WorkforceEmploymentType | null;
status?: WorkforceStatus | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
staff: {
id: UUIDString;
fullName: string;
} & Staff_Key;
vendor: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & Workforce_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getWorkforceById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetWorkforceByIdVariables } from '@dataconnect/generated';
import { useGetWorkforceById } from '@dataconnect/generated/react'
export default function GetWorkforceByIdComponent() {
// The `useGetWorkforceById` Query hook requires an argument of type `GetWorkforceByIdVariables`:
const getWorkforceByIdVars: GetWorkforceByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetWorkforceById(getWorkforceByIdVars);
// Variables can be defined inline as well.
const query = useGetWorkforceById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetWorkforceById(dataConnect, getWorkforceByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetWorkforceById(getWorkforceByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetWorkforceById(dataConnect, getWorkforceByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.workforce);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getWorkforceByVendorAndStaff
You can execute the getWorkforceByVendorAndStaff Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetWorkforceByVendorAndStaff(dc: DataConnect, vars: GetWorkforceByVendorAndStaffVariables, options?: useDataConnectQueryOptions<GetWorkforceByVendorAndStaffData>): UseDataConnectQueryResult<GetWorkforceByVendorAndStaffData, GetWorkforceByVendorAndStaffVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetWorkforceByVendorAndStaff(vars: GetWorkforceByVendorAndStaffVariables, options?: useDataConnectQueryOptions<GetWorkforceByVendorAndStaffData>): UseDataConnectQueryResult<GetWorkforceByVendorAndStaffData, GetWorkforceByVendorAndStaffVariables>;
Variables
The getWorkforceByVendorAndStaff Query requires an argument of type GetWorkforceByVendorAndStaffVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetWorkforceByVendorAndStaffVariables {
vendorId: UUIDString;
staffId: UUIDString;
}
Return Type
Recall that calling the getWorkforceByVendorAndStaff Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getWorkforceByVendorAndStaff Query is of type GetWorkforceByVendorAndStaffData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetWorkforceByVendorAndStaffData {
workforces: ({
id: UUIDString;
vendorId: UUIDString;
staffId: UUIDString;
workforceNumber: string;
employmentType?: WorkforceEmploymentType | null;
status?: WorkforceStatus | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
staff: {
id: UUIDString;
fullName: string;
} & Staff_Key;
vendor: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & Workforce_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getWorkforceByVendorAndStaff's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetWorkforceByVendorAndStaffVariables } from '@dataconnect/generated';
import { useGetWorkforceByVendorAndStaff } from '@dataconnect/generated/react'
export default function GetWorkforceByVendorAndStaffComponent() {
// The `useGetWorkforceByVendorAndStaff` Query hook requires an argument of type `GetWorkforceByVendorAndStaffVariables`:
const getWorkforceByVendorAndStaffVars: GetWorkforceByVendorAndStaffVariables = {
vendorId: ...,
staffId: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetWorkforceByVendorAndStaff(getWorkforceByVendorAndStaffVars);
// Variables can be defined inline as well.
const query = useGetWorkforceByVendorAndStaff({ vendorId: ..., staffId: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetWorkforceByVendorAndStaff(dataConnect, getWorkforceByVendorAndStaffVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetWorkforceByVendorAndStaff(getWorkforceByVendorAndStaffVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetWorkforceByVendorAndStaff(dataConnect, getWorkforceByVendorAndStaffVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.workforces);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listWorkforceByVendorId
You can execute the listWorkforceByVendorId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListWorkforceByVendorId(dc: DataConnect, vars: ListWorkforceByVendorIdVariables, options?: useDataConnectQueryOptions<ListWorkforceByVendorIdData>): UseDataConnectQueryResult<ListWorkforceByVendorIdData, ListWorkforceByVendorIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListWorkforceByVendorId(vars: ListWorkforceByVendorIdVariables, options?: useDataConnectQueryOptions<ListWorkforceByVendorIdData>): UseDataConnectQueryResult<ListWorkforceByVendorIdData, ListWorkforceByVendorIdVariables>;
Variables
The listWorkforceByVendorId Query requires an argument of type ListWorkforceByVendorIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListWorkforceByVendorIdVariables {
vendorId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listWorkforceByVendorId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listWorkforceByVendorId Query is of type ListWorkforceByVendorIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListWorkforceByVendorIdData {
workforces: ({
id: UUIDString;
staffId: UUIDString;
workforceNumber: string;
employmentType?: WorkforceEmploymentType | null;
status?: WorkforceStatus | null;
createdAt?: TimestampString | null;
staff: {
id: UUIDString;
fullName: string;
} & Staff_Key;
} & Workforce_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listWorkforceByVendorId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListWorkforceByVendorIdVariables } from '@dataconnect/generated';
import { useListWorkforceByVendorId } from '@dataconnect/generated/react'
export default function ListWorkforceByVendorIdComponent() {
// The `useListWorkforceByVendorId` Query hook requires an argument of type `ListWorkforceByVendorIdVariables`:
const listWorkforceByVendorIdVars: ListWorkforceByVendorIdVariables = {
vendorId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListWorkforceByVendorId(listWorkforceByVendorIdVars);
// Variables can be defined inline as well.
const query = useListWorkforceByVendorId({ vendorId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListWorkforceByVendorId(dataConnect, listWorkforceByVendorIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListWorkforceByVendorId(listWorkforceByVendorIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListWorkforceByVendorId(dataConnect, listWorkforceByVendorIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.workforces);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listWorkforceByStaffId
You can execute the listWorkforceByStaffId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListWorkforceByStaffId(dc: DataConnect, vars: ListWorkforceByStaffIdVariables, options?: useDataConnectQueryOptions<ListWorkforceByStaffIdData>): UseDataConnectQueryResult<ListWorkforceByStaffIdData, ListWorkforceByStaffIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListWorkforceByStaffId(vars: ListWorkforceByStaffIdVariables, options?: useDataConnectQueryOptions<ListWorkforceByStaffIdData>): UseDataConnectQueryResult<ListWorkforceByStaffIdData, ListWorkforceByStaffIdVariables>;
Variables
The listWorkforceByStaffId Query requires an argument of type ListWorkforceByStaffIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListWorkforceByStaffIdVariables {
staffId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listWorkforceByStaffId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listWorkforceByStaffId Query is of type ListWorkforceByStaffIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListWorkforceByStaffIdData {
workforces: ({
id: UUIDString;
vendorId: UUIDString;
workforceNumber: string;
employmentType?: WorkforceEmploymentType | null;
status?: WorkforceStatus | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
vendor: {
id: UUIDString;
companyName: string;
} & Vendor_Key;
} & Workforce_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listWorkforceByStaffId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListWorkforceByStaffIdVariables } from '@dataconnect/generated';
import { useListWorkforceByStaffId } from '@dataconnect/generated/react'
export default function ListWorkforceByStaffIdComponent() {
// The `useListWorkforceByStaffId` Query hook requires an argument of type `ListWorkforceByStaffIdVariables`:
const listWorkforceByStaffIdVars: ListWorkforceByStaffIdVariables = {
staffId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListWorkforceByStaffId(listWorkforceByStaffIdVars);
// Variables can be defined inline as well.
const query = useListWorkforceByStaffId({ staffId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListWorkforceByStaffId(dataConnect, listWorkforceByStaffIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListWorkforceByStaffId(listWorkforceByStaffIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListWorkforceByStaffId(dataConnect, listWorkforceByStaffIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.workforces);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getWorkforceByVendorAndNumber
You can execute the getWorkforceByVendorAndNumber Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetWorkforceByVendorAndNumber(dc: DataConnect, vars: GetWorkforceByVendorAndNumberVariables, options?: useDataConnectQueryOptions<GetWorkforceByVendorAndNumberData>): UseDataConnectQueryResult<GetWorkforceByVendorAndNumberData, GetWorkforceByVendorAndNumberVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetWorkforceByVendorAndNumber(vars: GetWorkforceByVendorAndNumberVariables, options?: useDataConnectQueryOptions<GetWorkforceByVendorAndNumberData>): UseDataConnectQueryResult<GetWorkforceByVendorAndNumberData, GetWorkforceByVendorAndNumberVariables>;
Variables
The getWorkforceByVendorAndNumber Query requires an argument of type GetWorkforceByVendorAndNumberVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetWorkforceByVendorAndNumberVariables {
vendorId: UUIDString;
workforceNumber: string;
}
Return Type
Recall that calling the getWorkforceByVendorAndNumber Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getWorkforceByVendorAndNumber Query is of type GetWorkforceByVendorAndNumberData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetWorkforceByVendorAndNumberData {
workforces: ({
id: UUIDString;
staffId: UUIDString;
workforceNumber: string;
status?: WorkforceStatus | null;
} & Workforce_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getWorkforceByVendorAndNumber's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetWorkforceByVendorAndNumberVariables } from '@dataconnect/generated';
import { useGetWorkforceByVendorAndNumber } from '@dataconnect/generated/react'
export default function GetWorkforceByVendorAndNumberComponent() {
// The `useGetWorkforceByVendorAndNumber` Query hook requires an argument of type `GetWorkforceByVendorAndNumberVariables`:
const getWorkforceByVendorAndNumberVars: GetWorkforceByVendorAndNumberVariables = {
vendorId: ...,
workforceNumber: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetWorkforceByVendorAndNumber(getWorkforceByVendorAndNumberVars);
// Variables can be defined inline as well.
const query = useGetWorkforceByVendorAndNumber({ vendorId: ..., workforceNumber: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetWorkforceByVendorAndNumber(dataConnect, getWorkforceByVendorAndNumberVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetWorkforceByVendorAndNumber(getWorkforceByVendorAndNumberVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetWorkforceByVendorAndNumber(dataConnect, getWorkforceByVendorAndNumberVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.workforces);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listStaffAvailabilityStats
You can execute the listStaffAvailabilityStats Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListStaffAvailabilityStats(dc: DataConnect, vars?: ListStaffAvailabilityStatsVariables, options?: useDataConnectQueryOptions<ListStaffAvailabilityStatsData>): UseDataConnectQueryResult<ListStaffAvailabilityStatsData, ListStaffAvailabilityStatsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListStaffAvailabilityStats(vars?: ListStaffAvailabilityStatsVariables, options?: useDataConnectQueryOptions<ListStaffAvailabilityStatsData>): UseDataConnectQueryResult<ListStaffAvailabilityStatsData, ListStaffAvailabilityStatsVariables>;
Variables
The listStaffAvailabilityStats Query has an optional argument of type ListStaffAvailabilityStatsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffAvailabilityStatsVariables {
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listStaffAvailabilityStats Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listStaffAvailabilityStats Query is of type ListStaffAvailabilityStatsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListStaffAvailabilityStatsData {
staffAvailabilityStatss: ({
id: UUIDString;
staffId: UUIDString;
needWorkIndex?: number | null;
utilizationPercentage?: number | null;
predictedAvailabilityScore?: number | null;
scheduledHoursThisPeriod?: number | null;
desiredHoursThisPeriod?: number | null;
lastShiftDate?: TimestampString | null;
acceptanceRate?: number | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
staff: {
id: UUIDString;
fullName: string;
} & Staff_Key;
} & StaffAvailabilityStats_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listStaffAvailabilityStats's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListStaffAvailabilityStatsVariables } from '@dataconnect/generated';
import { useListStaffAvailabilityStats } from '@dataconnect/generated/react'
export default function ListStaffAvailabilityStatsComponent() {
// The `useListStaffAvailabilityStats` Query hook has an optional argument of type `ListStaffAvailabilityStatsVariables`:
const listStaffAvailabilityStatsVars: ListStaffAvailabilityStatsVariables = {
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListStaffAvailabilityStats(listStaffAvailabilityStatsVars);
// Variables can be defined inline as well.
const query = useListStaffAvailabilityStats({ offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `ListStaffAvailabilityStatsVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useListStaffAvailabilityStats();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListStaffAvailabilityStats(dataConnect, listStaffAvailabilityStatsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListStaffAvailabilityStats(listStaffAvailabilityStatsVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useListStaffAvailabilityStats(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListStaffAvailabilityStats(dataConnect, listStaffAvailabilityStatsVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.staffAvailabilityStatss);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getStaffAvailabilityStatsByStaffId
You can execute the getStaffAvailabilityStatsByStaffId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetStaffAvailabilityStatsByStaffId(dc: DataConnect, vars: GetStaffAvailabilityStatsByStaffIdVariables, options?: useDataConnectQueryOptions<GetStaffAvailabilityStatsByStaffIdData>): UseDataConnectQueryResult<GetStaffAvailabilityStatsByStaffIdData, GetStaffAvailabilityStatsByStaffIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetStaffAvailabilityStatsByStaffId(vars: GetStaffAvailabilityStatsByStaffIdVariables, options?: useDataConnectQueryOptions<GetStaffAvailabilityStatsByStaffIdData>): UseDataConnectQueryResult<GetStaffAvailabilityStatsByStaffIdData, GetStaffAvailabilityStatsByStaffIdVariables>;
Variables
The getStaffAvailabilityStatsByStaffId Query requires an argument of type GetStaffAvailabilityStatsByStaffIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetStaffAvailabilityStatsByStaffIdVariables {
staffId: UUIDString;
}
Return Type
Recall that calling the getStaffAvailabilityStatsByStaffId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getStaffAvailabilityStatsByStaffId Query is of type GetStaffAvailabilityStatsByStaffIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetStaffAvailabilityStatsByStaffIdData {
staffAvailabilityStats?: {
id: UUIDString;
staffId: UUIDString;
needWorkIndex?: number | null;
utilizationPercentage?: number | null;
predictedAvailabilityScore?: number | null;
scheduledHoursThisPeriod?: number | null;
desiredHoursThisPeriod?: number | null;
lastShiftDate?: TimestampString | null;
acceptanceRate?: number | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
staff: {
id: UUIDString;
fullName: string;
} & Staff_Key;
} & StaffAvailabilityStats_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getStaffAvailabilityStatsByStaffId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetStaffAvailabilityStatsByStaffIdVariables } from '@dataconnect/generated';
import { useGetStaffAvailabilityStatsByStaffId } from '@dataconnect/generated/react'
export default function GetStaffAvailabilityStatsByStaffIdComponent() {
// The `useGetStaffAvailabilityStatsByStaffId` Query hook requires an argument of type `GetStaffAvailabilityStatsByStaffIdVariables`:
const getStaffAvailabilityStatsByStaffIdVars: GetStaffAvailabilityStatsByStaffIdVariables = {
staffId: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetStaffAvailabilityStatsByStaffId(getStaffAvailabilityStatsByStaffIdVars);
// Variables can be defined inline as well.
const query = useGetStaffAvailabilityStatsByStaffId({ staffId: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetStaffAvailabilityStatsByStaffId(dataConnect, getStaffAvailabilityStatsByStaffIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetStaffAvailabilityStatsByStaffId(getStaffAvailabilityStatsByStaffIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetStaffAvailabilityStatsByStaffId(dataConnect, getStaffAvailabilityStatsByStaffIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.staffAvailabilityStats);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterStaffAvailabilityStats
You can execute the filterStaffAvailabilityStats Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterStaffAvailabilityStats(dc: DataConnect, vars?: FilterStaffAvailabilityStatsVariables, options?: useDataConnectQueryOptions<FilterStaffAvailabilityStatsData>): UseDataConnectQueryResult<FilterStaffAvailabilityStatsData, FilterStaffAvailabilityStatsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterStaffAvailabilityStats(vars?: FilterStaffAvailabilityStatsVariables, options?: useDataConnectQueryOptions<FilterStaffAvailabilityStatsData>): UseDataConnectQueryResult<FilterStaffAvailabilityStatsData, FilterStaffAvailabilityStatsVariables>;
Variables
The filterStaffAvailabilityStats Query has an optional argument of type FilterStaffAvailabilityStatsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterStaffAvailabilityStatsVariables {
needWorkIndexMin?: number | null;
needWorkIndexMax?: number | null;
utilizationMin?: number | null;
utilizationMax?: number | null;
acceptanceRateMin?: number | null;
acceptanceRateMax?: number | null;
lastShiftAfter?: TimestampString | null;
lastShiftBefore?: TimestampString | null;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the filterStaffAvailabilityStats Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the filterStaffAvailabilityStats Query is of type FilterStaffAvailabilityStatsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterStaffAvailabilityStatsData {
staffAvailabilityStatss: ({
id: UUIDString;
staffId: UUIDString;
needWorkIndex?: number | null;
utilizationPercentage?: number | null;
predictedAvailabilityScore?: number | null;
scheduledHoursThisPeriod?: number | null;
desiredHoursThisPeriod?: number | null;
lastShiftDate?: TimestampString | null;
acceptanceRate?: number | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
staff: {
id: UUIDString;
fullName: string;
} & Staff_Key;
} & StaffAvailabilityStats_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterStaffAvailabilityStats's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterStaffAvailabilityStatsVariables } from '@dataconnect/generated';
import { useFilterStaffAvailabilityStats } from '@dataconnect/generated/react'
export default function FilterStaffAvailabilityStatsComponent() {
// The `useFilterStaffAvailabilityStats` Query hook has an optional argument of type `FilterStaffAvailabilityStatsVariables`:
const filterStaffAvailabilityStatsVars: FilterStaffAvailabilityStatsVariables = {
needWorkIndexMin: ..., // optional
needWorkIndexMax: ..., // optional
utilizationMin: ..., // optional
utilizationMax: ..., // optional
acceptanceRateMin: ..., // optional
acceptanceRateMax: ..., // optional
lastShiftAfter: ..., // optional
lastShiftBefore: ..., // optional
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useFilterStaffAvailabilityStats(filterStaffAvailabilityStatsVars);
// Variables can be defined inline as well.
const query = useFilterStaffAvailabilityStats({ needWorkIndexMin: ..., needWorkIndexMax: ..., utilizationMin: ..., utilizationMax: ..., acceptanceRateMin: ..., acceptanceRateMax: ..., lastShiftAfter: ..., lastShiftBefore: ..., offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `FilterStaffAvailabilityStatsVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterStaffAvailabilityStats();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterStaffAvailabilityStats(dataConnect, filterStaffAvailabilityStatsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterStaffAvailabilityStats(filterStaffAvailabilityStatsVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useFilterStaffAvailabilityStats(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useFilterStaffAvailabilityStats(dataConnect, filterStaffAvailabilityStatsVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.staffAvailabilityStatss);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listTeamHudDepartments
You can execute the listTeamHudDepartments Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListTeamHudDepartments(dc: DataConnect, vars?: ListTeamHudDepartmentsVariables, options?: useDataConnectQueryOptions<ListTeamHudDepartmentsData>): UseDataConnectQueryResult<ListTeamHudDepartmentsData, ListTeamHudDepartmentsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListTeamHudDepartments(vars?: ListTeamHudDepartmentsVariables, options?: useDataConnectQueryOptions<ListTeamHudDepartmentsData>): UseDataConnectQueryResult<ListTeamHudDepartmentsData, ListTeamHudDepartmentsVariables>;
Variables
The listTeamHudDepartments Query has an optional argument of type ListTeamHudDepartmentsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListTeamHudDepartmentsVariables {
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listTeamHudDepartments Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listTeamHudDepartments Query is of type ListTeamHudDepartmentsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListTeamHudDepartmentsData {
teamHudDepartments: ({
id: UUIDString;
name: string;
costCenter?: string | null;
teamHubId: UUIDString;
teamHub: {
id: UUIDString;
hubName: string;
} & TeamHub_Key;
createdAt?: TimestampString | null;
} & TeamHudDepartment_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listTeamHudDepartments's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListTeamHudDepartmentsVariables } from '@dataconnect/generated';
import { useListTeamHudDepartments } from '@dataconnect/generated/react'
export default function ListTeamHudDepartmentsComponent() {
// The `useListTeamHudDepartments` Query hook has an optional argument of type `ListTeamHudDepartmentsVariables`:
const listTeamHudDepartmentsVars: ListTeamHudDepartmentsVariables = {
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListTeamHudDepartments(listTeamHudDepartmentsVars);
// Variables can be defined inline as well.
const query = useListTeamHudDepartments({ offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `ListTeamHudDepartmentsVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useListTeamHudDepartments();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListTeamHudDepartments(dataConnect, listTeamHudDepartmentsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListTeamHudDepartments(listTeamHudDepartmentsVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useListTeamHudDepartments(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListTeamHudDepartments(dataConnect, listTeamHudDepartmentsVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.teamHudDepartments);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getTeamHudDepartmentById
You can execute the getTeamHudDepartmentById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetTeamHudDepartmentById(dc: DataConnect, vars: GetTeamHudDepartmentByIdVariables, options?: useDataConnectQueryOptions<GetTeamHudDepartmentByIdData>): UseDataConnectQueryResult<GetTeamHudDepartmentByIdData, GetTeamHudDepartmentByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetTeamHudDepartmentById(vars: GetTeamHudDepartmentByIdVariables, options?: useDataConnectQueryOptions<GetTeamHudDepartmentByIdData>): UseDataConnectQueryResult<GetTeamHudDepartmentByIdData, GetTeamHudDepartmentByIdVariables>;
Variables
The getTeamHudDepartmentById Query requires an argument of type GetTeamHudDepartmentByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTeamHudDepartmentByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getTeamHudDepartmentById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getTeamHudDepartmentById Query is of type GetTeamHudDepartmentByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTeamHudDepartmentByIdData {
teamHudDepartment?: {
id: UUIDString;
name: string;
costCenter?: string | null;
teamHubId: UUIDString;
teamHub: {
id: UUIDString;
hubName: string;
} & TeamHub_Key;
createdAt?: TimestampString | null;
} & TeamHudDepartment_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getTeamHudDepartmentById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetTeamHudDepartmentByIdVariables } from '@dataconnect/generated';
import { useGetTeamHudDepartmentById } from '@dataconnect/generated/react'
export default function GetTeamHudDepartmentByIdComponent() {
// The `useGetTeamHudDepartmentById` Query hook requires an argument of type `GetTeamHudDepartmentByIdVariables`:
const getTeamHudDepartmentByIdVars: GetTeamHudDepartmentByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetTeamHudDepartmentById(getTeamHudDepartmentByIdVars);
// Variables can be defined inline as well.
const query = useGetTeamHudDepartmentById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetTeamHudDepartmentById(dataConnect, getTeamHudDepartmentByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetTeamHudDepartmentById(getTeamHudDepartmentByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetTeamHudDepartmentById(dataConnect, getTeamHudDepartmentByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.teamHudDepartment);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listTeamHudDepartmentsByTeamHubId
You can execute the listTeamHudDepartmentsByTeamHubId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListTeamHudDepartmentsByTeamHubId(dc: DataConnect, vars: ListTeamHudDepartmentsByTeamHubIdVariables, options?: useDataConnectQueryOptions<ListTeamHudDepartmentsByTeamHubIdData>): UseDataConnectQueryResult<ListTeamHudDepartmentsByTeamHubIdData, ListTeamHudDepartmentsByTeamHubIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListTeamHudDepartmentsByTeamHubId(vars: ListTeamHudDepartmentsByTeamHubIdVariables, options?: useDataConnectQueryOptions<ListTeamHudDepartmentsByTeamHubIdData>): UseDataConnectQueryResult<ListTeamHudDepartmentsByTeamHubIdData, ListTeamHudDepartmentsByTeamHubIdVariables>;
Variables
The listTeamHudDepartmentsByTeamHubId Query requires an argument of type ListTeamHudDepartmentsByTeamHubIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListTeamHudDepartmentsByTeamHubIdVariables {
teamHubId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listTeamHudDepartmentsByTeamHubId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listTeamHudDepartmentsByTeamHubId Query is of type ListTeamHudDepartmentsByTeamHubIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListTeamHudDepartmentsByTeamHubIdData {
teamHudDepartments: ({
id: UUIDString;
name: string;
costCenter?: string | null;
teamHubId: UUIDString;
teamHub: {
id: UUIDString;
hubName: string;
} & TeamHub_Key;
createdAt?: TimestampString | null;
} & TeamHudDepartment_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listTeamHudDepartmentsByTeamHubId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListTeamHudDepartmentsByTeamHubIdVariables } from '@dataconnect/generated';
import { useListTeamHudDepartmentsByTeamHubId } from '@dataconnect/generated/react'
export default function ListTeamHudDepartmentsByTeamHubIdComponent() {
// The `useListTeamHudDepartmentsByTeamHubId` Query hook requires an argument of type `ListTeamHudDepartmentsByTeamHubIdVariables`:
const listTeamHudDepartmentsByTeamHubIdVars: ListTeamHudDepartmentsByTeamHubIdVariables = {
teamHubId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListTeamHudDepartmentsByTeamHubId(listTeamHudDepartmentsByTeamHubIdVars);
// Variables can be defined inline as well.
const query = useListTeamHudDepartmentsByTeamHubId({ teamHubId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListTeamHudDepartmentsByTeamHubId(dataConnect, listTeamHudDepartmentsByTeamHubIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListTeamHudDepartmentsByTeamHubId(listTeamHudDepartmentsByTeamHubIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListTeamHudDepartmentsByTeamHubId(dataConnect, listTeamHudDepartmentsByTeamHubIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.teamHudDepartments);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listLevels
You can execute the listLevels Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListLevels(dc: DataConnect, options?: useDataConnectQueryOptions<ListLevelsData>): UseDataConnectQueryResult<ListLevelsData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListLevels(options?: useDataConnectQueryOptions<ListLevelsData>): UseDataConnectQueryResult<ListLevelsData, undefined>;
Variables
The listLevels Query has no variables.
Return Type
Recall that calling the listLevels Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listLevels Query is of type ListLevelsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListLevelsData {
levels: ({
id: UUIDString;
name: string;
xpRequired: number;
icon?: string | null;
colors?: unknown | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & Level_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listLevels's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListLevels } from '@dataconnect/generated/react'
export default function ListLevelsComponent() {
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListLevels();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListLevels(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListLevels(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListLevels(dataConnect, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.levels);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getLevelById
You can execute the getLevelById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetLevelById(dc: DataConnect, vars: GetLevelByIdVariables, options?: useDataConnectQueryOptions<GetLevelByIdData>): UseDataConnectQueryResult<GetLevelByIdData, GetLevelByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetLevelById(vars: GetLevelByIdVariables, options?: useDataConnectQueryOptions<GetLevelByIdData>): UseDataConnectQueryResult<GetLevelByIdData, GetLevelByIdVariables>;
Variables
The getLevelById Query requires an argument of type GetLevelByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetLevelByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getLevelById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getLevelById Query is of type GetLevelByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetLevelByIdData {
level?: {
id: UUIDString;
name: string;
xpRequired: number;
icon?: string | null;
colors?: unknown | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & Level_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getLevelById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetLevelByIdVariables } from '@dataconnect/generated';
import { useGetLevelById } from '@dataconnect/generated/react'
export default function GetLevelByIdComponent() {
// The `useGetLevelById` Query hook requires an argument of type `GetLevelByIdVariables`:
const getLevelByIdVars: GetLevelByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetLevelById(getLevelByIdVars);
// Variables can be defined inline as well.
const query = useGetLevelById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetLevelById(dataConnect, getLevelByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetLevelById(getLevelByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetLevelById(dataConnect, getLevelByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.level);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterLevels
You can execute the filterLevels Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterLevels(dc: DataConnect, vars?: FilterLevelsVariables, options?: useDataConnectQueryOptions<FilterLevelsData>): UseDataConnectQueryResult<FilterLevelsData, FilterLevelsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterLevels(vars?: FilterLevelsVariables, options?: useDataConnectQueryOptions<FilterLevelsData>): UseDataConnectQueryResult<FilterLevelsData, FilterLevelsVariables>;
Variables
The filterLevels Query has an optional argument of type FilterLevelsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterLevelsVariables {
name?: string | null;
xpRequired?: number | null;
}
Return Type
Recall that calling the filterLevels Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the filterLevels Query is of type FilterLevelsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterLevelsData {
levels: ({
id: UUIDString;
name: string;
xpRequired: number;
icon?: string | null;
colors?: unknown | null;
} & Level_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterLevels's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterLevelsVariables } from '@dataconnect/generated';
import { useFilterLevels } from '@dataconnect/generated/react'
export default function FilterLevelsComponent() {
// The `useFilterLevels` Query hook has an optional argument of type `FilterLevelsVariables`:
const filterLevelsVars: FilterLevelsVariables = {
name: ..., // optional
xpRequired: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useFilterLevels(filterLevelsVars);
// Variables can be defined inline as well.
const query = useFilterLevels({ name: ..., xpRequired: ..., });
// Since all variables are optional for this Query, you can omit the `FilterLevelsVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterLevels();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterLevels(dataConnect, filterLevelsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterLevels(filterLevelsVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useFilterLevels(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useFilterLevels(dataConnect, filterLevelsVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.levels);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listTeams
You can execute the listTeams Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListTeams(dc: DataConnect, options?: useDataConnectQueryOptions<ListTeamsData>): UseDataConnectQueryResult<ListTeamsData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListTeams(options?: useDataConnectQueryOptions<ListTeamsData>): UseDataConnectQueryResult<ListTeamsData, undefined>;
Variables
The listTeams Query has no variables.
Return Type
Recall that calling the listTeams Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listTeams Query is of type ListTeamsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListTeamsData {
teams: ({
id: UUIDString;
teamName: string;
ownerId: UUIDString;
ownerName: string;
ownerRole: string;
email?: string | null;
companyLogo?: string | null;
totalMembers?: number | null;
activeMembers?: number | null;
totalHubs?: number | null;
departments?: unknown | null;
favoriteStaffCount?: number | null;
blockedStaffCount?: number | null;
favoriteStaff?: unknown | null;
blockedStaff?: unknown | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & Team_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listTeams's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListTeams } from '@dataconnect/generated/react'
export default function ListTeamsComponent() {
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListTeams();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListTeams(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListTeams(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListTeams(dataConnect, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.teams);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getTeamById
You can execute the getTeamById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetTeamById(dc: DataConnect, vars: GetTeamByIdVariables, options?: useDataConnectQueryOptions<GetTeamByIdData>): UseDataConnectQueryResult<GetTeamByIdData, GetTeamByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetTeamById(vars: GetTeamByIdVariables, options?: useDataConnectQueryOptions<GetTeamByIdData>): UseDataConnectQueryResult<GetTeamByIdData, GetTeamByIdVariables>;
Variables
The getTeamById Query requires an argument of type GetTeamByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTeamByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getTeamById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getTeamById Query is of type GetTeamByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTeamByIdData {
team?: {
id: UUIDString;
teamName: string;
ownerId: UUIDString;
ownerName: string;
ownerRole: string;
email?: string | null;
companyLogo?: string | null;
totalMembers?: number | null;
activeMembers?: number | null;
totalHubs?: number | null;
departments?: unknown | null;
favoriteStaffCount?: number | null;
blockedStaffCount?: number | null;
favoriteStaff?: unknown | null;
blockedStaff?: unknown | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & Team_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getTeamById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetTeamByIdVariables } from '@dataconnect/generated';
import { useGetTeamById } from '@dataconnect/generated/react'
export default function GetTeamByIdComponent() {
// The `useGetTeamById` Query hook requires an argument of type `GetTeamByIdVariables`:
const getTeamByIdVars: GetTeamByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetTeamById(getTeamByIdVars);
// Variables can be defined inline as well.
const query = useGetTeamById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetTeamById(dataConnect, getTeamByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetTeamById(getTeamByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetTeamById(dataConnect, getTeamByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.team);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getTeamsByOwnerId
You can execute the getTeamsByOwnerId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetTeamsByOwnerId(dc: DataConnect, vars: GetTeamsByOwnerIdVariables, options?: useDataConnectQueryOptions<GetTeamsByOwnerIdData>): UseDataConnectQueryResult<GetTeamsByOwnerIdData, GetTeamsByOwnerIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetTeamsByOwnerId(vars: GetTeamsByOwnerIdVariables, options?: useDataConnectQueryOptions<GetTeamsByOwnerIdData>): UseDataConnectQueryResult<GetTeamsByOwnerIdData, GetTeamsByOwnerIdVariables>;
Variables
The getTeamsByOwnerId Query requires an argument of type GetTeamsByOwnerIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTeamsByOwnerIdVariables {
ownerId: UUIDString;
}
Return Type
Recall that calling the getTeamsByOwnerId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getTeamsByOwnerId Query is of type GetTeamsByOwnerIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTeamsByOwnerIdData {
teams: ({
id: UUIDString;
teamName: string;
ownerId: UUIDString;
ownerName: string;
ownerRole: string;
email?: string | null;
companyLogo?: string | null;
totalMembers?: number | null;
activeMembers?: number | null;
totalHubs?: number | null;
departments?: unknown | null;
favoriteStaffCount?: number | null;
blockedStaffCount?: number | null;
favoriteStaff?: unknown | null;
blockedStaff?: unknown | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
} & Team_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getTeamsByOwnerId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetTeamsByOwnerIdVariables } from '@dataconnect/generated';
import { useGetTeamsByOwnerId } from '@dataconnect/generated/react'
export default function GetTeamsByOwnerIdComponent() {
// The `useGetTeamsByOwnerId` Query hook requires an argument of type `GetTeamsByOwnerIdVariables`:
const getTeamsByOwnerIdVars: GetTeamsByOwnerIdVariables = {
ownerId: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetTeamsByOwnerId(getTeamsByOwnerIdVars);
// Variables can be defined inline as well.
const query = useGetTeamsByOwnerId({ ownerId: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetTeamsByOwnerId(dataConnect, getTeamsByOwnerIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetTeamsByOwnerId(getTeamsByOwnerIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetTeamsByOwnerId(dataConnect, getTeamsByOwnerIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.teams);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listTeamMembers
You can execute the listTeamMembers Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListTeamMembers(dc: DataConnect, options?: useDataConnectQueryOptions<ListTeamMembersData>): UseDataConnectQueryResult<ListTeamMembersData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListTeamMembers(options?: useDataConnectQueryOptions<ListTeamMembersData>): UseDataConnectQueryResult<ListTeamMembersData, undefined>;
Variables
The listTeamMembers Query has no variables.
Return Type
Recall that calling the listTeamMembers Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listTeamMembers Query is of type ListTeamMembersData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListTeamMembersData {
teamMembers: ({
id: UUIDString;
teamId: UUIDString;
role: TeamMemberRole;
title?: string | null;
department?: string | null;
teamHubId?: UUIDString | null;
isActive?: boolean | null;
createdAt?: TimestampString | null;
user: {
fullName?: string | null;
email?: string | null;
};
teamHub?: {
hubName: string;
};
} & TeamMember_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listTeamMembers's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListTeamMembers } from '@dataconnect/generated/react'
export default function ListTeamMembersComponent() {
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListTeamMembers();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListTeamMembers(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListTeamMembers(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListTeamMembers(dataConnect, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.teamMembers);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getTeamMemberById
You can execute the getTeamMemberById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetTeamMemberById(dc: DataConnect, vars: GetTeamMemberByIdVariables, options?: useDataConnectQueryOptions<GetTeamMemberByIdData>): UseDataConnectQueryResult<GetTeamMemberByIdData, GetTeamMemberByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetTeamMemberById(vars: GetTeamMemberByIdVariables, options?: useDataConnectQueryOptions<GetTeamMemberByIdData>): UseDataConnectQueryResult<GetTeamMemberByIdData, GetTeamMemberByIdVariables>;
Variables
The getTeamMemberById Query requires an argument of type GetTeamMemberByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTeamMemberByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getTeamMemberById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getTeamMemberById Query is of type GetTeamMemberByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTeamMemberByIdData {
teamMember?: {
id: UUIDString;
teamId: UUIDString;
role: TeamMemberRole;
title?: string | null;
department?: string | null;
teamHubId?: UUIDString | null;
isActive?: boolean | null;
createdAt?: TimestampString | null;
user: {
fullName?: string | null;
email?: string | null;
};
teamHub?: {
hubName: string;
};
} & TeamMember_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getTeamMemberById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetTeamMemberByIdVariables } from '@dataconnect/generated';
import { useGetTeamMemberById } from '@dataconnect/generated/react'
export default function GetTeamMemberByIdComponent() {
// The `useGetTeamMemberById` Query hook requires an argument of type `GetTeamMemberByIdVariables`:
const getTeamMemberByIdVars: GetTeamMemberByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetTeamMemberById(getTeamMemberByIdVars);
// Variables can be defined inline as well.
const query = useGetTeamMemberById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetTeamMemberById(dataConnect, getTeamMemberByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetTeamMemberById(getTeamMemberByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetTeamMemberById(dataConnect, getTeamMemberByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.teamMember);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getTeamMembersByTeamId
You can execute the getTeamMembersByTeamId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetTeamMembersByTeamId(dc: DataConnect, vars: GetTeamMembersByTeamIdVariables, options?: useDataConnectQueryOptions<GetTeamMembersByTeamIdData>): UseDataConnectQueryResult<GetTeamMembersByTeamIdData, GetTeamMembersByTeamIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetTeamMembersByTeamId(vars: GetTeamMembersByTeamIdVariables, options?: useDataConnectQueryOptions<GetTeamMembersByTeamIdData>): UseDataConnectQueryResult<GetTeamMembersByTeamIdData, GetTeamMembersByTeamIdVariables>;
Variables
The getTeamMembersByTeamId Query requires an argument of type GetTeamMembersByTeamIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTeamMembersByTeamIdVariables {
teamId: UUIDString;
}
Return Type
Recall that calling the getTeamMembersByTeamId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getTeamMembersByTeamId Query is of type GetTeamMembersByTeamIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTeamMembersByTeamIdData {
teamMembers: ({
id: UUIDString;
teamId: UUIDString;
role: TeamMemberRole;
title?: string | null;
department?: string | null;
teamHubId?: UUIDString | null;
isActive?: boolean | null;
createdAt?: TimestampString | null;
user: {
fullName?: string | null;
email?: string | null;
};
teamHub?: {
hubName: string;
};
} & TeamMember_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getTeamMembersByTeamId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetTeamMembersByTeamIdVariables } from '@dataconnect/generated';
import { useGetTeamMembersByTeamId } from '@dataconnect/generated/react'
export default function GetTeamMembersByTeamIdComponent() {
// The `useGetTeamMembersByTeamId` Query hook requires an argument of type `GetTeamMembersByTeamIdVariables`:
const getTeamMembersByTeamIdVars: GetTeamMembersByTeamIdVariables = {
teamId: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetTeamMembersByTeamId(getTeamMembersByTeamIdVars);
// Variables can be defined inline as well.
const query = useGetTeamMembersByTeamId({ teamId: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetTeamMembersByTeamId(dataConnect, getTeamMembersByTeamIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetTeamMembersByTeamId(getTeamMembersByTeamIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetTeamMembersByTeamId(dataConnect, getTeamMembersByTeamIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.teamMembers);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listVendorBenefitPlans
You can execute the listVendorBenefitPlans Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListVendorBenefitPlans(dc: DataConnect, vars?: ListVendorBenefitPlansVariables, options?: useDataConnectQueryOptions<ListVendorBenefitPlansData>): UseDataConnectQueryResult<ListVendorBenefitPlansData, ListVendorBenefitPlansVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListVendorBenefitPlans(vars?: ListVendorBenefitPlansVariables, options?: useDataConnectQueryOptions<ListVendorBenefitPlansData>): UseDataConnectQueryResult<ListVendorBenefitPlansData, ListVendorBenefitPlansVariables>;
Variables
The listVendorBenefitPlans Query has an optional argument of type ListVendorBenefitPlansVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListVendorBenefitPlansVariables {
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listVendorBenefitPlans Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listVendorBenefitPlans Query is of type ListVendorBenefitPlansData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListVendorBenefitPlansData {
vendorBenefitPlans: ({
id: UUIDString;
vendorId: UUIDString;
title: string;
description?: string | null;
requestLabel?: string | null;
total?: number | null;
isActive?: boolean | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
vendor: {
companyName: string;
};
} & VendorBenefitPlan_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listVendorBenefitPlans's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListVendorBenefitPlansVariables } from '@dataconnect/generated';
import { useListVendorBenefitPlans } from '@dataconnect/generated/react'
export default function ListVendorBenefitPlansComponent() {
// The `useListVendorBenefitPlans` Query hook has an optional argument of type `ListVendorBenefitPlansVariables`:
const listVendorBenefitPlansVars: ListVendorBenefitPlansVariables = {
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListVendorBenefitPlans(listVendorBenefitPlansVars);
// Variables can be defined inline as well.
const query = useListVendorBenefitPlans({ offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `ListVendorBenefitPlansVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useListVendorBenefitPlans();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListVendorBenefitPlans(dataConnect, listVendorBenefitPlansVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListVendorBenefitPlans(listVendorBenefitPlansVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useListVendorBenefitPlans(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListVendorBenefitPlans(dataConnect, listVendorBenefitPlansVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.vendorBenefitPlans);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getVendorBenefitPlanById
You can execute the getVendorBenefitPlanById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetVendorBenefitPlanById(dc: DataConnect, vars: GetVendorBenefitPlanByIdVariables, options?: useDataConnectQueryOptions<GetVendorBenefitPlanByIdData>): UseDataConnectQueryResult<GetVendorBenefitPlanByIdData, GetVendorBenefitPlanByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetVendorBenefitPlanById(vars: GetVendorBenefitPlanByIdVariables, options?: useDataConnectQueryOptions<GetVendorBenefitPlanByIdData>): UseDataConnectQueryResult<GetVendorBenefitPlanByIdData, GetVendorBenefitPlanByIdVariables>;
Variables
The getVendorBenefitPlanById Query requires an argument of type GetVendorBenefitPlanByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetVendorBenefitPlanByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getVendorBenefitPlanById Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the getVendorBenefitPlanById Query is of type GetVendorBenefitPlanByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetVendorBenefitPlanByIdData {
vendorBenefitPlan?: {
id: UUIDString;
vendorId: UUIDString;
title: string;
description?: string | null;
requestLabel?: string | null;
total?: number | null;
isActive?: boolean | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
vendor: {
companyName: string;
};
} & VendorBenefitPlan_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getVendorBenefitPlanById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetVendorBenefitPlanByIdVariables } from '@dataconnect/generated';
import { useGetVendorBenefitPlanById } from '@dataconnect/generated/react'
export default function GetVendorBenefitPlanByIdComponent() {
// The `useGetVendorBenefitPlanById` Query hook requires an argument of type `GetVendorBenefitPlanByIdVariables`:
const getVendorBenefitPlanByIdVars: GetVendorBenefitPlanByIdVariables = {
id: ...,
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useGetVendorBenefitPlanById(getVendorBenefitPlanByIdVars);
// Variables can be defined inline as well.
const query = useGetVendorBenefitPlanById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetVendorBenefitPlanById(dataConnect, getVendorBenefitPlanByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetVendorBenefitPlanById(getVendorBenefitPlanByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetVendorBenefitPlanById(dataConnect, getVendorBenefitPlanByIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.vendorBenefitPlan);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listVendorBenefitPlansByVendorId
You can execute the listVendorBenefitPlansByVendorId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListVendorBenefitPlansByVendorId(dc: DataConnect, vars: ListVendorBenefitPlansByVendorIdVariables, options?: useDataConnectQueryOptions<ListVendorBenefitPlansByVendorIdData>): UseDataConnectQueryResult<ListVendorBenefitPlansByVendorIdData, ListVendorBenefitPlansByVendorIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListVendorBenefitPlansByVendorId(vars: ListVendorBenefitPlansByVendorIdVariables, options?: useDataConnectQueryOptions<ListVendorBenefitPlansByVendorIdData>): UseDataConnectQueryResult<ListVendorBenefitPlansByVendorIdData, ListVendorBenefitPlansByVendorIdVariables>;
Variables
The listVendorBenefitPlansByVendorId Query requires an argument of type ListVendorBenefitPlansByVendorIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListVendorBenefitPlansByVendorIdVariables {
vendorId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listVendorBenefitPlansByVendorId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listVendorBenefitPlansByVendorId Query is of type ListVendorBenefitPlansByVendorIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListVendorBenefitPlansByVendorIdData {
vendorBenefitPlans: ({
id: UUIDString;
vendorId: UUIDString;
title: string;
description?: string | null;
requestLabel?: string | null;
total?: number | null;
isActive?: boolean | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
vendor: {
companyName: string;
};
} & VendorBenefitPlan_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listVendorBenefitPlansByVendorId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListVendorBenefitPlansByVendorIdVariables } from '@dataconnect/generated';
import { useListVendorBenefitPlansByVendorId } from '@dataconnect/generated/react'
export default function ListVendorBenefitPlansByVendorIdComponent() {
// The `useListVendorBenefitPlansByVendorId` Query hook requires an argument of type `ListVendorBenefitPlansByVendorIdVariables`:
const listVendorBenefitPlansByVendorIdVars: ListVendorBenefitPlansByVendorIdVariables = {
vendorId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListVendorBenefitPlansByVendorId(listVendorBenefitPlansByVendorIdVars);
// Variables can be defined inline as well.
const query = useListVendorBenefitPlansByVendorId({ vendorId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListVendorBenefitPlansByVendorId(dataConnect, listVendorBenefitPlansByVendorIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListVendorBenefitPlansByVendorId(listVendorBenefitPlansByVendorIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListVendorBenefitPlansByVendorId(dataConnect, listVendorBenefitPlansByVendorIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.vendorBenefitPlans);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listActiveVendorBenefitPlansByVendorId
You can execute the listActiveVendorBenefitPlansByVendorId Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListActiveVendorBenefitPlansByVendorId(dc: DataConnect, vars: ListActiveVendorBenefitPlansByVendorIdVariables, options?: useDataConnectQueryOptions<ListActiveVendorBenefitPlansByVendorIdData>): UseDataConnectQueryResult<ListActiveVendorBenefitPlansByVendorIdData, ListActiveVendorBenefitPlansByVendorIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListActiveVendorBenefitPlansByVendorId(vars: ListActiveVendorBenefitPlansByVendorIdVariables, options?: useDataConnectQueryOptions<ListActiveVendorBenefitPlansByVendorIdData>): UseDataConnectQueryResult<ListActiveVendorBenefitPlansByVendorIdData, ListActiveVendorBenefitPlansByVendorIdVariables>;
Variables
The listActiveVendorBenefitPlansByVendorId Query requires an argument of type ListActiveVendorBenefitPlansByVendorIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListActiveVendorBenefitPlansByVendorIdVariables {
vendorId: UUIDString;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the listActiveVendorBenefitPlansByVendorId Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the listActiveVendorBenefitPlansByVendorId Query is of type ListActiveVendorBenefitPlansByVendorIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListActiveVendorBenefitPlansByVendorIdData {
vendorBenefitPlans: ({
id: UUIDString;
vendorId: UUIDString;
title: string;
description?: string | null;
requestLabel?: string | null;
total?: number | null;
isActive?: boolean | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
vendor: {
companyName: string;
};
} & VendorBenefitPlan_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listActiveVendorBenefitPlansByVendorId's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListActiveVendorBenefitPlansByVendorIdVariables } from '@dataconnect/generated';
import { useListActiveVendorBenefitPlansByVendorId } from '@dataconnect/generated/react'
export default function ListActiveVendorBenefitPlansByVendorIdComponent() {
// The `useListActiveVendorBenefitPlansByVendorId` Query hook requires an argument of type `ListActiveVendorBenefitPlansByVendorIdVariables`:
const listActiveVendorBenefitPlansByVendorIdVars: ListActiveVendorBenefitPlansByVendorIdVariables = {
vendorId: ...,
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useListActiveVendorBenefitPlansByVendorId(listActiveVendorBenefitPlansByVendorIdVars);
// Variables can be defined inline as well.
const query = useListActiveVendorBenefitPlansByVendorId({ vendorId: ..., offset: ..., limit: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListActiveVendorBenefitPlansByVendorId(dataConnect, listActiveVendorBenefitPlansByVendorIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListActiveVendorBenefitPlansByVendorId(listActiveVendorBenefitPlansByVendorIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListActiveVendorBenefitPlansByVendorId(dataConnect, listActiveVendorBenefitPlansByVendorIdVars, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.vendorBenefitPlans);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterVendorBenefitPlans
You can execute the filterVendorBenefitPlans Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterVendorBenefitPlans(dc: DataConnect, vars?: FilterVendorBenefitPlansVariables, options?: useDataConnectQueryOptions<FilterVendorBenefitPlansData>): UseDataConnectQueryResult<FilterVendorBenefitPlansData, FilterVendorBenefitPlansVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterVendorBenefitPlans(vars?: FilterVendorBenefitPlansVariables, options?: useDataConnectQueryOptions<FilterVendorBenefitPlansData>): UseDataConnectQueryResult<FilterVendorBenefitPlansData, FilterVendorBenefitPlansVariables>;
Variables
The filterVendorBenefitPlans Query has an optional argument of type FilterVendorBenefitPlansVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterVendorBenefitPlansVariables {
vendorId?: UUIDString | null;
title?: string | null;
isActive?: boolean | null;
offset?: number | null;
limit?: number | null;
}
Return Type
Recall that calling the filterVendorBenefitPlans Query hook function returns a UseQueryResult object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things.
To check the status of a Query, use the UseQueryResult.status field. You can also check for pending / success / error status using the UseQueryResult.isPending, UseQueryResult.isSuccess, and UseQueryResult.isError fields.
To access the data returned by a Query, use the UseQueryResult.data field. The data for the filterVendorBenefitPlans Query is of type FilterVendorBenefitPlansData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterVendorBenefitPlansData {
vendorBenefitPlans: ({
id: UUIDString;
vendorId: UUIDString;
title: string;
description?: string | null;
requestLabel?: string | null;
total?: number | null;
isActive?: boolean | null;
createdAt?: TimestampString | null;
updatedAt?: TimestampString | null;
createdBy?: string | null;
vendor: {
companyName: string;
};
} & VendorBenefitPlan_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterVendorBenefitPlans's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterVendorBenefitPlansVariables } from '@dataconnect/generated';
import { useFilterVendorBenefitPlans } from '@dataconnect/generated/react'
export default function FilterVendorBenefitPlansComponent() {
// The `useFilterVendorBenefitPlans` Query hook has an optional argument of type `FilterVendorBenefitPlansVariables`:
const filterVendorBenefitPlansVars: FilterVendorBenefitPlansVariables = {
vendorId: ..., // optional
title: ..., // optional
isActive: ..., // optional
offset: ..., // optional
limit: ..., // optional
};
// You don't have to do anything to "execute" the Query.
// Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query.
const query = useFilterVendorBenefitPlans(filterVendorBenefitPlansVars);
// Variables can be defined inline as well.
const query = useFilterVendorBenefitPlans({ vendorId: ..., title: ..., isActive: ..., offset: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `FilterVendorBenefitPlansVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterVendorBenefitPlans();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterVendorBenefitPlans(dataConnect, filterVendorBenefitPlansVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterVendorBenefitPlans(filterVendorBenefitPlansVars, options);
// If you'd like to provide options without providing any variables, you must
// pass `undefined` where you would normally pass the variables.
const query = useFilterVendorBenefitPlans(undefined, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useFilterVendorBenefitPlans(dataConnect, filterVendorBenefitPlansVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Query.
if (query.isPending) {
return <div>Loading...</div>;
}
if (query.isError) {
return <div>Error: {query.error.message}</div>;
}
// If the Query is successful, you can access the data returned using the `UseQueryResult.data` field.
if (query.isSuccess) {
console.log(query.data.vendorBenefitPlans);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
Mutations
The React generated SDK provides Mutations hook functions that call and return useDataConnectMutation hooks from TanStack Query Firebase.
Calling these hook functions will return a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, and the most recent data returned by the Mutation, among other things. To learn more about these hooks and how to use them, see the TanStack Query Firebase documentation.
Mutation hooks do not execute their Mutations automatically when called. Rather, after calling the Mutation hook function and getting a UseMutationResult object, you must call the UseMutationResult.mutate() function to execute the Mutation.
To learn more about TanStack React Query's Mutations, see the TanStack React Query documentation.
Using Mutation Hooks
Here's a general overview of how to use the generated Mutation hooks in your code:
- Mutation hook functions are not called with the arguments to the Mutation. Instead, arguments are passed to
UseMutationResult.mutate(). - If the Mutation has no variables, the
mutate()function does not require arguments. - If the Mutation has any required variables, the
mutate()function will require at least one argument: an object that contains all the required variables for the Mutation. - If the Mutation has some required and some optional variables, only required variables are necessary in the variables argument object, and optional variables may be provided as well.
- If all of the Mutation's variables are optional, the Mutation hook function does not require any arguments.
- Mutation hook functions can be called with or without passing in a
DataConnectinstance as an argument. If noDataConnectargument is passed in, then the generated SDK will callgetDataConnect(connectorConfig)behind the scenes for you. - Mutation hooks also accept an
optionsargument of typeuseDataConnectMutationOptions. To learn more about theoptionsargument, see the TanStack React Query documentation.UseMutationResult.mutate()also accepts anoptionsargument of typeuseDataConnectMutationOptions.- Special case: If the Mutation has no arguments (or all optional arguments and you wish to provide none), and you want to pass
optionstoUseMutationResult.mutate(), you must passundefinedwhere you would normally pass the Mutation's arguments, and then may provide the options argument.
Below are examples of how to use the example connector's generated Mutation hook functions to execute each Mutation. You can also follow the examples from the Data Connect documentation.
createBenefitsData
You can execute the createBenefitsData Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateBenefitsData(options?: useDataConnectMutationOptions<CreateBenefitsDataData, FirebaseError, CreateBenefitsDataVariables>): UseDataConnectMutationResult<CreateBenefitsDataData, CreateBenefitsDataVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateBenefitsData(dc: DataConnect, options?: useDataConnectMutationOptions<CreateBenefitsDataData, FirebaseError, CreateBenefitsDataVariables>): UseDataConnectMutationResult<CreateBenefitsDataData, CreateBenefitsDataVariables>;
Variables
The createBenefitsData Mutation requires an argument of type CreateBenefitsDataVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateBenefitsDataVariables {
vendorBenefitPlanId: UUIDString;
staffId: UUIDString;
current: number;
}
Return Type
Recall that calling the createBenefitsData Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createBenefitsData Mutation is of type CreateBenefitsDataData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateBenefitsDataData {
benefitsData_insert: BenefitsData_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createBenefitsData's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateBenefitsDataVariables } from '@dataconnect/generated';
import { useCreateBenefitsData } from '@dataconnect/generated/react'
export default function CreateBenefitsDataComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateBenefitsData();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateBenefitsData(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateBenefitsData(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateBenefitsData(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateBenefitsData` Mutation requires an argument of type `CreateBenefitsDataVariables`:
const createBenefitsDataVars: CreateBenefitsDataVariables = {
vendorBenefitPlanId: ...,
staffId: ...,
current: ...,
};
mutation.mutate(createBenefitsDataVars);
// Variables can be defined inline as well.
mutation.mutate({ vendorBenefitPlanId: ..., staffId: ..., current: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createBenefitsDataVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.benefitsData_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateBenefitsData
You can execute the updateBenefitsData Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateBenefitsData(options?: useDataConnectMutationOptions<UpdateBenefitsDataData, FirebaseError, UpdateBenefitsDataVariables>): UseDataConnectMutationResult<UpdateBenefitsDataData, UpdateBenefitsDataVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateBenefitsData(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateBenefitsDataData, FirebaseError, UpdateBenefitsDataVariables>): UseDataConnectMutationResult<UpdateBenefitsDataData, UpdateBenefitsDataVariables>;
Variables
The updateBenefitsData Mutation requires an argument of type UpdateBenefitsDataVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateBenefitsDataVariables {
staffId: UUIDString;
vendorBenefitPlanId: UUIDString;
current?: number | null;
}
Return Type
Recall that calling the updateBenefitsData Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateBenefitsData Mutation is of type UpdateBenefitsDataData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateBenefitsDataData {
benefitsData_update?: BenefitsData_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateBenefitsData's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateBenefitsDataVariables } from '@dataconnect/generated';
import { useUpdateBenefitsData } from '@dataconnect/generated/react'
export default function UpdateBenefitsDataComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateBenefitsData();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateBenefitsData(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateBenefitsData(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateBenefitsData(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateBenefitsData` Mutation requires an argument of type `UpdateBenefitsDataVariables`:
const updateBenefitsDataVars: UpdateBenefitsDataVariables = {
staffId: ...,
vendorBenefitPlanId: ...,
current: ..., // optional
};
mutation.mutate(updateBenefitsDataVars);
// Variables can be defined inline as well.
mutation.mutate({ staffId: ..., vendorBenefitPlanId: ..., current: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateBenefitsDataVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.benefitsData_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteBenefitsData
You can execute the deleteBenefitsData Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteBenefitsData(options?: useDataConnectMutationOptions<DeleteBenefitsDataData, FirebaseError, DeleteBenefitsDataVariables>): UseDataConnectMutationResult<DeleteBenefitsDataData, DeleteBenefitsDataVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteBenefitsData(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteBenefitsDataData, FirebaseError, DeleteBenefitsDataVariables>): UseDataConnectMutationResult<DeleteBenefitsDataData, DeleteBenefitsDataVariables>;
Variables
The deleteBenefitsData Mutation requires an argument of type DeleteBenefitsDataVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteBenefitsDataVariables {
staffId: UUIDString;
vendorBenefitPlanId: UUIDString;
}
Return Type
Recall that calling the deleteBenefitsData Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteBenefitsData Mutation is of type DeleteBenefitsDataData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteBenefitsDataData {
benefitsData_delete?: BenefitsData_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteBenefitsData's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteBenefitsDataVariables } from '@dataconnect/generated';
import { useDeleteBenefitsData } from '@dataconnect/generated/react'
export default function DeleteBenefitsDataComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteBenefitsData();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteBenefitsData(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteBenefitsData(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteBenefitsData(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteBenefitsData` Mutation requires an argument of type `DeleteBenefitsDataVariables`:
const deleteBenefitsDataVars: DeleteBenefitsDataVariables = {
staffId: ...,
vendorBenefitPlanId: ...,
};
mutation.mutate(deleteBenefitsDataVars);
// Variables can be defined inline as well.
mutation.mutate({ staffId: ..., vendorBenefitPlanId: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteBenefitsDataVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.benefitsData_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createStaffDocument
You can execute the createStaffDocument Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateStaffDocument(options?: useDataConnectMutationOptions<CreateStaffDocumentData, FirebaseError, CreateStaffDocumentVariables>): UseDataConnectMutationResult<CreateStaffDocumentData, CreateStaffDocumentVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateStaffDocument(dc: DataConnect, options?: useDataConnectMutationOptions<CreateStaffDocumentData, FirebaseError, CreateStaffDocumentVariables>): UseDataConnectMutationResult<CreateStaffDocumentData, CreateStaffDocumentVariables>;
Variables
The createStaffDocument Mutation requires an argument of type CreateStaffDocumentVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateStaffDocumentVariables {
staffId: UUIDString;
staffName: string;
documentId: UUIDString;
status: DocumentStatus;
documentUrl?: string | null;
expiryDate?: TimestampString | null;
}
Return Type
Recall that calling the createStaffDocument Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createStaffDocument Mutation is of type CreateStaffDocumentData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateStaffDocumentData {
staffDocument_insert: StaffDocument_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createStaffDocument's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateStaffDocumentVariables } from '@dataconnect/generated';
import { useCreateStaffDocument } from '@dataconnect/generated/react'
export default function CreateStaffDocumentComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateStaffDocument();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateStaffDocument(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateStaffDocument(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateStaffDocument(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateStaffDocument` Mutation requires an argument of type `CreateStaffDocumentVariables`:
const createStaffDocumentVars: CreateStaffDocumentVariables = {
staffId: ...,
staffName: ...,
documentId: ...,
status: ...,
documentUrl: ..., // optional
expiryDate: ..., // optional
};
mutation.mutate(createStaffDocumentVars);
// Variables can be defined inline as well.
mutation.mutate({ staffId: ..., staffName: ..., documentId: ..., status: ..., documentUrl: ..., expiryDate: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createStaffDocumentVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.staffDocument_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateStaffDocument
You can execute the updateStaffDocument Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateStaffDocument(options?: useDataConnectMutationOptions<UpdateStaffDocumentData, FirebaseError, UpdateStaffDocumentVariables>): UseDataConnectMutationResult<UpdateStaffDocumentData, UpdateStaffDocumentVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateStaffDocument(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateStaffDocumentData, FirebaseError, UpdateStaffDocumentVariables>): UseDataConnectMutationResult<UpdateStaffDocumentData, UpdateStaffDocumentVariables>;
Variables
The updateStaffDocument Mutation requires an argument of type UpdateStaffDocumentVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateStaffDocumentVariables {
staffId: UUIDString;
documentId: UUIDString;
status?: DocumentStatus | null;
documentUrl?: string | null;
expiryDate?: TimestampString | null;
}
Return Type
Recall that calling the updateStaffDocument Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateStaffDocument Mutation is of type UpdateStaffDocumentData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateStaffDocumentData {
staffDocument_update?: StaffDocument_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateStaffDocument's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateStaffDocumentVariables } from '@dataconnect/generated';
import { useUpdateStaffDocument } from '@dataconnect/generated/react'
export default function UpdateStaffDocumentComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateStaffDocument();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateStaffDocument(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateStaffDocument(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateStaffDocument(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateStaffDocument` Mutation requires an argument of type `UpdateStaffDocumentVariables`:
const updateStaffDocumentVars: UpdateStaffDocumentVariables = {
staffId: ...,
documentId: ...,
status: ..., // optional
documentUrl: ..., // optional
expiryDate: ..., // optional
};
mutation.mutate(updateStaffDocumentVars);
// Variables can be defined inline as well.
mutation.mutate({ staffId: ..., documentId: ..., status: ..., documentUrl: ..., expiryDate: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateStaffDocumentVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.staffDocument_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteStaffDocument
You can execute the deleteStaffDocument Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteStaffDocument(options?: useDataConnectMutationOptions<DeleteStaffDocumentData, FirebaseError, DeleteStaffDocumentVariables>): UseDataConnectMutationResult<DeleteStaffDocumentData, DeleteStaffDocumentVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteStaffDocument(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteStaffDocumentData, FirebaseError, DeleteStaffDocumentVariables>): UseDataConnectMutationResult<DeleteStaffDocumentData, DeleteStaffDocumentVariables>;
Variables
The deleteStaffDocument Mutation requires an argument of type DeleteStaffDocumentVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteStaffDocumentVariables {
staffId: UUIDString;
documentId: UUIDString;
}
Return Type
Recall that calling the deleteStaffDocument Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteStaffDocument Mutation is of type DeleteStaffDocumentData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteStaffDocumentData {
staffDocument_delete?: StaffDocument_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteStaffDocument's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteStaffDocumentVariables } from '@dataconnect/generated';
import { useDeleteStaffDocument } from '@dataconnect/generated/react'
export default function DeleteStaffDocumentComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteStaffDocument();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteStaffDocument(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteStaffDocument(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteStaffDocument(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteStaffDocument` Mutation requires an argument of type `DeleteStaffDocumentVariables`:
const deleteStaffDocumentVars: DeleteStaffDocumentVariables = {
staffId: ...,
documentId: ...,
};
mutation.mutate(deleteStaffDocumentVars);
// Variables can be defined inline as well.
mutation.mutate({ staffId: ..., documentId: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteStaffDocumentVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.staffDocument_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createTeamHudDepartment
You can execute the createTeamHudDepartment Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateTeamHudDepartment(options?: useDataConnectMutationOptions<CreateTeamHudDepartmentData, FirebaseError, CreateTeamHudDepartmentVariables>): UseDataConnectMutationResult<CreateTeamHudDepartmentData, CreateTeamHudDepartmentVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateTeamHudDepartment(dc: DataConnect, options?: useDataConnectMutationOptions<CreateTeamHudDepartmentData, FirebaseError, CreateTeamHudDepartmentVariables>): UseDataConnectMutationResult<CreateTeamHudDepartmentData, CreateTeamHudDepartmentVariables>;
Variables
The createTeamHudDepartment Mutation requires an argument of type CreateTeamHudDepartmentVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateTeamHudDepartmentVariables {
name: string;
costCenter?: string | null;
teamHubId: UUIDString;
}
Return Type
Recall that calling the createTeamHudDepartment Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createTeamHudDepartment Mutation is of type CreateTeamHudDepartmentData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateTeamHudDepartmentData {
teamHudDepartment_insert: TeamHudDepartment_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createTeamHudDepartment's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateTeamHudDepartmentVariables } from '@dataconnect/generated';
import { useCreateTeamHudDepartment } from '@dataconnect/generated/react'
export default function CreateTeamHudDepartmentComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateTeamHudDepartment();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateTeamHudDepartment(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateTeamHudDepartment(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateTeamHudDepartment(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateTeamHudDepartment` Mutation requires an argument of type `CreateTeamHudDepartmentVariables`:
const createTeamHudDepartmentVars: CreateTeamHudDepartmentVariables = {
name: ...,
costCenter: ..., // optional
teamHubId: ...,
};
mutation.mutate(createTeamHudDepartmentVars);
// Variables can be defined inline as well.
mutation.mutate({ name: ..., costCenter: ..., teamHubId: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createTeamHudDepartmentVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.teamHudDepartment_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateTeamHudDepartment
You can execute the updateTeamHudDepartment Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateTeamHudDepartment(options?: useDataConnectMutationOptions<UpdateTeamHudDepartmentData, FirebaseError, UpdateTeamHudDepartmentVariables>): UseDataConnectMutationResult<UpdateTeamHudDepartmentData, UpdateTeamHudDepartmentVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateTeamHudDepartment(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateTeamHudDepartmentData, FirebaseError, UpdateTeamHudDepartmentVariables>): UseDataConnectMutationResult<UpdateTeamHudDepartmentData, UpdateTeamHudDepartmentVariables>;
Variables
The updateTeamHudDepartment Mutation requires an argument of type UpdateTeamHudDepartmentVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateTeamHudDepartmentVariables {
id: UUIDString;
name?: string | null;
costCenter?: string | null;
teamHubId?: UUIDString | null;
}
Return Type
Recall that calling the updateTeamHudDepartment Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateTeamHudDepartment Mutation is of type UpdateTeamHudDepartmentData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateTeamHudDepartmentData {
teamHudDepartment_update?: TeamHudDepartment_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateTeamHudDepartment's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateTeamHudDepartmentVariables } from '@dataconnect/generated';
import { useUpdateTeamHudDepartment } from '@dataconnect/generated/react'
export default function UpdateTeamHudDepartmentComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateTeamHudDepartment();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateTeamHudDepartment(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateTeamHudDepartment(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateTeamHudDepartment(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateTeamHudDepartment` Mutation requires an argument of type `UpdateTeamHudDepartmentVariables`:
const updateTeamHudDepartmentVars: UpdateTeamHudDepartmentVariables = {
id: ...,
name: ..., // optional
costCenter: ..., // optional
teamHubId: ..., // optional
};
mutation.mutate(updateTeamHudDepartmentVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., name: ..., costCenter: ..., teamHubId: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateTeamHudDepartmentVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.teamHudDepartment_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteTeamHudDepartment
You can execute the deleteTeamHudDepartment Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteTeamHudDepartment(options?: useDataConnectMutationOptions<DeleteTeamHudDepartmentData, FirebaseError, DeleteTeamHudDepartmentVariables>): UseDataConnectMutationResult<DeleteTeamHudDepartmentData, DeleteTeamHudDepartmentVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteTeamHudDepartment(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteTeamHudDepartmentData, FirebaseError, DeleteTeamHudDepartmentVariables>): UseDataConnectMutationResult<DeleteTeamHudDepartmentData, DeleteTeamHudDepartmentVariables>;
Variables
The deleteTeamHudDepartment Mutation requires an argument of type DeleteTeamHudDepartmentVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteTeamHudDepartmentVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteTeamHudDepartment Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteTeamHudDepartment Mutation is of type DeleteTeamHudDepartmentData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteTeamHudDepartmentData {
teamHudDepartment_delete?: TeamHudDepartment_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteTeamHudDepartment's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteTeamHudDepartmentVariables } from '@dataconnect/generated';
import { useDeleteTeamHudDepartment } from '@dataconnect/generated/react'
export default function DeleteTeamHudDepartmentComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteTeamHudDepartment();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteTeamHudDepartment(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteTeamHudDepartment(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteTeamHudDepartment(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteTeamHudDepartment` Mutation requires an argument of type `DeleteTeamHudDepartmentVariables`:
const deleteTeamHudDepartmentVars: DeleteTeamHudDepartmentVariables = {
id: ...,
};
mutation.mutate(deleteTeamHudDepartmentVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteTeamHudDepartmentVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.teamHudDepartment_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createMemberTask
You can execute the createMemberTask Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateMemberTask(options?: useDataConnectMutationOptions<CreateMemberTaskData, FirebaseError, CreateMemberTaskVariables>): UseDataConnectMutationResult<CreateMemberTaskData, CreateMemberTaskVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateMemberTask(dc: DataConnect, options?: useDataConnectMutationOptions<CreateMemberTaskData, FirebaseError, CreateMemberTaskVariables>): UseDataConnectMutationResult<CreateMemberTaskData, CreateMemberTaskVariables>;
Variables
The createMemberTask Mutation requires an argument of type CreateMemberTaskVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateMemberTaskVariables {
teamMemberId: UUIDString;
taskId: UUIDString;
}
Return Type
Recall that calling the createMemberTask Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createMemberTask Mutation is of type CreateMemberTaskData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateMemberTaskData {
memberTask_insert: MemberTask_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createMemberTask's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateMemberTaskVariables } from '@dataconnect/generated';
import { useCreateMemberTask } from '@dataconnect/generated/react'
export default function CreateMemberTaskComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateMemberTask();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateMemberTask(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateMemberTask(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateMemberTask(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateMemberTask` Mutation requires an argument of type `CreateMemberTaskVariables`:
const createMemberTaskVars: CreateMemberTaskVariables = {
teamMemberId: ...,
taskId: ...,
};
mutation.mutate(createMemberTaskVars);
// Variables can be defined inline as well.
mutation.mutate({ teamMemberId: ..., taskId: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createMemberTaskVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.memberTask_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteMemberTask
You can execute the deleteMemberTask Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteMemberTask(options?: useDataConnectMutationOptions<DeleteMemberTaskData, FirebaseError, DeleteMemberTaskVariables>): UseDataConnectMutationResult<DeleteMemberTaskData, DeleteMemberTaskVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteMemberTask(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteMemberTaskData, FirebaseError, DeleteMemberTaskVariables>): UseDataConnectMutationResult<DeleteMemberTaskData, DeleteMemberTaskVariables>;
Variables
The deleteMemberTask Mutation requires an argument of type DeleteMemberTaskVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteMemberTaskVariables {
teamMemberId: UUIDString;
taskId: UUIDString;
}
Return Type
Recall that calling the deleteMemberTask Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteMemberTask Mutation is of type DeleteMemberTaskData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteMemberTaskData {
memberTask_delete?: MemberTask_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteMemberTask's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteMemberTaskVariables } from '@dataconnect/generated';
import { useDeleteMemberTask } from '@dataconnect/generated/react'
export default function DeleteMemberTaskComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteMemberTask();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteMemberTask(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteMemberTask(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteMemberTask(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteMemberTask` Mutation requires an argument of type `DeleteMemberTaskVariables`:
const deleteMemberTaskVars: DeleteMemberTaskVariables = {
teamMemberId: ...,
taskId: ...,
};
mutation.mutate(deleteMemberTaskVars);
// Variables can be defined inline as well.
mutation.mutate({ teamMemberId: ..., taskId: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteMemberTaskVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.memberTask_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createTeam
You can execute the createTeam Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateTeam(options?: useDataConnectMutationOptions<CreateTeamData, FirebaseError, CreateTeamVariables>): UseDataConnectMutationResult<CreateTeamData, CreateTeamVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateTeam(dc: DataConnect, options?: useDataConnectMutationOptions<CreateTeamData, FirebaseError, CreateTeamVariables>): UseDataConnectMutationResult<CreateTeamData, CreateTeamVariables>;
Variables
The createTeam Mutation requires an argument of type CreateTeamVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateTeamVariables {
teamName: string;
ownerId: UUIDString;
ownerName: string;
ownerRole: string;
email?: string | null;
companyLogo?: string | null;
totalMembers?: number | null;
activeMembers?: number | null;
totalHubs?: number | null;
departments?: unknown | null;
favoriteStaffCount?: number | null;
blockedStaffCount?: number | null;
favoriteStaff?: unknown | null;
blockedStaff?: unknown | null;
}
Return Type
Recall that calling the createTeam Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createTeam Mutation is of type CreateTeamData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateTeamData {
team_insert: Team_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createTeam's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateTeamVariables } from '@dataconnect/generated';
import { useCreateTeam } from '@dataconnect/generated/react'
export default function CreateTeamComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateTeam();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateTeam(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateTeam(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateTeam(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateTeam` Mutation requires an argument of type `CreateTeamVariables`:
const createTeamVars: CreateTeamVariables = {
teamName: ...,
ownerId: ...,
ownerName: ...,
ownerRole: ...,
email: ..., // optional
companyLogo: ..., // optional
totalMembers: ..., // optional
activeMembers: ..., // optional
totalHubs: ..., // optional
departments: ..., // optional
favoriteStaffCount: ..., // optional
blockedStaffCount: ..., // optional
favoriteStaff: ..., // optional
blockedStaff: ..., // optional
};
mutation.mutate(createTeamVars);
// Variables can be defined inline as well.
mutation.mutate({ teamName: ..., ownerId: ..., ownerName: ..., ownerRole: ..., email: ..., companyLogo: ..., totalMembers: ..., activeMembers: ..., totalHubs: ..., departments: ..., favoriteStaffCount: ..., blockedStaffCount: ..., favoriteStaff: ..., blockedStaff: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createTeamVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.team_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateTeam
You can execute the updateTeam Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateTeam(options?: useDataConnectMutationOptions<UpdateTeamData, FirebaseError, UpdateTeamVariables>): UseDataConnectMutationResult<UpdateTeamData, UpdateTeamVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateTeam(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateTeamData, FirebaseError, UpdateTeamVariables>): UseDataConnectMutationResult<UpdateTeamData, UpdateTeamVariables>;
Variables
The updateTeam Mutation requires an argument of type UpdateTeamVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateTeamVariables {
id: UUIDString;
teamName?: string | null;
ownerName?: string | null;
ownerRole?: string | null;
companyLogo?: string | null;
totalMembers?: number | null;
activeMembers?: number | null;
totalHubs?: number | null;
departments?: unknown | null;
favoriteStaffCount?: number | null;
blockedStaffCount?: number | null;
favoriteStaff?: unknown | null;
blockedStaff?: unknown | null;
}
Return Type
Recall that calling the updateTeam Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateTeam Mutation is of type UpdateTeamData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateTeamData {
team_update?: Team_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateTeam's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateTeamVariables } from '@dataconnect/generated';
import { useUpdateTeam } from '@dataconnect/generated/react'
export default function UpdateTeamComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateTeam();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateTeam(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateTeam(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateTeam(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateTeam` Mutation requires an argument of type `UpdateTeamVariables`:
const updateTeamVars: UpdateTeamVariables = {
id: ...,
teamName: ..., // optional
ownerName: ..., // optional
ownerRole: ..., // optional
companyLogo: ..., // optional
totalMembers: ..., // optional
activeMembers: ..., // optional
totalHubs: ..., // optional
departments: ..., // optional
favoriteStaffCount: ..., // optional
blockedStaffCount: ..., // optional
favoriteStaff: ..., // optional
blockedStaff: ..., // optional
};
mutation.mutate(updateTeamVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., teamName: ..., ownerName: ..., ownerRole: ..., companyLogo: ..., totalMembers: ..., activeMembers: ..., totalHubs: ..., departments: ..., favoriteStaffCount: ..., blockedStaffCount: ..., favoriteStaff: ..., blockedStaff: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateTeamVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.team_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteTeam
You can execute the deleteTeam Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteTeam(options?: useDataConnectMutationOptions<DeleteTeamData, FirebaseError, DeleteTeamVariables>): UseDataConnectMutationResult<DeleteTeamData, DeleteTeamVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteTeam(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteTeamData, FirebaseError, DeleteTeamVariables>): UseDataConnectMutationResult<DeleteTeamData, DeleteTeamVariables>;
Variables
The deleteTeam Mutation requires an argument of type DeleteTeamVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteTeamVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteTeam Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteTeam Mutation is of type DeleteTeamData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteTeamData {
team_delete?: Team_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteTeam's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteTeamVariables } from '@dataconnect/generated';
import { useDeleteTeam } from '@dataconnect/generated/react'
export default function DeleteTeamComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteTeam();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteTeam(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteTeam(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteTeam(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteTeam` Mutation requires an argument of type `DeleteTeamVariables`:
const deleteTeamVars: DeleteTeamVariables = {
id: ...,
};
mutation.mutate(deleteTeamVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteTeamVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.team_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createUserConversation
You can execute the createUserConversation Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateUserConversation(options?: useDataConnectMutationOptions<CreateUserConversationData, FirebaseError, CreateUserConversationVariables>): UseDataConnectMutationResult<CreateUserConversationData, CreateUserConversationVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateUserConversation(dc: DataConnect, options?: useDataConnectMutationOptions<CreateUserConversationData, FirebaseError, CreateUserConversationVariables>): UseDataConnectMutationResult<CreateUserConversationData, CreateUserConversationVariables>;
Variables
The createUserConversation Mutation requires an argument of type CreateUserConversationVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateUserConversationVariables {
conversationId: UUIDString;
userId: string;
unreadCount?: number | null;
lastReadAt?: TimestampString | null;
}
Return Type
Recall that calling the createUserConversation Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createUserConversation Mutation is of type CreateUserConversationData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateUserConversationData {
userConversation_insert: UserConversation_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createUserConversation's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateUserConversationVariables } from '@dataconnect/generated';
import { useCreateUserConversation } from '@dataconnect/generated/react'
export default function CreateUserConversationComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateUserConversation();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateUserConversation(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateUserConversation(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateUserConversation(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateUserConversation` Mutation requires an argument of type `CreateUserConversationVariables`:
const createUserConversationVars: CreateUserConversationVariables = {
conversationId: ...,
userId: ...,
unreadCount: ..., // optional
lastReadAt: ..., // optional
};
mutation.mutate(createUserConversationVars);
// Variables can be defined inline as well.
mutation.mutate({ conversationId: ..., userId: ..., unreadCount: ..., lastReadAt: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createUserConversationVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.userConversation_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateUserConversation
You can execute the updateUserConversation Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateUserConversation(options?: useDataConnectMutationOptions<UpdateUserConversationData, FirebaseError, UpdateUserConversationVariables>): UseDataConnectMutationResult<UpdateUserConversationData, UpdateUserConversationVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateUserConversation(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateUserConversationData, FirebaseError, UpdateUserConversationVariables>): UseDataConnectMutationResult<UpdateUserConversationData, UpdateUserConversationVariables>;
Variables
The updateUserConversation Mutation requires an argument of type UpdateUserConversationVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateUserConversationVariables {
conversationId: UUIDString;
userId: string;
unreadCount?: number | null;
lastReadAt?: TimestampString | null;
}
Return Type
Recall that calling the updateUserConversation Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateUserConversation Mutation is of type UpdateUserConversationData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateUserConversationData {
userConversation_update?: UserConversation_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateUserConversation's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateUserConversationVariables } from '@dataconnect/generated';
import { useUpdateUserConversation } from '@dataconnect/generated/react'
export default function UpdateUserConversationComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateUserConversation();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateUserConversation(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateUserConversation(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateUserConversation(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateUserConversation` Mutation requires an argument of type `UpdateUserConversationVariables`:
const updateUserConversationVars: UpdateUserConversationVariables = {
conversationId: ...,
userId: ...,
unreadCount: ..., // optional
lastReadAt: ..., // optional
};
mutation.mutate(updateUserConversationVars);
// Variables can be defined inline as well.
mutation.mutate({ conversationId: ..., userId: ..., unreadCount: ..., lastReadAt: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateUserConversationVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.userConversation_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
markConversationAsRead
You can execute the markConversationAsRead Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useMarkConversationAsRead(options?: useDataConnectMutationOptions<MarkConversationAsReadData, FirebaseError, MarkConversationAsReadVariables>): UseDataConnectMutationResult<MarkConversationAsReadData, MarkConversationAsReadVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useMarkConversationAsRead(dc: DataConnect, options?: useDataConnectMutationOptions<MarkConversationAsReadData, FirebaseError, MarkConversationAsReadVariables>): UseDataConnectMutationResult<MarkConversationAsReadData, MarkConversationAsReadVariables>;
Variables
The markConversationAsRead Mutation requires an argument of type MarkConversationAsReadVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface MarkConversationAsReadVariables {
conversationId: UUIDString;
userId: string;
lastReadAt?: TimestampString | null;
}
Return Type
Recall that calling the markConversationAsRead Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the markConversationAsRead Mutation is of type MarkConversationAsReadData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface MarkConversationAsReadData {
userConversation_update?: UserConversation_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using markConversationAsRead's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, MarkConversationAsReadVariables } from '@dataconnect/generated';
import { useMarkConversationAsRead } from '@dataconnect/generated/react'
export default function MarkConversationAsReadComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useMarkConversationAsRead();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useMarkConversationAsRead(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useMarkConversationAsRead(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useMarkConversationAsRead(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useMarkConversationAsRead` Mutation requires an argument of type `MarkConversationAsReadVariables`:
const markConversationAsReadVars: MarkConversationAsReadVariables = {
conversationId: ...,
userId: ...,
lastReadAt: ..., // optional
};
mutation.mutate(markConversationAsReadVars);
// Variables can be defined inline as well.
mutation.mutate({ conversationId: ..., userId: ..., lastReadAt: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(markConversationAsReadVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.userConversation_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
incrementUnreadForUser
You can execute the incrementUnreadForUser Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useIncrementUnreadForUser(options?: useDataConnectMutationOptions<IncrementUnreadForUserData, FirebaseError, IncrementUnreadForUserVariables>): UseDataConnectMutationResult<IncrementUnreadForUserData, IncrementUnreadForUserVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useIncrementUnreadForUser(dc: DataConnect, options?: useDataConnectMutationOptions<IncrementUnreadForUserData, FirebaseError, IncrementUnreadForUserVariables>): UseDataConnectMutationResult<IncrementUnreadForUserData, IncrementUnreadForUserVariables>;
Variables
The incrementUnreadForUser Mutation requires an argument of type IncrementUnreadForUserVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface IncrementUnreadForUserVariables {
conversationId: UUIDString;
userId: string;
unreadCount: number;
}
Return Type
Recall that calling the incrementUnreadForUser Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the incrementUnreadForUser Mutation is of type IncrementUnreadForUserData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface IncrementUnreadForUserData {
userConversation_update?: UserConversation_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using incrementUnreadForUser's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, IncrementUnreadForUserVariables } from '@dataconnect/generated';
import { useIncrementUnreadForUser } from '@dataconnect/generated/react'
export default function IncrementUnreadForUserComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useIncrementUnreadForUser();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useIncrementUnreadForUser(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useIncrementUnreadForUser(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useIncrementUnreadForUser(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useIncrementUnreadForUser` Mutation requires an argument of type `IncrementUnreadForUserVariables`:
const incrementUnreadForUserVars: IncrementUnreadForUserVariables = {
conversationId: ...,
userId: ...,
unreadCount: ...,
};
mutation.mutate(incrementUnreadForUserVars);
// Variables can be defined inline as well.
mutation.mutate({ conversationId: ..., userId: ..., unreadCount: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(incrementUnreadForUserVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.userConversation_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteUserConversation
You can execute the deleteUserConversation Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteUserConversation(options?: useDataConnectMutationOptions<DeleteUserConversationData, FirebaseError, DeleteUserConversationVariables>): UseDataConnectMutationResult<DeleteUserConversationData, DeleteUserConversationVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteUserConversation(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteUserConversationData, FirebaseError, DeleteUserConversationVariables>): UseDataConnectMutationResult<DeleteUserConversationData, DeleteUserConversationVariables>;
Variables
The deleteUserConversation Mutation requires an argument of type DeleteUserConversationVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteUserConversationVariables {
conversationId: UUIDString;
userId: string;
}
Return Type
Recall that calling the deleteUserConversation Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteUserConversation Mutation is of type DeleteUserConversationData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteUserConversationData {
userConversation_delete?: UserConversation_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteUserConversation's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteUserConversationVariables } from '@dataconnect/generated';
import { useDeleteUserConversation } from '@dataconnect/generated/react'
export default function DeleteUserConversationComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteUserConversation();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteUserConversation(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteUserConversation(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteUserConversation(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteUserConversation` Mutation requires an argument of type `DeleteUserConversationVariables`:
const deleteUserConversationVars: DeleteUserConversationVariables = {
conversationId: ...,
userId: ...,
};
mutation.mutate(deleteUserConversationVars);
// Variables can be defined inline as well.
mutation.mutate({ conversationId: ..., userId: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteUserConversationVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.userConversation_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createAttireOption
You can execute the createAttireOption Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateAttireOption(options?: useDataConnectMutationOptions<CreateAttireOptionData, FirebaseError, CreateAttireOptionVariables>): UseDataConnectMutationResult<CreateAttireOptionData, CreateAttireOptionVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateAttireOption(dc: DataConnect, options?: useDataConnectMutationOptions<CreateAttireOptionData, FirebaseError, CreateAttireOptionVariables>): UseDataConnectMutationResult<CreateAttireOptionData, CreateAttireOptionVariables>;
Variables
The createAttireOption Mutation requires an argument of type CreateAttireOptionVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateAttireOptionVariables {
itemId: string;
label: string;
icon?: string | null;
imageUrl?: string | null;
isMandatory?: boolean | null;
vendorId?: UUIDString | null;
}
Return Type
Recall that calling the createAttireOption Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createAttireOption Mutation is of type CreateAttireOptionData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateAttireOptionData {
attireOption_insert: AttireOption_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createAttireOption's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateAttireOptionVariables } from '@dataconnect/generated';
import { useCreateAttireOption } from '@dataconnect/generated/react'
export default function CreateAttireOptionComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateAttireOption();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateAttireOption(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateAttireOption(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateAttireOption(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateAttireOption` Mutation requires an argument of type `CreateAttireOptionVariables`:
const createAttireOptionVars: CreateAttireOptionVariables = {
itemId: ...,
label: ...,
icon: ..., // optional
imageUrl: ..., // optional
isMandatory: ..., // optional
vendorId: ..., // optional
};
mutation.mutate(createAttireOptionVars);
// Variables can be defined inline as well.
mutation.mutate({ itemId: ..., label: ..., icon: ..., imageUrl: ..., isMandatory: ..., vendorId: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createAttireOptionVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.attireOption_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateAttireOption
You can execute the updateAttireOption Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateAttireOption(options?: useDataConnectMutationOptions<UpdateAttireOptionData, FirebaseError, UpdateAttireOptionVariables>): UseDataConnectMutationResult<UpdateAttireOptionData, UpdateAttireOptionVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateAttireOption(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateAttireOptionData, FirebaseError, UpdateAttireOptionVariables>): UseDataConnectMutationResult<UpdateAttireOptionData, UpdateAttireOptionVariables>;
Variables
The updateAttireOption Mutation requires an argument of type UpdateAttireOptionVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateAttireOptionVariables {
id: UUIDString;
itemId?: string | null;
label?: string | null;
icon?: string | null;
imageUrl?: string | null;
isMandatory?: boolean | null;
vendorId?: UUIDString | null;
}
Return Type
Recall that calling the updateAttireOption Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateAttireOption Mutation is of type UpdateAttireOptionData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateAttireOptionData {
attireOption_update?: AttireOption_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateAttireOption's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateAttireOptionVariables } from '@dataconnect/generated';
import { useUpdateAttireOption } from '@dataconnect/generated/react'
export default function UpdateAttireOptionComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateAttireOption();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateAttireOption(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateAttireOption(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateAttireOption(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateAttireOption` Mutation requires an argument of type `UpdateAttireOptionVariables`:
const updateAttireOptionVars: UpdateAttireOptionVariables = {
id: ...,
itemId: ..., // optional
label: ..., // optional
icon: ..., // optional
imageUrl: ..., // optional
isMandatory: ..., // optional
vendorId: ..., // optional
};
mutation.mutate(updateAttireOptionVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., itemId: ..., label: ..., icon: ..., imageUrl: ..., isMandatory: ..., vendorId: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateAttireOptionVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.attireOption_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteAttireOption
You can execute the deleteAttireOption Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteAttireOption(options?: useDataConnectMutationOptions<DeleteAttireOptionData, FirebaseError, DeleteAttireOptionVariables>): UseDataConnectMutationResult<DeleteAttireOptionData, DeleteAttireOptionVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteAttireOption(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteAttireOptionData, FirebaseError, DeleteAttireOptionVariables>): UseDataConnectMutationResult<DeleteAttireOptionData, DeleteAttireOptionVariables>;
Variables
The deleteAttireOption Mutation requires an argument of type DeleteAttireOptionVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteAttireOptionVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteAttireOption Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteAttireOption Mutation is of type DeleteAttireOptionData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteAttireOptionData {
attireOption_delete?: AttireOption_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteAttireOption's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteAttireOptionVariables } from '@dataconnect/generated';
import { useDeleteAttireOption } from '@dataconnect/generated/react'
export default function DeleteAttireOptionComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteAttireOption();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteAttireOption(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteAttireOption(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteAttireOption(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteAttireOption` Mutation requires an argument of type `DeleteAttireOptionVariables`:
const deleteAttireOptionVars: DeleteAttireOptionVariables = {
id: ...,
};
mutation.mutate(deleteAttireOptionVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteAttireOptionVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.attireOption_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createCourse
You can execute the createCourse Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateCourse(options?: useDataConnectMutationOptions<CreateCourseData, FirebaseError, CreateCourseVariables>): UseDataConnectMutationResult<CreateCourseData, CreateCourseVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateCourse(dc: DataConnect, options?: useDataConnectMutationOptions<CreateCourseData, FirebaseError, CreateCourseVariables>): UseDataConnectMutationResult<CreateCourseData, CreateCourseVariables>;
Variables
The createCourse Mutation requires an argument of type CreateCourseVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateCourseVariables {
title?: string | null;
description?: string | null;
thumbnailUrl?: string | null;
durationMinutes?: number | null;
xpReward?: number | null;
categoryId: UUIDString;
levelRequired?: string | null;
isCertification?: boolean | null;
}
Return Type
Recall that calling the createCourse Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createCourse Mutation is of type CreateCourseData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateCourseData {
course_insert: Course_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createCourse's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateCourseVariables } from '@dataconnect/generated';
import { useCreateCourse } from '@dataconnect/generated/react'
export default function CreateCourseComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateCourse();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateCourse(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateCourse(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateCourse(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateCourse` Mutation requires an argument of type `CreateCourseVariables`:
const createCourseVars: CreateCourseVariables = {
title: ..., // optional
description: ..., // optional
thumbnailUrl: ..., // optional
durationMinutes: ..., // optional
xpReward: ..., // optional
categoryId: ...,
levelRequired: ..., // optional
isCertification: ..., // optional
};
mutation.mutate(createCourseVars);
// Variables can be defined inline as well.
mutation.mutate({ title: ..., description: ..., thumbnailUrl: ..., durationMinutes: ..., xpReward: ..., categoryId: ..., levelRequired: ..., isCertification: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createCourseVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.course_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateCourse
You can execute the updateCourse Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateCourse(options?: useDataConnectMutationOptions<UpdateCourseData, FirebaseError, UpdateCourseVariables>): UseDataConnectMutationResult<UpdateCourseData, UpdateCourseVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateCourse(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateCourseData, FirebaseError, UpdateCourseVariables>): UseDataConnectMutationResult<UpdateCourseData, UpdateCourseVariables>;
Variables
The updateCourse Mutation requires an argument of type UpdateCourseVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateCourseVariables {
id: UUIDString;
title?: string | null;
description?: string | null;
thumbnailUrl?: string | null;
durationMinutes?: number | null;
xpReward?: number | null;
categoryId: UUIDString;
levelRequired?: string | null;
isCertification?: boolean | null;
}
Return Type
Recall that calling the updateCourse Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateCourse Mutation is of type UpdateCourseData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateCourseData {
course_update?: Course_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateCourse's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateCourseVariables } from '@dataconnect/generated';
import { useUpdateCourse } from '@dataconnect/generated/react'
export default function UpdateCourseComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateCourse();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateCourse(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateCourse(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateCourse(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateCourse` Mutation requires an argument of type `UpdateCourseVariables`:
const updateCourseVars: UpdateCourseVariables = {
id: ...,
title: ..., // optional
description: ..., // optional
thumbnailUrl: ..., // optional
durationMinutes: ..., // optional
xpReward: ..., // optional
categoryId: ...,
levelRequired: ..., // optional
isCertification: ..., // optional
};
mutation.mutate(updateCourseVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., title: ..., description: ..., thumbnailUrl: ..., durationMinutes: ..., xpReward: ..., categoryId: ..., levelRequired: ..., isCertification: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateCourseVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.course_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteCourse
You can execute the deleteCourse Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteCourse(options?: useDataConnectMutationOptions<DeleteCourseData, FirebaseError, DeleteCourseVariables>): UseDataConnectMutationResult<DeleteCourseData, DeleteCourseVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteCourse(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteCourseData, FirebaseError, DeleteCourseVariables>): UseDataConnectMutationResult<DeleteCourseData, DeleteCourseVariables>;
Variables
The deleteCourse Mutation requires an argument of type DeleteCourseVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteCourseVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteCourse Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteCourse Mutation is of type DeleteCourseData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteCourseData {
course_delete?: Course_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteCourse's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteCourseVariables } from '@dataconnect/generated';
import { useDeleteCourse } from '@dataconnect/generated/react'
export default function DeleteCourseComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteCourse();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteCourse(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteCourse(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteCourse(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteCourse` Mutation requires an argument of type `DeleteCourseVariables`:
const deleteCourseVars: DeleteCourseVariables = {
id: ...,
};
mutation.mutate(deleteCourseVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteCourseVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.course_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createEmergencyContact
You can execute the createEmergencyContact Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateEmergencyContact(options?: useDataConnectMutationOptions<CreateEmergencyContactData, FirebaseError, CreateEmergencyContactVariables>): UseDataConnectMutationResult<CreateEmergencyContactData, CreateEmergencyContactVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateEmergencyContact(dc: DataConnect, options?: useDataConnectMutationOptions<CreateEmergencyContactData, FirebaseError, CreateEmergencyContactVariables>): UseDataConnectMutationResult<CreateEmergencyContactData, CreateEmergencyContactVariables>;
Variables
The createEmergencyContact Mutation requires an argument of type CreateEmergencyContactVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateEmergencyContactVariables {
name: string;
phone: string;
relationship: RelationshipType;
staffId: UUIDString;
}
Return Type
Recall that calling the createEmergencyContact Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createEmergencyContact Mutation is of type CreateEmergencyContactData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateEmergencyContactData {
emergencyContact_insert: EmergencyContact_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createEmergencyContact's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateEmergencyContactVariables } from '@dataconnect/generated';
import { useCreateEmergencyContact } from '@dataconnect/generated/react'
export default function CreateEmergencyContactComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateEmergencyContact();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateEmergencyContact(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateEmergencyContact(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateEmergencyContact(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateEmergencyContact` Mutation requires an argument of type `CreateEmergencyContactVariables`:
const createEmergencyContactVars: CreateEmergencyContactVariables = {
name: ...,
phone: ...,
relationship: ...,
staffId: ...,
};
mutation.mutate(createEmergencyContactVars);
// Variables can be defined inline as well.
mutation.mutate({ name: ..., phone: ..., relationship: ..., staffId: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createEmergencyContactVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.emergencyContact_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateEmergencyContact
You can execute the updateEmergencyContact Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateEmergencyContact(options?: useDataConnectMutationOptions<UpdateEmergencyContactData, FirebaseError, UpdateEmergencyContactVariables>): UseDataConnectMutationResult<UpdateEmergencyContactData, UpdateEmergencyContactVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateEmergencyContact(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateEmergencyContactData, FirebaseError, UpdateEmergencyContactVariables>): UseDataConnectMutationResult<UpdateEmergencyContactData, UpdateEmergencyContactVariables>;
Variables
The updateEmergencyContact Mutation requires an argument of type UpdateEmergencyContactVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateEmergencyContactVariables {
id: UUIDString;
name?: string | null;
phone?: string | null;
relationship?: RelationshipType | null;
}
Return Type
Recall that calling the updateEmergencyContact Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateEmergencyContact Mutation is of type UpdateEmergencyContactData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateEmergencyContactData {
emergencyContact_update?: EmergencyContact_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateEmergencyContact's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateEmergencyContactVariables } from '@dataconnect/generated';
import { useUpdateEmergencyContact } from '@dataconnect/generated/react'
export default function UpdateEmergencyContactComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateEmergencyContact();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateEmergencyContact(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateEmergencyContact(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateEmergencyContact(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateEmergencyContact` Mutation requires an argument of type `UpdateEmergencyContactVariables`:
const updateEmergencyContactVars: UpdateEmergencyContactVariables = {
id: ...,
name: ..., // optional
phone: ..., // optional
relationship: ..., // optional
};
mutation.mutate(updateEmergencyContactVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., name: ..., phone: ..., relationship: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateEmergencyContactVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.emergencyContact_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteEmergencyContact
You can execute the deleteEmergencyContact Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteEmergencyContact(options?: useDataConnectMutationOptions<DeleteEmergencyContactData, FirebaseError, DeleteEmergencyContactVariables>): UseDataConnectMutationResult<DeleteEmergencyContactData, DeleteEmergencyContactVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteEmergencyContact(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteEmergencyContactData, FirebaseError, DeleteEmergencyContactVariables>): UseDataConnectMutationResult<DeleteEmergencyContactData, DeleteEmergencyContactVariables>;
Variables
The deleteEmergencyContact Mutation requires an argument of type DeleteEmergencyContactVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteEmergencyContactVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteEmergencyContact Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteEmergencyContact Mutation is of type DeleteEmergencyContactData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteEmergencyContactData {
emergencyContact_delete?: EmergencyContact_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteEmergencyContact's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteEmergencyContactVariables } from '@dataconnect/generated';
import { useDeleteEmergencyContact } from '@dataconnect/generated/react'
export default function DeleteEmergencyContactComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteEmergencyContact();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteEmergencyContact(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteEmergencyContact(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteEmergencyContact(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteEmergencyContact` Mutation requires an argument of type `DeleteEmergencyContactVariables`:
const deleteEmergencyContactVars: DeleteEmergencyContactVariables = {
id: ...,
};
mutation.mutate(deleteEmergencyContactVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteEmergencyContactVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.emergencyContact_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createStaffCourse
You can execute the createStaffCourse Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateStaffCourse(options?: useDataConnectMutationOptions<CreateStaffCourseData, FirebaseError, CreateStaffCourseVariables>): UseDataConnectMutationResult<CreateStaffCourseData, CreateStaffCourseVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateStaffCourse(dc: DataConnect, options?: useDataConnectMutationOptions<CreateStaffCourseData, FirebaseError, CreateStaffCourseVariables>): UseDataConnectMutationResult<CreateStaffCourseData, CreateStaffCourseVariables>;
Variables
The createStaffCourse Mutation requires an argument of type CreateStaffCourseVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateStaffCourseVariables {
staffId: UUIDString;
courseId: UUIDString;
progressPercent?: number | null;
completed?: boolean | null;
completedAt?: TimestampString | null;
startedAt?: TimestampString | null;
lastAccessedAt?: TimestampString | null;
}
Return Type
Recall that calling the createStaffCourse Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createStaffCourse Mutation is of type CreateStaffCourseData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateStaffCourseData {
staffCourse_insert: StaffCourse_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createStaffCourse's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateStaffCourseVariables } from '@dataconnect/generated';
import { useCreateStaffCourse } from '@dataconnect/generated/react'
export default function CreateStaffCourseComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateStaffCourse();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateStaffCourse(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateStaffCourse(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateStaffCourse(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateStaffCourse` Mutation requires an argument of type `CreateStaffCourseVariables`:
const createStaffCourseVars: CreateStaffCourseVariables = {
staffId: ...,
courseId: ...,
progressPercent: ..., // optional
completed: ..., // optional
completedAt: ..., // optional
startedAt: ..., // optional
lastAccessedAt: ..., // optional
};
mutation.mutate(createStaffCourseVars);
// Variables can be defined inline as well.
mutation.mutate({ staffId: ..., courseId: ..., progressPercent: ..., completed: ..., completedAt: ..., startedAt: ..., lastAccessedAt: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createStaffCourseVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.staffCourse_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateStaffCourse
You can execute the updateStaffCourse Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateStaffCourse(options?: useDataConnectMutationOptions<UpdateStaffCourseData, FirebaseError, UpdateStaffCourseVariables>): UseDataConnectMutationResult<UpdateStaffCourseData, UpdateStaffCourseVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateStaffCourse(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateStaffCourseData, FirebaseError, UpdateStaffCourseVariables>): UseDataConnectMutationResult<UpdateStaffCourseData, UpdateStaffCourseVariables>;
Variables
The updateStaffCourse Mutation requires an argument of type UpdateStaffCourseVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateStaffCourseVariables {
id: UUIDString;
progressPercent?: number | null;
completed?: boolean | null;
completedAt?: TimestampString | null;
startedAt?: TimestampString | null;
lastAccessedAt?: TimestampString | null;
}
Return Type
Recall that calling the updateStaffCourse Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateStaffCourse Mutation is of type UpdateStaffCourseData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateStaffCourseData {
staffCourse_update?: StaffCourse_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateStaffCourse's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateStaffCourseVariables } from '@dataconnect/generated';
import { useUpdateStaffCourse } from '@dataconnect/generated/react'
export default function UpdateStaffCourseComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateStaffCourse();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateStaffCourse(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateStaffCourse(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateStaffCourse(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateStaffCourse` Mutation requires an argument of type `UpdateStaffCourseVariables`:
const updateStaffCourseVars: UpdateStaffCourseVariables = {
id: ...,
progressPercent: ..., // optional
completed: ..., // optional
completedAt: ..., // optional
startedAt: ..., // optional
lastAccessedAt: ..., // optional
};
mutation.mutate(updateStaffCourseVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., progressPercent: ..., completed: ..., completedAt: ..., startedAt: ..., lastAccessedAt: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateStaffCourseVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.staffCourse_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteStaffCourse
You can execute the deleteStaffCourse Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteStaffCourse(options?: useDataConnectMutationOptions<DeleteStaffCourseData, FirebaseError, DeleteStaffCourseVariables>): UseDataConnectMutationResult<DeleteStaffCourseData, DeleteStaffCourseVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteStaffCourse(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteStaffCourseData, FirebaseError, DeleteStaffCourseVariables>): UseDataConnectMutationResult<DeleteStaffCourseData, DeleteStaffCourseVariables>;
Variables
The deleteStaffCourse Mutation requires an argument of type DeleteStaffCourseVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteStaffCourseVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteStaffCourse Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteStaffCourse Mutation is of type DeleteStaffCourseData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteStaffCourseData {
staffCourse_delete?: StaffCourse_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteStaffCourse's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteStaffCourseVariables } from '@dataconnect/generated';
import { useDeleteStaffCourse } from '@dataconnect/generated/react'
export default function DeleteStaffCourseComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteStaffCourse();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteStaffCourse(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteStaffCourse(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteStaffCourse(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteStaffCourse` Mutation requires an argument of type `DeleteStaffCourseVariables`:
const deleteStaffCourseVars: DeleteStaffCourseVariables = {
id: ...,
};
mutation.mutate(deleteStaffCourseVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteStaffCourseVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.staffCourse_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createTask
You can execute the createTask Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateTask(options?: useDataConnectMutationOptions<CreateTaskData, FirebaseError, CreateTaskVariables>): UseDataConnectMutationResult<CreateTaskData, CreateTaskVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateTask(dc: DataConnect, options?: useDataConnectMutationOptions<CreateTaskData, FirebaseError, CreateTaskVariables>): UseDataConnectMutationResult<CreateTaskData, CreateTaskVariables>;
Variables
The createTask Mutation requires an argument of type CreateTaskVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateTaskVariables {
taskName: string;
description?: string | null;
priority: TaskPriority;
status: TaskStatus;
dueDate?: TimestampString | null;
progress?: number | null;
orderIndex?: number | null;
commentCount?: number | null;
attachmentCount?: number | null;
files?: unknown | null;
ownerId: UUIDString;
}
Return Type
Recall that calling the createTask Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createTask Mutation is of type CreateTaskData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateTaskData {
task_insert: Task_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createTask's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateTaskVariables } from '@dataconnect/generated';
import { useCreateTask } from '@dataconnect/generated/react'
export default function CreateTaskComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateTask();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateTask(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateTask(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateTask(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateTask` Mutation requires an argument of type `CreateTaskVariables`:
const createTaskVars: CreateTaskVariables = {
taskName: ...,
description: ..., // optional
priority: ...,
status: ...,
dueDate: ..., // optional
progress: ..., // optional
orderIndex: ..., // optional
commentCount: ..., // optional
attachmentCount: ..., // optional
files: ..., // optional
ownerId: ...,
};
mutation.mutate(createTaskVars);
// Variables can be defined inline as well.
mutation.mutate({ taskName: ..., description: ..., priority: ..., status: ..., dueDate: ..., progress: ..., orderIndex: ..., commentCount: ..., attachmentCount: ..., files: ..., ownerId: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createTaskVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.task_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateTask
You can execute the updateTask Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateTask(options?: useDataConnectMutationOptions<UpdateTaskData, FirebaseError, UpdateTaskVariables>): UseDataConnectMutationResult<UpdateTaskData, UpdateTaskVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateTask(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateTaskData, FirebaseError, UpdateTaskVariables>): UseDataConnectMutationResult<UpdateTaskData, UpdateTaskVariables>;
Variables
The updateTask Mutation requires an argument of type UpdateTaskVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateTaskVariables {
id: UUIDString;
taskName?: string | null;
description?: string | null;
priority?: TaskPriority | null;
status?: TaskStatus | null;
dueDate?: TimestampString | null;
progress?: number | null;
assignedMembers?: unknown | null;
orderIndex?: number | null;
commentCount?: number | null;
attachmentCount?: number | null;
files?: unknown | null;
}
Return Type
Recall that calling the updateTask Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateTask Mutation is of type UpdateTaskData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateTaskData {
task_update?: Task_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateTask's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateTaskVariables } from '@dataconnect/generated';
import { useUpdateTask } from '@dataconnect/generated/react'
export default function UpdateTaskComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateTask();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateTask(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateTask(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateTask(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateTask` Mutation requires an argument of type `UpdateTaskVariables`:
const updateTaskVars: UpdateTaskVariables = {
id: ...,
taskName: ..., // optional
description: ..., // optional
priority: ..., // optional
status: ..., // optional
dueDate: ..., // optional
progress: ..., // optional
assignedMembers: ..., // optional
orderIndex: ..., // optional
commentCount: ..., // optional
attachmentCount: ..., // optional
files: ..., // optional
};
mutation.mutate(updateTaskVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., taskName: ..., description: ..., priority: ..., status: ..., dueDate: ..., progress: ..., assignedMembers: ..., orderIndex: ..., commentCount: ..., attachmentCount: ..., files: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateTaskVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.task_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteTask
You can execute the deleteTask Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteTask(options?: useDataConnectMutationOptions<DeleteTaskData, FirebaseError, DeleteTaskVariables>): UseDataConnectMutationResult<DeleteTaskData, DeleteTaskVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteTask(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteTaskData, FirebaseError, DeleteTaskVariables>): UseDataConnectMutationResult<DeleteTaskData, DeleteTaskVariables>;
Variables
The deleteTask Mutation requires an argument of type DeleteTaskVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteTaskVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteTask Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteTask Mutation is of type DeleteTaskData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteTaskData {
task_delete?: Task_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteTask's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteTaskVariables } from '@dataconnect/generated';
import { useDeleteTask } from '@dataconnect/generated/react'
export default function DeleteTaskComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteTask();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteTask(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteTask(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteTask(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteTask` Mutation requires an argument of type `DeleteTaskVariables`:
const deleteTaskVars: DeleteTaskVariables = {
id: ...,
};
mutation.mutate(deleteTaskVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteTaskVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.task_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
CreateCertificate
You can execute the CreateCertificate Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateCertificate(options?: useDataConnectMutationOptions<CreateCertificateData, FirebaseError, CreateCertificateVariables>): UseDataConnectMutationResult<CreateCertificateData, CreateCertificateVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateCertificate(dc: DataConnect, options?: useDataConnectMutationOptions<CreateCertificateData, FirebaseError, CreateCertificateVariables>): UseDataConnectMutationResult<CreateCertificateData, CreateCertificateVariables>;
Variables
The CreateCertificate Mutation requires an argument of type CreateCertificateVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateCertificateVariables {
name: string;
description?: string | null;
expiry?: TimestampString | null;
status: CertificateStatus;
fileUrl?: string | null;
icon?: string | null;
certificationType?: ComplianceType | null;
issuer?: string | null;
staffId: UUIDString;
validationStatus?: ValidationStatus | null;
certificateNumber?: string | null;
}
Return Type
Recall that calling the CreateCertificate Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the CreateCertificate Mutation is of type CreateCertificateData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateCertificateData {
certificate_insert: Certificate_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using CreateCertificate's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateCertificateVariables } from '@dataconnect/generated';
import { useCreateCertificate } from '@dataconnect/generated/react'
export default function CreateCertificateComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateCertificate();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateCertificate(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateCertificate(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateCertificate(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateCertificate` Mutation requires an argument of type `CreateCertificateVariables`:
const createCertificateVars: CreateCertificateVariables = {
name: ...,
description: ..., // optional
expiry: ..., // optional
status: ...,
fileUrl: ..., // optional
icon: ..., // optional
certificationType: ..., // optional
issuer: ..., // optional
staffId: ...,
validationStatus: ..., // optional
certificateNumber: ..., // optional
};
mutation.mutate(createCertificateVars);
// Variables can be defined inline as well.
mutation.mutate({ name: ..., description: ..., expiry: ..., status: ..., fileUrl: ..., icon: ..., certificationType: ..., issuer: ..., staffId: ..., validationStatus: ..., certificateNumber: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createCertificateVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.certificate_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
UpdateCertificate
You can execute the UpdateCertificate Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateCertificate(options?: useDataConnectMutationOptions<UpdateCertificateData, FirebaseError, UpdateCertificateVariables>): UseDataConnectMutationResult<UpdateCertificateData, UpdateCertificateVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateCertificate(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateCertificateData, FirebaseError, UpdateCertificateVariables>): UseDataConnectMutationResult<UpdateCertificateData, UpdateCertificateVariables>;
Variables
The UpdateCertificate Mutation requires an argument of type UpdateCertificateVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateCertificateVariables {
id: UUIDString;
name?: string | null;
description?: string | null;
expiry?: TimestampString | null;
status?: CertificateStatus | null;
fileUrl?: string | null;
icon?: string | null;
staffId?: UUIDString | null;
certificationType?: ComplianceType | null;
issuer?: string | null;
validationStatus?: ValidationStatus | null;
certificateNumber?: string | null;
}
Return Type
Recall that calling the UpdateCertificate Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the UpdateCertificate Mutation is of type UpdateCertificateData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateCertificateData {
certificate_update?: Certificate_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using UpdateCertificate's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateCertificateVariables } from '@dataconnect/generated';
import { useUpdateCertificate } from '@dataconnect/generated/react'
export default function UpdateCertificateComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateCertificate();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateCertificate(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateCertificate(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateCertificate(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateCertificate` Mutation requires an argument of type `UpdateCertificateVariables`:
const updateCertificateVars: UpdateCertificateVariables = {
id: ...,
name: ..., // optional
description: ..., // optional
expiry: ..., // optional
status: ..., // optional
fileUrl: ..., // optional
icon: ..., // optional
staffId: ..., // optional
certificationType: ..., // optional
issuer: ..., // optional
validationStatus: ..., // optional
certificateNumber: ..., // optional
};
mutation.mutate(updateCertificateVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., name: ..., description: ..., expiry: ..., status: ..., fileUrl: ..., icon: ..., staffId: ..., certificationType: ..., issuer: ..., validationStatus: ..., certificateNumber: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateCertificateVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.certificate_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
DeleteCertificate
You can execute the DeleteCertificate Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteCertificate(options?: useDataConnectMutationOptions<DeleteCertificateData, FirebaseError, DeleteCertificateVariables>): UseDataConnectMutationResult<DeleteCertificateData, DeleteCertificateVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteCertificate(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteCertificateData, FirebaseError, DeleteCertificateVariables>): UseDataConnectMutationResult<DeleteCertificateData, DeleteCertificateVariables>;
Variables
The DeleteCertificate Mutation requires an argument of type DeleteCertificateVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteCertificateVariables {
id: UUIDString;
}
Return Type
Recall that calling the DeleteCertificate Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the DeleteCertificate Mutation is of type DeleteCertificateData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteCertificateData {
certificate_delete?: Certificate_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using DeleteCertificate's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteCertificateVariables } from '@dataconnect/generated';
import { useDeleteCertificate } from '@dataconnect/generated/react'
export default function DeleteCertificateComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteCertificate();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteCertificate(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteCertificate(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteCertificate(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteCertificate` Mutation requires an argument of type `DeleteCertificateVariables`:
const deleteCertificateVars: DeleteCertificateVariables = {
id: ...,
};
mutation.mutate(deleteCertificateVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteCertificateVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.certificate_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createRole
You can execute the createRole Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateRole(options?: useDataConnectMutationOptions<CreateRoleData, FirebaseError, CreateRoleVariables>): UseDataConnectMutationResult<CreateRoleData, CreateRoleVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateRole(dc: DataConnect, options?: useDataConnectMutationOptions<CreateRoleData, FirebaseError, CreateRoleVariables>): UseDataConnectMutationResult<CreateRoleData, CreateRoleVariables>;
Variables
The createRole Mutation requires an argument of type CreateRoleVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateRoleVariables {
name: string;
costPerHour: number;
vendorId: UUIDString;
roleCategoryId: UUIDString;
}
Return Type
Recall that calling the createRole Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createRole Mutation is of type CreateRoleData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateRoleData {
role_insert: Role_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createRole's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateRoleVariables } from '@dataconnect/generated';
import { useCreateRole } from '@dataconnect/generated/react'
export default function CreateRoleComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateRole();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateRole(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateRole(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateRole(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateRole` Mutation requires an argument of type `CreateRoleVariables`:
const createRoleVars: CreateRoleVariables = {
name: ...,
costPerHour: ...,
vendorId: ...,
roleCategoryId: ...,
};
mutation.mutate(createRoleVars);
// Variables can be defined inline as well.
mutation.mutate({ name: ..., costPerHour: ..., vendorId: ..., roleCategoryId: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createRoleVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.role_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateRole
You can execute the updateRole Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateRole(options?: useDataConnectMutationOptions<UpdateRoleData, FirebaseError, UpdateRoleVariables>): UseDataConnectMutationResult<UpdateRoleData, UpdateRoleVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateRole(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateRoleData, FirebaseError, UpdateRoleVariables>): UseDataConnectMutationResult<UpdateRoleData, UpdateRoleVariables>;
Variables
The updateRole Mutation requires an argument of type UpdateRoleVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateRoleVariables {
id: UUIDString;
name?: string | null;
costPerHour?: number | null;
roleCategoryId: UUIDString;
}
Return Type
Recall that calling the updateRole Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateRole Mutation is of type UpdateRoleData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateRoleData {
role_update?: Role_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateRole's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateRoleVariables } from '@dataconnect/generated';
import { useUpdateRole } from '@dataconnect/generated/react'
export default function UpdateRoleComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateRole();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateRole(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateRole(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateRole(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateRole` Mutation requires an argument of type `UpdateRoleVariables`:
const updateRoleVars: UpdateRoleVariables = {
id: ...,
name: ..., // optional
costPerHour: ..., // optional
roleCategoryId: ...,
};
mutation.mutate(updateRoleVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., name: ..., costPerHour: ..., roleCategoryId: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateRoleVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.role_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteRole
You can execute the deleteRole Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteRole(options?: useDataConnectMutationOptions<DeleteRoleData, FirebaseError, DeleteRoleVariables>): UseDataConnectMutationResult<DeleteRoleData, DeleteRoleVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteRole(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteRoleData, FirebaseError, DeleteRoleVariables>): UseDataConnectMutationResult<DeleteRoleData, DeleteRoleVariables>;
Variables
The deleteRole Mutation requires an argument of type DeleteRoleVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteRoleVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteRole Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteRole Mutation is of type DeleteRoleData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteRoleData {
role_delete?: Role_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteRole's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteRoleVariables } from '@dataconnect/generated';
import { useDeleteRole } from '@dataconnect/generated/react'
export default function DeleteRoleComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteRole();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteRole(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteRole(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteRole(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteRole` Mutation requires an argument of type `DeleteRoleVariables`:
const deleteRoleVars: DeleteRoleVariables = {
id: ...,
};
mutation.mutate(deleteRoleVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteRoleVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.role_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createClientFeedback
You can execute the createClientFeedback Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateClientFeedback(options?: useDataConnectMutationOptions<CreateClientFeedbackData, FirebaseError, CreateClientFeedbackVariables>): UseDataConnectMutationResult<CreateClientFeedbackData, CreateClientFeedbackVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateClientFeedback(dc: DataConnect, options?: useDataConnectMutationOptions<CreateClientFeedbackData, FirebaseError, CreateClientFeedbackVariables>): UseDataConnectMutationResult<CreateClientFeedbackData, CreateClientFeedbackVariables>;
Variables
The createClientFeedback Mutation requires an argument of type CreateClientFeedbackVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateClientFeedbackVariables {
businessId: UUIDString;
vendorId: UUIDString;
rating?: number | null;
comment?: string | null;
date?: TimestampString | null;
createdBy?: string | null;
}
Return Type
Recall that calling the createClientFeedback Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createClientFeedback Mutation is of type CreateClientFeedbackData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateClientFeedbackData {
clientFeedback_insert: ClientFeedback_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createClientFeedback's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateClientFeedbackVariables } from '@dataconnect/generated';
import { useCreateClientFeedback } from '@dataconnect/generated/react'
export default function CreateClientFeedbackComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateClientFeedback();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateClientFeedback(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateClientFeedback(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateClientFeedback(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateClientFeedback` Mutation requires an argument of type `CreateClientFeedbackVariables`:
const createClientFeedbackVars: CreateClientFeedbackVariables = {
businessId: ...,
vendorId: ...,
rating: ..., // optional
comment: ..., // optional
date: ..., // optional
createdBy: ..., // optional
};
mutation.mutate(createClientFeedbackVars);
// Variables can be defined inline as well.
mutation.mutate({ businessId: ..., vendorId: ..., rating: ..., comment: ..., date: ..., createdBy: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createClientFeedbackVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.clientFeedback_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateClientFeedback
You can execute the updateClientFeedback Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateClientFeedback(options?: useDataConnectMutationOptions<UpdateClientFeedbackData, FirebaseError, UpdateClientFeedbackVariables>): UseDataConnectMutationResult<UpdateClientFeedbackData, UpdateClientFeedbackVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateClientFeedback(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateClientFeedbackData, FirebaseError, UpdateClientFeedbackVariables>): UseDataConnectMutationResult<UpdateClientFeedbackData, UpdateClientFeedbackVariables>;
Variables
The updateClientFeedback Mutation requires an argument of type UpdateClientFeedbackVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateClientFeedbackVariables {
id: UUIDString;
businessId?: UUIDString | null;
vendorId?: UUIDString | null;
rating?: number | null;
comment?: string | null;
date?: TimestampString | null;
createdBy?: string | null;
}
Return Type
Recall that calling the updateClientFeedback Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateClientFeedback Mutation is of type UpdateClientFeedbackData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateClientFeedbackData {
clientFeedback_update?: ClientFeedback_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateClientFeedback's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateClientFeedbackVariables } from '@dataconnect/generated';
import { useUpdateClientFeedback } from '@dataconnect/generated/react'
export default function UpdateClientFeedbackComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateClientFeedback();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateClientFeedback(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateClientFeedback(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateClientFeedback(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateClientFeedback` Mutation requires an argument of type `UpdateClientFeedbackVariables`:
const updateClientFeedbackVars: UpdateClientFeedbackVariables = {
id: ...,
businessId: ..., // optional
vendorId: ..., // optional
rating: ..., // optional
comment: ..., // optional
date: ..., // optional
createdBy: ..., // optional
};
mutation.mutate(updateClientFeedbackVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., businessId: ..., vendorId: ..., rating: ..., comment: ..., date: ..., createdBy: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateClientFeedbackVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.clientFeedback_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteClientFeedback
You can execute the deleteClientFeedback Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteClientFeedback(options?: useDataConnectMutationOptions<DeleteClientFeedbackData, FirebaseError, DeleteClientFeedbackVariables>): UseDataConnectMutationResult<DeleteClientFeedbackData, DeleteClientFeedbackVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteClientFeedback(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteClientFeedbackData, FirebaseError, DeleteClientFeedbackVariables>): UseDataConnectMutationResult<DeleteClientFeedbackData, DeleteClientFeedbackVariables>;
Variables
The deleteClientFeedback Mutation requires an argument of type DeleteClientFeedbackVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteClientFeedbackVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteClientFeedback Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteClientFeedback Mutation is of type DeleteClientFeedbackData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteClientFeedbackData {
clientFeedback_delete?: ClientFeedback_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteClientFeedback's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteClientFeedbackVariables } from '@dataconnect/generated';
import { useDeleteClientFeedback } from '@dataconnect/generated/react'
export default function DeleteClientFeedbackComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteClientFeedback();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteClientFeedback(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteClientFeedback(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteClientFeedback(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteClientFeedback` Mutation requires an argument of type `DeleteClientFeedbackVariables`:
const deleteClientFeedbackVars: DeleteClientFeedbackVariables = {
id: ...,
};
mutation.mutate(deleteClientFeedbackVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteClientFeedbackVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.clientFeedback_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createBusiness
You can execute the createBusiness Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateBusiness(options?: useDataConnectMutationOptions<CreateBusinessData, FirebaseError, CreateBusinessVariables>): UseDataConnectMutationResult<CreateBusinessData, CreateBusinessVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateBusiness(dc: DataConnect, options?: useDataConnectMutationOptions<CreateBusinessData, FirebaseError, CreateBusinessVariables>): UseDataConnectMutationResult<CreateBusinessData, CreateBusinessVariables>;
Variables
The createBusiness Mutation requires an argument of type CreateBusinessVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateBusinessVariables {
businessName: string;
contactName?: string | null;
userId: string;
companyLogoUrl?: string | null;
phone?: string | null;
email?: string | null;
hubBuilding?: string | null;
address?: string | null;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
city?: string | null;
state?: string | null;
street?: string | null;
country?: string | null;
zipCode?: string | null;
area?: BusinessArea | null;
sector?: BusinessSector | null;
rateGroup: BusinessRateGroup;
status: BusinessStatus;
notes?: string | null;
}
Return Type
Recall that calling the createBusiness Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createBusiness Mutation is of type CreateBusinessData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateBusinessData {
business_insert: Business_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createBusiness's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateBusinessVariables } from '@dataconnect/generated';
import { useCreateBusiness } from '@dataconnect/generated/react'
export default function CreateBusinessComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateBusiness();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateBusiness(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateBusiness(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateBusiness(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateBusiness` Mutation requires an argument of type `CreateBusinessVariables`:
const createBusinessVars: CreateBusinessVariables = {
businessName: ...,
contactName: ..., // optional
userId: ...,
companyLogoUrl: ..., // optional
phone: ..., // optional
email: ..., // optional
hubBuilding: ..., // optional
address: ..., // optional
placeId: ..., // optional
latitude: ..., // optional
longitude: ..., // optional
city: ..., // optional
state: ..., // optional
street: ..., // optional
country: ..., // optional
zipCode: ..., // optional
area: ..., // optional
sector: ..., // optional
rateGroup: ...,
status: ...,
notes: ..., // optional
};
mutation.mutate(createBusinessVars);
// Variables can be defined inline as well.
mutation.mutate({ businessName: ..., contactName: ..., userId: ..., companyLogoUrl: ..., phone: ..., email: ..., hubBuilding: ..., address: ..., placeId: ..., latitude: ..., longitude: ..., city: ..., state: ..., street: ..., country: ..., zipCode: ..., area: ..., sector: ..., rateGroup: ..., status: ..., notes: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createBusinessVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.business_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateBusiness
You can execute the updateBusiness Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateBusiness(options?: useDataConnectMutationOptions<UpdateBusinessData, FirebaseError, UpdateBusinessVariables>): UseDataConnectMutationResult<UpdateBusinessData, UpdateBusinessVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateBusiness(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateBusinessData, FirebaseError, UpdateBusinessVariables>): UseDataConnectMutationResult<UpdateBusinessData, UpdateBusinessVariables>;
Variables
The updateBusiness Mutation requires an argument of type UpdateBusinessVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateBusinessVariables {
id: UUIDString;
businessName?: string | null;
contactName?: string | null;
companyLogoUrl?: string | null;
phone?: string | null;
email?: string | null;
hubBuilding?: string | null;
address?: string | null;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
city?: string | null;
state?: string | null;
street?: string | null;
country?: string | null;
zipCode?: string | null;
area?: BusinessArea | null;
sector?: BusinessSector | null;
rateGroup?: BusinessRateGroup | null;
status?: BusinessStatus | null;
notes?: string | null;
}
Return Type
Recall that calling the updateBusiness Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateBusiness Mutation is of type UpdateBusinessData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateBusinessData {
business_update?: Business_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateBusiness's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateBusinessVariables } from '@dataconnect/generated';
import { useUpdateBusiness } from '@dataconnect/generated/react'
export default function UpdateBusinessComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateBusiness();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateBusiness(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateBusiness(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateBusiness(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateBusiness` Mutation requires an argument of type `UpdateBusinessVariables`:
const updateBusinessVars: UpdateBusinessVariables = {
id: ...,
businessName: ..., // optional
contactName: ..., // optional
companyLogoUrl: ..., // optional
phone: ..., // optional
email: ..., // optional
hubBuilding: ..., // optional
address: ..., // optional
placeId: ..., // optional
latitude: ..., // optional
longitude: ..., // optional
city: ..., // optional
state: ..., // optional
street: ..., // optional
country: ..., // optional
zipCode: ..., // optional
area: ..., // optional
sector: ..., // optional
rateGroup: ..., // optional
status: ..., // optional
notes: ..., // optional
};
mutation.mutate(updateBusinessVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., businessName: ..., contactName: ..., companyLogoUrl: ..., phone: ..., email: ..., hubBuilding: ..., address: ..., placeId: ..., latitude: ..., longitude: ..., city: ..., state: ..., street: ..., country: ..., zipCode: ..., area: ..., sector: ..., rateGroup: ..., status: ..., notes: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateBusinessVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.business_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteBusiness
You can execute the deleteBusiness Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteBusiness(options?: useDataConnectMutationOptions<DeleteBusinessData, FirebaseError, DeleteBusinessVariables>): UseDataConnectMutationResult<DeleteBusinessData, DeleteBusinessVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteBusiness(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteBusinessData, FirebaseError, DeleteBusinessVariables>): UseDataConnectMutationResult<DeleteBusinessData, DeleteBusinessVariables>;
Variables
The deleteBusiness Mutation requires an argument of type DeleteBusinessVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteBusinessVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteBusiness Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteBusiness Mutation is of type DeleteBusinessData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteBusinessData {
business_delete?: Business_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteBusiness's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteBusinessVariables } from '@dataconnect/generated';
import { useDeleteBusiness } from '@dataconnect/generated/react'
export default function DeleteBusinessComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteBusiness();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteBusiness(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteBusiness(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteBusiness(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteBusiness` Mutation requires an argument of type `DeleteBusinessVariables`:
const deleteBusinessVars: DeleteBusinessVariables = {
id: ...,
};
mutation.mutate(deleteBusinessVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteBusinessVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.business_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createConversation
You can execute the createConversation Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateConversation(options?: useDataConnectMutationOptions<CreateConversationData, FirebaseError, CreateConversationVariables | void>): UseDataConnectMutationResult<CreateConversationData, CreateConversationVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateConversation(dc: DataConnect, options?: useDataConnectMutationOptions<CreateConversationData, FirebaseError, CreateConversationVariables | void>): UseDataConnectMutationResult<CreateConversationData, CreateConversationVariables>;
Variables
The createConversation Mutation has an optional argument of type CreateConversationVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateConversationVariables {
subject?: string | null;
status?: ConversationStatus | null;
conversationType?: ConversationType | null;
isGroup?: boolean | null;
groupName?: string | null;
lastMessage?: string | null;
lastMessageAt?: TimestampString | null;
}
Return Type
Recall that calling the createConversation Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createConversation Mutation is of type CreateConversationData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateConversationData {
conversation_insert: Conversation_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createConversation's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateConversationVariables } from '@dataconnect/generated';
import { useCreateConversation } from '@dataconnect/generated/react'
export default function CreateConversationComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateConversation();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateConversation(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateConversation(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateConversation(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateConversation` Mutation has an optional argument of type `CreateConversationVariables`:
const createConversationVars: CreateConversationVariables = {
subject: ..., // optional
status: ..., // optional
conversationType: ..., // optional
isGroup: ..., // optional
groupName: ..., // optional
lastMessage: ..., // optional
lastMessageAt: ..., // optional
};
mutation.mutate(createConversationVars);
// Variables can be defined inline as well.
mutation.mutate({ subject: ..., status: ..., conversationType: ..., isGroup: ..., groupName: ..., lastMessage: ..., lastMessageAt: ..., });
// Since all variables are optional for this Mutation, you can omit the `CreateConversationVariables` argument.
mutation.mutate();
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
// Since all variables are optional for this Mutation, you can provide options without providing any variables.
// To do so, you must pass `undefined` where you would normally pass the variables.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createConversationVars /** or undefined */, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.conversation_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateConversation
You can execute the updateConversation Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateConversation(options?: useDataConnectMutationOptions<UpdateConversationData, FirebaseError, UpdateConversationVariables>): UseDataConnectMutationResult<UpdateConversationData, UpdateConversationVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateConversation(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateConversationData, FirebaseError, UpdateConversationVariables>): UseDataConnectMutationResult<UpdateConversationData, UpdateConversationVariables>;
Variables
The updateConversation Mutation requires an argument of type UpdateConversationVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateConversationVariables {
id: UUIDString;
subject?: string | null;
status?: ConversationStatus | null;
conversationType?: ConversationType | null;
isGroup?: boolean | null;
groupName?: string | null;
lastMessage?: string | null;
lastMessageAt?: TimestampString | null;
}
Return Type
Recall that calling the updateConversation Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateConversation Mutation is of type UpdateConversationData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateConversationData {
conversation_update?: Conversation_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateConversation's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateConversationVariables } from '@dataconnect/generated';
import { useUpdateConversation } from '@dataconnect/generated/react'
export default function UpdateConversationComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateConversation();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateConversation(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateConversation(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateConversation(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateConversation` Mutation requires an argument of type `UpdateConversationVariables`:
const updateConversationVars: UpdateConversationVariables = {
id: ...,
subject: ..., // optional
status: ..., // optional
conversationType: ..., // optional
isGroup: ..., // optional
groupName: ..., // optional
lastMessage: ..., // optional
lastMessageAt: ..., // optional
};
mutation.mutate(updateConversationVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., subject: ..., status: ..., conversationType: ..., isGroup: ..., groupName: ..., lastMessage: ..., lastMessageAt: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateConversationVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.conversation_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateConversationLastMessage
You can execute the updateConversationLastMessage Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateConversationLastMessage(options?: useDataConnectMutationOptions<UpdateConversationLastMessageData, FirebaseError, UpdateConversationLastMessageVariables>): UseDataConnectMutationResult<UpdateConversationLastMessageData, UpdateConversationLastMessageVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateConversationLastMessage(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateConversationLastMessageData, FirebaseError, UpdateConversationLastMessageVariables>): UseDataConnectMutationResult<UpdateConversationLastMessageData, UpdateConversationLastMessageVariables>;
Variables
The updateConversationLastMessage Mutation requires an argument of type UpdateConversationLastMessageVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateConversationLastMessageVariables {
id: UUIDString;
lastMessage?: string | null;
lastMessageAt?: TimestampString | null;
}
Return Type
Recall that calling the updateConversationLastMessage Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateConversationLastMessage Mutation is of type UpdateConversationLastMessageData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateConversationLastMessageData {
conversation_update?: Conversation_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateConversationLastMessage's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateConversationLastMessageVariables } from '@dataconnect/generated';
import { useUpdateConversationLastMessage } from '@dataconnect/generated/react'
export default function UpdateConversationLastMessageComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateConversationLastMessage();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateConversationLastMessage(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateConversationLastMessage(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateConversationLastMessage(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateConversationLastMessage` Mutation requires an argument of type `UpdateConversationLastMessageVariables`:
const updateConversationLastMessageVars: UpdateConversationLastMessageVariables = {
id: ...,
lastMessage: ..., // optional
lastMessageAt: ..., // optional
};
mutation.mutate(updateConversationLastMessageVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., lastMessage: ..., lastMessageAt: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateConversationLastMessageVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.conversation_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteConversation
You can execute the deleteConversation Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteConversation(options?: useDataConnectMutationOptions<DeleteConversationData, FirebaseError, DeleteConversationVariables>): UseDataConnectMutationResult<DeleteConversationData, DeleteConversationVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteConversation(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteConversationData, FirebaseError, DeleteConversationVariables>): UseDataConnectMutationResult<DeleteConversationData, DeleteConversationVariables>;
Variables
The deleteConversation Mutation requires an argument of type DeleteConversationVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteConversationVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteConversation Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteConversation Mutation is of type DeleteConversationData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteConversationData {
conversation_delete?: Conversation_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteConversation's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteConversationVariables } from '@dataconnect/generated';
import { useDeleteConversation } from '@dataconnect/generated/react'
export default function DeleteConversationComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteConversation();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteConversation(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteConversation(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteConversation(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteConversation` Mutation requires an argument of type `DeleteConversationVariables`:
const deleteConversationVars: DeleteConversationVariables = {
id: ...,
};
mutation.mutate(deleteConversationVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteConversationVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.conversation_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createCustomRateCard
You can execute the createCustomRateCard Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateCustomRateCard(options?: useDataConnectMutationOptions<CreateCustomRateCardData, FirebaseError, CreateCustomRateCardVariables>): UseDataConnectMutationResult<CreateCustomRateCardData, CreateCustomRateCardVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateCustomRateCard(dc: DataConnect, options?: useDataConnectMutationOptions<CreateCustomRateCardData, FirebaseError, CreateCustomRateCardVariables>): UseDataConnectMutationResult<CreateCustomRateCardData, CreateCustomRateCardVariables>;
Variables
The createCustomRateCard Mutation requires an argument of type CreateCustomRateCardVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateCustomRateCardVariables {
name: string;
baseBook?: string | null;
discount?: number | null;
isDefault?: boolean | null;
}
Return Type
Recall that calling the createCustomRateCard Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createCustomRateCard Mutation is of type CreateCustomRateCardData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateCustomRateCardData {
customRateCard_insert: CustomRateCard_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createCustomRateCard's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateCustomRateCardVariables } from '@dataconnect/generated';
import { useCreateCustomRateCard } from '@dataconnect/generated/react'
export default function CreateCustomRateCardComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateCustomRateCard();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateCustomRateCard(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateCustomRateCard(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateCustomRateCard(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateCustomRateCard` Mutation requires an argument of type `CreateCustomRateCardVariables`:
const createCustomRateCardVars: CreateCustomRateCardVariables = {
name: ...,
baseBook: ..., // optional
discount: ..., // optional
isDefault: ..., // optional
};
mutation.mutate(createCustomRateCardVars);
// Variables can be defined inline as well.
mutation.mutate({ name: ..., baseBook: ..., discount: ..., isDefault: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createCustomRateCardVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.customRateCard_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateCustomRateCard
You can execute the updateCustomRateCard Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateCustomRateCard(options?: useDataConnectMutationOptions<UpdateCustomRateCardData, FirebaseError, UpdateCustomRateCardVariables>): UseDataConnectMutationResult<UpdateCustomRateCardData, UpdateCustomRateCardVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateCustomRateCard(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateCustomRateCardData, FirebaseError, UpdateCustomRateCardVariables>): UseDataConnectMutationResult<UpdateCustomRateCardData, UpdateCustomRateCardVariables>;
Variables
The updateCustomRateCard Mutation requires an argument of type UpdateCustomRateCardVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateCustomRateCardVariables {
id: UUIDString;
name?: string | null;
baseBook?: string | null;
discount?: number | null;
isDefault?: boolean | null;
}
Return Type
Recall that calling the updateCustomRateCard Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateCustomRateCard Mutation is of type UpdateCustomRateCardData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateCustomRateCardData {
customRateCard_update?: CustomRateCard_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateCustomRateCard's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateCustomRateCardVariables } from '@dataconnect/generated';
import { useUpdateCustomRateCard } from '@dataconnect/generated/react'
export default function UpdateCustomRateCardComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateCustomRateCard();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateCustomRateCard(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateCustomRateCard(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateCustomRateCard(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateCustomRateCard` Mutation requires an argument of type `UpdateCustomRateCardVariables`:
const updateCustomRateCardVars: UpdateCustomRateCardVariables = {
id: ...,
name: ..., // optional
baseBook: ..., // optional
discount: ..., // optional
isDefault: ..., // optional
};
mutation.mutate(updateCustomRateCardVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., name: ..., baseBook: ..., discount: ..., isDefault: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateCustomRateCardVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.customRateCard_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteCustomRateCard
You can execute the deleteCustomRateCard Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteCustomRateCard(options?: useDataConnectMutationOptions<DeleteCustomRateCardData, FirebaseError, DeleteCustomRateCardVariables>): UseDataConnectMutationResult<DeleteCustomRateCardData, DeleteCustomRateCardVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteCustomRateCard(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteCustomRateCardData, FirebaseError, DeleteCustomRateCardVariables>): UseDataConnectMutationResult<DeleteCustomRateCardData, DeleteCustomRateCardVariables>;
Variables
The deleteCustomRateCard Mutation requires an argument of type DeleteCustomRateCardVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteCustomRateCardVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteCustomRateCard Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteCustomRateCard Mutation is of type DeleteCustomRateCardData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteCustomRateCardData {
customRateCard_delete?: CustomRateCard_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteCustomRateCard's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteCustomRateCardVariables } from '@dataconnect/generated';
import { useDeleteCustomRateCard } from '@dataconnect/generated/react'
export default function DeleteCustomRateCardComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteCustomRateCard();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteCustomRateCard(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteCustomRateCard(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteCustomRateCard(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteCustomRateCard` Mutation requires an argument of type `DeleteCustomRateCardVariables`:
const deleteCustomRateCardVars: DeleteCustomRateCardVariables = {
id: ...,
};
mutation.mutate(deleteCustomRateCardVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteCustomRateCardVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.customRateCard_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createRecentPayment
You can execute the createRecentPayment Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateRecentPayment(options?: useDataConnectMutationOptions<CreateRecentPaymentData, FirebaseError, CreateRecentPaymentVariables>): UseDataConnectMutationResult<CreateRecentPaymentData, CreateRecentPaymentVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateRecentPayment(dc: DataConnect, options?: useDataConnectMutationOptions<CreateRecentPaymentData, FirebaseError, CreateRecentPaymentVariables>): UseDataConnectMutationResult<CreateRecentPaymentData, CreateRecentPaymentVariables>;
Variables
The createRecentPayment Mutation requires an argument of type CreateRecentPaymentVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateRecentPaymentVariables {
workedTime?: string | null;
status?: RecentPaymentStatus | null;
staffId: UUIDString;
applicationId: UUIDString;
invoiceId: UUIDString;
}
Return Type
Recall that calling the createRecentPayment Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createRecentPayment Mutation is of type CreateRecentPaymentData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateRecentPaymentData {
recentPayment_insert: RecentPayment_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createRecentPayment's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateRecentPaymentVariables } from '@dataconnect/generated';
import { useCreateRecentPayment } from '@dataconnect/generated/react'
export default function CreateRecentPaymentComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateRecentPayment();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateRecentPayment(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateRecentPayment(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateRecentPayment(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateRecentPayment` Mutation requires an argument of type `CreateRecentPaymentVariables`:
const createRecentPaymentVars: CreateRecentPaymentVariables = {
workedTime: ..., // optional
status: ..., // optional
staffId: ...,
applicationId: ...,
invoiceId: ...,
};
mutation.mutate(createRecentPaymentVars);
// Variables can be defined inline as well.
mutation.mutate({ workedTime: ..., status: ..., staffId: ..., applicationId: ..., invoiceId: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createRecentPaymentVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.recentPayment_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateRecentPayment
You can execute the updateRecentPayment Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateRecentPayment(options?: useDataConnectMutationOptions<UpdateRecentPaymentData, FirebaseError, UpdateRecentPaymentVariables>): UseDataConnectMutationResult<UpdateRecentPaymentData, UpdateRecentPaymentVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateRecentPayment(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateRecentPaymentData, FirebaseError, UpdateRecentPaymentVariables>): UseDataConnectMutationResult<UpdateRecentPaymentData, UpdateRecentPaymentVariables>;
Variables
The updateRecentPayment Mutation requires an argument of type UpdateRecentPaymentVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateRecentPaymentVariables {
id: UUIDString;
workedTime?: string | null;
status?: RecentPaymentStatus | null;
staffId?: UUIDString | null;
applicationId?: UUIDString | null;
invoiceId?: UUIDString | null;
}
Return Type
Recall that calling the updateRecentPayment Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateRecentPayment Mutation is of type UpdateRecentPaymentData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateRecentPaymentData {
recentPayment_update?: RecentPayment_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateRecentPayment's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateRecentPaymentVariables } from '@dataconnect/generated';
import { useUpdateRecentPayment } from '@dataconnect/generated/react'
export default function UpdateRecentPaymentComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateRecentPayment();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateRecentPayment(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateRecentPayment(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateRecentPayment(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateRecentPayment` Mutation requires an argument of type `UpdateRecentPaymentVariables`:
const updateRecentPaymentVars: UpdateRecentPaymentVariables = {
id: ...,
workedTime: ..., // optional
status: ..., // optional
staffId: ..., // optional
applicationId: ..., // optional
invoiceId: ..., // optional
};
mutation.mutate(updateRecentPaymentVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., workedTime: ..., status: ..., staffId: ..., applicationId: ..., invoiceId: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateRecentPaymentVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.recentPayment_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteRecentPayment
You can execute the deleteRecentPayment Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteRecentPayment(options?: useDataConnectMutationOptions<DeleteRecentPaymentData, FirebaseError, DeleteRecentPaymentVariables>): UseDataConnectMutationResult<DeleteRecentPaymentData, DeleteRecentPaymentVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteRecentPayment(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteRecentPaymentData, FirebaseError, DeleteRecentPaymentVariables>): UseDataConnectMutationResult<DeleteRecentPaymentData, DeleteRecentPaymentVariables>;
Variables
The deleteRecentPayment Mutation requires an argument of type DeleteRecentPaymentVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteRecentPaymentVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteRecentPayment Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteRecentPayment Mutation is of type DeleteRecentPaymentData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteRecentPaymentData {
recentPayment_delete?: RecentPayment_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteRecentPayment's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteRecentPaymentVariables } from '@dataconnect/generated';
import { useDeleteRecentPayment } from '@dataconnect/generated/react'
export default function DeleteRecentPaymentComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteRecentPayment();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteRecentPayment(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteRecentPayment(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteRecentPayment(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteRecentPayment` Mutation requires an argument of type `DeleteRecentPaymentVariables`:
const deleteRecentPaymentVars: DeleteRecentPaymentVariables = {
id: ...,
};
mutation.mutate(deleteRecentPaymentVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteRecentPaymentVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.recentPayment_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
CreateUser
You can execute the CreateUser Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateUser(options?: useDataConnectMutationOptions<CreateUserData, FirebaseError, CreateUserVariables>): UseDataConnectMutationResult<CreateUserData, CreateUserVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateUser(dc: DataConnect, options?: useDataConnectMutationOptions<CreateUserData, FirebaseError, CreateUserVariables>): UseDataConnectMutationResult<CreateUserData, CreateUserVariables>;
Variables
The CreateUser Mutation requires an argument of type CreateUserVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateUserVariables {
id: string;
email?: string | null;
fullName?: string | null;
role: UserBaseRole;
userRole?: string | null;
photoUrl?: string | null;
}
Return Type
Recall that calling the CreateUser Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the CreateUser Mutation is of type CreateUserData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateUserData {
user_insert: User_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using CreateUser's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateUserVariables } from '@dataconnect/generated';
import { useCreateUser } from '@dataconnect/generated/react'
export default function CreateUserComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateUser();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateUser(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateUser(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateUser(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateUser` Mutation requires an argument of type `CreateUserVariables`:
const createUserVars: CreateUserVariables = {
id: ...,
email: ..., // optional
fullName: ..., // optional
role: ...,
userRole: ..., // optional
photoUrl: ..., // optional
};
mutation.mutate(createUserVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., email: ..., fullName: ..., role: ..., userRole: ..., photoUrl: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createUserVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.user_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
UpdateUser
You can execute the UpdateUser Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateUser(options?: useDataConnectMutationOptions<UpdateUserData, FirebaseError, UpdateUserVariables>): UseDataConnectMutationResult<UpdateUserData, UpdateUserVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateUser(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateUserData, FirebaseError, UpdateUserVariables>): UseDataConnectMutationResult<UpdateUserData, UpdateUserVariables>;
Variables
The UpdateUser Mutation requires an argument of type UpdateUserVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateUserVariables {
id: string;
email?: string | null;
fullName?: string | null;
role?: UserBaseRole | null;
userRole?: string | null;
photoUrl?: string | null;
}
Return Type
Recall that calling the UpdateUser Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the UpdateUser Mutation is of type UpdateUserData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateUserData {
user_update?: User_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using UpdateUser's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateUserVariables } from '@dataconnect/generated';
import { useUpdateUser } from '@dataconnect/generated/react'
export default function UpdateUserComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateUser();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateUser(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateUser(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateUser(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateUser` Mutation requires an argument of type `UpdateUserVariables`:
const updateUserVars: UpdateUserVariables = {
id: ...,
email: ..., // optional
fullName: ..., // optional
role: ..., // optional
userRole: ..., // optional
photoUrl: ..., // optional
};
mutation.mutate(updateUserVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., email: ..., fullName: ..., role: ..., userRole: ..., photoUrl: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateUserVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.user_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
DeleteUser
You can execute the DeleteUser Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteUser(options?: useDataConnectMutationOptions<DeleteUserData, FirebaseError, DeleteUserVariables>): UseDataConnectMutationResult<DeleteUserData, DeleteUserVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteUser(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteUserData, FirebaseError, DeleteUserVariables>): UseDataConnectMutationResult<DeleteUserData, DeleteUserVariables>;
Variables
The DeleteUser Mutation requires an argument of type DeleteUserVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteUserVariables {
id: string;
}
Return Type
Recall that calling the DeleteUser Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the DeleteUser Mutation is of type DeleteUserData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteUserData {
user_delete?: User_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using DeleteUser's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteUserVariables } from '@dataconnect/generated';
import { useDeleteUser } from '@dataconnect/generated/react'
export default function DeleteUserComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteUser();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteUser(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteUser(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteUser(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteUser` Mutation requires an argument of type `DeleteUserVariables`:
const deleteUserVars: DeleteUserVariables = {
id: ...,
};
mutation.mutate(deleteUserVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteUserVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.user_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createVendor
You can execute the createVendor Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateVendor(options?: useDataConnectMutationOptions<CreateVendorData, FirebaseError, CreateVendorVariables>): UseDataConnectMutationResult<CreateVendorData, CreateVendorVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateVendor(dc: DataConnect, options?: useDataConnectMutationOptions<CreateVendorData, FirebaseError, CreateVendorVariables>): UseDataConnectMutationResult<CreateVendorData, CreateVendorVariables>;
Variables
The createVendor Mutation requires an argument of type CreateVendorVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateVendorVariables {
userId: string;
companyName: string;
email?: string | null;
phone?: string | null;
photoUrl?: string | null;
address?: string | null;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
street?: string | null;
country?: string | null;
zipCode?: string | null;
billingAddress?: string | null;
timezone?: string | null;
legalName?: string | null;
doingBusinessAs?: string | null;
region?: string | null;
state?: string | null;
city?: string | null;
serviceSpecialty?: string | null;
approvalStatus?: ApprovalStatus | null;
isActive?: boolean | null;
markup?: number | null;
fee?: number | null;
csat?: number | null;
tier?: VendorTier | null;
}
Return Type
Recall that calling the createVendor Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createVendor Mutation is of type CreateVendorData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateVendorData {
vendor_insert: Vendor_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createVendor's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateVendorVariables } from '@dataconnect/generated';
import { useCreateVendor } from '@dataconnect/generated/react'
export default function CreateVendorComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateVendor();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateVendor(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateVendor(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateVendor(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateVendor` Mutation requires an argument of type `CreateVendorVariables`:
const createVendorVars: CreateVendorVariables = {
userId: ...,
companyName: ...,
email: ..., // optional
phone: ..., // optional
photoUrl: ..., // optional
address: ..., // optional
placeId: ..., // optional
latitude: ..., // optional
longitude: ..., // optional
street: ..., // optional
country: ..., // optional
zipCode: ..., // optional
billingAddress: ..., // optional
timezone: ..., // optional
legalName: ..., // optional
doingBusinessAs: ..., // optional
region: ..., // optional
state: ..., // optional
city: ..., // optional
serviceSpecialty: ..., // optional
approvalStatus: ..., // optional
isActive: ..., // optional
markup: ..., // optional
fee: ..., // optional
csat: ..., // optional
tier: ..., // optional
};
mutation.mutate(createVendorVars);
// Variables can be defined inline as well.
mutation.mutate({ userId: ..., companyName: ..., email: ..., phone: ..., photoUrl: ..., address: ..., placeId: ..., latitude: ..., longitude: ..., street: ..., country: ..., zipCode: ..., billingAddress: ..., timezone: ..., legalName: ..., doingBusinessAs: ..., region: ..., state: ..., city: ..., serviceSpecialty: ..., approvalStatus: ..., isActive: ..., markup: ..., fee: ..., csat: ..., tier: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createVendorVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.vendor_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateVendor
You can execute the updateVendor Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateVendor(options?: useDataConnectMutationOptions<UpdateVendorData, FirebaseError, UpdateVendorVariables>): UseDataConnectMutationResult<UpdateVendorData, UpdateVendorVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateVendor(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateVendorData, FirebaseError, UpdateVendorVariables>): UseDataConnectMutationResult<UpdateVendorData, UpdateVendorVariables>;
Variables
The updateVendor Mutation requires an argument of type UpdateVendorVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateVendorVariables {
id: UUIDString;
companyName?: string | null;
email?: string | null;
phone?: string | null;
photoUrl?: string | null;
address?: string | null;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
street?: string | null;
country?: string | null;
zipCode?: string | null;
billingAddress?: string | null;
timezone?: string | null;
legalName?: string | null;
doingBusinessAs?: string | null;
region?: string | null;
state?: string | null;
city?: string | null;
serviceSpecialty?: string | null;
approvalStatus?: ApprovalStatus | null;
isActive?: boolean | null;
markup?: number | null;
fee?: number | null;
csat?: number | null;
tier?: VendorTier | null;
}
Return Type
Recall that calling the updateVendor Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateVendor Mutation is of type UpdateVendorData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateVendorData {
vendor_update?: Vendor_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateVendor's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateVendorVariables } from '@dataconnect/generated';
import { useUpdateVendor } from '@dataconnect/generated/react'
export default function UpdateVendorComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateVendor();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateVendor(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateVendor(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateVendor(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateVendor` Mutation requires an argument of type `UpdateVendorVariables`:
const updateVendorVars: UpdateVendorVariables = {
id: ...,
companyName: ..., // optional
email: ..., // optional
phone: ..., // optional
photoUrl: ..., // optional
address: ..., // optional
placeId: ..., // optional
latitude: ..., // optional
longitude: ..., // optional
street: ..., // optional
country: ..., // optional
zipCode: ..., // optional
billingAddress: ..., // optional
timezone: ..., // optional
legalName: ..., // optional
doingBusinessAs: ..., // optional
region: ..., // optional
state: ..., // optional
city: ..., // optional
serviceSpecialty: ..., // optional
approvalStatus: ..., // optional
isActive: ..., // optional
markup: ..., // optional
fee: ..., // optional
csat: ..., // optional
tier: ..., // optional
};
mutation.mutate(updateVendorVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., companyName: ..., email: ..., phone: ..., photoUrl: ..., address: ..., placeId: ..., latitude: ..., longitude: ..., street: ..., country: ..., zipCode: ..., billingAddress: ..., timezone: ..., legalName: ..., doingBusinessAs: ..., region: ..., state: ..., city: ..., serviceSpecialty: ..., approvalStatus: ..., isActive: ..., markup: ..., fee: ..., csat: ..., tier: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateVendorVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.vendor_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteVendor
You can execute the deleteVendor Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteVendor(options?: useDataConnectMutationOptions<DeleteVendorData, FirebaseError, DeleteVendorVariables>): UseDataConnectMutationResult<DeleteVendorData, DeleteVendorVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteVendor(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteVendorData, FirebaseError, DeleteVendorVariables>): UseDataConnectMutationResult<DeleteVendorData, DeleteVendorVariables>;
Variables
The deleteVendor Mutation requires an argument of type DeleteVendorVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteVendorVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteVendor Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteVendor Mutation is of type DeleteVendorData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteVendorData {
vendor_delete?: Vendor_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteVendor's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteVendorVariables } from '@dataconnect/generated';
import { useDeleteVendor } from '@dataconnect/generated/react'
export default function DeleteVendorComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteVendor();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteVendor(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteVendor(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteVendor(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteVendor` Mutation requires an argument of type `DeleteVendorVariables`:
const deleteVendorVars: DeleteVendorVariables = {
id: ...,
};
mutation.mutate(deleteVendorVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteVendorVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.vendor_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createDocument
You can execute the createDocument Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateDocument(options?: useDataConnectMutationOptions<CreateDocumentData, FirebaseError, CreateDocumentVariables>): UseDataConnectMutationResult<CreateDocumentData, CreateDocumentVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateDocument(dc: DataConnect, options?: useDataConnectMutationOptions<CreateDocumentData, FirebaseError, CreateDocumentVariables>): UseDataConnectMutationResult<CreateDocumentData, CreateDocumentVariables>;
Variables
The createDocument Mutation requires an argument of type CreateDocumentVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateDocumentVariables {
documentType: DocumentType;
name: string;
description?: string | null;
}
Return Type
Recall that calling the createDocument Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createDocument Mutation is of type CreateDocumentData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateDocumentData {
document_insert: Document_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createDocument's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateDocumentVariables } from '@dataconnect/generated';
import { useCreateDocument } from '@dataconnect/generated/react'
export default function CreateDocumentComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateDocument();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateDocument(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateDocument(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateDocument(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateDocument` Mutation requires an argument of type `CreateDocumentVariables`:
const createDocumentVars: CreateDocumentVariables = {
documentType: ...,
name: ...,
description: ..., // optional
};
mutation.mutate(createDocumentVars);
// Variables can be defined inline as well.
mutation.mutate({ documentType: ..., name: ..., description: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createDocumentVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.document_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateDocument
You can execute the updateDocument Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateDocument(options?: useDataConnectMutationOptions<UpdateDocumentData, FirebaseError, UpdateDocumentVariables>): UseDataConnectMutationResult<UpdateDocumentData, UpdateDocumentVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateDocument(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateDocumentData, FirebaseError, UpdateDocumentVariables>): UseDataConnectMutationResult<UpdateDocumentData, UpdateDocumentVariables>;
Variables
The updateDocument Mutation requires an argument of type UpdateDocumentVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateDocumentVariables {
id: UUIDString;
documentType?: DocumentType | null;
name?: string | null;
description?: string | null;
}
Return Type
Recall that calling the updateDocument Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateDocument Mutation is of type UpdateDocumentData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateDocumentData {
document_update?: Document_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateDocument's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateDocumentVariables } from '@dataconnect/generated';
import { useUpdateDocument } from '@dataconnect/generated/react'
export default function UpdateDocumentComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateDocument();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateDocument(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateDocument(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateDocument(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateDocument` Mutation requires an argument of type `UpdateDocumentVariables`:
const updateDocumentVars: UpdateDocumentVariables = {
id: ...,
documentType: ..., // optional
name: ..., // optional
description: ..., // optional
};
mutation.mutate(updateDocumentVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., documentType: ..., name: ..., description: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateDocumentVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.document_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteDocument
You can execute the deleteDocument Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteDocument(options?: useDataConnectMutationOptions<DeleteDocumentData, FirebaseError, DeleteDocumentVariables>): UseDataConnectMutationResult<DeleteDocumentData, DeleteDocumentVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteDocument(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteDocumentData, FirebaseError, DeleteDocumentVariables>): UseDataConnectMutationResult<DeleteDocumentData, DeleteDocumentVariables>;
Variables
The deleteDocument Mutation requires an argument of type DeleteDocumentVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteDocumentVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteDocument Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteDocument Mutation is of type DeleteDocumentData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteDocumentData {
document_delete?: Document_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteDocument's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteDocumentVariables } from '@dataconnect/generated';
import { useDeleteDocument } from '@dataconnect/generated/react'
export default function DeleteDocumentComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteDocument();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteDocument(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteDocument(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteDocument(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteDocument` Mutation requires an argument of type `DeleteDocumentVariables`:
const deleteDocumentVars: DeleteDocumentVariables = {
id: ...,
};
mutation.mutate(deleteDocumentVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteDocumentVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.document_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createTaskComment
You can execute the createTaskComment Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateTaskComment(options?: useDataConnectMutationOptions<CreateTaskCommentData, FirebaseError, CreateTaskCommentVariables>): UseDataConnectMutationResult<CreateTaskCommentData, CreateTaskCommentVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateTaskComment(dc: DataConnect, options?: useDataConnectMutationOptions<CreateTaskCommentData, FirebaseError, CreateTaskCommentVariables>): UseDataConnectMutationResult<CreateTaskCommentData, CreateTaskCommentVariables>;
Variables
The createTaskComment Mutation requires an argument of type CreateTaskCommentVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateTaskCommentVariables {
taskId: UUIDString;
teamMemberId: UUIDString;
comment: string;
isSystem?: boolean | null;
}
Return Type
Recall that calling the createTaskComment Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createTaskComment Mutation is of type CreateTaskCommentData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateTaskCommentData {
taskComment_insert: TaskComment_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createTaskComment's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateTaskCommentVariables } from '@dataconnect/generated';
import { useCreateTaskComment } from '@dataconnect/generated/react'
export default function CreateTaskCommentComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateTaskComment();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateTaskComment(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateTaskComment(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateTaskComment(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateTaskComment` Mutation requires an argument of type `CreateTaskCommentVariables`:
const createTaskCommentVars: CreateTaskCommentVariables = {
taskId: ...,
teamMemberId: ...,
comment: ...,
isSystem: ..., // optional
};
mutation.mutate(createTaskCommentVars);
// Variables can be defined inline as well.
mutation.mutate({ taskId: ..., teamMemberId: ..., comment: ..., isSystem: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createTaskCommentVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.taskComment_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateTaskComment
You can execute the updateTaskComment Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateTaskComment(options?: useDataConnectMutationOptions<UpdateTaskCommentData, FirebaseError, UpdateTaskCommentVariables>): UseDataConnectMutationResult<UpdateTaskCommentData, UpdateTaskCommentVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateTaskComment(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateTaskCommentData, FirebaseError, UpdateTaskCommentVariables>): UseDataConnectMutationResult<UpdateTaskCommentData, UpdateTaskCommentVariables>;
Variables
The updateTaskComment Mutation requires an argument of type UpdateTaskCommentVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateTaskCommentVariables {
id: UUIDString;
comment?: string | null;
isSystem?: boolean | null;
}
Return Type
Recall that calling the updateTaskComment Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateTaskComment Mutation is of type UpdateTaskCommentData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateTaskCommentData {
taskComment_update?: TaskComment_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateTaskComment's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateTaskCommentVariables } from '@dataconnect/generated';
import { useUpdateTaskComment } from '@dataconnect/generated/react'
export default function UpdateTaskCommentComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateTaskComment();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateTaskComment(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateTaskComment(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateTaskComment(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateTaskComment` Mutation requires an argument of type `UpdateTaskCommentVariables`:
const updateTaskCommentVars: UpdateTaskCommentVariables = {
id: ...,
comment: ..., // optional
isSystem: ..., // optional
};
mutation.mutate(updateTaskCommentVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., comment: ..., isSystem: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateTaskCommentVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.taskComment_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteTaskComment
You can execute the deleteTaskComment Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteTaskComment(options?: useDataConnectMutationOptions<DeleteTaskCommentData, FirebaseError, DeleteTaskCommentVariables>): UseDataConnectMutationResult<DeleteTaskCommentData, DeleteTaskCommentVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteTaskComment(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteTaskCommentData, FirebaseError, DeleteTaskCommentVariables>): UseDataConnectMutationResult<DeleteTaskCommentData, DeleteTaskCommentVariables>;
Variables
The deleteTaskComment Mutation requires an argument of type DeleteTaskCommentVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteTaskCommentVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteTaskComment Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteTaskComment Mutation is of type DeleteTaskCommentData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteTaskCommentData {
taskComment_delete?: TaskComment_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteTaskComment's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteTaskCommentVariables } from '@dataconnect/generated';
import { useDeleteTaskComment } from '@dataconnect/generated/react'
export default function DeleteTaskCommentComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteTaskComment();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteTaskComment(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteTaskComment(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteTaskComment(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteTaskComment` Mutation requires an argument of type `DeleteTaskCommentVariables`:
const deleteTaskCommentVars: DeleteTaskCommentVariables = {
id: ...,
};
mutation.mutate(deleteTaskCommentVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteTaskCommentVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.taskComment_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createVendorBenefitPlan
You can execute the createVendorBenefitPlan Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateVendorBenefitPlan(options?: useDataConnectMutationOptions<CreateVendorBenefitPlanData, FirebaseError, CreateVendorBenefitPlanVariables>): UseDataConnectMutationResult<CreateVendorBenefitPlanData, CreateVendorBenefitPlanVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateVendorBenefitPlan(dc: DataConnect, options?: useDataConnectMutationOptions<CreateVendorBenefitPlanData, FirebaseError, CreateVendorBenefitPlanVariables>): UseDataConnectMutationResult<CreateVendorBenefitPlanData, CreateVendorBenefitPlanVariables>;
Variables
The createVendorBenefitPlan Mutation requires an argument of type CreateVendorBenefitPlanVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateVendorBenefitPlanVariables {
vendorId: UUIDString;
title: string;
description?: string | null;
requestLabel?: string | null;
total?: number | null;
isActive?: boolean | null;
createdBy?: string | null;
}
Return Type
Recall that calling the createVendorBenefitPlan Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createVendorBenefitPlan Mutation is of type CreateVendorBenefitPlanData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateVendorBenefitPlanData {
vendorBenefitPlan_insert: VendorBenefitPlan_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createVendorBenefitPlan's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateVendorBenefitPlanVariables } from '@dataconnect/generated';
import { useCreateVendorBenefitPlan } from '@dataconnect/generated/react'
export default function CreateVendorBenefitPlanComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateVendorBenefitPlan();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateVendorBenefitPlan(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateVendorBenefitPlan(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateVendorBenefitPlan(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateVendorBenefitPlan` Mutation requires an argument of type `CreateVendorBenefitPlanVariables`:
const createVendorBenefitPlanVars: CreateVendorBenefitPlanVariables = {
vendorId: ...,
title: ...,
description: ..., // optional
requestLabel: ..., // optional
total: ..., // optional
isActive: ..., // optional
createdBy: ..., // optional
};
mutation.mutate(createVendorBenefitPlanVars);
// Variables can be defined inline as well.
mutation.mutate({ vendorId: ..., title: ..., description: ..., requestLabel: ..., total: ..., isActive: ..., createdBy: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createVendorBenefitPlanVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.vendorBenefitPlan_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateVendorBenefitPlan
You can execute the updateVendorBenefitPlan Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateVendorBenefitPlan(options?: useDataConnectMutationOptions<UpdateVendorBenefitPlanData, FirebaseError, UpdateVendorBenefitPlanVariables>): UseDataConnectMutationResult<UpdateVendorBenefitPlanData, UpdateVendorBenefitPlanVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateVendorBenefitPlan(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateVendorBenefitPlanData, FirebaseError, UpdateVendorBenefitPlanVariables>): UseDataConnectMutationResult<UpdateVendorBenefitPlanData, UpdateVendorBenefitPlanVariables>;
Variables
The updateVendorBenefitPlan Mutation requires an argument of type UpdateVendorBenefitPlanVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateVendorBenefitPlanVariables {
id: UUIDString;
vendorId?: UUIDString | null;
title?: string | null;
description?: string | null;
requestLabel?: string | null;
total?: number | null;
isActive?: boolean | null;
createdBy?: string | null;
}
Return Type
Recall that calling the updateVendorBenefitPlan Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateVendorBenefitPlan Mutation is of type UpdateVendorBenefitPlanData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateVendorBenefitPlanData {
vendorBenefitPlan_update?: VendorBenefitPlan_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateVendorBenefitPlan's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateVendorBenefitPlanVariables } from '@dataconnect/generated';
import { useUpdateVendorBenefitPlan } from '@dataconnect/generated/react'
export default function UpdateVendorBenefitPlanComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateVendorBenefitPlan();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateVendorBenefitPlan(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateVendorBenefitPlan(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateVendorBenefitPlan(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateVendorBenefitPlan` Mutation requires an argument of type `UpdateVendorBenefitPlanVariables`:
const updateVendorBenefitPlanVars: UpdateVendorBenefitPlanVariables = {
id: ...,
vendorId: ..., // optional
title: ..., // optional
description: ..., // optional
requestLabel: ..., // optional
total: ..., // optional
isActive: ..., // optional
createdBy: ..., // optional
};
mutation.mutate(updateVendorBenefitPlanVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., vendorId: ..., title: ..., description: ..., requestLabel: ..., total: ..., isActive: ..., createdBy: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateVendorBenefitPlanVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.vendorBenefitPlan_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteVendorBenefitPlan
You can execute the deleteVendorBenefitPlan Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteVendorBenefitPlan(options?: useDataConnectMutationOptions<DeleteVendorBenefitPlanData, FirebaseError, DeleteVendorBenefitPlanVariables>): UseDataConnectMutationResult<DeleteVendorBenefitPlanData, DeleteVendorBenefitPlanVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteVendorBenefitPlan(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteVendorBenefitPlanData, FirebaseError, DeleteVendorBenefitPlanVariables>): UseDataConnectMutationResult<DeleteVendorBenefitPlanData, DeleteVendorBenefitPlanVariables>;
Variables
The deleteVendorBenefitPlan Mutation requires an argument of type DeleteVendorBenefitPlanVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteVendorBenefitPlanVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteVendorBenefitPlan Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteVendorBenefitPlan Mutation is of type DeleteVendorBenefitPlanData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteVendorBenefitPlanData {
vendorBenefitPlan_delete?: VendorBenefitPlan_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteVendorBenefitPlan's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteVendorBenefitPlanVariables } from '@dataconnect/generated';
import { useDeleteVendorBenefitPlan } from '@dataconnect/generated/react'
export default function DeleteVendorBenefitPlanComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteVendorBenefitPlan();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteVendorBenefitPlan(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteVendorBenefitPlan(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteVendorBenefitPlan(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteVendorBenefitPlan` Mutation requires an argument of type `DeleteVendorBenefitPlanVariables`:
const deleteVendorBenefitPlanVars: DeleteVendorBenefitPlanVariables = {
id: ...,
};
mutation.mutate(deleteVendorBenefitPlanVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteVendorBenefitPlanVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.vendorBenefitPlan_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createMessage
You can execute the createMessage Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateMessage(options?: useDataConnectMutationOptions<CreateMessageData, FirebaseError, CreateMessageVariables>): UseDataConnectMutationResult<CreateMessageData, CreateMessageVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateMessage(dc: DataConnect, options?: useDataConnectMutationOptions<CreateMessageData, FirebaseError, CreateMessageVariables>): UseDataConnectMutationResult<CreateMessageData, CreateMessageVariables>;
Variables
The createMessage Mutation requires an argument of type CreateMessageVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateMessageVariables {
conversationId: UUIDString;
senderId: string;
content: string;
isSystem?: boolean | null;
}
Return Type
Recall that calling the createMessage Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createMessage Mutation is of type CreateMessageData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateMessageData {
message_insert: Message_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createMessage's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateMessageVariables } from '@dataconnect/generated';
import { useCreateMessage } from '@dataconnect/generated/react'
export default function CreateMessageComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateMessage();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateMessage(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateMessage(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateMessage(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateMessage` Mutation requires an argument of type `CreateMessageVariables`:
const createMessageVars: CreateMessageVariables = {
conversationId: ...,
senderId: ...,
content: ...,
isSystem: ..., // optional
};
mutation.mutate(createMessageVars);
// Variables can be defined inline as well.
mutation.mutate({ conversationId: ..., senderId: ..., content: ..., isSystem: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createMessageVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.message_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateMessage
You can execute the updateMessage Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateMessage(options?: useDataConnectMutationOptions<UpdateMessageData, FirebaseError, UpdateMessageVariables>): UseDataConnectMutationResult<UpdateMessageData, UpdateMessageVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateMessage(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateMessageData, FirebaseError, UpdateMessageVariables>): UseDataConnectMutationResult<UpdateMessageData, UpdateMessageVariables>;
Variables
The updateMessage Mutation requires an argument of type UpdateMessageVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateMessageVariables {
id: UUIDString;
conversationId?: UUIDString | null;
senderId?: string | null;
content?: string | null;
isSystem?: boolean | null;
}
Return Type
Recall that calling the updateMessage Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateMessage Mutation is of type UpdateMessageData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateMessageData {
message_update?: Message_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateMessage's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateMessageVariables } from '@dataconnect/generated';
import { useUpdateMessage } from '@dataconnect/generated/react'
export default function UpdateMessageComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateMessage();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateMessage(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateMessage(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateMessage(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateMessage` Mutation requires an argument of type `UpdateMessageVariables`:
const updateMessageVars: UpdateMessageVariables = {
id: ...,
conversationId: ..., // optional
senderId: ..., // optional
content: ..., // optional
isSystem: ..., // optional
};
mutation.mutate(updateMessageVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., conversationId: ..., senderId: ..., content: ..., isSystem: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateMessageVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.message_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteMessage
You can execute the deleteMessage Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteMessage(options?: useDataConnectMutationOptions<DeleteMessageData, FirebaseError, DeleteMessageVariables>): UseDataConnectMutationResult<DeleteMessageData, DeleteMessageVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteMessage(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteMessageData, FirebaseError, DeleteMessageVariables>): UseDataConnectMutationResult<DeleteMessageData, DeleteMessageVariables>;
Variables
The deleteMessage Mutation requires an argument of type DeleteMessageVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteMessageVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteMessage Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteMessage Mutation is of type DeleteMessageData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteMessageData {
message_delete?: Message_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteMessage's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteMessageVariables } from '@dataconnect/generated';
import { useDeleteMessage } from '@dataconnect/generated/react'
export default function DeleteMessageComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteMessage();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteMessage(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteMessage(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteMessage(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteMessage` Mutation requires an argument of type `DeleteMessageVariables`:
const deleteMessageVars: DeleteMessageVariables = {
id: ...,
};
mutation.mutate(deleteMessageVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteMessageVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.message_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createWorkforce
You can execute the createWorkforce Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateWorkforce(options?: useDataConnectMutationOptions<CreateWorkforceData, FirebaseError, CreateWorkforceVariables>): UseDataConnectMutationResult<CreateWorkforceData, CreateWorkforceVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateWorkforce(dc: DataConnect, options?: useDataConnectMutationOptions<CreateWorkforceData, FirebaseError, CreateWorkforceVariables>): UseDataConnectMutationResult<CreateWorkforceData, CreateWorkforceVariables>;
Variables
The createWorkforce Mutation requires an argument of type CreateWorkforceVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateWorkforceVariables {
vendorId: UUIDString;
staffId: UUIDString;
workforceNumber: string;
employmentType?: WorkforceEmploymentType | null;
}
Return Type
Recall that calling the createWorkforce Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createWorkforce Mutation is of type CreateWorkforceData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateWorkforceData {
workforce_insert: Workforce_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createWorkforce's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateWorkforceVariables } from '@dataconnect/generated';
import { useCreateWorkforce } from '@dataconnect/generated/react'
export default function CreateWorkforceComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateWorkforce();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateWorkforce(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateWorkforce(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateWorkforce(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateWorkforce` Mutation requires an argument of type `CreateWorkforceVariables`:
const createWorkforceVars: CreateWorkforceVariables = {
vendorId: ...,
staffId: ...,
workforceNumber: ...,
employmentType: ..., // optional
};
mutation.mutate(createWorkforceVars);
// Variables can be defined inline as well.
mutation.mutate({ vendorId: ..., staffId: ..., workforceNumber: ..., employmentType: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createWorkforceVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.workforce_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateWorkforce
You can execute the updateWorkforce Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateWorkforce(options?: useDataConnectMutationOptions<UpdateWorkforceData, FirebaseError, UpdateWorkforceVariables>): UseDataConnectMutationResult<UpdateWorkforceData, UpdateWorkforceVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateWorkforce(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateWorkforceData, FirebaseError, UpdateWorkforceVariables>): UseDataConnectMutationResult<UpdateWorkforceData, UpdateWorkforceVariables>;
Variables
The updateWorkforce Mutation requires an argument of type UpdateWorkforceVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateWorkforceVariables {
id: UUIDString;
workforceNumber?: string | null;
employmentType?: WorkforceEmploymentType | null;
status?: WorkforceStatus | null;
}
Return Type
Recall that calling the updateWorkforce Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateWorkforce Mutation is of type UpdateWorkforceData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateWorkforceData {
workforce_update?: Workforce_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateWorkforce's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateWorkforceVariables } from '@dataconnect/generated';
import { useUpdateWorkforce } from '@dataconnect/generated/react'
export default function UpdateWorkforceComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateWorkforce();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateWorkforce(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateWorkforce(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateWorkforce(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateWorkforce` Mutation requires an argument of type `UpdateWorkforceVariables`:
const updateWorkforceVars: UpdateWorkforceVariables = {
id: ...,
workforceNumber: ..., // optional
employmentType: ..., // optional
status: ..., // optional
};
mutation.mutate(updateWorkforceVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., workforceNumber: ..., employmentType: ..., status: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateWorkforceVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.workforce_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deactivateWorkforce
You can execute the deactivateWorkforce Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeactivateWorkforce(options?: useDataConnectMutationOptions<DeactivateWorkforceData, FirebaseError, DeactivateWorkforceVariables>): UseDataConnectMutationResult<DeactivateWorkforceData, DeactivateWorkforceVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeactivateWorkforce(dc: DataConnect, options?: useDataConnectMutationOptions<DeactivateWorkforceData, FirebaseError, DeactivateWorkforceVariables>): UseDataConnectMutationResult<DeactivateWorkforceData, DeactivateWorkforceVariables>;
Variables
The deactivateWorkforce Mutation requires an argument of type DeactivateWorkforceVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeactivateWorkforceVariables {
id: UUIDString;
}
Return Type
Recall that calling the deactivateWorkforce Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deactivateWorkforce Mutation is of type DeactivateWorkforceData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeactivateWorkforceData {
workforce_update?: Workforce_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deactivateWorkforce's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeactivateWorkforceVariables } from '@dataconnect/generated';
import { useDeactivateWorkforce } from '@dataconnect/generated/react'
export default function DeactivateWorkforceComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeactivateWorkforce();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeactivateWorkforce(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeactivateWorkforce(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeactivateWorkforce(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeactivateWorkforce` Mutation requires an argument of type `DeactivateWorkforceVariables`:
const deactivateWorkforceVars: DeactivateWorkforceVariables = {
id: ...,
};
mutation.mutate(deactivateWorkforceVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deactivateWorkforceVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.workforce_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createFaqData
You can execute the createFaqData Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateFaqData(options?: useDataConnectMutationOptions<CreateFaqDataData, FirebaseError, CreateFaqDataVariables>): UseDataConnectMutationResult<CreateFaqDataData, CreateFaqDataVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateFaqData(dc: DataConnect, options?: useDataConnectMutationOptions<CreateFaqDataData, FirebaseError, CreateFaqDataVariables>): UseDataConnectMutationResult<CreateFaqDataData, CreateFaqDataVariables>;
Variables
The createFaqData Mutation requires an argument of type CreateFaqDataVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateFaqDataVariables {
category: string;
questions?: unknown[] | null;
}
Return Type
Recall that calling the createFaqData Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createFaqData Mutation is of type CreateFaqDataData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateFaqDataData {
faqData_insert: FaqData_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createFaqData's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateFaqDataVariables } from '@dataconnect/generated';
import { useCreateFaqData } from '@dataconnect/generated/react'
export default function CreateFaqDataComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateFaqData();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateFaqData(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateFaqData(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateFaqData(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateFaqData` Mutation requires an argument of type `CreateFaqDataVariables`:
const createFaqDataVars: CreateFaqDataVariables = {
category: ...,
questions: ..., // optional
};
mutation.mutate(createFaqDataVars);
// Variables can be defined inline as well.
mutation.mutate({ category: ..., questions: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createFaqDataVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.faqData_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateFaqData
You can execute the updateFaqData Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateFaqData(options?: useDataConnectMutationOptions<UpdateFaqDataData, FirebaseError, UpdateFaqDataVariables>): UseDataConnectMutationResult<UpdateFaqDataData, UpdateFaqDataVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateFaqData(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateFaqDataData, FirebaseError, UpdateFaqDataVariables>): UseDataConnectMutationResult<UpdateFaqDataData, UpdateFaqDataVariables>;
Variables
The updateFaqData Mutation requires an argument of type UpdateFaqDataVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateFaqDataVariables {
id: UUIDString;
category?: string | null;
questions?: unknown[] | null;
}
Return Type
Recall that calling the updateFaqData Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateFaqData Mutation is of type UpdateFaqDataData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateFaqDataData {
faqData_update?: FaqData_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateFaqData's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateFaqDataVariables } from '@dataconnect/generated';
import { useUpdateFaqData } from '@dataconnect/generated/react'
export default function UpdateFaqDataComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateFaqData();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateFaqData(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateFaqData(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateFaqData(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateFaqData` Mutation requires an argument of type `UpdateFaqDataVariables`:
const updateFaqDataVars: UpdateFaqDataVariables = {
id: ...,
category: ..., // optional
questions: ..., // optional
};
mutation.mutate(updateFaqDataVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., category: ..., questions: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateFaqDataVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.faqData_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteFaqData
You can execute the deleteFaqData Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteFaqData(options?: useDataConnectMutationOptions<DeleteFaqDataData, FirebaseError, DeleteFaqDataVariables>): UseDataConnectMutationResult<DeleteFaqDataData, DeleteFaqDataVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteFaqData(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteFaqDataData, FirebaseError, DeleteFaqDataVariables>): UseDataConnectMutationResult<DeleteFaqDataData, DeleteFaqDataVariables>;
Variables
The deleteFaqData Mutation requires an argument of type DeleteFaqDataVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteFaqDataVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteFaqData Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteFaqData Mutation is of type DeleteFaqDataData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteFaqDataData {
faqData_delete?: FaqData_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteFaqData's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteFaqDataVariables } from '@dataconnect/generated';
import { useDeleteFaqData } from '@dataconnect/generated/react'
export default function DeleteFaqDataComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteFaqData();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteFaqData(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteFaqData(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteFaqData(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteFaqData` Mutation requires an argument of type `DeleteFaqDataVariables`:
const deleteFaqDataVars: DeleteFaqDataVariables = {
id: ...,
};
mutation.mutate(deleteFaqDataVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteFaqDataVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.faqData_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createInvoice
You can execute the createInvoice Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateInvoice(options?: useDataConnectMutationOptions<CreateInvoiceData, FirebaseError, CreateInvoiceVariables>): UseDataConnectMutationResult<CreateInvoiceData, CreateInvoiceVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateInvoice(dc: DataConnect, options?: useDataConnectMutationOptions<CreateInvoiceData, FirebaseError, CreateInvoiceVariables>): UseDataConnectMutationResult<CreateInvoiceData, CreateInvoiceVariables>;
Variables
The createInvoice Mutation requires an argument of type CreateInvoiceVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateInvoiceVariables {
status: InvoiceStatus;
vendorId: UUIDString;
businessId: UUIDString;
orderId: UUIDString;
paymentTerms?: InovicePaymentTerms | null;
invoiceNumber: string;
issueDate: TimestampString;
dueDate: TimestampString;
hub?: string | null;
managerName?: string | null;
vendorNumber?: string | null;
roles?: unknown | null;
charges?: unknown | null;
otherCharges?: number | null;
subtotal?: number | null;
amount: number;
notes?: string | null;
staffCount?: number | null;
chargesCount?: number | null;
}
Return Type
Recall that calling the createInvoice Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createInvoice Mutation is of type CreateInvoiceData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateInvoiceData {
invoice_insert: Invoice_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createInvoice's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateInvoiceVariables } from '@dataconnect/generated';
import { useCreateInvoice } from '@dataconnect/generated/react'
export default function CreateInvoiceComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateInvoice();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateInvoice(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateInvoice(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateInvoice(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateInvoice` Mutation requires an argument of type `CreateInvoiceVariables`:
const createInvoiceVars: CreateInvoiceVariables = {
status: ...,
vendorId: ...,
businessId: ...,
orderId: ...,
paymentTerms: ..., // optional
invoiceNumber: ...,
issueDate: ...,
dueDate: ...,
hub: ..., // optional
managerName: ..., // optional
vendorNumber: ..., // optional
roles: ..., // optional
charges: ..., // optional
otherCharges: ..., // optional
subtotal: ..., // optional
amount: ...,
notes: ..., // optional
staffCount: ..., // optional
chargesCount: ..., // optional
};
mutation.mutate(createInvoiceVars);
// Variables can be defined inline as well.
mutation.mutate({ status: ..., vendorId: ..., businessId: ..., orderId: ..., paymentTerms: ..., invoiceNumber: ..., issueDate: ..., dueDate: ..., hub: ..., managerName: ..., vendorNumber: ..., roles: ..., charges: ..., otherCharges: ..., subtotal: ..., amount: ..., notes: ..., staffCount: ..., chargesCount: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createInvoiceVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.invoice_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateInvoice
You can execute the updateInvoice Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateInvoice(options?: useDataConnectMutationOptions<UpdateInvoiceData, FirebaseError, UpdateInvoiceVariables>): UseDataConnectMutationResult<UpdateInvoiceData, UpdateInvoiceVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateInvoice(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateInvoiceData, FirebaseError, UpdateInvoiceVariables>): UseDataConnectMutationResult<UpdateInvoiceData, UpdateInvoiceVariables>;
Variables
The updateInvoice Mutation requires an argument of type UpdateInvoiceVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateInvoiceVariables {
id: UUIDString;
status?: InvoiceStatus | null;
vendorId?: UUIDString | null;
businessId?: UUIDString | null;
orderId?: UUIDString | null;
paymentTerms?: InovicePaymentTerms | null;
invoiceNumber?: string | null;
issueDate?: TimestampString | null;
dueDate?: TimestampString | null;
hub?: string | null;
managerName?: string | null;
vendorNumber?: string | null;
roles?: unknown | null;
charges?: unknown | null;
otherCharges?: number | null;
subtotal?: number | null;
amount?: number | null;
notes?: string | null;
staffCount?: number | null;
chargesCount?: number | null;
disputedItems?: unknown | null;
disputeReason?: string | null;
disputeDetails?: string | null;
}
Return Type
Recall that calling the updateInvoice Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateInvoice Mutation is of type UpdateInvoiceData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateInvoiceData {
invoice_update?: Invoice_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateInvoice's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateInvoiceVariables } from '@dataconnect/generated';
import { useUpdateInvoice } from '@dataconnect/generated/react'
export default function UpdateInvoiceComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateInvoice();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateInvoice(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateInvoice(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateInvoice(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateInvoice` Mutation requires an argument of type `UpdateInvoiceVariables`:
const updateInvoiceVars: UpdateInvoiceVariables = {
id: ...,
status: ..., // optional
vendorId: ..., // optional
businessId: ..., // optional
orderId: ..., // optional
paymentTerms: ..., // optional
invoiceNumber: ..., // optional
issueDate: ..., // optional
dueDate: ..., // optional
hub: ..., // optional
managerName: ..., // optional
vendorNumber: ..., // optional
roles: ..., // optional
charges: ..., // optional
otherCharges: ..., // optional
subtotal: ..., // optional
amount: ..., // optional
notes: ..., // optional
staffCount: ..., // optional
chargesCount: ..., // optional
disputedItems: ..., // optional
disputeReason: ..., // optional
disputeDetails: ..., // optional
};
mutation.mutate(updateInvoiceVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., status: ..., vendorId: ..., businessId: ..., orderId: ..., paymentTerms: ..., invoiceNumber: ..., issueDate: ..., dueDate: ..., hub: ..., managerName: ..., vendorNumber: ..., roles: ..., charges: ..., otherCharges: ..., subtotal: ..., amount: ..., notes: ..., staffCount: ..., chargesCount: ..., disputedItems: ..., disputeReason: ..., disputeDetails: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateInvoiceVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.invoice_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteInvoice
You can execute the deleteInvoice Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteInvoice(options?: useDataConnectMutationOptions<DeleteInvoiceData, FirebaseError, DeleteInvoiceVariables>): UseDataConnectMutationResult<DeleteInvoiceData, DeleteInvoiceVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteInvoice(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteInvoiceData, FirebaseError, DeleteInvoiceVariables>): UseDataConnectMutationResult<DeleteInvoiceData, DeleteInvoiceVariables>;
Variables
The deleteInvoice Mutation requires an argument of type DeleteInvoiceVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteInvoiceVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteInvoice Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteInvoice Mutation is of type DeleteInvoiceData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteInvoiceData {
invoice_delete?: Invoice_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteInvoice's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteInvoiceVariables } from '@dataconnect/generated';
import { useDeleteInvoice } from '@dataconnect/generated/react'
export default function DeleteInvoiceComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteInvoice();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteInvoice(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteInvoice(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteInvoice(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteInvoice` Mutation requires an argument of type `DeleteInvoiceVariables`:
const deleteInvoiceVars: DeleteInvoiceVariables = {
id: ...,
};
mutation.mutate(deleteInvoiceVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteInvoiceVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.invoice_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createTeamHub
You can execute the createTeamHub Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateTeamHub(options?: useDataConnectMutationOptions<CreateTeamHubData, FirebaseError, CreateTeamHubVariables>): UseDataConnectMutationResult<CreateTeamHubData, CreateTeamHubVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateTeamHub(dc: DataConnect, options?: useDataConnectMutationOptions<CreateTeamHubData, FirebaseError, CreateTeamHubVariables>): UseDataConnectMutationResult<CreateTeamHubData, CreateTeamHubVariables>;
Variables
The createTeamHub Mutation requires an argument of type CreateTeamHubVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateTeamHubVariables {
teamId: UUIDString;
hubName: string;
address: string;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
city?: string | null;
state?: string | null;
street?: string | null;
country?: string | null;
zipCode?: string | null;
managerName?: string | null;
isActive?: boolean | null;
departments?: unknown | null;
}
Return Type
Recall that calling the createTeamHub Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createTeamHub Mutation is of type CreateTeamHubData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateTeamHubData {
teamHub_insert: TeamHub_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createTeamHub's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateTeamHubVariables } from '@dataconnect/generated';
import { useCreateTeamHub } from '@dataconnect/generated/react'
export default function CreateTeamHubComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateTeamHub();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateTeamHub(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateTeamHub(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateTeamHub(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateTeamHub` Mutation requires an argument of type `CreateTeamHubVariables`:
const createTeamHubVars: CreateTeamHubVariables = {
teamId: ...,
hubName: ...,
address: ...,
placeId: ..., // optional
latitude: ..., // optional
longitude: ..., // optional
city: ..., // optional
state: ..., // optional
street: ..., // optional
country: ..., // optional
zipCode: ..., // optional
managerName: ..., // optional
isActive: ..., // optional
departments: ..., // optional
};
mutation.mutate(createTeamHubVars);
// Variables can be defined inline as well.
mutation.mutate({ teamId: ..., hubName: ..., address: ..., placeId: ..., latitude: ..., longitude: ..., city: ..., state: ..., street: ..., country: ..., zipCode: ..., managerName: ..., isActive: ..., departments: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createTeamHubVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.teamHub_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateTeamHub
You can execute the updateTeamHub Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateTeamHub(options?: useDataConnectMutationOptions<UpdateTeamHubData, FirebaseError, UpdateTeamHubVariables>): UseDataConnectMutationResult<UpdateTeamHubData, UpdateTeamHubVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateTeamHub(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateTeamHubData, FirebaseError, UpdateTeamHubVariables>): UseDataConnectMutationResult<UpdateTeamHubData, UpdateTeamHubVariables>;
Variables
The updateTeamHub Mutation requires an argument of type UpdateTeamHubVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateTeamHubVariables {
id: UUIDString;
teamId?: UUIDString | null;
hubName?: string | null;
address?: string | null;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
city?: string | null;
state?: string | null;
street?: string | null;
country?: string | null;
zipCode?: string | null;
managerName?: string | null;
isActive?: boolean | null;
departments?: unknown | null;
}
Return Type
Recall that calling the updateTeamHub Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateTeamHub Mutation is of type UpdateTeamHubData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateTeamHubData {
teamHub_update?: TeamHub_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateTeamHub's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateTeamHubVariables } from '@dataconnect/generated';
import { useUpdateTeamHub } from '@dataconnect/generated/react'
export default function UpdateTeamHubComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateTeamHub();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateTeamHub(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateTeamHub(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateTeamHub(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateTeamHub` Mutation requires an argument of type `UpdateTeamHubVariables`:
const updateTeamHubVars: UpdateTeamHubVariables = {
id: ...,
teamId: ..., // optional
hubName: ..., // optional
address: ..., // optional
placeId: ..., // optional
latitude: ..., // optional
longitude: ..., // optional
city: ..., // optional
state: ..., // optional
street: ..., // optional
country: ..., // optional
zipCode: ..., // optional
managerName: ..., // optional
isActive: ..., // optional
departments: ..., // optional
};
mutation.mutate(updateTeamHubVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., teamId: ..., hubName: ..., address: ..., placeId: ..., latitude: ..., longitude: ..., city: ..., state: ..., street: ..., country: ..., zipCode: ..., managerName: ..., isActive: ..., departments: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateTeamHubVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.teamHub_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteTeamHub
You can execute the deleteTeamHub Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteTeamHub(options?: useDataConnectMutationOptions<DeleteTeamHubData, FirebaseError, DeleteTeamHubVariables>): UseDataConnectMutationResult<DeleteTeamHubData, DeleteTeamHubVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteTeamHub(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteTeamHubData, FirebaseError, DeleteTeamHubVariables>): UseDataConnectMutationResult<DeleteTeamHubData, DeleteTeamHubVariables>;
Variables
The deleteTeamHub Mutation requires an argument of type DeleteTeamHubVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteTeamHubVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteTeamHub Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteTeamHub Mutation is of type DeleteTeamHubData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteTeamHubData {
teamHub_delete?: TeamHub_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteTeamHub's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteTeamHubVariables } from '@dataconnect/generated';
import { useDeleteTeamHub } from '@dataconnect/generated/react'
export default function DeleteTeamHubComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteTeamHub();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteTeamHub(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteTeamHub(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteTeamHub(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteTeamHub` Mutation requires an argument of type `DeleteTeamHubVariables`:
const deleteTeamHubVars: DeleteTeamHubVariables = {
id: ...,
};
mutation.mutate(deleteTeamHubVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteTeamHubVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.teamHub_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createHub
You can execute the createHub Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateHub(options?: useDataConnectMutationOptions<CreateHubData, FirebaseError, CreateHubVariables>): UseDataConnectMutationResult<CreateHubData, CreateHubVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateHub(dc: DataConnect, options?: useDataConnectMutationOptions<CreateHubData, FirebaseError, CreateHubVariables>): UseDataConnectMutationResult<CreateHubData, CreateHubVariables>;
Variables
The createHub Mutation requires an argument of type CreateHubVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateHubVariables {
name: string;
locationName?: string | null;
address?: string | null;
nfcTagId?: string | null;
ownerId: UUIDString;
}
Return Type
Recall that calling the createHub Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createHub Mutation is of type CreateHubData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateHubData {
hub_insert: Hub_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createHub's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateHubVariables } from '@dataconnect/generated';
import { useCreateHub } from '@dataconnect/generated/react'
export default function CreateHubComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateHub();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateHub(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateHub(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateHub(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateHub` Mutation requires an argument of type `CreateHubVariables`:
const createHubVars: CreateHubVariables = {
name: ...,
locationName: ..., // optional
address: ..., // optional
nfcTagId: ..., // optional
ownerId: ...,
};
mutation.mutate(createHubVars);
// Variables can be defined inline as well.
mutation.mutate({ name: ..., locationName: ..., address: ..., nfcTagId: ..., ownerId: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createHubVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.hub_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateHub
You can execute the updateHub Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateHub(options?: useDataConnectMutationOptions<UpdateHubData, FirebaseError, UpdateHubVariables>): UseDataConnectMutationResult<UpdateHubData, UpdateHubVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateHub(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateHubData, FirebaseError, UpdateHubVariables>): UseDataConnectMutationResult<UpdateHubData, UpdateHubVariables>;
Variables
The updateHub Mutation requires an argument of type UpdateHubVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateHubVariables {
id: UUIDString;
name?: string | null;
locationName?: string | null;
address?: string | null;
nfcTagId?: string | null;
ownerId?: UUIDString | null;
}
Return Type
Recall that calling the updateHub Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateHub Mutation is of type UpdateHubData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateHubData {
hub_update?: Hub_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateHub's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateHubVariables } from '@dataconnect/generated';
import { useUpdateHub } from '@dataconnect/generated/react'
export default function UpdateHubComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateHub();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateHub(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateHub(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateHub(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateHub` Mutation requires an argument of type `UpdateHubVariables`:
const updateHubVars: UpdateHubVariables = {
id: ...,
name: ..., // optional
locationName: ..., // optional
address: ..., // optional
nfcTagId: ..., // optional
ownerId: ..., // optional
};
mutation.mutate(updateHubVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., name: ..., locationName: ..., address: ..., nfcTagId: ..., ownerId: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateHubVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.hub_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteHub
You can execute the deleteHub Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteHub(options?: useDataConnectMutationOptions<DeleteHubData, FirebaseError, DeleteHubVariables>): UseDataConnectMutationResult<DeleteHubData, DeleteHubVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteHub(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteHubData, FirebaseError, DeleteHubVariables>): UseDataConnectMutationResult<DeleteHubData, DeleteHubVariables>;
Variables
The deleteHub Mutation requires an argument of type DeleteHubVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteHubVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteHub Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteHub Mutation is of type DeleteHubData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteHubData {
hub_delete?: Hub_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteHub's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteHubVariables } from '@dataconnect/generated';
import { useDeleteHub } from '@dataconnect/generated/react'
export default function DeleteHubComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteHub();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteHub(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteHub(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteHub(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteHub` Mutation requires an argument of type `DeleteHubVariables`:
const deleteHubVars: DeleteHubVariables = {
id: ...,
};
mutation.mutate(deleteHubVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteHubVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.hub_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createRoleCategory
You can execute the createRoleCategory Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateRoleCategory(options?: useDataConnectMutationOptions<CreateRoleCategoryData, FirebaseError, CreateRoleCategoryVariables>): UseDataConnectMutationResult<CreateRoleCategoryData, CreateRoleCategoryVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateRoleCategory(dc: DataConnect, options?: useDataConnectMutationOptions<CreateRoleCategoryData, FirebaseError, CreateRoleCategoryVariables>): UseDataConnectMutationResult<CreateRoleCategoryData, CreateRoleCategoryVariables>;
Variables
The createRoleCategory Mutation requires an argument of type CreateRoleCategoryVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateRoleCategoryVariables {
roleName: string;
category: RoleCategoryType;
}
Return Type
Recall that calling the createRoleCategory Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createRoleCategory Mutation is of type CreateRoleCategoryData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateRoleCategoryData {
roleCategory_insert: RoleCategory_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createRoleCategory's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateRoleCategoryVariables } from '@dataconnect/generated';
import { useCreateRoleCategory } from '@dataconnect/generated/react'
export default function CreateRoleCategoryComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateRoleCategory();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateRoleCategory(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateRoleCategory(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateRoleCategory(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateRoleCategory` Mutation requires an argument of type `CreateRoleCategoryVariables`:
const createRoleCategoryVars: CreateRoleCategoryVariables = {
roleName: ...,
category: ...,
};
mutation.mutate(createRoleCategoryVars);
// Variables can be defined inline as well.
mutation.mutate({ roleName: ..., category: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createRoleCategoryVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.roleCategory_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateRoleCategory
You can execute the updateRoleCategory Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateRoleCategory(options?: useDataConnectMutationOptions<UpdateRoleCategoryData, FirebaseError, UpdateRoleCategoryVariables>): UseDataConnectMutationResult<UpdateRoleCategoryData, UpdateRoleCategoryVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateRoleCategory(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateRoleCategoryData, FirebaseError, UpdateRoleCategoryVariables>): UseDataConnectMutationResult<UpdateRoleCategoryData, UpdateRoleCategoryVariables>;
Variables
The updateRoleCategory Mutation requires an argument of type UpdateRoleCategoryVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateRoleCategoryVariables {
id: UUIDString;
roleName?: string | null;
category?: RoleCategoryType | null;
}
Return Type
Recall that calling the updateRoleCategory Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateRoleCategory Mutation is of type UpdateRoleCategoryData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateRoleCategoryData {
roleCategory_update?: RoleCategory_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateRoleCategory's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateRoleCategoryVariables } from '@dataconnect/generated';
import { useUpdateRoleCategory } from '@dataconnect/generated/react'
export default function UpdateRoleCategoryComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateRoleCategory();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateRoleCategory(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateRoleCategory(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateRoleCategory(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateRoleCategory` Mutation requires an argument of type `UpdateRoleCategoryVariables`:
const updateRoleCategoryVars: UpdateRoleCategoryVariables = {
id: ...,
roleName: ..., // optional
category: ..., // optional
};
mutation.mutate(updateRoleCategoryVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., roleName: ..., category: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateRoleCategoryVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.roleCategory_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteRoleCategory
You can execute the deleteRoleCategory Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteRoleCategory(options?: useDataConnectMutationOptions<DeleteRoleCategoryData, FirebaseError, DeleteRoleCategoryVariables>): UseDataConnectMutationResult<DeleteRoleCategoryData, DeleteRoleCategoryVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteRoleCategory(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteRoleCategoryData, FirebaseError, DeleteRoleCategoryVariables>): UseDataConnectMutationResult<DeleteRoleCategoryData, DeleteRoleCategoryVariables>;
Variables
The deleteRoleCategory Mutation requires an argument of type DeleteRoleCategoryVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteRoleCategoryVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteRoleCategory Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteRoleCategory Mutation is of type DeleteRoleCategoryData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteRoleCategoryData {
roleCategory_delete?: RoleCategory_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteRoleCategory's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteRoleCategoryVariables } from '@dataconnect/generated';
import { useDeleteRoleCategory } from '@dataconnect/generated/react'
export default function DeleteRoleCategoryComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteRoleCategory();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteRoleCategory(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteRoleCategory(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteRoleCategory(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteRoleCategory` Mutation requires an argument of type `DeleteRoleCategoryVariables`:
const deleteRoleCategoryVars: DeleteRoleCategoryVariables = {
id: ...,
};
mutation.mutate(deleteRoleCategoryVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteRoleCategoryVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.roleCategory_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createStaffAvailabilityStats
You can execute the createStaffAvailabilityStats Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateStaffAvailabilityStats(options?: useDataConnectMutationOptions<CreateStaffAvailabilityStatsData, FirebaseError, CreateStaffAvailabilityStatsVariables>): UseDataConnectMutationResult<CreateStaffAvailabilityStatsData, CreateStaffAvailabilityStatsVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateStaffAvailabilityStats(dc: DataConnect, options?: useDataConnectMutationOptions<CreateStaffAvailabilityStatsData, FirebaseError, CreateStaffAvailabilityStatsVariables>): UseDataConnectMutationResult<CreateStaffAvailabilityStatsData, CreateStaffAvailabilityStatsVariables>;
Variables
The createStaffAvailabilityStats Mutation requires an argument of type CreateStaffAvailabilityStatsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateStaffAvailabilityStatsVariables {
staffId: UUIDString;
needWorkIndex?: number | null;
utilizationPercentage?: number | null;
predictedAvailabilityScore?: number | null;
scheduledHoursThisPeriod?: number | null;
desiredHoursThisPeriod?: number | null;
lastShiftDate?: TimestampString | null;
acceptanceRate?: number | null;
}
Return Type
Recall that calling the createStaffAvailabilityStats Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createStaffAvailabilityStats Mutation is of type CreateStaffAvailabilityStatsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateStaffAvailabilityStatsData {
staffAvailabilityStats_insert: StaffAvailabilityStats_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createStaffAvailabilityStats's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateStaffAvailabilityStatsVariables } from '@dataconnect/generated';
import { useCreateStaffAvailabilityStats } from '@dataconnect/generated/react'
export default function CreateStaffAvailabilityStatsComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateStaffAvailabilityStats();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateStaffAvailabilityStats(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateStaffAvailabilityStats(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateStaffAvailabilityStats(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateStaffAvailabilityStats` Mutation requires an argument of type `CreateStaffAvailabilityStatsVariables`:
const createStaffAvailabilityStatsVars: CreateStaffAvailabilityStatsVariables = {
staffId: ...,
needWorkIndex: ..., // optional
utilizationPercentage: ..., // optional
predictedAvailabilityScore: ..., // optional
scheduledHoursThisPeriod: ..., // optional
desiredHoursThisPeriod: ..., // optional
lastShiftDate: ..., // optional
acceptanceRate: ..., // optional
};
mutation.mutate(createStaffAvailabilityStatsVars);
// Variables can be defined inline as well.
mutation.mutate({ staffId: ..., needWorkIndex: ..., utilizationPercentage: ..., predictedAvailabilityScore: ..., scheduledHoursThisPeriod: ..., desiredHoursThisPeriod: ..., lastShiftDate: ..., acceptanceRate: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createStaffAvailabilityStatsVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.staffAvailabilityStats_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateStaffAvailabilityStats
You can execute the updateStaffAvailabilityStats Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateStaffAvailabilityStats(options?: useDataConnectMutationOptions<UpdateStaffAvailabilityStatsData, FirebaseError, UpdateStaffAvailabilityStatsVariables>): UseDataConnectMutationResult<UpdateStaffAvailabilityStatsData, UpdateStaffAvailabilityStatsVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateStaffAvailabilityStats(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateStaffAvailabilityStatsData, FirebaseError, UpdateStaffAvailabilityStatsVariables>): UseDataConnectMutationResult<UpdateStaffAvailabilityStatsData, UpdateStaffAvailabilityStatsVariables>;
Variables
The updateStaffAvailabilityStats Mutation requires an argument of type UpdateStaffAvailabilityStatsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateStaffAvailabilityStatsVariables {
staffId: UUIDString;
needWorkIndex?: number | null;
utilizationPercentage?: number | null;
predictedAvailabilityScore?: number | null;
scheduledHoursThisPeriod?: number | null;
desiredHoursThisPeriod?: number | null;
lastShiftDate?: TimestampString | null;
acceptanceRate?: number | null;
}
Return Type
Recall that calling the updateStaffAvailabilityStats Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateStaffAvailabilityStats Mutation is of type UpdateStaffAvailabilityStatsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateStaffAvailabilityStatsData {
staffAvailabilityStats_update?: StaffAvailabilityStats_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateStaffAvailabilityStats's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateStaffAvailabilityStatsVariables } from '@dataconnect/generated';
import { useUpdateStaffAvailabilityStats } from '@dataconnect/generated/react'
export default function UpdateStaffAvailabilityStatsComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateStaffAvailabilityStats();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateStaffAvailabilityStats(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateStaffAvailabilityStats(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateStaffAvailabilityStats(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateStaffAvailabilityStats` Mutation requires an argument of type `UpdateStaffAvailabilityStatsVariables`:
const updateStaffAvailabilityStatsVars: UpdateStaffAvailabilityStatsVariables = {
staffId: ...,
needWorkIndex: ..., // optional
utilizationPercentage: ..., // optional
predictedAvailabilityScore: ..., // optional
scheduledHoursThisPeriod: ..., // optional
desiredHoursThisPeriod: ..., // optional
lastShiftDate: ..., // optional
acceptanceRate: ..., // optional
};
mutation.mutate(updateStaffAvailabilityStatsVars);
// Variables can be defined inline as well.
mutation.mutate({ staffId: ..., needWorkIndex: ..., utilizationPercentage: ..., predictedAvailabilityScore: ..., scheduledHoursThisPeriod: ..., desiredHoursThisPeriod: ..., lastShiftDate: ..., acceptanceRate: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateStaffAvailabilityStatsVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.staffAvailabilityStats_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteStaffAvailabilityStats
You can execute the deleteStaffAvailabilityStats Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteStaffAvailabilityStats(options?: useDataConnectMutationOptions<DeleteStaffAvailabilityStatsData, FirebaseError, DeleteStaffAvailabilityStatsVariables>): UseDataConnectMutationResult<DeleteStaffAvailabilityStatsData, DeleteStaffAvailabilityStatsVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteStaffAvailabilityStats(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteStaffAvailabilityStatsData, FirebaseError, DeleteStaffAvailabilityStatsVariables>): UseDataConnectMutationResult<DeleteStaffAvailabilityStatsData, DeleteStaffAvailabilityStatsVariables>;
Variables
The deleteStaffAvailabilityStats Mutation requires an argument of type DeleteStaffAvailabilityStatsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteStaffAvailabilityStatsVariables {
staffId: UUIDString;
}
Return Type
Recall that calling the deleteStaffAvailabilityStats Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteStaffAvailabilityStats Mutation is of type DeleteStaffAvailabilityStatsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteStaffAvailabilityStatsData {
staffAvailabilityStats_delete?: StaffAvailabilityStats_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteStaffAvailabilityStats's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteStaffAvailabilityStatsVariables } from '@dataconnect/generated';
import { useDeleteStaffAvailabilityStats } from '@dataconnect/generated/react'
export default function DeleteStaffAvailabilityStatsComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteStaffAvailabilityStats();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteStaffAvailabilityStats(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteStaffAvailabilityStats(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteStaffAvailabilityStats(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteStaffAvailabilityStats` Mutation requires an argument of type `DeleteStaffAvailabilityStatsVariables`:
const deleteStaffAvailabilityStatsVars: DeleteStaffAvailabilityStatsVariables = {
staffId: ...,
};
mutation.mutate(deleteStaffAvailabilityStatsVars);
// Variables can be defined inline as well.
mutation.mutate({ staffId: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteStaffAvailabilityStatsVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.staffAvailabilityStats_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createShiftRole
You can execute the createShiftRole Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateShiftRole(options?: useDataConnectMutationOptions<CreateShiftRoleData, FirebaseError, CreateShiftRoleVariables>): UseDataConnectMutationResult<CreateShiftRoleData, CreateShiftRoleVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateShiftRole(dc: DataConnect, options?: useDataConnectMutationOptions<CreateShiftRoleData, FirebaseError, CreateShiftRoleVariables>): UseDataConnectMutationResult<CreateShiftRoleData, CreateShiftRoleVariables>;
Variables
The createShiftRole Mutation requires an argument of type CreateShiftRoleVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateShiftRoleVariables {
shiftId: UUIDString;
roleId: UUIDString;
count: number;
assigned?: number | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
department?: string | null;
uniform?: string | null;
breakType?: BreakDuration | null;
totalValue?: number | null;
}
Return Type
Recall that calling the createShiftRole Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createShiftRole Mutation is of type CreateShiftRoleData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateShiftRoleData {
shiftRole_insert: ShiftRole_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createShiftRole's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateShiftRoleVariables } from '@dataconnect/generated';
import { useCreateShiftRole } from '@dataconnect/generated/react'
export default function CreateShiftRoleComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateShiftRole();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateShiftRole(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateShiftRole(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateShiftRole(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateShiftRole` Mutation requires an argument of type `CreateShiftRoleVariables`:
const createShiftRoleVars: CreateShiftRoleVariables = {
shiftId: ...,
roleId: ...,
count: ...,
assigned: ..., // optional
startTime: ..., // optional
endTime: ..., // optional
hours: ..., // optional
department: ..., // optional
uniform: ..., // optional
breakType: ..., // optional
totalValue: ..., // optional
};
mutation.mutate(createShiftRoleVars);
// Variables can be defined inline as well.
mutation.mutate({ shiftId: ..., roleId: ..., count: ..., assigned: ..., startTime: ..., endTime: ..., hours: ..., department: ..., uniform: ..., breakType: ..., totalValue: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createShiftRoleVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.shiftRole_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateShiftRole
You can execute the updateShiftRole Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateShiftRole(options?: useDataConnectMutationOptions<UpdateShiftRoleData, FirebaseError, UpdateShiftRoleVariables>): UseDataConnectMutationResult<UpdateShiftRoleData, UpdateShiftRoleVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateShiftRole(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateShiftRoleData, FirebaseError, UpdateShiftRoleVariables>): UseDataConnectMutationResult<UpdateShiftRoleData, UpdateShiftRoleVariables>;
Variables
The updateShiftRole Mutation requires an argument of type UpdateShiftRoleVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateShiftRoleVariables {
shiftId: UUIDString;
roleId: UUIDString;
count?: number | null;
assigned?: number | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
department?: string | null;
uniform?: string | null;
breakType?: BreakDuration | null;
totalValue?: number | null;
}
Return Type
Recall that calling the updateShiftRole Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateShiftRole Mutation is of type UpdateShiftRoleData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateShiftRoleData {
shiftRole_update?: ShiftRole_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateShiftRole's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateShiftRoleVariables } from '@dataconnect/generated';
import { useUpdateShiftRole } from '@dataconnect/generated/react'
export default function UpdateShiftRoleComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateShiftRole();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateShiftRole(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateShiftRole(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateShiftRole(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateShiftRole` Mutation requires an argument of type `UpdateShiftRoleVariables`:
const updateShiftRoleVars: UpdateShiftRoleVariables = {
shiftId: ...,
roleId: ...,
count: ..., // optional
assigned: ..., // optional
startTime: ..., // optional
endTime: ..., // optional
hours: ..., // optional
department: ..., // optional
uniform: ..., // optional
breakType: ..., // optional
totalValue: ..., // optional
};
mutation.mutate(updateShiftRoleVars);
// Variables can be defined inline as well.
mutation.mutate({ shiftId: ..., roleId: ..., count: ..., assigned: ..., startTime: ..., endTime: ..., hours: ..., department: ..., uniform: ..., breakType: ..., totalValue: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateShiftRoleVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.shiftRole_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteShiftRole
You can execute the deleteShiftRole Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteShiftRole(options?: useDataConnectMutationOptions<DeleteShiftRoleData, FirebaseError, DeleteShiftRoleVariables>): UseDataConnectMutationResult<DeleteShiftRoleData, DeleteShiftRoleVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteShiftRole(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteShiftRoleData, FirebaseError, DeleteShiftRoleVariables>): UseDataConnectMutationResult<DeleteShiftRoleData, DeleteShiftRoleVariables>;
Variables
The deleteShiftRole Mutation requires an argument of type DeleteShiftRoleVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteShiftRoleVariables {
shiftId: UUIDString;
roleId: UUIDString;
}
Return Type
Recall that calling the deleteShiftRole Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteShiftRole Mutation is of type DeleteShiftRoleData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteShiftRoleData {
shiftRole_delete?: ShiftRole_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteShiftRole's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteShiftRoleVariables } from '@dataconnect/generated';
import { useDeleteShiftRole } from '@dataconnect/generated/react'
export default function DeleteShiftRoleComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteShiftRole();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteShiftRole(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteShiftRole(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteShiftRole(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteShiftRole` Mutation requires an argument of type `DeleteShiftRoleVariables`:
const deleteShiftRoleVars: DeleteShiftRoleVariables = {
shiftId: ...,
roleId: ...,
};
mutation.mutate(deleteShiftRoleVars);
// Variables can be defined inline as well.
mutation.mutate({ shiftId: ..., roleId: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteShiftRoleVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.shiftRole_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createStaffRole
You can execute the createStaffRole Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateStaffRole(options?: useDataConnectMutationOptions<CreateStaffRoleData, FirebaseError, CreateStaffRoleVariables>): UseDataConnectMutationResult<CreateStaffRoleData, CreateStaffRoleVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateStaffRole(dc: DataConnect, options?: useDataConnectMutationOptions<CreateStaffRoleData, FirebaseError, CreateStaffRoleVariables>): UseDataConnectMutationResult<CreateStaffRoleData, CreateStaffRoleVariables>;
Variables
The createStaffRole Mutation requires an argument of type CreateStaffRoleVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateStaffRoleVariables {
staffId: UUIDString;
roleId: UUIDString;
roleType?: RoleType | null;
}
Return Type
Recall that calling the createStaffRole Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createStaffRole Mutation is of type CreateStaffRoleData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateStaffRoleData {
staffRole_insert: StaffRole_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createStaffRole's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateStaffRoleVariables } from '@dataconnect/generated';
import { useCreateStaffRole } from '@dataconnect/generated/react'
export default function CreateStaffRoleComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateStaffRole();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateStaffRole(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateStaffRole(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateStaffRole(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateStaffRole` Mutation requires an argument of type `CreateStaffRoleVariables`:
const createStaffRoleVars: CreateStaffRoleVariables = {
staffId: ...,
roleId: ...,
roleType: ..., // optional
};
mutation.mutate(createStaffRoleVars);
// Variables can be defined inline as well.
mutation.mutate({ staffId: ..., roleId: ..., roleType: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createStaffRoleVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.staffRole_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteStaffRole
You can execute the deleteStaffRole Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteStaffRole(options?: useDataConnectMutationOptions<DeleteStaffRoleData, FirebaseError, DeleteStaffRoleVariables>): UseDataConnectMutationResult<DeleteStaffRoleData, DeleteStaffRoleVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteStaffRole(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteStaffRoleData, FirebaseError, DeleteStaffRoleVariables>): UseDataConnectMutationResult<DeleteStaffRoleData, DeleteStaffRoleVariables>;
Variables
The deleteStaffRole Mutation requires an argument of type DeleteStaffRoleVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteStaffRoleVariables {
staffId: UUIDString;
roleId: UUIDString;
}
Return Type
Recall that calling the deleteStaffRole Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteStaffRole Mutation is of type DeleteStaffRoleData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteStaffRoleData {
staffRole_delete?: StaffRole_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteStaffRole's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteStaffRoleVariables } from '@dataconnect/generated';
import { useDeleteStaffRole } from '@dataconnect/generated/react'
export default function DeleteStaffRoleComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteStaffRole();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteStaffRole(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteStaffRole(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteStaffRole(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteStaffRole` Mutation requires an argument of type `DeleteStaffRoleVariables`:
const deleteStaffRoleVars: DeleteStaffRoleVariables = {
staffId: ...,
roleId: ...,
};
mutation.mutate(deleteStaffRoleVars);
// Variables can be defined inline as well.
mutation.mutate({ staffId: ..., roleId: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteStaffRoleVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.staffRole_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createAccount
You can execute the createAccount Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateAccount(options?: useDataConnectMutationOptions<CreateAccountData, FirebaseError, CreateAccountVariables>): UseDataConnectMutationResult<CreateAccountData, CreateAccountVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateAccount(dc: DataConnect, options?: useDataConnectMutationOptions<CreateAccountData, FirebaseError, CreateAccountVariables>): UseDataConnectMutationResult<CreateAccountData, CreateAccountVariables>;
Variables
The createAccount Mutation requires an argument of type CreateAccountVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateAccountVariables {
bank: string;
type: AccountType;
last4: string;
isPrimary?: boolean | null;
ownerId: UUIDString;
accountNumber?: string | null;
routeNumber?: string | null;
expiryTime?: TimestampString | null;
}
Return Type
Recall that calling the createAccount Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createAccount Mutation is of type CreateAccountData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateAccountData {
account_insert: Account_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createAccount's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateAccountVariables } from '@dataconnect/generated';
import { useCreateAccount } from '@dataconnect/generated/react'
export default function CreateAccountComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateAccount();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateAccount(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateAccount(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateAccount(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateAccount` Mutation requires an argument of type `CreateAccountVariables`:
const createAccountVars: CreateAccountVariables = {
bank: ...,
type: ...,
last4: ...,
isPrimary: ..., // optional
ownerId: ...,
accountNumber: ..., // optional
routeNumber: ..., // optional
expiryTime: ..., // optional
};
mutation.mutate(createAccountVars);
// Variables can be defined inline as well.
mutation.mutate({ bank: ..., type: ..., last4: ..., isPrimary: ..., ownerId: ..., accountNumber: ..., routeNumber: ..., expiryTime: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createAccountVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.account_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateAccount
You can execute the updateAccount Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateAccount(options?: useDataConnectMutationOptions<UpdateAccountData, FirebaseError, UpdateAccountVariables>): UseDataConnectMutationResult<UpdateAccountData, UpdateAccountVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateAccount(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateAccountData, FirebaseError, UpdateAccountVariables>): UseDataConnectMutationResult<UpdateAccountData, UpdateAccountVariables>;
Variables
The updateAccount Mutation requires an argument of type UpdateAccountVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateAccountVariables {
id: UUIDString;
bank?: string | null;
type?: AccountType | null;
last4?: string | null;
isPrimary?: boolean | null;
accountNumber?: string | null;
routeNumber?: string | null;
expiryTime?: TimestampString | null;
}
Return Type
Recall that calling the updateAccount Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateAccount Mutation is of type UpdateAccountData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateAccountData {
account_update?: Account_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateAccount's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateAccountVariables } from '@dataconnect/generated';
import { useUpdateAccount } from '@dataconnect/generated/react'
export default function UpdateAccountComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateAccount();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateAccount(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateAccount(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateAccount(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateAccount` Mutation requires an argument of type `UpdateAccountVariables`:
const updateAccountVars: UpdateAccountVariables = {
id: ...,
bank: ..., // optional
type: ..., // optional
last4: ..., // optional
isPrimary: ..., // optional
accountNumber: ..., // optional
routeNumber: ..., // optional
expiryTime: ..., // optional
};
mutation.mutate(updateAccountVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., bank: ..., type: ..., last4: ..., isPrimary: ..., accountNumber: ..., routeNumber: ..., expiryTime: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateAccountVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.account_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteAccount
You can execute the deleteAccount Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteAccount(options?: useDataConnectMutationOptions<DeleteAccountData, FirebaseError, DeleteAccountVariables>): UseDataConnectMutationResult<DeleteAccountData, DeleteAccountVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteAccount(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteAccountData, FirebaseError, DeleteAccountVariables>): UseDataConnectMutationResult<DeleteAccountData, DeleteAccountVariables>;
Variables
The deleteAccount Mutation requires an argument of type DeleteAccountVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteAccountVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteAccount Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteAccount Mutation is of type DeleteAccountData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteAccountData {
account_delete?: Account_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteAccount's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteAccountVariables } from '@dataconnect/generated';
import { useDeleteAccount } from '@dataconnect/generated/react'
export default function DeleteAccountComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteAccount();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteAccount(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteAccount(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteAccount(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteAccount` Mutation requires an argument of type `DeleteAccountVariables`:
const deleteAccountVars: DeleteAccountVariables = {
id: ...,
};
mutation.mutate(deleteAccountVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteAccountVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.account_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createApplication
You can execute the createApplication Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateApplication(options?: useDataConnectMutationOptions<CreateApplicationData, FirebaseError, CreateApplicationVariables>): UseDataConnectMutationResult<CreateApplicationData, CreateApplicationVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateApplication(dc: DataConnect, options?: useDataConnectMutationOptions<CreateApplicationData, FirebaseError, CreateApplicationVariables>): UseDataConnectMutationResult<CreateApplicationData, CreateApplicationVariables>;
Variables
The createApplication Mutation requires an argument of type CreateApplicationVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateApplicationVariables {
shiftId: UUIDString;
staffId: UUIDString;
status: ApplicationStatus;
checkInTime?: TimestampString | null;
checkOutTime?: TimestampString | null;
origin: ApplicationOrigin;
roleId: UUIDString;
}
Return Type
Recall that calling the createApplication Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createApplication Mutation is of type CreateApplicationData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateApplicationData {
application_insert: Application_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createApplication's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateApplicationVariables } from '@dataconnect/generated';
import { useCreateApplication } from '@dataconnect/generated/react'
export default function CreateApplicationComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateApplication();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateApplication(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateApplication(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateApplication(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateApplication` Mutation requires an argument of type `CreateApplicationVariables`:
const createApplicationVars: CreateApplicationVariables = {
shiftId: ...,
staffId: ...,
status: ...,
checkInTime: ..., // optional
checkOutTime: ..., // optional
origin: ...,
roleId: ...,
};
mutation.mutate(createApplicationVars);
// Variables can be defined inline as well.
mutation.mutate({ shiftId: ..., staffId: ..., status: ..., checkInTime: ..., checkOutTime: ..., origin: ..., roleId: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createApplicationVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.application_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateApplicationStatus
You can execute the updateApplicationStatus Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateApplicationStatus(options?: useDataConnectMutationOptions<UpdateApplicationStatusData, FirebaseError, UpdateApplicationStatusVariables>): UseDataConnectMutationResult<UpdateApplicationStatusData, UpdateApplicationStatusVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateApplicationStatus(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateApplicationStatusData, FirebaseError, UpdateApplicationStatusVariables>): UseDataConnectMutationResult<UpdateApplicationStatusData, UpdateApplicationStatusVariables>;
Variables
The updateApplicationStatus Mutation requires an argument of type UpdateApplicationStatusVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateApplicationStatusVariables {
id: UUIDString;
shiftId?: UUIDString | null;
staffId?: UUIDString | null;
status?: ApplicationStatus | null;
checkInTime?: TimestampString | null;
checkOutTime?: TimestampString | null;
roleId?: UUIDString | null;
}
Return Type
Recall that calling the updateApplicationStatus Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateApplicationStatus Mutation is of type UpdateApplicationStatusData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateApplicationStatusData {
application_update?: Application_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateApplicationStatus's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateApplicationStatusVariables } from '@dataconnect/generated';
import { useUpdateApplicationStatus } from '@dataconnect/generated/react'
export default function UpdateApplicationStatusComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateApplicationStatus();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateApplicationStatus(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateApplicationStatus(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateApplicationStatus(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateApplicationStatus` Mutation requires an argument of type `UpdateApplicationStatusVariables`:
const updateApplicationStatusVars: UpdateApplicationStatusVariables = {
id: ...,
shiftId: ..., // optional
staffId: ..., // optional
status: ..., // optional
checkInTime: ..., // optional
checkOutTime: ..., // optional
roleId: ..., // optional
};
mutation.mutate(updateApplicationStatusVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., shiftId: ..., staffId: ..., status: ..., checkInTime: ..., checkOutTime: ..., roleId: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateApplicationStatusVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.application_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteApplication
You can execute the deleteApplication Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteApplication(options?: useDataConnectMutationOptions<DeleteApplicationData, FirebaseError, DeleteApplicationVariables>): UseDataConnectMutationResult<DeleteApplicationData, DeleteApplicationVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteApplication(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteApplicationData, FirebaseError, DeleteApplicationVariables>): UseDataConnectMutationResult<DeleteApplicationData, DeleteApplicationVariables>;
Variables
The deleteApplication Mutation requires an argument of type DeleteApplicationVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteApplicationVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteApplication Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteApplication Mutation is of type DeleteApplicationData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteApplicationData {
application_delete?: Application_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteApplication's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteApplicationVariables } from '@dataconnect/generated';
import { useDeleteApplication } from '@dataconnect/generated/react'
export default function DeleteApplicationComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteApplication();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteApplication(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteApplication(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteApplication(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteApplication` Mutation requires an argument of type `DeleteApplicationVariables`:
const deleteApplicationVars: DeleteApplicationVariables = {
id: ...,
};
mutation.mutate(deleteApplicationVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteApplicationVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.application_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
CreateAssignment
You can execute the CreateAssignment Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateAssignment(options?: useDataConnectMutationOptions<CreateAssignmentData, FirebaseError, CreateAssignmentVariables>): UseDataConnectMutationResult<CreateAssignmentData, CreateAssignmentVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateAssignment(dc: DataConnect, options?: useDataConnectMutationOptions<CreateAssignmentData, FirebaseError, CreateAssignmentVariables>): UseDataConnectMutationResult<CreateAssignmentData, CreateAssignmentVariables>;
Variables
The CreateAssignment Mutation requires an argument of type CreateAssignmentVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateAssignmentVariables {
workforceId: UUIDString;
title?: string | null;
description?: string | null;
instructions?: string | null;
status?: AssignmentStatus | null;
tipsAvailable?: boolean | null;
travelTime?: boolean | null;
mealProvided?: boolean | null;
parkingAvailable?: boolean | null;
gasCompensation?: boolean | null;
managers?: unknown[] | null;
roleId: UUIDString;
shiftId: UUIDString;
}
Return Type
Recall that calling the CreateAssignment Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the CreateAssignment Mutation is of type CreateAssignmentData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateAssignmentData {
assignment_insert: Assignment_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using CreateAssignment's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateAssignmentVariables } from '@dataconnect/generated';
import { useCreateAssignment } from '@dataconnect/generated/react'
export default function CreateAssignmentComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateAssignment();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateAssignment(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateAssignment(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateAssignment(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateAssignment` Mutation requires an argument of type `CreateAssignmentVariables`:
const createAssignmentVars: CreateAssignmentVariables = {
workforceId: ...,
title: ..., // optional
description: ..., // optional
instructions: ..., // optional
status: ..., // optional
tipsAvailable: ..., // optional
travelTime: ..., // optional
mealProvided: ..., // optional
parkingAvailable: ..., // optional
gasCompensation: ..., // optional
managers: ..., // optional
roleId: ...,
shiftId: ...,
};
mutation.mutate(createAssignmentVars);
// Variables can be defined inline as well.
mutation.mutate({ workforceId: ..., title: ..., description: ..., instructions: ..., status: ..., tipsAvailable: ..., travelTime: ..., mealProvided: ..., parkingAvailable: ..., gasCompensation: ..., managers: ..., roleId: ..., shiftId: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createAssignmentVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.assignment_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
UpdateAssignment
You can execute the UpdateAssignment Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateAssignment(options?: useDataConnectMutationOptions<UpdateAssignmentData, FirebaseError, UpdateAssignmentVariables>): UseDataConnectMutationResult<UpdateAssignmentData, UpdateAssignmentVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateAssignment(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateAssignmentData, FirebaseError, UpdateAssignmentVariables>): UseDataConnectMutationResult<UpdateAssignmentData, UpdateAssignmentVariables>;
Variables
The UpdateAssignment Mutation requires an argument of type UpdateAssignmentVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateAssignmentVariables {
id: UUIDString;
title?: string | null;
description?: string | null;
instructions?: string | null;
status?: AssignmentStatus | null;
tipsAvailable?: boolean | null;
travelTime?: boolean | null;
mealProvided?: boolean | null;
parkingAvailable?: boolean | null;
gasCompensation?: boolean | null;
managers?: unknown[] | null;
roleId: UUIDString;
shiftId: UUIDString;
}
Return Type
Recall that calling the UpdateAssignment Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the UpdateAssignment Mutation is of type UpdateAssignmentData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateAssignmentData {
assignment_update?: Assignment_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using UpdateAssignment's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateAssignmentVariables } from '@dataconnect/generated';
import { useUpdateAssignment } from '@dataconnect/generated/react'
export default function UpdateAssignmentComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateAssignment();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateAssignment(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateAssignment(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateAssignment(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateAssignment` Mutation requires an argument of type `UpdateAssignmentVariables`:
const updateAssignmentVars: UpdateAssignmentVariables = {
id: ...,
title: ..., // optional
description: ..., // optional
instructions: ..., // optional
status: ..., // optional
tipsAvailable: ..., // optional
travelTime: ..., // optional
mealProvided: ..., // optional
parkingAvailable: ..., // optional
gasCompensation: ..., // optional
managers: ..., // optional
roleId: ...,
shiftId: ...,
};
mutation.mutate(updateAssignmentVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., title: ..., description: ..., instructions: ..., status: ..., tipsAvailable: ..., travelTime: ..., mealProvided: ..., parkingAvailable: ..., gasCompensation: ..., managers: ..., roleId: ..., shiftId: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateAssignmentVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.assignment_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
DeleteAssignment
You can execute the DeleteAssignment Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteAssignment(options?: useDataConnectMutationOptions<DeleteAssignmentData, FirebaseError, DeleteAssignmentVariables>): UseDataConnectMutationResult<DeleteAssignmentData, DeleteAssignmentVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteAssignment(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteAssignmentData, FirebaseError, DeleteAssignmentVariables>): UseDataConnectMutationResult<DeleteAssignmentData, DeleteAssignmentVariables>;
Variables
The DeleteAssignment Mutation requires an argument of type DeleteAssignmentVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteAssignmentVariables {
id: UUIDString;
}
Return Type
Recall that calling the DeleteAssignment Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the DeleteAssignment Mutation is of type DeleteAssignmentData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteAssignmentData {
assignment_delete?: Assignment_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using DeleteAssignment's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteAssignmentVariables } from '@dataconnect/generated';
import { useDeleteAssignment } from '@dataconnect/generated/react'
export default function DeleteAssignmentComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteAssignment();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteAssignment(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteAssignment(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteAssignment(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteAssignment` Mutation requires an argument of type `DeleteAssignmentVariables`:
const deleteAssignmentVars: DeleteAssignmentVariables = {
id: ...,
};
mutation.mutate(deleteAssignmentVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteAssignmentVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.assignment_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createInvoiceTemplate
You can execute the createInvoiceTemplate Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateInvoiceTemplate(options?: useDataConnectMutationOptions<CreateInvoiceTemplateData, FirebaseError, CreateInvoiceTemplateVariables>): UseDataConnectMutationResult<CreateInvoiceTemplateData, CreateInvoiceTemplateVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateInvoiceTemplate(dc: DataConnect, options?: useDataConnectMutationOptions<CreateInvoiceTemplateData, FirebaseError, CreateInvoiceTemplateVariables>): UseDataConnectMutationResult<CreateInvoiceTemplateData, CreateInvoiceTemplateVariables>;
Variables
The createInvoiceTemplate Mutation requires an argument of type CreateInvoiceTemplateVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateInvoiceTemplateVariables {
name: string;
ownerId: UUIDString;
vendorId?: UUIDString | null;
businessId?: UUIDString | null;
orderId?: UUIDString | null;
paymentTerms?: InovicePaymentTermsTemp | null;
invoiceNumber?: string | null;
issueDate?: TimestampString | null;
dueDate?: TimestampString | null;
hub?: string | null;
managerName?: string | null;
vendorNumber?: string | null;
roles?: unknown | null;
charges?: unknown | null;
otherCharges?: number | null;
subtotal?: number | null;
amount?: number | null;
notes?: string | null;
staffCount?: number | null;
chargesCount?: number | null;
}
Return Type
Recall that calling the createInvoiceTemplate Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createInvoiceTemplate Mutation is of type CreateInvoiceTemplateData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateInvoiceTemplateData {
invoiceTemplate_insert: InvoiceTemplate_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createInvoiceTemplate's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateInvoiceTemplateVariables } from '@dataconnect/generated';
import { useCreateInvoiceTemplate } from '@dataconnect/generated/react'
export default function CreateInvoiceTemplateComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateInvoiceTemplate();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateInvoiceTemplate(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateInvoiceTemplate(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateInvoiceTemplate(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateInvoiceTemplate` Mutation requires an argument of type `CreateInvoiceTemplateVariables`:
const createInvoiceTemplateVars: CreateInvoiceTemplateVariables = {
name: ...,
ownerId: ...,
vendorId: ..., // optional
businessId: ..., // optional
orderId: ..., // optional
paymentTerms: ..., // optional
invoiceNumber: ..., // optional
issueDate: ..., // optional
dueDate: ..., // optional
hub: ..., // optional
managerName: ..., // optional
vendorNumber: ..., // optional
roles: ..., // optional
charges: ..., // optional
otherCharges: ..., // optional
subtotal: ..., // optional
amount: ..., // optional
notes: ..., // optional
staffCount: ..., // optional
chargesCount: ..., // optional
};
mutation.mutate(createInvoiceTemplateVars);
// Variables can be defined inline as well.
mutation.mutate({ name: ..., ownerId: ..., vendorId: ..., businessId: ..., orderId: ..., paymentTerms: ..., invoiceNumber: ..., issueDate: ..., dueDate: ..., hub: ..., managerName: ..., vendorNumber: ..., roles: ..., charges: ..., otherCharges: ..., subtotal: ..., amount: ..., notes: ..., staffCount: ..., chargesCount: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createInvoiceTemplateVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.invoiceTemplate_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateInvoiceTemplate
You can execute the updateInvoiceTemplate Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateInvoiceTemplate(options?: useDataConnectMutationOptions<UpdateInvoiceTemplateData, FirebaseError, UpdateInvoiceTemplateVariables>): UseDataConnectMutationResult<UpdateInvoiceTemplateData, UpdateInvoiceTemplateVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateInvoiceTemplate(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateInvoiceTemplateData, FirebaseError, UpdateInvoiceTemplateVariables>): UseDataConnectMutationResult<UpdateInvoiceTemplateData, UpdateInvoiceTemplateVariables>;
Variables
The updateInvoiceTemplate Mutation requires an argument of type UpdateInvoiceTemplateVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateInvoiceTemplateVariables {
id: UUIDString;
name?: string | null;
ownerId?: UUIDString | null;
vendorId?: UUIDString | null;
businessId?: UUIDString | null;
orderId?: UUIDString | null;
paymentTerms?: InovicePaymentTermsTemp | null;
invoiceNumber?: string | null;
issueDate?: TimestampString | null;
dueDate?: TimestampString | null;
hub?: string | null;
managerName?: string | null;
vendorNumber?: string | null;
roles?: unknown | null;
charges?: unknown | null;
otherCharges?: number | null;
subtotal?: number | null;
amount?: number | null;
notes?: string | null;
staffCount?: number | null;
chargesCount?: number | null;
}
Return Type
Recall that calling the updateInvoiceTemplate Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateInvoiceTemplate Mutation is of type UpdateInvoiceTemplateData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateInvoiceTemplateData {
invoiceTemplate_update?: InvoiceTemplate_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateInvoiceTemplate's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateInvoiceTemplateVariables } from '@dataconnect/generated';
import { useUpdateInvoiceTemplate } from '@dataconnect/generated/react'
export default function UpdateInvoiceTemplateComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateInvoiceTemplate();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateInvoiceTemplate(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateInvoiceTemplate(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateInvoiceTemplate(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateInvoiceTemplate` Mutation requires an argument of type `UpdateInvoiceTemplateVariables`:
const updateInvoiceTemplateVars: UpdateInvoiceTemplateVariables = {
id: ...,
name: ..., // optional
ownerId: ..., // optional
vendorId: ..., // optional
businessId: ..., // optional
orderId: ..., // optional
paymentTerms: ..., // optional
invoiceNumber: ..., // optional
issueDate: ..., // optional
dueDate: ..., // optional
hub: ..., // optional
managerName: ..., // optional
vendorNumber: ..., // optional
roles: ..., // optional
charges: ..., // optional
otherCharges: ..., // optional
subtotal: ..., // optional
amount: ..., // optional
notes: ..., // optional
staffCount: ..., // optional
chargesCount: ..., // optional
};
mutation.mutate(updateInvoiceTemplateVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., name: ..., ownerId: ..., vendorId: ..., businessId: ..., orderId: ..., paymentTerms: ..., invoiceNumber: ..., issueDate: ..., dueDate: ..., hub: ..., managerName: ..., vendorNumber: ..., roles: ..., charges: ..., otherCharges: ..., subtotal: ..., amount: ..., notes: ..., staffCount: ..., chargesCount: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateInvoiceTemplateVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.invoiceTemplate_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteInvoiceTemplate
You can execute the deleteInvoiceTemplate Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteInvoiceTemplate(options?: useDataConnectMutationOptions<DeleteInvoiceTemplateData, FirebaseError, DeleteInvoiceTemplateVariables>): UseDataConnectMutationResult<DeleteInvoiceTemplateData, DeleteInvoiceTemplateVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteInvoiceTemplate(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteInvoiceTemplateData, FirebaseError, DeleteInvoiceTemplateVariables>): UseDataConnectMutationResult<DeleteInvoiceTemplateData, DeleteInvoiceTemplateVariables>;
Variables
The deleteInvoiceTemplate Mutation requires an argument of type DeleteInvoiceTemplateVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteInvoiceTemplateVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteInvoiceTemplate Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteInvoiceTemplate Mutation is of type DeleteInvoiceTemplateData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteInvoiceTemplateData {
invoiceTemplate_delete?: InvoiceTemplate_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteInvoiceTemplate's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteInvoiceTemplateVariables } from '@dataconnect/generated';
import { useDeleteInvoiceTemplate } from '@dataconnect/generated/react'
export default function DeleteInvoiceTemplateComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteInvoiceTemplate();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteInvoiceTemplate(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteInvoiceTemplate(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteInvoiceTemplate(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteInvoiceTemplate` Mutation requires an argument of type `DeleteInvoiceTemplateVariables`:
const deleteInvoiceTemplateVars: DeleteInvoiceTemplateVariables = {
id: ...,
};
mutation.mutate(deleteInvoiceTemplateVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteInvoiceTemplateVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.invoiceTemplate_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createStaffAvailability
You can execute the createStaffAvailability Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateStaffAvailability(options?: useDataConnectMutationOptions<CreateStaffAvailabilityData, FirebaseError, CreateStaffAvailabilityVariables>): UseDataConnectMutationResult<CreateStaffAvailabilityData, CreateStaffAvailabilityVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateStaffAvailability(dc: DataConnect, options?: useDataConnectMutationOptions<CreateStaffAvailabilityData, FirebaseError, CreateStaffAvailabilityVariables>): UseDataConnectMutationResult<CreateStaffAvailabilityData, CreateStaffAvailabilityVariables>;
Variables
The createStaffAvailability Mutation requires an argument of type CreateStaffAvailabilityVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateStaffAvailabilityVariables {
staffId: UUIDString;
day: DayOfWeek;
slot: AvailabilitySlot;
status?: AvailabilityStatus | null;
notes?: string | null;
}
Return Type
Recall that calling the createStaffAvailability Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createStaffAvailability Mutation is of type CreateStaffAvailabilityData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateStaffAvailabilityData {
staffAvailability_insert: StaffAvailability_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createStaffAvailability's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateStaffAvailabilityVariables } from '@dataconnect/generated';
import { useCreateStaffAvailability } from '@dataconnect/generated/react'
export default function CreateStaffAvailabilityComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateStaffAvailability();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateStaffAvailability(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateStaffAvailability(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateStaffAvailability(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateStaffAvailability` Mutation requires an argument of type `CreateStaffAvailabilityVariables`:
const createStaffAvailabilityVars: CreateStaffAvailabilityVariables = {
staffId: ...,
day: ...,
slot: ...,
status: ..., // optional
notes: ..., // optional
};
mutation.mutate(createStaffAvailabilityVars);
// Variables can be defined inline as well.
mutation.mutate({ staffId: ..., day: ..., slot: ..., status: ..., notes: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createStaffAvailabilityVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.staffAvailability_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateStaffAvailability
You can execute the updateStaffAvailability Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateStaffAvailability(options?: useDataConnectMutationOptions<UpdateStaffAvailabilityData, FirebaseError, UpdateStaffAvailabilityVariables>): UseDataConnectMutationResult<UpdateStaffAvailabilityData, UpdateStaffAvailabilityVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateStaffAvailability(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateStaffAvailabilityData, FirebaseError, UpdateStaffAvailabilityVariables>): UseDataConnectMutationResult<UpdateStaffAvailabilityData, UpdateStaffAvailabilityVariables>;
Variables
The updateStaffAvailability Mutation requires an argument of type UpdateStaffAvailabilityVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateStaffAvailabilityVariables {
staffId: UUIDString;
day: DayOfWeek;
slot: AvailabilitySlot;
status?: AvailabilityStatus | null;
notes?: string | null;
}
Return Type
Recall that calling the updateStaffAvailability Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateStaffAvailability Mutation is of type UpdateStaffAvailabilityData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateStaffAvailabilityData {
staffAvailability_update?: StaffAvailability_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateStaffAvailability's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateStaffAvailabilityVariables } from '@dataconnect/generated';
import { useUpdateStaffAvailability } from '@dataconnect/generated/react'
export default function UpdateStaffAvailabilityComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateStaffAvailability();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateStaffAvailability(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateStaffAvailability(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateStaffAvailability(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateStaffAvailability` Mutation requires an argument of type `UpdateStaffAvailabilityVariables`:
const updateStaffAvailabilityVars: UpdateStaffAvailabilityVariables = {
staffId: ...,
day: ...,
slot: ...,
status: ..., // optional
notes: ..., // optional
};
mutation.mutate(updateStaffAvailabilityVars);
// Variables can be defined inline as well.
mutation.mutate({ staffId: ..., day: ..., slot: ..., status: ..., notes: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateStaffAvailabilityVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.staffAvailability_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteStaffAvailability
You can execute the deleteStaffAvailability Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteStaffAvailability(options?: useDataConnectMutationOptions<DeleteStaffAvailabilityData, FirebaseError, DeleteStaffAvailabilityVariables>): UseDataConnectMutationResult<DeleteStaffAvailabilityData, DeleteStaffAvailabilityVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteStaffAvailability(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteStaffAvailabilityData, FirebaseError, DeleteStaffAvailabilityVariables>): UseDataConnectMutationResult<DeleteStaffAvailabilityData, DeleteStaffAvailabilityVariables>;
Variables
The deleteStaffAvailability Mutation requires an argument of type DeleteStaffAvailabilityVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteStaffAvailabilityVariables {
staffId: UUIDString;
day: DayOfWeek;
slot: AvailabilitySlot;
}
Return Type
Recall that calling the deleteStaffAvailability Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteStaffAvailability Mutation is of type DeleteStaffAvailabilityData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteStaffAvailabilityData {
staffAvailability_delete?: StaffAvailability_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteStaffAvailability's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteStaffAvailabilityVariables } from '@dataconnect/generated';
import { useDeleteStaffAvailability } from '@dataconnect/generated/react'
export default function DeleteStaffAvailabilityComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteStaffAvailability();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteStaffAvailability(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteStaffAvailability(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteStaffAvailability(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteStaffAvailability` Mutation requires an argument of type `DeleteStaffAvailabilityVariables`:
const deleteStaffAvailabilityVars: DeleteStaffAvailabilityVariables = {
staffId: ...,
day: ...,
slot: ...,
};
mutation.mutate(deleteStaffAvailabilityVars);
// Variables can be defined inline as well.
mutation.mutate({ staffId: ..., day: ..., slot: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteStaffAvailabilityVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.staffAvailability_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createTeamMember
You can execute the createTeamMember Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateTeamMember(options?: useDataConnectMutationOptions<CreateTeamMemberData, FirebaseError, CreateTeamMemberVariables>): UseDataConnectMutationResult<CreateTeamMemberData, CreateTeamMemberVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateTeamMember(dc: DataConnect, options?: useDataConnectMutationOptions<CreateTeamMemberData, FirebaseError, CreateTeamMemberVariables>): UseDataConnectMutationResult<CreateTeamMemberData, CreateTeamMemberVariables>;
Variables
The createTeamMember Mutation requires an argument of type CreateTeamMemberVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateTeamMemberVariables {
teamId: UUIDString;
role: TeamMemberRole;
title?: string | null;
department?: string | null;
teamHubId?: UUIDString | null;
isActive?: boolean | null;
userId: string;
inviteStatus?: TeamMemberInviteStatus | null;
}
Return Type
Recall that calling the createTeamMember Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createTeamMember Mutation is of type CreateTeamMemberData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateTeamMemberData {
teamMember_insert: TeamMember_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createTeamMember's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateTeamMemberVariables } from '@dataconnect/generated';
import { useCreateTeamMember } from '@dataconnect/generated/react'
export default function CreateTeamMemberComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateTeamMember();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateTeamMember(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateTeamMember(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateTeamMember(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateTeamMember` Mutation requires an argument of type `CreateTeamMemberVariables`:
const createTeamMemberVars: CreateTeamMemberVariables = {
teamId: ...,
role: ...,
title: ..., // optional
department: ..., // optional
teamHubId: ..., // optional
isActive: ..., // optional
userId: ...,
inviteStatus: ..., // optional
};
mutation.mutate(createTeamMemberVars);
// Variables can be defined inline as well.
mutation.mutate({ teamId: ..., role: ..., title: ..., department: ..., teamHubId: ..., isActive: ..., userId: ..., inviteStatus: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createTeamMemberVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.teamMember_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateTeamMember
You can execute the updateTeamMember Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateTeamMember(options?: useDataConnectMutationOptions<UpdateTeamMemberData, FirebaseError, UpdateTeamMemberVariables>): UseDataConnectMutationResult<UpdateTeamMemberData, UpdateTeamMemberVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateTeamMember(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateTeamMemberData, FirebaseError, UpdateTeamMemberVariables>): UseDataConnectMutationResult<UpdateTeamMemberData, UpdateTeamMemberVariables>;
Variables
The updateTeamMember Mutation requires an argument of type UpdateTeamMemberVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateTeamMemberVariables {
id: UUIDString;
role?: TeamMemberRole | null;
title?: string | null;
department?: string | null;
teamHubId?: UUIDString | null;
isActive?: boolean | null;
inviteStatus?: TeamMemberInviteStatus | null;
}
Return Type
Recall that calling the updateTeamMember Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateTeamMember Mutation is of type UpdateTeamMemberData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateTeamMemberData {
teamMember_update?: TeamMember_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateTeamMember's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateTeamMemberVariables } from '@dataconnect/generated';
import { useUpdateTeamMember } from '@dataconnect/generated/react'
export default function UpdateTeamMemberComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateTeamMember();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateTeamMember(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateTeamMember(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateTeamMember(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateTeamMember` Mutation requires an argument of type `UpdateTeamMemberVariables`:
const updateTeamMemberVars: UpdateTeamMemberVariables = {
id: ...,
role: ..., // optional
title: ..., // optional
department: ..., // optional
teamHubId: ..., // optional
isActive: ..., // optional
inviteStatus: ..., // optional
};
mutation.mutate(updateTeamMemberVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., role: ..., title: ..., department: ..., teamHubId: ..., isActive: ..., inviteStatus: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateTeamMemberVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.teamMember_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateTeamMemberInviteStatus
You can execute the updateTeamMemberInviteStatus Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateTeamMemberInviteStatus(options?: useDataConnectMutationOptions<UpdateTeamMemberInviteStatusData, FirebaseError, UpdateTeamMemberInviteStatusVariables>): UseDataConnectMutationResult<UpdateTeamMemberInviteStatusData, UpdateTeamMemberInviteStatusVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateTeamMemberInviteStatus(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateTeamMemberInviteStatusData, FirebaseError, UpdateTeamMemberInviteStatusVariables>): UseDataConnectMutationResult<UpdateTeamMemberInviteStatusData, UpdateTeamMemberInviteStatusVariables>;
Variables
The updateTeamMemberInviteStatus Mutation requires an argument of type UpdateTeamMemberInviteStatusVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateTeamMemberInviteStatusVariables {
id: UUIDString;
inviteStatus: TeamMemberInviteStatus;
}
Return Type
Recall that calling the updateTeamMemberInviteStatus Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateTeamMemberInviteStatus Mutation is of type UpdateTeamMemberInviteStatusData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateTeamMemberInviteStatusData {
teamMember_update?: TeamMember_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateTeamMemberInviteStatus's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateTeamMemberInviteStatusVariables } from '@dataconnect/generated';
import { useUpdateTeamMemberInviteStatus } from '@dataconnect/generated/react'
export default function UpdateTeamMemberInviteStatusComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateTeamMemberInviteStatus();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateTeamMemberInviteStatus(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateTeamMemberInviteStatus(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateTeamMemberInviteStatus(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateTeamMemberInviteStatus` Mutation requires an argument of type `UpdateTeamMemberInviteStatusVariables`:
const updateTeamMemberInviteStatusVars: UpdateTeamMemberInviteStatusVariables = {
id: ...,
inviteStatus: ...,
};
mutation.mutate(updateTeamMemberInviteStatusVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., inviteStatus: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateTeamMemberInviteStatusVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.teamMember_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
acceptInviteByCode
You can execute the acceptInviteByCode Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useAcceptInviteByCode(options?: useDataConnectMutationOptions<AcceptInviteByCodeData, FirebaseError, AcceptInviteByCodeVariables>): UseDataConnectMutationResult<AcceptInviteByCodeData, AcceptInviteByCodeVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useAcceptInviteByCode(dc: DataConnect, options?: useDataConnectMutationOptions<AcceptInviteByCodeData, FirebaseError, AcceptInviteByCodeVariables>): UseDataConnectMutationResult<AcceptInviteByCodeData, AcceptInviteByCodeVariables>;
Variables
The acceptInviteByCode Mutation requires an argument of type AcceptInviteByCodeVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface AcceptInviteByCodeVariables {
inviteCode: UUIDString;
}
Return Type
Recall that calling the acceptInviteByCode Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the acceptInviteByCode Mutation is of type AcceptInviteByCodeData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface AcceptInviteByCodeData {
teamMember_updateMany: number;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using acceptInviteByCode's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, AcceptInviteByCodeVariables } from '@dataconnect/generated';
import { useAcceptInviteByCode } from '@dataconnect/generated/react'
export default function AcceptInviteByCodeComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useAcceptInviteByCode();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useAcceptInviteByCode(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useAcceptInviteByCode(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useAcceptInviteByCode(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useAcceptInviteByCode` Mutation requires an argument of type `AcceptInviteByCodeVariables`:
const acceptInviteByCodeVars: AcceptInviteByCodeVariables = {
inviteCode: ...,
};
mutation.mutate(acceptInviteByCodeVars);
// Variables can be defined inline as well.
mutation.mutate({ inviteCode: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(acceptInviteByCodeVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.teamMember_updateMany);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
cancelInviteByCode
You can execute the cancelInviteByCode Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCancelInviteByCode(options?: useDataConnectMutationOptions<CancelInviteByCodeData, FirebaseError, CancelInviteByCodeVariables>): UseDataConnectMutationResult<CancelInviteByCodeData, CancelInviteByCodeVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCancelInviteByCode(dc: DataConnect, options?: useDataConnectMutationOptions<CancelInviteByCodeData, FirebaseError, CancelInviteByCodeVariables>): UseDataConnectMutationResult<CancelInviteByCodeData, CancelInviteByCodeVariables>;
Variables
The cancelInviteByCode Mutation requires an argument of type CancelInviteByCodeVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CancelInviteByCodeVariables {
inviteCode: UUIDString;
}
Return Type
Recall that calling the cancelInviteByCode Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the cancelInviteByCode Mutation is of type CancelInviteByCodeData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CancelInviteByCodeData {
teamMember_updateMany: number;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using cancelInviteByCode's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CancelInviteByCodeVariables } from '@dataconnect/generated';
import { useCancelInviteByCode } from '@dataconnect/generated/react'
export default function CancelInviteByCodeComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCancelInviteByCode();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCancelInviteByCode(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCancelInviteByCode(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCancelInviteByCode(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCancelInviteByCode` Mutation requires an argument of type `CancelInviteByCodeVariables`:
const cancelInviteByCodeVars: CancelInviteByCodeVariables = {
inviteCode: ...,
};
mutation.mutate(cancelInviteByCodeVars);
// Variables can be defined inline as well.
mutation.mutate({ inviteCode: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(cancelInviteByCodeVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.teamMember_updateMany);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteTeamMember
You can execute the deleteTeamMember Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteTeamMember(options?: useDataConnectMutationOptions<DeleteTeamMemberData, FirebaseError, DeleteTeamMemberVariables>): UseDataConnectMutationResult<DeleteTeamMemberData, DeleteTeamMemberVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteTeamMember(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteTeamMemberData, FirebaseError, DeleteTeamMemberVariables>): UseDataConnectMutationResult<DeleteTeamMemberData, DeleteTeamMemberVariables>;
Variables
The deleteTeamMember Mutation requires an argument of type DeleteTeamMemberVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteTeamMemberVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteTeamMember Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteTeamMember Mutation is of type DeleteTeamMemberData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteTeamMemberData {
teamMember_delete?: TeamMember_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteTeamMember's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteTeamMemberVariables } from '@dataconnect/generated';
import { useDeleteTeamMember } from '@dataconnect/generated/react'
export default function DeleteTeamMemberComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteTeamMember();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteTeamMember(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteTeamMember(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteTeamMember(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteTeamMember` Mutation requires an argument of type `DeleteTeamMemberVariables`:
const deleteTeamMemberVars: DeleteTeamMemberVariables = {
id: ...,
};
mutation.mutate(deleteTeamMemberVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteTeamMemberVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.teamMember_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createLevel
You can execute the createLevel Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateLevel(options?: useDataConnectMutationOptions<CreateLevelData, FirebaseError, CreateLevelVariables>): UseDataConnectMutationResult<CreateLevelData, CreateLevelVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateLevel(dc: DataConnect, options?: useDataConnectMutationOptions<CreateLevelData, FirebaseError, CreateLevelVariables>): UseDataConnectMutationResult<CreateLevelData, CreateLevelVariables>;
Variables
The createLevel Mutation requires an argument of type CreateLevelVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateLevelVariables {
name: string;
xpRequired: number;
icon?: string | null;
colors?: unknown | null;
}
Return Type
Recall that calling the createLevel Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createLevel Mutation is of type CreateLevelData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateLevelData {
level_insert: Level_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createLevel's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateLevelVariables } from '@dataconnect/generated';
import { useCreateLevel } from '@dataconnect/generated/react'
export default function CreateLevelComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateLevel();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateLevel(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateLevel(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateLevel(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateLevel` Mutation requires an argument of type `CreateLevelVariables`:
const createLevelVars: CreateLevelVariables = {
name: ...,
xpRequired: ...,
icon: ..., // optional
colors: ..., // optional
};
mutation.mutate(createLevelVars);
// Variables can be defined inline as well.
mutation.mutate({ name: ..., xpRequired: ..., icon: ..., colors: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createLevelVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.level_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateLevel
You can execute the updateLevel Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateLevel(options?: useDataConnectMutationOptions<UpdateLevelData, FirebaseError, UpdateLevelVariables>): UseDataConnectMutationResult<UpdateLevelData, UpdateLevelVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateLevel(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateLevelData, FirebaseError, UpdateLevelVariables>): UseDataConnectMutationResult<UpdateLevelData, UpdateLevelVariables>;
Variables
The updateLevel Mutation requires an argument of type UpdateLevelVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateLevelVariables {
id: UUIDString;
name?: string | null;
xpRequired?: number | null;
icon?: string | null;
colors?: unknown | null;
}
Return Type
Recall that calling the updateLevel Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateLevel Mutation is of type UpdateLevelData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateLevelData {
level_update?: Level_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateLevel's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateLevelVariables } from '@dataconnect/generated';
import { useUpdateLevel } from '@dataconnect/generated/react'
export default function UpdateLevelComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateLevel();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateLevel(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateLevel(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateLevel(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateLevel` Mutation requires an argument of type `UpdateLevelVariables`:
const updateLevelVars: UpdateLevelVariables = {
id: ...,
name: ..., // optional
xpRequired: ..., // optional
icon: ..., // optional
colors: ..., // optional
};
mutation.mutate(updateLevelVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., name: ..., xpRequired: ..., icon: ..., colors: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateLevelVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.level_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteLevel
You can execute the deleteLevel Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteLevel(options?: useDataConnectMutationOptions<DeleteLevelData, FirebaseError, DeleteLevelVariables>): UseDataConnectMutationResult<DeleteLevelData, DeleteLevelVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteLevel(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteLevelData, FirebaseError, DeleteLevelVariables>): UseDataConnectMutationResult<DeleteLevelData, DeleteLevelVariables>;
Variables
The deleteLevel Mutation requires an argument of type DeleteLevelVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteLevelVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteLevel Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteLevel Mutation is of type DeleteLevelData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteLevelData {
level_delete?: Level_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteLevel's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteLevelVariables } from '@dataconnect/generated';
import { useDeleteLevel } from '@dataconnect/generated/react'
export default function DeleteLevelComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteLevel();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteLevel(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteLevel(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteLevel(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteLevel` Mutation requires an argument of type `DeleteLevelVariables`:
const deleteLevelVars: DeleteLevelVariables = {
id: ...,
};
mutation.mutate(deleteLevelVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteLevelVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.level_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createOrder
You can execute the createOrder Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateOrder(options?: useDataConnectMutationOptions<CreateOrderData, FirebaseError, CreateOrderVariables>): UseDataConnectMutationResult<CreateOrderData, CreateOrderVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateOrder(dc: DataConnect, options?: useDataConnectMutationOptions<CreateOrderData, FirebaseError, CreateOrderVariables>): UseDataConnectMutationResult<CreateOrderData, CreateOrderVariables>;
Variables
The createOrder Mutation requires an argument of type CreateOrderVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateOrderVariables {
vendorId?: UUIDString | null;
businessId: UUIDString;
orderType: OrderType;
status?: OrderStatus | null;
date?: TimestampString | null;
startDate?: TimestampString | null;
endDate?: TimestampString | null;
duration?: OrderDuration | null;
lunchBreak?: number | null;
total?: number | null;
eventName?: string | null;
assignedStaff?: unknown | null;
shifts?: unknown | null;
requested?: number | null;
teamHubId: UUIDString;
recurringDays?: unknown | null;
permanentStartDate?: TimestampString | null;
permanentDays?: unknown | null;
notes?: string | null;
detectedConflicts?: unknown | null;
poReference?: string | null;
}
Return Type
Recall that calling the createOrder Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createOrder Mutation is of type CreateOrderData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateOrderData {
order_insert: Order_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createOrder's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateOrderVariables } from '@dataconnect/generated';
import { useCreateOrder } from '@dataconnect/generated/react'
export default function CreateOrderComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateOrder();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateOrder(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateOrder(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateOrder(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateOrder` Mutation requires an argument of type `CreateOrderVariables`:
const createOrderVars: CreateOrderVariables = {
vendorId: ..., // optional
businessId: ...,
orderType: ...,
status: ..., // optional
date: ..., // optional
startDate: ..., // optional
endDate: ..., // optional
duration: ..., // optional
lunchBreak: ..., // optional
total: ..., // optional
eventName: ..., // optional
assignedStaff: ..., // optional
shifts: ..., // optional
requested: ..., // optional
teamHubId: ...,
recurringDays: ..., // optional
permanentStartDate: ..., // optional
permanentDays: ..., // optional
notes: ..., // optional
detectedConflicts: ..., // optional
poReference: ..., // optional
};
mutation.mutate(createOrderVars);
// Variables can be defined inline as well.
mutation.mutate({ vendorId: ..., businessId: ..., orderType: ..., status: ..., date: ..., startDate: ..., endDate: ..., duration: ..., lunchBreak: ..., total: ..., eventName: ..., assignedStaff: ..., shifts: ..., requested: ..., teamHubId: ..., recurringDays: ..., permanentStartDate: ..., permanentDays: ..., notes: ..., detectedConflicts: ..., poReference: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createOrderVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.order_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateOrder
You can execute the updateOrder Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateOrder(options?: useDataConnectMutationOptions<UpdateOrderData, FirebaseError, UpdateOrderVariables>): UseDataConnectMutationResult<UpdateOrderData, UpdateOrderVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateOrder(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateOrderData, FirebaseError, UpdateOrderVariables>): UseDataConnectMutationResult<UpdateOrderData, UpdateOrderVariables>;
Variables
The updateOrder Mutation requires an argument of type UpdateOrderVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateOrderVariables {
id: UUIDString;
vendorId?: UUIDString | null;
businessId?: UUIDString | null;
status?: OrderStatus | null;
date?: TimestampString | null;
startDate?: TimestampString | null;
endDate?: TimestampString | null;
total?: number | null;
eventName?: string | null;
assignedStaff?: unknown | null;
shifts?: unknown | null;
requested?: number | null;
teamHubId: UUIDString;
recurringDays?: unknown | null;
permanentDays?: unknown | null;
notes?: string | null;
detectedConflicts?: unknown | null;
poReference?: string | null;
}
Return Type
Recall that calling the updateOrder Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateOrder Mutation is of type UpdateOrderData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateOrderData {
order_update?: Order_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateOrder's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateOrderVariables } from '@dataconnect/generated';
import { useUpdateOrder } from '@dataconnect/generated/react'
export default function UpdateOrderComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateOrder();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateOrder(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateOrder(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateOrder(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateOrder` Mutation requires an argument of type `UpdateOrderVariables`:
const updateOrderVars: UpdateOrderVariables = {
id: ...,
vendorId: ..., // optional
businessId: ..., // optional
status: ..., // optional
date: ..., // optional
startDate: ..., // optional
endDate: ..., // optional
total: ..., // optional
eventName: ..., // optional
assignedStaff: ..., // optional
shifts: ..., // optional
requested: ..., // optional
teamHubId: ...,
recurringDays: ..., // optional
permanentDays: ..., // optional
notes: ..., // optional
detectedConflicts: ..., // optional
poReference: ..., // optional
};
mutation.mutate(updateOrderVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., vendorId: ..., businessId: ..., status: ..., date: ..., startDate: ..., endDate: ..., total: ..., eventName: ..., assignedStaff: ..., shifts: ..., requested: ..., teamHubId: ..., recurringDays: ..., permanentDays: ..., notes: ..., detectedConflicts: ..., poReference: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateOrderVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.order_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteOrder
You can execute the deleteOrder Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteOrder(options?: useDataConnectMutationOptions<DeleteOrderData, FirebaseError, DeleteOrderVariables>): UseDataConnectMutationResult<DeleteOrderData, DeleteOrderVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteOrder(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteOrderData, FirebaseError, DeleteOrderVariables>): UseDataConnectMutationResult<DeleteOrderData, DeleteOrderVariables>;
Variables
The deleteOrder Mutation requires an argument of type DeleteOrderVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteOrderVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteOrder Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteOrder Mutation is of type DeleteOrderData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteOrderData {
order_delete?: Order_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteOrder's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteOrderVariables } from '@dataconnect/generated';
import { useDeleteOrder } from '@dataconnect/generated/react'
export default function DeleteOrderComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteOrder();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteOrder(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteOrder(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteOrder(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteOrder` Mutation requires an argument of type `DeleteOrderVariables`:
const deleteOrderVars: DeleteOrderVariables = {
id: ...,
};
mutation.mutate(deleteOrderVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteOrderVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.order_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createCategory
You can execute the createCategory Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateCategory(options?: useDataConnectMutationOptions<CreateCategoryData, FirebaseError, CreateCategoryVariables>): UseDataConnectMutationResult<CreateCategoryData, CreateCategoryVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateCategory(dc: DataConnect, options?: useDataConnectMutationOptions<CreateCategoryData, FirebaseError, CreateCategoryVariables>): UseDataConnectMutationResult<CreateCategoryData, CreateCategoryVariables>;
Variables
The createCategory Mutation requires an argument of type CreateCategoryVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateCategoryVariables {
categoryId: string;
label: string;
icon?: string | null;
}
Return Type
Recall that calling the createCategory Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createCategory Mutation is of type CreateCategoryData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateCategoryData {
category_insert: Category_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createCategory's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateCategoryVariables } from '@dataconnect/generated';
import { useCreateCategory } from '@dataconnect/generated/react'
export default function CreateCategoryComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateCategory();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateCategory(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateCategory(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateCategory(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateCategory` Mutation requires an argument of type `CreateCategoryVariables`:
const createCategoryVars: CreateCategoryVariables = {
categoryId: ...,
label: ...,
icon: ..., // optional
};
mutation.mutate(createCategoryVars);
// Variables can be defined inline as well.
mutation.mutate({ categoryId: ..., label: ..., icon: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createCategoryVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.category_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateCategory
You can execute the updateCategory Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateCategory(options?: useDataConnectMutationOptions<UpdateCategoryData, FirebaseError, UpdateCategoryVariables>): UseDataConnectMutationResult<UpdateCategoryData, UpdateCategoryVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateCategory(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateCategoryData, FirebaseError, UpdateCategoryVariables>): UseDataConnectMutationResult<UpdateCategoryData, UpdateCategoryVariables>;
Variables
The updateCategory Mutation requires an argument of type UpdateCategoryVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateCategoryVariables {
id: UUIDString;
categoryId?: string | null;
label?: string | null;
icon?: string | null;
}
Return Type
Recall that calling the updateCategory Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateCategory Mutation is of type UpdateCategoryData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateCategoryData {
category_update?: Category_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateCategory's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateCategoryVariables } from '@dataconnect/generated';
import { useUpdateCategory } from '@dataconnect/generated/react'
export default function UpdateCategoryComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateCategory();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateCategory(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateCategory(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateCategory(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateCategory` Mutation requires an argument of type `UpdateCategoryVariables`:
const updateCategoryVars: UpdateCategoryVariables = {
id: ...,
categoryId: ..., // optional
label: ..., // optional
icon: ..., // optional
};
mutation.mutate(updateCategoryVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., categoryId: ..., label: ..., icon: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateCategoryVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.category_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteCategory
You can execute the deleteCategory Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteCategory(options?: useDataConnectMutationOptions<DeleteCategoryData, FirebaseError, DeleteCategoryVariables>): UseDataConnectMutationResult<DeleteCategoryData, DeleteCategoryVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteCategory(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteCategoryData, FirebaseError, DeleteCategoryVariables>): UseDataConnectMutationResult<DeleteCategoryData, DeleteCategoryVariables>;
Variables
The deleteCategory Mutation requires an argument of type DeleteCategoryVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteCategoryVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteCategory Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteCategory Mutation is of type DeleteCategoryData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteCategoryData {
category_delete?: Category_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteCategory's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteCategoryVariables } from '@dataconnect/generated';
import { useDeleteCategory } from '@dataconnect/generated/react'
export default function DeleteCategoryComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteCategory();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteCategory(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteCategory(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteCategory(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteCategory` Mutation requires an argument of type `DeleteCategoryVariables`:
const deleteCategoryVars: DeleteCategoryVariables = {
id: ...,
};
mutation.mutate(deleteCategoryVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteCategoryVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.category_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createTaxForm
You can execute the createTaxForm Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateTaxForm(options?: useDataConnectMutationOptions<CreateTaxFormData, FirebaseError, CreateTaxFormVariables>): UseDataConnectMutationResult<CreateTaxFormData, CreateTaxFormVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateTaxForm(dc: DataConnect, options?: useDataConnectMutationOptions<CreateTaxFormData, FirebaseError, CreateTaxFormVariables>): UseDataConnectMutationResult<CreateTaxFormData, CreateTaxFormVariables>;
Variables
The createTaxForm Mutation requires an argument of type CreateTaxFormVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateTaxFormVariables {
formType: TaxFormType;
firstName: string;
lastName: string;
mInitial?: string | null;
oLastName?: string | null;
dob?: TimestampString | null;
socialSN: number;
email?: string | null;
phone?: string | null;
address: string;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
city?: string | null;
apt?: string | null;
state?: string | null;
street?: string | null;
country?: string | null;
zipCode?: string | null;
marital?: MaritalStatus | null;
multipleJob?: boolean | null;
childrens?: number | null;
otherDeps?: number | null;
totalCredits?: number | null;
otherInconme?: number | null;
deductions?: number | null;
extraWithholding?: number | null;
citizen?: CitizenshipStatus | null;
uscis?: string | null;
passportNumber?: string | null;
countryIssue?: string | null;
prepartorOrTranslator?: boolean | null;
signature?: string | null;
date?: TimestampString | null;
status: TaxFormStatus;
staffId: UUIDString;
createdBy?: string | null;
}
Return Type
Recall that calling the createTaxForm Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createTaxForm Mutation is of type CreateTaxFormData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateTaxFormData {
taxForm_insert: TaxForm_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createTaxForm's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateTaxFormVariables } from '@dataconnect/generated';
import { useCreateTaxForm } from '@dataconnect/generated/react'
export default function CreateTaxFormComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateTaxForm();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateTaxForm(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateTaxForm(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateTaxForm(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateTaxForm` Mutation requires an argument of type `CreateTaxFormVariables`:
const createTaxFormVars: CreateTaxFormVariables = {
formType: ...,
firstName: ...,
lastName: ...,
mInitial: ..., // optional
oLastName: ..., // optional
dob: ..., // optional
socialSN: ...,
email: ..., // optional
phone: ..., // optional
address: ...,
placeId: ..., // optional
latitude: ..., // optional
longitude: ..., // optional
city: ..., // optional
apt: ..., // optional
state: ..., // optional
street: ..., // optional
country: ..., // optional
zipCode: ..., // optional
marital: ..., // optional
multipleJob: ..., // optional
childrens: ..., // optional
otherDeps: ..., // optional
totalCredits: ..., // optional
otherInconme: ..., // optional
deductions: ..., // optional
extraWithholding: ..., // optional
citizen: ..., // optional
uscis: ..., // optional
passportNumber: ..., // optional
countryIssue: ..., // optional
prepartorOrTranslator: ..., // optional
signature: ..., // optional
date: ..., // optional
status: ...,
staffId: ...,
createdBy: ..., // optional
};
mutation.mutate(createTaxFormVars);
// Variables can be defined inline as well.
mutation.mutate({ formType: ..., firstName: ..., lastName: ..., mInitial: ..., oLastName: ..., dob: ..., socialSN: ..., email: ..., phone: ..., address: ..., placeId: ..., latitude: ..., longitude: ..., city: ..., apt: ..., state: ..., street: ..., country: ..., zipCode: ..., marital: ..., multipleJob: ..., childrens: ..., otherDeps: ..., totalCredits: ..., otherInconme: ..., deductions: ..., extraWithholding: ..., citizen: ..., uscis: ..., passportNumber: ..., countryIssue: ..., prepartorOrTranslator: ..., signature: ..., date: ..., status: ..., staffId: ..., createdBy: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createTaxFormVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.taxForm_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateTaxForm
You can execute the updateTaxForm Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateTaxForm(options?: useDataConnectMutationOptions<UpdateTaxFormData, FirebaseError, UpdateTaxFormVariables>): UseDataConnectMutationResult<UpdateTaxFormData, UpdateTaxFormVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateTaxForm(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateTaxFormData, FirebaseError, UpdateTaxFormVariables>): UseDataConnectMutationResult<UpdateTaxFormData, UpdateTaxFormVariables>;
Variables
The updateTaxForm Mutation requires an argument of type UpdateTaxFormVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateTaxFormVariables {
id: UUIDString;
formType?: TaxFormType | null;
firstName?: string | null;
lastName?: string | null;
mInitial?: string | null;
oLastName?: string | null;
dob?: TimestampString | null;
socialSN?: number | null;
email?: string | null;
phone?: string | null;
address?: string | null;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
city?: string | null;
apt?: string | null;
state?: string | null;
street?: string | null;
country?: string | null;
zipCode?: string | null;
marital?: MaritalStatus | null;
multipleJob?: boolean | null;
childrens?: number | null;
otherDeps?: number | null;
totalCredits?: number | null;
otherInconme?: number | null;
deductions?: number | null;
extraWithholding?: number | null;
citizen?: CitizenshipStatus | null;
uscis?: string | null;
passportNumber?: string | null;
countryIssue?: string | null;
prepartorOrTranslator?: boolean | null;
signature?: string | null;
date?: TimestampString | null;
status?: TaxFormStatus | null;
}
Return Type
Recall that calling the updateTaxForm Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateTaxForm Mutation is of type UpdateTaxFormData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateTaxFormData {
taxForm_update?: TaxForm_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateTaxForm's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateTaxFormVariables } from '@dataconnect/generated';
import { useUpdateTaxForm } from '@dataconnect/generated/react'
export default function UpdateTaxFormComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateTaxForm();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateTaxForm(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateTaxForm(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateTaxForm(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateTaxForm` Mutation requires an argument of type `UpdateTaxFormVariables`:
const updateTaxFormVars: UpdateTaxFormVariables = {
id: ...,
formType: ..., // optional
firstName: ..., // optional
lastName: ..., // optional
mInitial: ..., // optional
oLastName: ..., // optional
dob: ..., // optional
socialSN: ..., // optional
email: ..., // optional
phone: ..., // optional
address: ..., // optional
placeId: ..., // optional
latitude: ..., // optional
longitude: ..., // optional
city: ..., // optional
apt: ..., // optional
state: ..., // optional
street: ..., // optional
country: ..., // optional
zipCode: ..., // optional
marital: ..., // optional
multipleJob: ..., // optional
childrens: ..., // optional
otherDeps: ..., // optional
totalCredits: ..., // optional
otherInconme: ..., // optional
deductions: ..., // optional
extraWithholding: ..., // optional
citizen: ..., // optional
uscis: ..., // optional
passportNumber: ..., // optional
countryIssue: ..., // optional
prepartorOrTranslator: ..., // optional
signature: ..., // optional
date: ..., // optional
status: ..., // optional
};
mutation.mutate(updateTaxFormVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., formType: ..., firstName: ..., lastName: ..., mInitial: ..., oLastName: ..., dob: ..., socialSN: ..., email: ..., phone: ..., address: ..., placeId: ..., latitude: ..., longitude: ..., city: ..., apt: ..., state: ..., street: ..., country: ..., zipCode: ..., marital: ..., multipleJob: ..., childrens: ..., otherDeps: ..., totalCredits: ..., otherInconme: ..., deductions: ..., extraWithholding: ..., citizen: ..., uscis: ..., passportNumber: ..., countryIssue: ..., prepartorOrTranslator: ..., signature: ..., date: ..., status: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateTaxFormVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.taxForm_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteTaxForm
You can execute the deleteTaxForm Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteTaxForm(options?: useDataConnectMutationOptions<DeleteTaxFormData, FirebaseError, DeleteTaxFormVariables>): UseDataConnectMutationResult<DeleteTaxFormData, DeleteTaxFormVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteTaxForm(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteTaxFormData, FirebaseError, DeleteTaxFormVariables>): UseDataConnectMutationResult<DeleteTaxFormData, DeleteTaxFormVariables>;
Variables
The deleteTaxForm Mutation requires an argument of type DeleteTaxFormVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteTaxFormVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteTaxForm Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteTaxForm Mutation is of type DeleteTaxFormData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteTaxFormData {
taxForm_delete?: TaxForm_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteTaxForm's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteTaxFormVariables } from '@dataconnect/generated';
import { useDeleteTaxForm } from '@dataconnect/generated/react'
export default function DeleteTaxFormComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteTaxForm();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteTaxForm(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteTaxForm(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteTaxForm(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteTaxForm` Mutation requires an argument of type `DeleteTaxFormVariables`:
const deleteTaxFormVars: DeleteTaxFormVariables = {
id: ...,
};
mutation.mutate(deleteTaxFormVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteTaxFormVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.taxForm_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createVendorRate
You can execute the createVendorRate Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateVendorRate(options?: useDataConnectMutationOptions<CreateVendorRateData, FirebaseError, CreateVendorRateVariables>): UseDataConnectMutationResult<CreateVendorRateData, CreateVendorRateVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateVendorRate(dc: DataConnect, options?: useDataConnectMutationOptions<CreateVendorRateData, FirebaseError, CreateVendorRateVariables>): UseDataConnectMutationResult<CreateVendorRateData, CreateVendorRateVariables>;
Variables
The createVendorRate Mutation requires an argument of type CreateVendorRateVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateVendorRateVariables {
vendorId: UUIDString;
roleName?: string | null;
category?: CategoryType | null;
clientRate?: number | null;
employeeWage?: number | null;
markupPercentage?: number | null;
vendorFeePercentage?: number | null;
isActive?: boolean | null;
notes?: string | null;
}
Return Type
Recall that calling the createVendorRate Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createVendorRate Mutation is of type CreateVendorRateData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateVendorRateData {
vendorRate_insert: VendorRate_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createVendorRate's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateVendorRateVariables } from '@dataconnect/generated';
import { useCreateVendorRate } from '@dataconnect/generated/react'
export default function CreateVendorRateComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateVendorRate();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateVendorRate(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateVendorRate(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateVendorRate(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateVendorRate` Mutation requires an argument of type `CreateVendorRateVariables`:
const createVendorRateVars: CreateVendorRateVariables = {
vendorId: ...,
roleName: ..., // optional
category: ..., // optional
clientRate: ..., // optional
employeeWage: ..., // optional
markupPercentage: ..., // optional
vendorFeePercentage: ..., // optional
isActive: ..., // optional
notes: ..., // optional
};
mutation.mutate(createVendorRateVars);
// Variables can be defined inline as well.
mutation.mutate({ vendorId: ..., roleName: ..., category: ..., clientRate: ..., employeeWage: ..., markupPercentage: ..., vendorFeePercentage: ..., isActive: ..., notes: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createVendorRateVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.vendorRate_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateVendorRate
You can execute the updateVendorRate Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateVendorRate(options?: useDataConnectMutationOptions<UpdateVendorRateData, FirebaseError, UpdateVendorRateVariables>): UseDataConnectMutationResult<UpdateVendorRateData, UpdateVendorRateVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateVendorRate(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateVendorRateData, FirebaseError, UpdateVendorRateVariables>): UseDataConnectMutationResult<UpdateVendorRateData, UpdateVendorRateVariables>;
Variables
The updateVendorRate Mutation requires an argument of type UpdateVendorRateVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateVendorRateVariables {
id: UUIDString;
vendorId?: UUIDString | null;
roleName?: string | null;
category?: CategoryType | null;
clientRate?: number | null;
employeeWage?: number | null;
markupPercentage?: number | null;
vendorFeePercentage?: number | null;
isActive?: boolean | null;
notes?: string | null;
}
Return Type
Recall that calling the updateVendorRate Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateVendorRate Mutation is of type UpdateVendorRateData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateVendorRateData {
vendorRate_update?: VendorRate_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateVendorRate's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateVendorRateVariables } from '@dataconnect/generated';
import { useUpdateVendorRate } from '@dataconnect/generated/react'
export default function UpdateVendorRateComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateVendorRate();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateVendorRate(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateVendorRate(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateVendorRate(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateVendorRate` Mutation requires an argument of type `UpdateVendorRateVariables`:
const updateVendorRateVars: UpdateVendorRateVariables = {
id: ...,
vendorId: ..., // optional
roleName: ..., // optional
category: ..., // optional
clientRate: ..., // optional
employeeWage: ..., // optional
markupPercentage: ..., // optional
vendorFeePercentage: ..., // optional
isActive: ..., // optional
notes: ..., // optional
};
mutation.mutate(updateVendorRateVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., vendorId: ..., roleName: ..., category: ..., clientRate: ..., employeeWage: ..., markupPercentage: ..., vendorFeePercentage: ..., isActive: ..., notes: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateVendorRateVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.vendorRate_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteVendorRate
You can execute the deleteVendorRate Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteVendorRate(options?: useDataConnectMutationOptions<DeleteVendorRateData, FirebaseError, DeleteVendorRateVariables>): UseDataConnectMutationResult<DeleteVendorRateData, DeleteVendorRateVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteVendorRate(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteVendorRateData, FirebaseError, DeleteVendorRateVariables>): UseDataConnectMutationResult<DeleteVendorRateData, DeleteVendorRateVariables>;
Variables
The deleteVendorRate Mutation requires an argument of type DeleteVendorRateVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteVendorRateVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteVendorRate Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteVendorRate Mutation is of type DeleteVendorRateData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteVendorRateData {
vendorRate_delete?: VendorRate_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteVendorRate's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteVendorRateVariables } from '@dataconnect/generated';
import { useDeleteVendorRate } from '@dataconnect/generated/react'
export default function DeleteVendorRateComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteVendorRate();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteVendorRate(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteVendorRate(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteVendorRate(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteVendorRate` Mutation requires an argument of type `DeleteVendorRateVariables`:
const deleteVendorRateVars: DeleteVendorRateVariables = {
id: ...,
};
mutation.mutate(deleteVendorRateVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteVendorRateVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.vendorRate_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createActivityLog
You can execute the createActivityLog Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateActivityLog(options?: useDataConnectMutationOptions<CreateActivityLogData, FirebaseError, CreateActivityLogVariables>): UseDataConnectMutationResult<CreateActivityLogData, CreateActivityLogVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateActivityLog(dc: DataConnect, options?: useDataConnectMutationOptions<CreateActivityLogData, FirebaseError, CreateActivityLogVariables>): UseDataConnectMutationResult<CreateActivityLogData, CreateActivityLogVariables>;
Variables
The createActivityLog Mutation requires an argument of type CreateActivityLogVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateActivityLogVariables {
userId: string;
date: TimestampString;
hourStart?: string | null;
hourEnd?: string | null;
totalhours?: string | null;
iconType?: ActivityIconType | null;
iconColor?: string | null;
title: string;
description: string;
isRead?: boolean | null;
activityType: ActivityType;
}
Return Type
Recall that calling the createActivityLog Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createActivityLog Mutation is of type CreateActivityLogData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateActivityLogData {
activityLog_insert: ActivityLog_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createActivityLog's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateActivityLogVariables } from '@dataconnect/generated';
import { useCreateActivityLog } from '@dataconnect/generated/react'
export default function CreateActivityLogComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateActivityLog();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateActivityLog(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateActivityLog(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateActivityLog(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateActivityLog` Mutation requires an argument of type `CreateActivityLogVariables`:
const createActivityLogVars: CreateActivityLogVariables = {
userId: ...,
date: ...,
hourStart: ..., // optional
hourEnd: ..., // optional
totalhours: ..., // optional
iconType: ..., // optional
iconColor: ..., // optional
title: ...,
description: ...,
isRead: ..., // optional
activityType: ...,
};
mutation.mutate(createActivityLogVars);
// Variables can be defined inline as well.
mutation.mutate({ userId: ..., date: ..., hourStart: ..., hourEnd: ..., totalhours: ..., iconType: ..., iconColor: ..., title: ..., description: ..., isRead: ..., activityType: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createActivityLogVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.activityLog_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateActivityLog
You can execute the updateActivityLog Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateActivityLog(options?: useDataConnectMutationOptions<UpdateActivityLogData, FirebaseError, UpdateActivityLogVariables>): UseDataConnectMutationResult<UpdateActivityLogData, UpdateActivityLogVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateActivityLog(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateActivityLogData, FirebaseError, UpdateActivityLogVariables>): UseDataConnectMutationResult<UpdateActivityLogData, UpdateActivityLogVariables>;
Variables
The updateActivityLog Mutation requires an argument of type UpdateActivityLogVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateActivityLogVariables {
id: UUIDString;
userId?: string | null;
date?: TimestampString | null;
hourStart?: string | null;
hourEnd?: string | null;
totalhours?: string | null;
iconType?: ActivityIconType | null;
iconColor?: string | null;
title?: string | null;
description?: string | null;
isRead?: boolean | null;
activityType?: ActivityType | null;
}
Return Type
Recall that calling the updateActivityLog Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateActivityLog Mutation is of type UpdateActivityLogData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateActivityLogData {
activityLog_update?: ActivityLog_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateActivityLog's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateActivityLogVariables } from '@dataconnect/generated';
import { useUpdateActivityLog } from '@dataconnect/generated/react'
export default function UpdateActivityLogComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateActivityLog();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateActivityLog(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateActivityLog(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateActivityLog(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateActivityLog` Mutation requires an argument of type `UpdateActivityLogVariables`:
const updateActivityLogVars: UpdateActivityLogVariables = {
id: ...,
userId: ..., // optional
date: ..., // optional
hourStart: ..., // optional
hourEnd: ..., // optional
totalhours: ..., // optional
iconType: ..., // optional
iconColor: ..., // optional
title: ..., // optional
description: ..., // optional
isRead: ..., // optional
activityType: ..., // optional
};
mutation.mutate(updateActivityLogVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., userId: ..., date: ..., hourStart: ..., hourEnd: ..., totalhours: ..., iconType: ..., iconColor: ..., title: ..., description: ..., isRead: ..., activityType: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateActivityLogVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.activityLog_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
markActivityLogAsRead
You can execute the markActivityLogAsRead Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useMarkActivityLogAsRead(options?: useDataConnectMutationOptions<MarkActivityLogAsReadData, FirebaseError, MarkActivityLogAsReadVariables>): UseDataConnectMutationResult<MarkActivityLogAsReadData, MarkActivityLogAsReadVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useMarkActivityLogAsRead(dc: DataConnect, options?: useDataConnectMutationOptions<MarkActivityLogAsReadData, FirebaseError, MarkActivityLogAsReadVariables>): UseDataConnectMutationResult<MarkActivityLogAsReadData, MarkActivityLogAsReadVariables>;
Variables
The markActivityLogAsRead Mutation requires an argument of type MarkActivityLogAsReadVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface MarkActivityLogAsReadVariables {
id: UUIDString;
}
Return Type
Recall that calling the markActivityLogAsRead Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the markActivityLogAsRead Mutation is of type MarkActivityLogAsReadData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface MarkActivityLogAsReadData {
activityLog_update?: ActivityLog_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using markActivityLogAsRead's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, MarkActivityLogAsReadVariables } from '@dataconnect/generated';
import { useMarkActivityLogAsRead } from '@dataconnect/generated/react'
export default function MarkActivityLogAsReadComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useMarkActivityLogAsRead();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useMarkActivityLogAsRead(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useMarkActivityLogAsRead(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useMarkActivityLogAsRead(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useMarkActivityLogAsRead` Mutation requires an argument of type `MarkActivityLogAsReadVariables`:
const markActivityLogAsReadVars: MarkActivityLogAsReadVariables = {
id: ...,
};
mutation.mutate(markActivityLogAsReadVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(markActivityLogAsReadVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.activityLog_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
markActivityLogsAsRead
You can execute the markActivityLogsAsRead Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useMarkActivityLogsAsRead(options?: useDataConnectMutationOptions<MarkActivityLogsAsReadData, FirebaseError, MarkActivityLogsAsReadVariables>): UseDataConnectMutationResult<MarkActivityLogsAsReadData, MarkActivityLogsAsReadVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useMarkActivityLogsAsRead(dc: DataConnect, options?: useDataConnectMutationOptions<MarkActivityLogsAsReadData, FirebaseError, MarkActivityLogsAsReadVariables>): UseDataConnectMutationResult<MarkActivityLogsAsReadData, MarkActivityLogsAsReadVariables>;
Variables
The markActivityLogsAsRead Mutation requires an argument of type MarkActivityLogsAsReadVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface MarkActivityLogsAsReadVariables {
ids: UUIDString[];
}
Return Type
Recall that calling the markActivityLogsAsRead Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the markActivityLogsAsRead Mutation is of type MarkActivityLogsAsReadData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface MarkActivityLogsAsReadData {
activityLog_updateMany: number;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using markActivityLogsAsRead's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, MarkActivityLogsAsReadVariables } from '@dataconnect/generated';
import { useMarkActivityLogsAsRead } from '@dataconnect/generated/react'
export default function MarkActivityLogsAsReadComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useMarkActivityLogsAsRead();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useMarkActivityLogsAsRead(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useMarkActivityLogsAsRead(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useMarkActivityLogsAsRead(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useMarkActivityLogsAsRead` Mutation requires an argument of type `MarkActivityLogsAsReadVariables`:
const markActivityLogsAsReadVars: MarkActivityLogsAsReadVariables = {
ids: ...,
};
mutation.mutate(markActivityLogsAsReadVars);
// Variables can be defined inline as well.
mutation.mutate({ ids: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(markActivityLogsAsReadVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.activityLog_updateMany);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteActivityLog
You can execute the deleteActivityLog Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteActivityLog(options?: useDataConnectMutationOptions<DeleteActivityLogData, FirebaseError, DeleteActivityLogVariables>): UseDataConnectMutationResult<DeleteActivityLogData, DeleteActivityLogVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteActivityLog(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteActivityLogData, FirebaseError, DeleteActivityLogVariables>): UseDataConnectMutationResult<DeleteActivityLogData, DeleteActivityLogVariables>;
Variables
The deleteActivityLog Mutation requires an argument of type DeleteActivityLogVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteActivityLogVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteActivityLog Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteActivityLog Mutation is of type DeleteActivityLogData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteActivityLogData {
activityLog_delete?: ActivityLog_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteActivityLog's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteActivityLogVariables } from '@dataconnect/generated';
import { useDeleteActivityLog } from '@dataconnect/generated/react'
export default function DeleteActivityLogComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteActivityLog();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteActivityLog(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteActivityLog(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteActivityLog(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteActivityLog` Mutation requires an argument of type `DeleteActivityLogVariables`:
const deleteActivityLogVars: DeleteActivityLogVariables = {
id: ...,
};
mutation.mutate(deleteActivityLogVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteActivityLogVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.activityLog_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
createShift
You can execute the createShift Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateShift(options?: useDataConnectMutationOptions<CreateShiftData, FirebaseError, CreateShiftVariables>): UseDataConnectMutationResult<CreateShiftData, CreateShiftVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateShift(dc: DataConnect, options?: useDataConnectMutationOptions<CreateShiftData, FirebaseError, CreateShiftVariables>): UseDataConnectMutationResult<CreateShiftData, CreateShiftVariables>;
Variables
The createShift Mutation requires an argument of type CreateShiftVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateShiftVariables {
title: string;
orderId: UUIDString;
date?: TimestampString | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
cost?: number | null;
location?: string | null;
locationAddress?: string | null;
latitude?: number | null;
longitude?: number | null;
placeId?: string | null;
city?: string | null;
state?: string | null;
street?: string | null;
country?: string | null;
description?: string | null;
status?: ShiftStatus | null;
workersNeeded?: number | null;
filled?: number | null;
filledAt?: TimestampString | null;
managers?: unknown[] | null;
durationDays?: number | null;
createdBy?: string | null;
}
Return Type
Recall that calling the createShift Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the createShift Mutation is of type CreateShiftData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateShiftData {
shift_insert: Shift_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using createShift's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateShiftVariables } from '@dataconnect/generated';
import { useCreateShift } from '@dataconnect/generated/react'
export default function CreateShiftComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateShift();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateShift(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateShift(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateShift(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateShift` Mutation requires an argument of type `CreateShiftVariables`:
const createShiftVars: CreateShiftVariables = {
title: ...,
orderId: ...,
date: ..., // optional
startTime: ..., // optional
endTime: ..., // optional
hours: ..., // optional
cost: ..., // optional
location: ..., // optional
locationAddress: ..., // optional
latitude: ..., // optional
longitude: ..., // optional
placeId: ..., // optional
city: ..., // optional
state: ..., // optional
street: ..., // optional
country: ..., // optional
description: ..., // optional
status: ..., // optional
workersNeeded: ..., // optional
filled: ..., // optional
filledAt: ..., // optional
managers: ..., // optional
durationDays: ..., // optional
createdBy: ..., // optional
};
mutation.mutate(createShiftVars);
// Variables can be defined inline as well.
mutation.mutate({ title: ..., orderId: ..., date: ..., startTime: ..., endTime: ..., hours: ..., cost: ..., location: ..., locationAddress: ..., latitude: ..., longitude: ..., placeId: ..., city: ..., state: ..., street: ..., country: ..., description: ..., status: ..., workersNeeded: ..., filled: ..., filledAt: ..., managers: ..., durationDays: ..., createdBy: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createShiftVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.shift_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
updateShift
You can execute the updateShift Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateShift(options?: useDataConnectMutationOptions<UpdateShiftData, FirebaseError, UpdateShiftVariables>): UseDataConnectMutationResult<UpdateShiftData, UpdateShiftVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateShift(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateShiftData, FirebaseError, UpdateShiftVariables>): UseDataConnectMutationResult<UpdateShiftData, UpdateShiftVariables>;
Variables
The updateShift Mutation requires an argument of type UpdateShiftVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateShiftVariables {
id: UUIDString;
title?: string | null;
orderId?: UUIDString | null;
date?: TimestampString | null;
startTime?: TimestampString | null;
endTime?: TimestampString | null;
hours?: number | null;
cost?: number | null;
location?: string | null;
locationAddress?: string | null;
latitude?: number | null;
longitude?: number | null;
placeId?: string | null;
city?: string | null;
state?: string | null;
street?: string | null;
country?: string | null;
description?: string | null;
status?: ShiftStatus | null;
workersNeeded?: number | null;
filled?: number | null;
filledAt?: TimestampString | null;
managers?: unknown[] | null;
durationDays?: number | null;
}
Return Type
Recall that calling the updateShift Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the updateShift Mutation is of type UpdateShiftData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateShiftData {
shift_update?: Shift_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using updateShift's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateShiftVariables } from '@dataconnect/generated';
import { useUpdateShift } from '@dataconnect/generated/react'
export default function UpdateShiftComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateShift();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateShift(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateShift(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateShift(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateShift` Mutation requires an argument of type `UpdateShiftVariables`:
const updateShiftVars: UpdateShiftVariables = {
id: ...,
title: ..., // optional
orderId: ..., // optional
date: ..., // optional
startTime: ..., // optional
endTime: ..., // optional
hours: ..., // optional
cost: ..., // optional
location: ..., // optional
locationAddress: ..., // optional
latitude: ..., // optional
longitude: ..., // optional
placeId: ..., // optional
city: ..., // optional
state: ..., // optional
street: ..., // optional
country: ..., // optional
description: ..., // optional
status: ..., // optional
workersNeeded: ..., // optional
filled: ..., // optional
filledAt: ..., // optional
managers: ..., // optional
durationDays: ..., // optional
};
mutation.mutate(updateShiftVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., title: ..., orderId: ..., date: ..., startTime: ..., endTime: ..., hours: ..., cost: ..., location: ..., locationAddress: ..., latitude: ..., longitude: ..., placeId: ..., city: ..., state: ..., street: ..., country: ..., description: ..., status: ..., workersNeeded: ..., filled: ..., filledAt: ..., managers: ..., durationDays: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateShiftVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.shift_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
deleteShift
You can execute the deleteShift Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteShift(options?: useDataConnectMutationOptions<DeleteShiftData, FirebaseError, DeleteShiftVariables>): UseDataConnectMutationResult<DeleteShiftData, DeleteShiftVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteShift(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteShiftData, FirebaseError, DeleteShiftVariables>): UseDataConnectMutationResult<DeleteShiftData, DeleteShiftVariables>;
Variables
The deleteShift Mutation requires an argument of type DeleteShiftVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteShiftVariables {
id: UUIDString;
}
Return Type
Recall that calling the deleteShift Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the deleteShift Mutation is of type DeleteShiftData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteShiftData {
shift_delete?: Shift_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using deleteShift's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteShiftVariables } from '@dataconnect/generated';
import { useDeleteShift } from '@dataconnect/generated/react'
export default function DeleteShiftComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteShift();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteShift(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteShift(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteShift(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteShift` Mutation requires an argument of type `DeleteShiftVariables`:
const deleteShiftVars: DeleteShiftVariables = {
id: ...,
};
mutation.mutate(deleteShiftVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteShiftVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.shift_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
CreateStaff
You can execute the CreateStaff Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateStaff(options?: useDataConnectMutationOptions<CreateStaffData, FirebaseError, CreateStaffVariables>): UseDataConnectMutationResult<CreateStaffData, CreateStaffVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateStaff(dc: DataConnect, options?: useDataConnectMutationOptions<CreateStaffData, FirebaseError, CreateStaffVariables>): UseDataConnectMutationResult<CreateStaffData, CreateStaffVariables>;
Variables
The CreateStaff Mutation requires an argument of type CreateStaffVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateStaffVariables {
userId: string;
fullName: string;
level?: string | null;
role?: string | null;
phone?: string | null;
email?: string | null;
photoUrl?: string | null;
totalShifts?: number | null;
averageRating?: number | null;
onTimeRate?: number | null;
noShowCount?: number | null;
cancellationCount?: number | null;
reliabilityScore?: number | null;
bio?: string | null;
skills?: string[] | null;
industries?: string[] | null;
preferredLocations?: string[] | null;
maxDistanceMiles?: number | null;
languages?: unknown | null;
itemsAttire?: unknown | null;
xp?: number | null;
badges?: unknown | null;
isRecommended?: boolean | null;
ownerId?: UUIDString | null;
department?: DepartmentType | null;
hubId?: UUIDString | null;
manager?: UUIDString | null;
english?: EnglishProficiency | null;
backgroundCheckStatus?: BackgroundCheckStatus | null;
employmentType?: EmploymentType | null;
initial?: string | null;
englishRequired?: boolean | null;
city?: string | null;
addres?: string | null;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
state?: string | null;
street?: string | null;
country?: string | null;
zipCode?: string | null;
}
Return Type
Recall that calling the CreateStaff Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the CreateStaff Mutation is of type CreateStaffData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateStaffData {
staff_insert: Staff_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using CreateStaff's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateStaffVariables } from '@dataconnect/generated';
import { useCreateStaff } from '@dataconnect/generated/react'
export default function CreateStaffComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateStaff();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateStaff(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateStaff(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateStaff(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateStaff` Mutation requires an argument of type `CreateStaffVariables`:
const createStaffVars: CreateStaffVariables = {
userId: ...,
fullName: ...,
level: ..., // optional
role: ..., // optional
phone: ..., // optional
email: ..., // optional
photoUrl: ..., // optional
totalShifts: ..., // optional
averageRating: ..., // optional
onTimeRate: ..., // optional
noShowCount: ..., // optional
cancellationCount: ..., // optional
reliabilityScore: ..., // optional
bio: ..., // optional
skills: ..., // optional
industries: ..., // optional
preferredLocations: ..., // optional
maxDistanceMiles: ..., // optional
languages: ..., // optional
itemsAttire: ..., // optional
xp: ..., // optional
badges: ..., // optional
isRecommended: ..., // optional
ownerId: ..., // optional
department: ..., // optional
hubId: ..., // optional
manager: ..., // optional
english: ..., // optional
backgroundCheckStatus: ..., // optional
employmentType: ..., // optional
initial: ..., // optional
englishRequired: ..., // optional
city: ..., // optional
addres: ..., // optional
placeId: ..., // optional
latitude: ..., // optional
longitude: ..., // optional
state: ..., // optional
street: ..., // optional
country: ..., // optional
zipCode: ..., // optional
};
mutation.mutate(createStaffVars);
// Variables can be defined inline as well.
mutation.mutate({ userId: ..., fullName: ..., level: ..., role: ..., phone: ..., email: ..., photoUrl: ..., totalShifts: ..., averageRating: ..., onTimeRate: ..., noShowCount: ..., cancellationCount: ..., reliabilityScore: ..., bio: ..., skills: ..., industries: ..., preferredLocations: ..., maxDistanceMiles: ..., languages: ..., itemsAttire: ..., xp: ..., badges: ..., isRecommended: ..., ownerId: ..., department: ..., hubId: ..., manager: ..., english: ..., backgroundCheckStatus: ..., employmentType: ..., initial: ..., englishRequired: ..., city: ..., addres: ..., placeId: ..., latitude: ..., longitude: ..., state: ..., street: ..., country: ..., zipCode: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createStaffVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.staff_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
UpdateStaff
You can execute the UpdateStaff Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateStaff(options?: useDataConnectMutationOptions<UpdateStaffData, FirebaseError, UpdateStaffVariables>): UseDataConnectMutationResult<UpdateStaffData, UpdateStaffVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateStaff(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateStaffData, FirebaseError, UpdateStaffVariables>): UseDataConnectMutationResult<UpdateStaffData, UpdateStaffVariables>;
Variables
The UpdateStaff Mutation requires an argument of type UpdateStaffVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateStaffVariables {
id: UUIDString;
userId?: string | null;
fullName?: string | null;
level?: string | null;
role?: string | null;
phone?: string | null;
email?: string | null;
photoUrl?: string | null;
totalShifts?: number | null;
averageRating?: number | null;
onTimeRate?: number | null;
noShowCount?: number | null;
cancellationCount?: number | null;
reliabilityScore?: number | null;
bio?: string | null;
skills?: string[] | null;
industries?: string[] | null;
preferredLocations?: string[] | null;
maxDistanceMiles?: number | null;
languages?: unknown | null;
itemsAttire?: unknown | null;
xp?: number | null;
badges?: unknown | null;
isRecommended?: boolean | null;
ownerId?: UUIDString | null;
department?: DepartmentType | null;
hubId?: UUIDString | null;
manager?: UUIDString | null;
english?: EnglishProficiency | null;
backgroundCheckStatus?: BackgroundCheckStatus | null;
employmentType?: EmploymentType | null;
initial?: string | null;
englishRequired?: boolean | null;
city?: string | null;
addres?: string | null;
placeId?: string | null;
latitude?: number | null;
longitude?: number | null;
state?: string | null;
street?: string | null;
country?: string | null;
zipCode?: string | null;
}
Return Type
Recall that calling the UpdateStaff Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the UpdateStaff Mutation is of type UpdateStaffData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateStaffData {
staff_update?: Staff_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using UpdateStaff's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateStaffVariables } from '@dataconnect/generated';
import { useUpdateStaff } from '@dataconnect/generated/react'
export default function UpdateStaffComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateStaff();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateStaff(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateStaff(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateStaff(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateStaff` Mutation requires an argument of type `UpdateStaffVariables`:
const updateStaffVars: UpdateStaffVariables = {
id: ...,
userId: ..., // optional
fullName: ..., // optional
level: ..., // optional
role: ..., // optional
phone: ..., // optional
email: ..., // optional
photoUrl: ..., // optional
totalShifts: ..., // optional
averageRating: ..., // optional
onTimeRate: ..., // optional
noShowCount: ..., // optional
cancellationCount: ..., // optional
reliabilityScore: ..., // optional
bio: ..., // optional
skills: ..., // optional
industries: ..., // optional
preferredLocations: ..., // optional
maxDistanceMiles: ..., // optional
languages: ..., // optional
itemsAttire: ..., // optional
xp: ..., // optional
badges: ..., // optional
isRecommended: ..., // optional
ownerId: ..., // optional
department: ..., // optional
hubId: ..., // optional
manager: ..., // optional
english: ..., // optional
backgroundCheckStatus: ..., // optional
employmentType: ..., // optional
initial: ..., // optional
englishRequired: ..., // optional
city: ..., // optional
addres: ..., // optional
placeId: ..., // optional
latitude: ..., // optional
longitude: ..., // optional
state: ..., // optional
street: ..., // optional
country: ..., // optional
zipCode: ..., // optional
};
mutation.mutate(updateStaffVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., userId: ..., fullName: ..., level: ..., role: ..., phone: ..., email: ..., photoUrl: ..., totalShifts: ..., averageRating: ..., onTimeRate: ..., noShowCount: ..., cancellationCount: ..., reliabilityScore: ..., bio: ..., skills: ..., industries: ..., preferredLocations: ..., maxDistanceMiles: ..., languages: ..., itemsAttire: ..., xp: ..., badges: ..., isRecommended: ..., ownerId: ..., department: ..., hubId: ..., manager: ..., english: ..., backgroundCheckStatus: ..., employmentType: ..., initial: ..., englishRequired: ..., city: ..., addres: ..., placeId: ..., latitude: ..., longitude: ..., state: ..., street: ..., country: ..., zipCode: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateStaffVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.staff_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
DeleteStaff
You can execute the DeleteStaff Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteStaff(options?: useDataConnectMutationOptions<DeleteStaffData, FirebaseError, DeleteStaffVariables>): UseDataConnectMutationResult<DeleteStaffData, DeleteStaffVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteStaff(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteStaffData, FirebaseError, DeleteStaffVariables>): UseDataConnectMutationResult<DeleteStaffData, DeleteStaffVariables>;
Variables
The DeleteStaff Mutation requires an argument of type DeleteStaffVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteStaffVariables {
id: UUIDString;
}
Return Type
Recall that calling the DeleteStaff Mutation hook function returns a UseMutationResult object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things.
To check the status of a Mutation, use the UseMutationResult.status field. You can also check for pending / success / error status using the UseMutationResult.isPending, UseMutationResult.isSuccess, and UseMutationResult.isError fields.
To execute the Mutation, call UseMutationResult.mutate(). This function executes the Mutation, but does not return the data from the Mutation.
To access the data returned by a Mutation, use the UseMutationResult.data field. The data for the DeleteStaff Mutation is of type DeleteStaffData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteStaffData {
staff_delete?: Staff_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using DeleteStaff's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteStaffVariables } from '@dataconnect/generated';
import { useDeleteStaff } from '@dataconnect/generated/react'
export default function DeleteStaffComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteStaff();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteStaff(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteStaff(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteStaff(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteStaff` Mutation requires an argument of type `DeleteStaffVariables`:
const deleteStaffVars: DeleteStaffVariables = {
id: ...,
};
mutation.mutate(deleteStaffVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(deleteStaffVars, options);
// Then, you can render your component dynamically based on the status of the Mutation.
if (mutation.isPending) {
return <div>Loading...</div>;
}
if (mutation.isError) {
return <div>Error: {mutation.error.message}</div>;
}
// If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field.
if (mutation.isSuccess) {
console.log(mutation.data.staff_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}