Generated React README
This README will guide you through the process of using the generated React SDK package for the connector krow-connector. 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
- listTeamMemberInvite
- getTeamMemberInviteById
- filterTeamMemberInvite
- listCertification
- getCertificationById
- filterCertification
- listConversation
- getConversationById
- filterConversation
- listShift
- getShiftById
- filterShift
- listEnterprise
- getEnterpriseById
- filterEnterprise
- listInvoice
- getInvoiceById
- filterInvoices
- listTeamMember
- getTeamMemberById
- filterTeamMember
- listUsers
- getUserById
- filterUsers
- listVendorDefaultSettings
- getVendorDefaultSettingById
- filterVendorDefaultSettings
- listAssignment
- getAssignmentById
- filterAssignment
- listEvents
- getEventById
- filterEvents
- listMessage
- getMessageById
- filterMessage
- listSector
- getSectorById
- filterSector
- listStaff
- getStaffById
- filterStaff
- listOrder
- getOrderById
- filterOrder
- listPartner
- getPartnerById
- filterPartner
- listVendor
- getVendorById
- filterVendors
- listWorkforce
- getWorkforceById
- filterWorkforce
- listActivityLog
- getActivityLogById
- filterActivityLog
- listTeam
- getTeamById
- filterTeam
- listVendorRate
- getVendorRateById
- filterVendorRates
- listTeamHub
- getTeamHubById
- filterTeamHub
- listBusiness
- getBusinessById
- filterBusiness
- Mutations
- CreateMessage
- UpdateMessage
- DeleteMessage
- CreateStaff
- UpdateStaff
- DeleteStaff
- CreateVendor
- UpdateVendor
- DeleteVendor
- CreateActivityLog
- UpdateActivityLog
- DeleteActivityLog
- CreateAssignment
- UpdateAssignment
- DeleteAssignment
- CreateCertification
- UpdateCertification
- DeleteCertification
- CreateShift
- UpdateShift
- DeleteShift
- CreateTeamHub
- UpdateTeamHub
- DeleteTeamHub
- CreateOrder
- UpdateOrder
- DeleteOrder
- CreateSector
- UpdateSector
- DeleteSector
- CreateUser
- UpdateUser
- DeleteUser
- CreateTeamMemberInvite
- UpdateTeamMemberInvite
- DeleteTeamMemberInvite
- CreateVendorDefaultSetting
- UpdateVendorDefaultSetting
- DeleteVendorDefaultSetting
- CreateVendorRate
- UpdateVendorRate
- DeleteVendorRate
- CreateEnterprise
- UpdateEnterprise
- DeleteEnterprise
- CreatePartner
- UpdatePartner
- DeletePartner
- CreateTeamMember
- UpdateTeamMember
- DeleteTeamMember
- CreateConversation
- UpdateConversation
- DeleteConversation
- CreateInvoice
- UpdateInvoice
- DeleteInvoice
- CreateBusiness
- UpdateBusiness
- DeleteBusiness
- CreateEvent
- UpdateEvent
- DeleteEvent
- CreateTeam
- UpdateTeam
- DeleteTeam
- CreateWorkforce
- UpdateWorkforce
- DeleteWorkforce
TanStack Query Firebase & TanStack React Query
This SDK provides React hooks generated specific to your application, for the operations found in the connector krow-connector. 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 krow-connector.
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 krow-connector connector's generated Query hook functions to execute each Query. You can also follow the examples from the Data Connect documentation.
listTeamMemberInvite
You can execute the listTeamMemberInvite Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListTeamMemberInvite(dc: DataConnect, options?: useDataConnectQueryOptions<ListTeamMemberInviteData>): UseDataConnectQueryResult<ListTeamMemberInviteData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListTeamMemberInvite(options?: useDataConnectQueryOptions<ListTeamMemberInviteData>): UseDataConnectQueryResult<ListTeamMemberInviteData, undefined>;
Variables
The listTeamMemberInvite Query has no variables.
Return Type
Recall that calling the listTeamMemberInvite 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 listTeamMemberInvite Query is of type ListTeamMemberInviteData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListTeamMemberInviteData {
teamMemberInvites: ({
id: UUIDString;
teamId: UUIDString;
inviteCode: string;
email: string;
inviteStatus: TeamMemberInviteStatus;
} & TeamMemberInvite_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listTeamMemberInvite's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListTeamMemberInvite } from '@dataconnect/generated/react'
export default function ListTeamMemberInviteComponent() {
// 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 = useListTeamMemberInvite();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListTeamMemberInvite(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListTeamMemberInvite(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListTeamMemberInvite(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.teamMemberInvites);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getTeamMemberInviteById
You can execute the getTeamMemberInviteById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetTeamMemberInviteById(dc: DataConnect, vars: GetTeamMemberInviteByIdVariables, options?: useDataConnectQueryOptions<GetTeamMemberInviteByIdData>): UseDataConnectQueryResult<GetTeamMemberInviteByIdData, GetTeamMemberInviteByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetTeamMemberInviteById(vars: GetTeamMemberInviteByIdVariables, options?: useDataConnectQueryOptions<GetTeamMemberInviteByIdData>): UseDataConnectQueryResult<GetTeamMemberInviteByIdData, GetTeamMemberInviteByIdVariables>;
Variables
The getTeamMemberInviteById Query requires an argument of type GetTeamMemberInviteByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTeamMemberInviteByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getTeamMemberInviteById 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 getTeamMemberInviteById Query is of type GetTeamMemberInviteByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetTeamMemberInviteByIdData {
teamMemberInvite?: {
id: UUIDString;
teamId: UUIDString;
inviteCode: string;
email: string;
inviteStatus: TeamMemberInviteStatus;
} & TeamMemberInvite_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getTeamMemberInviteById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetTeamMemberInviteByIdVariables } from '@dataconnect/generated';
import { useGetTeamMemberInviteById } from '@dataconnect/generated/react'
export default function GetTeamMemberInviteByIdComponent() {
// The `useGetTeamMemberInviteById` Query hook requires an argument of type `GetTeamMemberInviteByIdVariables`:
const getTeamMemberInviteByIdVars: GetTeamMemberInviteByIdVariables = {
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 = useGetTeamMemberInviteById(getTeamMemberInviteByIdVars);
// Variables can be defined inline as well.
const query = useGetTeamMemberInviteById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetTeamMemberInviteById(dataConnect, getTeamMemberInviteByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetTeamMemberInviteById(getTeamMemberInviteByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetTeamMemberInviteById(dataConnect, getTeamMemberInviteByIdVars, 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.teamMemberInvite);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterTeamMemberInvite
You can execute the filterTeamMemberInvite Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterTeamMemberInvite(dc: DataConnect, vars?: FilterTeamMemberInviteVariables, options?: useDataConnectQueryOptions<FilterTeamMemberInviteData>): UseDataConnectQueryResult<FilterTeamMemberInviteData, FilterTeamMemberInviteVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterTeamMemberInvite(vars?: FilterTeamMemberInviteVariables, options?: useDataConnectQueryOptions<FilterTeamMemberInviteData>): UseDataConnectQueryResult<FilterTeamMemberInviteData, FilterTeamMemberInviteVariables>;
Variables
The filterTeamMemberInvite Query has an optional argument of type FilterTeamMemberInviteVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterTeamMemberInviteVariables {
teamId?: UUIDString | null;
email?: string | null;
inviteStatus?: TeamMemberInviteStatus | null;
}
Return Type
Recall that calling the filterTeamMemberInvite 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 filterTeamMemberInvite Query is of type FilterTeamMemberInviteData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterTeamMemberInviteData {
teamMemberInvites: ({
id: UUIDString;
teamId: UUIDString;
inviteCode: string;
email: string;
inviteStatus: TeamMemberInviteStatus;
} & TeamMemberInvite_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterTeamMemberInvite's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterTeamMemberInviteVariables } from '@dataconnect/generated';
import { useFilterTeamMemberInvite } from '@dataconnect/generated/react'
export default function FilterTeamMemberInviteComponent() {
// The `useFilterTeamMemberInvite` Query hook has an optional argument of type `FilterTeamMemberInviteVariables`:
const filterTeamMemberInviteVars: FilterTeamMemberInviteVariables = {
teamId: ..., // optional
email: ..., // optional
inviteStatus: ..., // 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 = useFilterTeamMemberInvite(filterTeamMemberInviteVars);
// Variables can be defined inline as well.
const query = useFilterTeamMemberInvite({ teamId: ..., email: ..., inviteStatus: ..., });
// Since all variables are optional for this Query, you can omit the `FilterTeamMemberInviteVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterTeamMemberInvite();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterTeamMemberInvite(dataConnect, filterTeamMemberInviteVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterTeamMemberInvite(filterTeamMemberInviteVars, 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 = useFilterTeamMemberInvite(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 = useFilterTeamMemberInvite(dataConnect, filterTeamMemberInviteVars /** 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.teamMemberInvites);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listCertification
You can execute the listCertification Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListCertification(dc: DataConnect, options?: useDataConnectQueryOptions<ListCertificationData>): UseDataConnectQueryResult<ListCertificationData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListCertification(options?: useDataConnectQueryOptions<ListCertificationData>): UseDataConnectQueryResult<ListCertificationData, undefined>;
Variables
The listCertification Query has no variables.
Return Type
Recall that calling the listCertification 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 listCertification Query is of type ListCertificationData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListCertificationData {
certifications: ({
id: UUIDString;
employeeName: string;
certificationName: string;
certificationType?: CertificationType | null;
status?: CertificationStatus | null;
expiryDate: string;
validationStatus?: CertificationValidationStatus | null;
} & Certification_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listCertification's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListCertification } from '@dataconnect/generated/react'
export default function ListCertificationComponent() {
// 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 = useListCertification();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListCertification(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListCertification(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListCertification(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.certifications);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getCertificationById
You can execute the getCertificationById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetCertificationById(dc: DataConnect, vars: GetCertificationByIdVariables, options?: useDataConnectQueryOptions<GetCertificationByIdData>): UseDataConnectQueryResult<GetCertificationByIdData, GetCertificationByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetCertificationById(vars: GetCertificationByIdVariables, options?: useDataConnectQueryOptions<GetCertificationByIdData>): UseDataConnectQueryResult<GetCertificationByIdData, GetCertificationByIdVariables>;
Variables
The getCertificationById Query requires an argument of type GetCertificationByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetCertificationByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getCertificationById 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 getCertificationById Query is of type GetCertificationByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetCertificationByIdData {
certification?: {
id: UUIDString;
employeeName: string;
certificationName: string;
certificationType?: CertificationType | null;
status?: CertificationStatus | null;
expiryDate: string;
validationStatus?: CertificationValidationStatus | null;
createdDate?: TimestampString | null;
updatedDate?: TimestampString | null;
createdBy?: string | null;
} & Certification_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getCertificationById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetCertificationByIdVariables } from '@dataconnect/generated';
import { useGetCertificationById } from '@dataconnect/generated/react'
export default function GetCertificationByIdComponent() {
// The `useGetCertificationById` Query hook requires an argument of type `GetCertificationByIdVariables`:
const getCertificationByIdVars: GetCertificationByIdVariables = {
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 = useGetCertificationById(getCertificationByIdVars);
// Variables can be defined inline as well.
const query = useGetCertificationById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetCertificationById(dataConnect, getCertificationByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetCertificationById(getCertificationByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetCertificationById(dataConnect, getCertificationByIdVars, 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.certification);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterCertification
You can execute the filterCertification Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterCertification(dc: DataConnect, vars?: FilterCertificationVariables, options?: useDataConnectQueryOptions<FilterCertificationData>): UseDataConnectQueryResult<FilterCertificationData, FilterCertificationVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterCertification(vars?: FilterCertificationVariables, options?: useDataConnectQueryOptions<FilterCertificationData>): UseDataConnectQueryResult<FilterCertificationData, FilterCertificationVariables>;
Variables
The filterCertification Query has an optional argument of type FilterCertificationVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterCertificationVariables {
employeeName?: string | null;
certificationName?: string | null;
certificationType?: CertificationType | null;
status?: CertificationStatus | null;
validationStatus?: CertificationValidationStatus | null;
}
Return Type
Recall that calling the filterCertification 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 filterCertification Query is of type FilterCertificationData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterCertificationData {
certifications: ({
id: UUIDString;
employeeName: string;
certificationName: string;
certificationType?: CertificationType | null;
status?: CertificationStatus | null;
expiryDate: string;
validationStatus?: CertificationValidationStatus | null;
} & Certification_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterCertification's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterCertificationVariables } from '@dataconnect/generated';
import { useFilterCertification } from '@dataconnect/generated/react'
export default function FilterCertificationComponent() {
// The `useFilterCertification` Query hook has an optional argument of type `FilterCertificationVariables`:
const filterCertificationVars: FilterCertificationVariables = {
employeeName: ..., // optional
certificationName: ..., // optional
certificationType: ..., // optional
status: ..., // optional
validationStatus: ..., // 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 = useFilterCertification(filterCertificationVars);
// Variables can be defined inline as well.
const query = useFilterCertification({ employeeName: ..., certificationName: ..., certificationType: ..., status: ..., validationStatus: ..., });
// Since all variables are optional for this Query, you can omit the `FilterCertificationVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterCertification();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterCertification(dataConnect, filterCertificationVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterCertification(filterCertificationVars, 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 = useFilterCertification(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 = useFilterCertification(dataConnect, filterCertificationVars /** 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.certifications);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listConversation
You can execute the listConversation Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListConversation(dc: DataConnect, options?: useDataConnectQueryOptions<ListConversationData>): UseDataConnectQueryResult<ListConversationData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListConversation(options?: useDataConnectQueryOptions<ListConversationData>): UseDataConnectQueryResult<ListConversationData, undefined>;
Variables
The listConversation Query has no variables.
Return Type
Recall that calling the listConversation 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 listConversation Query is of type ListConversationData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListConversationData {
conversations: ({
id: UUIDString;
participants: string;
conversationType: ConversationType;
relatedTo: UUIDString;
status?: ConversationStatus | null;
} & Conversation_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listConversation's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListConversation } from '@dataconnect/generated/react'
export default function ListConversationComponent() {
// 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 = useListConversation();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListConversation(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListConversation(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListConversation(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.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;
participants: string;
conversationType: ConversationType;
relatedTo: UUIDString;
status?: ConversationStatus | 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>;
}
filterConversation
You can execute the filterConversation Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterConversation(dc: DataConnect, vars?: FilterConversationVariables, options?: useDataConnectQueryOptions<FilterConversationData>): UseDataConnectQueryResult<FilterConversationData, FilterConversationVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterConversation(vars?: FilterConversationVariables, options?: useDataConnectQueryOptions<FilterConversationData>): UseDataConnectQueryResult<FilterConversationData, FilterConversationVariables>;
Variables
The filterConversation Query has an optional argument of type FilterConversationVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterConversationVariables {
conversationType?: ConversationType | null;
status?: ConversationStatus | null;
relatedTo?: UUIDString | null;
}
Return Type
Recall that calling the filterConversation 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 filterConversation Query is of type FilterConversationData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterConversationData {
conversations: ({
id: UUIDString;
participants: string;
conversationType: ConversationType;
relatedTo: UUIDString;
status?: ConversationStatus | null;
} & Conversation_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterConversation's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterConversationVariables } from '@dataconnect/generated';
import { useFilterConversation } from '@dataconnect/generated/react'
export default function FilterConversationComponent() {
// The `useFilterConversation` Query hook has an optional argument of type `FilterConversationVariables`:
const filterConversationVars: FilterConversationVariables = {
conversationType: ..., // optional
status: ..., // optional
relatedTo: ..., // 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 = useFilterConversation(filterConversationVars);
// Variables can be defined inline as well.
const query = useFilterConversation({ conversationType: ..., status: ..., relatedTo: ..., });
// Since all variables are optional for this Query, you can omit the `FilterConversationVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterConversation();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterConversation(dataConnect, filterConversationVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterConversation(filterConversationVars, 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 = useFilterConversation(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 = useFilterConversation(dataConnect, filterConversationVars /** 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>;
}
listShift
You can execute the listShift Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListShift(dc: DataConnect, options?: useDataConnectQueryOptions<ListShiftData>): UseDataConnectQueryResult<ListShiftData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListShift(options?: useDataConnectQueryOptions<ListShiftData>): UseDataConnectQueryResult<ListShiftData, undefined>;
Variables
The listShift Query has no variables.
Return Type
Recall that calling the listShift 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 listShift Query is of type ListShiftData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListShiftData {
shifts: ({
id: UUIDString;
shiftName: string;
startDate: TimestampString;
endDate?: TimestampString | null;
assignedStaff?: string | null;
} & Shift_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listShift's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListShift } from '@dataconnect/generated/react'
export default function ListShiftComponent() {
// 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 = useListShift();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListShift(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListShift(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListShift(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.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;
shiftName: string;
startDate: TimestampString;
endDate?: TimestampString | null;
assignedStaff?: string | null;
createdDate?: TimestampString | null;
updatedDate?: TimestampString | null;
createdBy?: string | null;
} & 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>;
}
filterShift
You can execute the filterShift Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterShift(dc: DataConnect, vars?: FilterShiftVariables, options?: useDataConnectQueryOptions<FilterShiftData>): UseDataConnectQueryResult<FilterShiftData, FilterShiftVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterShift(vars?: FilterShiftVariables, options?: useDataConnectQueryOptions<FilterShiftData>): UseDataConnectQueryResult<FilterShiftData, FilterShiftVariables>;
Variables
The filterShift Query has an optional argument of type FilterShiftVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterShiftVariables {
shiftName?: string | null;
startDate?: TimestampString | null;
endDate?: TimestampString | null;
}
Return Type
Recall that calling the filterShift 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 filterShift Query is of type FilterShiftData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterShiftData {
shifts: ({
id: UUIDString;
shiftName: string;
startDate: TimestampString;
endDate?: TimestampString | null;
assignedStaff?: string | null;
} & Shift_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterShift's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterShiftVariables } from '@dataconnect/generated';
import { useFilterShift } from '@dataconnect/generated/react'
export default function FilterShiftComponent() {
// The `useFilterShift` Query hook has an optional argument of type `FilterShiftVariables`:
const filterShiftVars: FilterShiftVariables = {
shiftName: ..., // optional
startDate: ..., // optional
endDate: ..., // 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 = useFilterShift(filterShiftVars);
// Variables can be defined inline as well.
const query = useFilterShift({ shiftName: ..., startDate: ..., endDate: ..., });
// Since all variables are optional for this Query, you can omit the `FilterShiftVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterShift();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterShift(dataConnect, filterShiftVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterShift(filterShiftVars, 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 = useFilterShift(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 = useFilterShift(dataConnect, filterShiftVars /** 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>;
}
listEnterprise
You can execute the listEnterprise Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListEnterprise(dc: DataConnect, options?: useDataConnectQueryOptions<ListEnterpriseData>): UseDataConnectQueryResult<ListEnterpriseData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListEnterprise(options?: useDataConnectQueryOptions<ListEnterpriseData>): UseDataConnectQueryResult<ListEnterpriseData, undefined>;
Variables
The listEnterprise Query has no variables.
Return Type
Recall that calling the listEnterprise 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 listEnterprise Query is of type ListEnterpriseData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListEnterpriseData {
enterprises: ({
id: UUIDString;
enterpriseNumber: string;
enterpriseName: string;
enterpriseCode: string;
} & Enterprise_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listEnterprise's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListEnterprise } from '@dataconnect/generated/react'
export default function ListEnterpriseComponent() {
// 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 = useListEnterprise();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListEnterprise(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListEnterprise(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListEnterprise(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.enterprises);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getEnterpriseById
You can execute the getEnterpriseById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetEnterpriseById(dc: DataConnect, vars: GetEnterpriseByIdVariables, options?: useDataConnectQueryOptions<GetEnterpriseByIdData>): UseDataConnectQueryResult<GetEnterpriseByIdData, GetEnterpriseByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetEnterpriseById(vars: GetEnterpriseByIdVariables, options?: useDataConnectQueryOptions<GetEnterpriseByIdData>): UseDataConnectQueryResult<GetEnterpriseByIdData, GetEnterpriseByIdVariables>;
Variables
The getEnterpriseById Query requires an argument of type GetEnterpriseByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetEnterpriseByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getEnterpriseById 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 getEnterpriseById Query is of type GetEnterpriseByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetEnterpriseByIdData {
enterprise?: {
id: UUIDString;
enterpriseNumber: string;
enterpriseName: string;
enterpriseCode: string;
} & Enterprise_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getEnterpriseById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetEnterpriseByIdVariables } from '@dataconnect/generated';
import { useGetEnterpriseById } from '@dataconnect/generated/react'
export default function GetEnterpriseByIdComponent() {
// The `useGetEnterpriseById` Query hook requires an argument of type `GetEnterpriseByIdVariables`:
const getEnterpriseByIdVars: GetEnterpriseByIdVariables = {
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 = useGetEnterpriseById(getEnterpriseByIdVars);
// Variables can be defined inline as well.
const query = useGetEnterpriseById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetEnterpriseById(dataConnect, getEnterpriseByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetEnterpriseById(getEnterpriseByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetEnterpriseById(dataConnect, getEnterpriseByIdVars, 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.enterprise);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterEnterprise
You can execute the filterEnterprise Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterEnterprise(dc: DataConnect, vars?: FilterEnterpriseVariables, options?: useDataConnectQueryOptions<FilterEnterpriseData>): UseDataConnectQueryResult<FilterEnterpriseData, FilterEnterpriseVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterEnterprise(vars?: FilterEnterpriseVariables, options?: useDataConnectQueryOptions<FilterEnterpriseData>): UseDataConnectQueryResult<FilterEnterpriseData, FilterEnterpriseVariables>;
Variables
The filterEnterprise Query has an optional argument of type FilterEnterpriseVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterEnterpriseVariables {
enterpriseNumber?: string | null;
enterpriseName?: string | null;
enterpriseCode?: string | null;
}
Return Type
Recall that calling the filterEnterprise 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 filterEnterprise Query is of type FilterEnterpriseData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterEnterpriseData {
enterprises: ({
id: UUIDString;
enterpriseNumber: string;
enterpriseName: string;
enterpriseCode: string;
} & Enterprise_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterEnterprise's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterEnterpriseVariables } from '@dataconnect/generated';
import { useFilterEnterprise } from '@dataconnect/generated/react'
export default function FilterEnterpriseComponent() {
// The `useFilterEnterprise` Query hook has an optional argument of type `FilterEnterpriseVariables`:
const filterEnterpriseVars: FilterEnterpriseVariables = {
enterpriseNumber: ..., // optional
enterpriseName: ..., // optional
enterpriseCode: ..., // 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 = useFilterEnterprise(filterEnterpriseVars);
// Variables can be defined inline as well.
const query = useFilterEnterprise({ enterpriseNumber: ..., enterpriseName: ..., enterpriseCode: ..., });
// Since all variables are optional for this Query, you can omit the `FilterEnterpriseVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterEnterprise();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterEnterprise(dataConnect, filterEnterpriseVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterEnterprise(filterEnterpriseVars, 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 = useFilterEnterprise(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 = useFilterEnterprise(dataConnect, filterEnterpriseVars /** 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.enterprises);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listInvoice
You can execute the listInvoice Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListInvoice(dc: DataConnect, options?: useDataConnectQueryOptions<ListInvoiceData>): UseDataConnectQueryResult<ListInvoiceData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListInvoice(options?: useDataConnectQueryOptions<ListInvoiceData>): UseDataConnectQueryResult<ListInvoiceData, undefined>;
Variables
The listInvoice Query has no variables.
Return Type
Recall that calling the listInvoice 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 listInvoice Query is of type ListInvoiceData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListInvoiceData {
invoices: ({
id: UUIDString;
invoiceNumber: string;
amount: number;
status: InvoiceStatus;
issueDate: TimestampString;
dueDate: TimestampString;
disputedItems?: string | null;
isAutoGenerated?: boolean | null;
} & Invoice_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listInvoice's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListInvoice } from '@dataconnect/generated/react'
export default function ListInvoiceComponent() {
// 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 = useListInvoice();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListInvoice(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListInvoice(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListInvoice(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.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;
invoiceNumber: string;
amount: number;
status: InvoiceStatus;
issueDate: TimestampString;
dueDate: TimestampString;
disputedItems?: string | null;
isAutoGenerated?: boolean | null;
} & 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>;
}
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 {
invoiceNumber?: string | null;
status?: InvoiceStatus | null;
isAutoGenerated?: boolean | null;
amount?: 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;
invoiceNumber: string;
amount: number;
status: InvoiceStatus;
issueDate: TimestampString;
dueDate: TimestampString;
isAutoGenerated?: boolean | null;
} & 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 = {
invoiceNumber: ..., // optional
status: ..., // optional
isAutoGenerated: ..., // optional
amount: ..., // 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({ invoiceNumber: ..., status: ..., isAutoGenerated: ..., amount: ..., });
// 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>;
}
listTeamMember
You can execute the listTeamMember Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListTeamMember(dc: DataConnect, options?: useDataConnectQueryOptions<ListTeamMemberData>): UseDataConnectQueryResult<ListTeamMemberData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListTeamMember(options?: useDataConnectQueryOptions<ListTeamMemberData>): UseDataConnectQueryResult<ListTeamMemberData, undefined>;
Variables
The listTeamMember Query has no variables.
Return Type
Recall that calling the listTeamMember 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 listTeamMember Query is of type ListTeamMemberData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListTeamMemberData {
teamMembers: ({
id: UUIDString;
teamId: UUIDString;
memberName: string;
email: string;
role?: TeamMemberRole | null;
isActive?: boolean | null;
} & TeamMember_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listTeamMember's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListTeamMember } from '@dataconnect/generated/react'
export default function ListTeamMemberComponent() {
// 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 = useListTeamMember();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListTeamMember(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListTeamMember(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListTeamMember(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;
memberName: string;
email: string;
role?: TeamMemberRole | null;
isActive?: boolean | null;
} & 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>;
}
filterTeamMember
You can execute the filterTeamMember Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterTeamMember(dc: DataConnect, vars?: FilterTeamMemberVariables, options?: useDataConnectQueryOptions<FilterTeamMemberData>): UseDataConnectQueryResult<FilterTeamMemberData, FilterTeamMemberVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterTeamMember(vars?: FilterTeamMemberVariables, options?: useDataConnectQueryOptions<FilterTeamMemberData>): UseDataConnectQueryResult<FilterTeamMemberData, FilterTeamMemberVariables>;
Variables
The filterTeamMember Query has an optional argument of type FilterTeamMemberVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterTeamMemberVariables {
teamId?: UUIDString | null;
memberName?: string | null;
email?: string | null;
role?: TeamMemberRole | null;
isActive?: boolean | null;
}
Return Type
Recall that calling the filterTeamMember 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 filterTeamMember Query is of type FilterTeamMemberData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterTeamMemberData {
teamMembers: ({
id: UUIDString;
teamId: UUIDString;
memberName: string;
email: string;
role?: TeamMemberRole | null;
isActive?: boolean | null;
} & TeamMember_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterTeamMember's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterTeamMemberVariables } from '@dataconnect/generated';
import { useFilterTeamMember } from '@dataconnect/generated/react'
export default function FilterTeamMemberComponent() {
// The `useFilterTeamMember` Query hook has an optional argument of type `FilterTeamMemberVariables`:
const filterTeamMemberVars: FilterTeamMemberVariables = {
teamId: ..., // optional
memberName: ..., // optional
email: ..., // optional
role: ..., // optional
isActive: ..., // 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 = useFilterTeamMember(filterTeamMemberVars);
// Variables can be defined inline as well.
const query = useFilterTeamMember({ teamId: ..., memberName: ..., email: ..., role: ..., isActive: ..., });
// Since all variables are optional for this Query, you can omit the `FilterTeamMemberVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterTeamMember();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterTeamMember(dataConnect, filterTeamMemberVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterTeamMember(filterTeamMemberVars, 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 = useFilterTeamMember(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 = useFilterTeamMember(dataConnect, filterTeamMemberVars /** 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.teamMembers);
}
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;
fullName: string;
role: UserBaseRole;
userRole?: 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;
fullName: string;
role: UserBaseRole;
userRole?: 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;
fullName: string;
role: UserBaseRole;
userRole?: 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>;
}
listVendorDefaultSettings
You can execute the listVendorDefaultSettings Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListVendorDefaultSettings(dc: DataConnect, options?: useDataConnectQueryOptions<ListVendorDefaultSettingsData>): UseDataConnectQueryResult<ListVendorDefaultSettingsData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListVendorDefaultSettings(options?: useDataConnectQueryOptions<ListVendorDefaultSettingsData>): UseDataConnectQueryResult<ListVendorDefaultSettingsData, undefined>;
Variables
The listVendorDefaultSettings Query has no variables.
Return Type
Recall that calling the listVendorDefaultSettings 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 listVendorDefaultSettings Query is of type ListVendorDefaultSettingsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListVendorDefaultSettingsData {
vendorDefaultSettings: ({
id: UUIDString;
vendorName: string;
defaultMarkupPercentage: number;
defaultVendorFeePercentage: number;
} & VendorDefaultSetting_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listVendorDefaultSettings's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListVendorDefaultSettings } from '@dataconnect/generated/react'
export default function ListVendorDefaultSettingsComponent() {
// 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 = useListVendorDefaultSettings();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListVendorDefaultSettings(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListVendorDefaultSettings(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListVendorDefaultSettings(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.vendorDefaultSettings);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getVendorDefaultSettingById
You can execute the getVendorDefaultSettingById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetVendorDefaultSettingById(dc: DataConnect, vars: GetVendorDefaultSettingByIdVariables, options?: useDataConnectQueryOptions<GetVendorDefaultSettingByIdData>): UseDataConnectQueryResult<GetVendorDefaultSettingByIdData, GetVendorDefaultSettingByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetVendorDefaultSettingById(vars: GetVendorDefaultSettingByIdVariables, options?: useDataConnectQueryOptions<GetVendorDefaultSettingByIdData>): UseDataConnectQueryResult<GetVendorDefaultSettingByIdData, GetVendorDefaultSettingByIdVariables>;
Variables
The getVendorDefaultSettingById Query requires an argument of type GetVendorDefaultSettingByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetVendorDefaultSettingByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getVendorDefaultSettingById 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 getVendorDefaultSettingById Query is of type GetVendorDefaultSettingByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetVendorDefaultSettingByIdData {
vendorDefaultSetting?: {
id: UUIDString;
vendorName: string;
defaultMarkupPercentage: number;
defaultVendorFeePercentage: number;
} & VendorDefaultSetting_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getVendorDefaultSettingById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetVendorDefaultSettingByIdVariables } from '@dataconnect/generated';
import { useGetVendorDefaultSettingById } from '@dataconnect/generated/react'
export default function GetVendorDefaultSettingByIdComponent() {
// The `useGetVendorDefaultSettingById` Query hook requires an argument of type `GetVendorDefaultSettingByIdVariables`:
const getVendorDefaultSettingByIdVars: GetVendorDefaultSettingByIdVariables = {
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 = useGetVendorDefaultSettingById(getVendorDefaultSettingByIdVars);
// Variables can be defined inline as well.
const query = useGetVendorDefaultSettingById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetVendorDefaultSettingById(dataConnect, getVendorDefaultSettingByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetVendorDefaultSettingById(getVendorDefaultSettingByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetVendorDefaultSettingById(dataConnect, getVendorDefaultSettingByIdVars, 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.vendorDefaultSetting);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterVendorDefaultSettings
You can execute the filterVendorDefaultSettings Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterVendorDefaultSettings(dc: DataConnect, vars?: FilterVendorDefaultSettingsVariables, options?: useDataConnectQueryOptions<FilterVendorDefaultSettingsData>): UseDataConnectQueryResult<FilterVendorDefaultSettingsData, FilterVendorDefaultSettingsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterVendorDefaultSettings(vars?: FilterVendorDefaultSettingsVariables, options?: useDataConnectQueryOptions<FilterVendorDefaultSettingsData>): UseDataConnectQueryResult<FilterVendorDefaultSettingsData, FilterVendorDefaultSettingsVariables>;
Variables
The filterVendorDefaultSettings Query has an optional argument of type FilterVendorDefaultSettingsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterVendorDefaultSettingsVariables {
vendorName?: string | null;
defaultMarkupPercentage?: number | null;
defaultVendorFeePercentage?: number | null;
}
Return Type
Recall that calling the filterVendorDefaultSettings 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 filterVendorDefaultSettings Query is of type FilterVendorDefaultSettingsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterVendorDefaultSettingsData {
vendorDefaultSettings: ({
id: UUIDString;
vendorName: string;
defaultMarkupPercentage: number;
defaultVendorFeePercentage: number;
} & VendorDefaultSetting_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterVendorDefaultSettings's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterVendorDefaultSettingsVariables } from '@dataconnect/generated';
import { useFilterVendorDefaultSettings } from '@dataconnect/generated/react'
export default function FilterVendorDefaultSettingsComponent() {
// The `useFilterVendorDefaultSettings` Query hook has an optional argument of type `FilterVendorDefaultSettingsVariables`:
const filterVendorDefaultSettingsVars: FilterVendorDefaultSettingsVariables = {
vendorName: ..., // optional
defaultMarkupPercentage: ..., // optional
defaultVendorFeePercentage: ..., // 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 = useFilterVendorDefaultSettings(filterVendorDefaultSettingsVars);
// Variables can be defined inline as well.
const query = useFilterVendorDefaultSettings({ vendorName: ..., defaultMarkupPercentage: ..., defaultVendorFeePercentage: ..., });
// Since all variables are optional for this Query, you can omit the `FilterVendorDefaultSettingsVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterVendorDefaultSettings();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterVendorDefaultSettings(dataConnect, filterVendorDefaultSettingsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterVendorDefaultSettings(filterVendorDefaultSettingsVars, 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 = useFilterVendorDefaultSettings(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 = useFilterVendorDefaultSettings(dataConnect, filterVendorDefaultSettingsVars /** 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.vendorDefaultSettings);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listAssignment
You can execute the listAssignment Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListAssignment(dc: DataConnect, options?: useDataConnectQueryOptions<ListAssignmentData>): UseDataConnectQueryResult<ListAssignmentData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListAssignment(options?: useDataConnectQueryOptions<ListAssignmentData>): UseDataConnectQueryResult<ListAssignmentData, undefined>;
Variables
The listAssignment Query has no variables.
Return Type
Recall that calling the listAssignment 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 listAssignment Query is of type ListAssignmentData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListAssignmentData {
assignments: ({
id: UUIDString;
assignmentNumber?: string | null;
orderId: UUIDString;
workforceId: UUIDString;
vendorId: UUIDString;
role: string;
assignmentStatus: AssignmentStatus;
scheduledStart: TimestampString;
} & Assignment_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listAssignment's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListAssignment } from '@dataconnect/generated/react'
export default function ListAssignmentComponent() {
// 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 = useListAssignment();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListAssignment(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListAssignment(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListAssignment(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.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;
assignmentNumber?: string | null;
orderId: UUIDString;
workforceId: UUIDString;
vendorId: UUIDString;
role: string;
assignmentStatus: AssignmentStatus;
scheduledStart: TimestampString;
} & 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>;
}
filterAssignment
You can execute the filterAssignment Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterAssignment(dc: DataConnect, vars?: FilterAssignmentVariables, options?: useDataConnectQueryOptions<FilterAssignmentData>): UseDataConnectQueryResult<FilterAssignmentData, FilterAssignmentVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterAssignment(vars?: FilterAssignmentVariables, options?: useDataConnectQueryOptions<FilterAssignmentData>): UseDataConnectQueryResult<FilterAssignmentData, FilterAssignmentVariables>;
Variables
The filterAssignment Query has an optional argument of type FilterAssignmentVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterAssignmentVariables {
assignmentNumber?: string | null;
orderId?: UUIDString | null;
workforceId?: UUIDString | null;
vendorId?: UUIDString | null;
assignmentStatus?: AssignmentStatus | null;
}
Return Type
Recall that calling the filterAssignment 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 filterAssignment Query is of type FilterAssignmentData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterAssignmentData {
assignments: ({
id: UUIDString;
assignmentNumber?: string | null;
orderId: UUIDString;
workforceId: UUIDString;
vendorId: UUIDString;
role: string;
assignmentStatus: AssignmentStatus;
scheduledStart: TimestampString;
} & Assignment_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterAssignment's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterAssignmentVariables } from '@dataconnect/generated';
import { useFilterAssignment } from '@dataconnect/generated/react'
export default function FilterAssignmentComponent() {
// The `useFilterAssignment` Query hook has an optional argument of type `FilterAssignmentVariables`:
const filterAssignmentVars: FilterAssignmentVariables = {
assignmentNumber: ..., // optional
orderId: ..., // optional
workforceId: ..., // optional
vendorId: ..., // optional
assignmentStatus: ..., // 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 = useFilterAssignment(filterAssignmentVars);
// Variables can be defined inline as well.
const query = useFilterAssignment({ assignmentNumber: ..., orderId: ..., workforceId: ..., vendorId: ..., assignmentStatus: ..., });
// Since all variables are optional for this Query, you can omit the `FilterAssignmentVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterAssignment();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterAssignment(dataConnect, filterAssignmentVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterAssignment(filterAssignmentVars, 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 = useFilterAssignment(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 = useFilterAssignment(dataConnect, filterAssignmentVars /** 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>;
}
listEvents
You can execute the listEvents Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListEvents(dc: DataConnect, vars?: ListEventsVariables, options?: useDataConnectQueryOptions<ListEventsData>): UseDataConnectQueryResult<ListEventsData, ListEventsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListEvents(vars?: ListEventsVariables, options?: useDataConnectQueryOptions<ListEventsData>): UseDataConnectQueryResult<ListEventsData, ListEventsVariables>;
Variables
The listEvents Query has an optional argument of type ListEventsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListEventsVariables {
orderByDate?: OrderDirection | null;
orderByCreatedDate?: OrderDirection | null;
limit?: number | null;
}
Return Type
Recall that calling the listEvents 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 listEvents Query is of type ListEventsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListEventsData {
events: ({
id: UUIDString;
eventName: string;
status: EventStatus;
date: string;
isRapid?: boolean | null;
isRecurring?: boolean | null;
isMultiDay?: boolean | null;
recurrenceType?: RecurrenceType | null;
recurrenceStartDate?: TimestampString | null;
recurrenceEndDate?: TimestampString | null;
scatterDates?: unknown | null;
multiDayStartDate?: TimestampString | null;
multiDayEndDate?: TimestampString | null;
bufferTimeBefore?: number | null;
bufferTimeAfter?: number | null;
conflictDetectionEnabled?: boolean | null;
detectedConflicts?: unknown | null;
businessId: UUIDString;
businessName?: string | null;
vendorId?: string | null;
vendorName?: string | null;
hub?: string | null;
eventLocation?: string | null;
contractType?: ContractType | null;
poReference?: string | null;
shifts?: unknown | null;
addons?: unknown | null;
total?: number | null;
clientName?: string | null;
clientEmail?: string | null;
clientPhone?: string | null;
invoiceId?: UUIDString | null;
notes?: string | null;
requested?: number | null;
assignedStaff?: unknown | null;
orderType?: string | null;
department?: string | null;
createdBy?: string | null;
recurringStartDate?: string | null;
recurringEndDate?: string | null;
recurringDays?: unknown | null;
permanentStartDate?: string | null;
permanentDays?: unknown | null;
includeBackup?: boolean | null;
backupStaffCount?: number | null;
recurringTime?: string | null;
permanentTime?: string | null;
} & Event_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listEvents's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListEventsVariables } from '@dataconnect/generated';
import { useListEvents } from '@dataconnect/generated/react'
export default function ListEventsComponent() {
// The `useListEvents` Query hook has an optional argument of type `ListEventsVariables`:
const listEventsVars: ListEventsVariables = {
orderByDate: ..., // optional
orderByCreatedDate: ..., // 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 = useListEvents(listEventsVars);
// Variables can be defined inline as well.
const query = useListEvents({ orderByDate: ..., orderByCreatedDate: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `ListEventsVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useListEvents();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListEvents(dataConnect, listEventsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListEvents(listEventsVars, 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 = useListEvents(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 = useListEvents(dataConnect, listEventsVars /** 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.events);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getEventById
You can execute the getEventById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetEventById(dc: DataConnect, vars: GetEventByIdVariables, options?: useDataConnectQueryOptions<GetEventByIdData>): UseDataConnectQueryResult<GetEventByIdData, GetEventByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetEventById(vars: GetEventByIdVariables, options?: useDataConnectQueryOptions<GetEventByIdData>): UseDataConnectQueryResult<GetEventByIdData, GetEventByIdVariables>;
Variables
The getEventById Query requires an argument of type GetEventByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetEventByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getEventById 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 getEventById Query is of type GetEventByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetEventByIdData {
event?: {
id: UUIDString;
eventName: string;
status: EventStatus;
date: string;
isRapid?: boolean | null;
isRecurring?: boolean | null;
isMultiDay?: boolean | null;
recurrenceType?: RecurrenceType | null;
recurrenceStartDate?: TimestampString | null;
recurrenceEndDate?: TimestampString | null;
scatterDates?: unknown | null;
multiDayStartDate?: TimestampString | null;
multiDayEndDate?: TimestampString | null;
bufferTimeBefore?: number | null;
bufferTimeAfter?: number | null;
conflictDetectionEnabled?: boolean | null;
detectedConflicts?: unknown | null;
businessId: UUIDString;
businessName?: string | null;
vendorId?: string | null;
vendorName?: string | null;
hub?: string | null;
eventLocation?: string | null;
contractType?: ContractType | null;
poReference?: string | null;
shifts?: unknown | null;
addons?: unknown | null;
total?: number | null;
clientName?: string | null;
clientEmail?: string | null;
clientPhone?: string | null;
invoiceId?: UUIDString | null;
notes?: string | null;
requested?: number | null;
orderType?: string | null;
department?: string | null;
assignedStaff?: unknown | null;
recurringStartDate?: string | null;
recurringEndDate?: string | null;
recurringDays?: unknown | null;
permanentStartDate?: string | null;
permanentDays?: unknown | null;
includeBackup?: boolean | null;
backupStaffCount?: number | null;
recurringTime?: string | null;
permanentTime?: string | null;
} & Event_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getEventById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetEventByIdVariables } from '@dataconnect/generated';
import { useGetEventById } from '@dataconnect/generated/react'
export default function GetEventByIdComponent() {
// The `useGetEventById` Query hook requires an argument of type `GetEventByIdVariables`:
const getEventByIdVars: GetEventByIdVariables = {
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 = useGetEventById(getEventByIdVars);
// Variables can be defined inline as well.
const query = useGetEventById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetEventById(dataConnect, getEventByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetEventById(getEventByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetEventById(dataConnect, getEventByIdVars, 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.event);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterEvents
You can execute the filterEvents Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterEvents(dc: DataConnect, vars?: FilterEventsVariables, options?: useDataConnectQueryOptions<FilterEventsData>): UseDataConnectQueryResult<FilterEventsData, FilterEventsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterEvents(vars?: FilterEventsVariables, options?: useDataConnectQueryOptions<FilterEventsData>): UseDataConnectQueryResult<FilterEventsData, FilterEventsVariables>;
Variables
The filterEvents Query has an optional argument of type FilterEventsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterEventsVariables {
status?: EventStatus | null;
businessId?: UUIDString | null;
vendorId?: string | null;
isRecurring?: boolean | null;
isRapid?: boolean | null;
isMultiDay?: boolean | null;
recurrenceType?: RecurrenceType | null;
date?: string | null;
hub?: string | null;
eventLocation?: string | null;
contractType?: ContractType | null;
clientEmail?: string | null;
}
Return Type
Recall that calling the filterEvents 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 filterEvents Query is of type FilterEventsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterEventsData {
events: ({
id: UUIDString;
eventName: string;
status: EventStatus;
date: string;
isRapid?: boolean | null;
isRecurring?: boolean | null;
isMultiDay?: boolean | null;
recurrenceType?: RecurrenceType | null;
recurrenceStartDate?: TimestampString | null;
recurrenceEndDate?: TimestampString | null;
scatterDates?: unknown | null;
multiDayStartDate?: TimestampString | null;
multiDayEndDate?: TimestampString | null;
bufferTimeBefore?: number | null;
bufferTimeAfter?: number | null;
conflictDetectionEnabled?: boolean | null;
detectedConflicts?: unknown | null;
businessId: UUIDString;
businessName?: string | null;
vendorId?: string | null;
vendorName?: string | null;
hub?: string | null;
eventLocation?: string | null;
contractType?: ContractType | null;
poReference?: string | null;
shifts?: unknown | null;
addons?: unknown | null;
total?: number | null;
clientName?: string | null;
clientEmail?: string | null;
clientPhone?: string | null;
invoiceId?: UUIDString | null;
notes?: string | null;
requested?: number | null;
assignedStaff?: unknown | null;
orderType?: string | null;
department?: string | null;
createdBy?: string | null;
recurringStartDate?: string | null;
recurringEndDate?: string | null;
recurringDays?: unknown | null;
permanentStartDate?: string | null;
permanentDays?: unknown | null;
includeBackup?: boolean | null;
backupStaffCount?: number | null;
recurringTime?: string | null;
permanentTime?: string | null;
} & Event_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterEvents's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterEventsVariables } from '@dataconnect/generated';
import { useFilterEvents } from '@dataconnect/generated/react'
export default function FilterEventsComponent() {
// The `useFilterEvents` Query hook has an optional argument of type `FilterEventsVariables`:
const filterEventsVars: FilterEventsVariables = {
status: ..., // optional
businessId: ..., // optional
vendorId: ..., // optional
isRecurring: ..., // optional
isRapid: ..., // optional
isMultiDay: ..., // optional
recurrenceType: ..., // optional
date: ..., // optional
hub: ..., // optional
eventLocation: ..., // optional
contractType: ..., // optional
clientEmail: ..., // 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 = useFilterEvents(filterEventsVars);
// Variables can be defined inline as well.
const query = useFilterEvents({ status: ..., businessId: ..., vendorId: ..., isRecurring: ..., isRapid: ..., isMultiDay: ..., recurrenceType: ..., date: ..., hub: ..., eventLocation: ..., contractType: ..., clientEmail: ..., });
// Since all variables are optional for this Query, you can omit the `FilterEventsVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterEvents();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterEvents(dataConnect, filterEventsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterEvents(filterEventsVars, 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 = useFilterEvents(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 = useFilterEvents(dataConnect, filterEventsVars /** 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.events);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listMessage
You can execute the listMessage Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListMessage(dc: DataConnect, options?: useDataConnectQueryOptions<ListMessageData>): UseDataConnectQueryResult<ListMessageData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListMessage(options?: useDataConnectQueryOptions<ListMessageData>): UseDataConnectQueryResult<ListMessageData, undefined>;
Variables
The listMessage Query has no variables.
Return Type
Recall that calling the listMessage 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 listMessage Query is of type ListMessageData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListMessageData {
messages: ({
id: UUIDString;
conversationId: UUIDString;
senderName: string;
content: string;
readBy?: string | null;
} & Message_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listMessage's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListMessage } from '@dataconnect/generated/react'
export default function ListMessageComponent() {
// 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 = useListMessage();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListMessage(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListMessage(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListMessage(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;
senderName: string;
content: string;
readBy?: 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>;
}
filterMessage
You can execute the filterMessage Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterMessage(dc: DataConnect, vars?: FilterMessageVariables, options?: useDataConnectQueryOptions<FilterMessageData>): UseDataConnectQueryResult<FilterMessageData, FilterMessageVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterMessage(vars?: FilterMessageVariables, options?: useDataConnectQueryOptions<FilterMessageData>): UseDataConnectQueryResult<FilterMessageData, FilterMessageVariables>;
Variables
The filterMessage Query has an optional argument of type FilterMessageVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterMessageVariables {
conversationId?: UUIDString | null;
senderName?: string | null;
}
Return Type
Recall that calling the filterMessage 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 filterMessage Query is of type FilterMessageData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterMessageData {
messages: ({
id: UUIDString;
conversationId: UUIDString;
senderName: string;
content: string;
readBy?: string | null;
} & Message_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterMessage's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterMessageVariables } from '@dataconnect/generated';
import { useFilterMessage } from '@dataconnect/generated/react'
export default function FilterMessageComponent() {
// The `useFilterMessage` Query hook has an optional argument of type `FilterMessageVariables`:
const filterMessageVars: FilterMessageVariables = {
conversationId: ..., // optional
senderName: ..., // 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 = useFilterMessage(filterMessageVars);
// Variables can be defined inline as well.
const query = useFilterMessage({ conversationId: ..., senderName: ..., });
// Since all variables are optional for this Query, you can omit the `FilterMessageVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterMessage();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterMessage(dataConnect, filterMessageVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterMessage(filterMessageVars, 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 = useFilterMessage(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 = useFilterMessage(dataConnect, filterMessageVars /** 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.messages);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listSector
You can execute the listSector Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListSector(dc: DataConnect, options?: useDataConnectQueryOptions<ListSectorData>): UseDataConnectQueryResult<ListSectorData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListSector(options?: useDataConnectQueryOptions<ListSectorData>): UseDataConnectQueryResult<ListSectorData, undefined>;
Variables
The listSector Query has no variables.
Return Type
Recall that calling the listSector 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 listSector Query is of type ListSectorData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListSectorData {
sectors: ({
id: UUIDString;
sectorNumber: string;
sectorName: string;
sectorType?: SectorType | null;
} & Sector_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listSector's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListSector } from '@dataconnect/generated/react'
export default function ListSectorComponent() {
// 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 = useListSector();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListSector(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListSector(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListSector(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.sectors);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getSectorById
You can execute the getSectorById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetSectorById(dc: DataConnect, vars: GetSectorByIdVariables, options?: useDataConnectQueryOptions<GetSectorByIdData>): UseDataConnectQueryResult<GetSectorByIdData, GetSectorByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetSectorById(vars: GetSectorByIdVariables, options?: useDataConnectQueryOptions<GetSectorByIdData>): UseDataConnectQueryResult<GetSectorByIdData, GetSectorByIdVariables>;
Variables
The getSectorById Query requires an argument of type GetSectorByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetSectorByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getSectorById 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 getSectorById Query is of type GetSectorByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetSectorByIdData {
sector?: {
id: UUIDString;
sectorNumber: string;
sectorName: string;
sectorType?: SectorType | null;
} & Sector_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getSectorById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetSectorByIdVariables } from '@dataconnect/generated';
import { useGetSectorById } from '@dataconnect/generated/react'
export default function GetSectorByIdComponent() {
// The `useGetSectorById` Query hook requires an argument of type `GetSectorByIdVariables`:
const getSectorByIdVars: GetSectorByIdVariables = {
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 = useGetSectorById(getSectorByIdVars);
// Variables can be defined inline as well.
const query = useGetSectorById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetSectorById(dataConnect, getSectorByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetSectorById(getSectorByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetSectorById(dataConnect, getSectorByIdVars, 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.sector);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterSector
You can execute the filterSector Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterSector(dc: DataConnect, vars?: FilterSectorVariables, options?: useDataConnectQueryOptions<FilterSectorData>): UseDataConnectQueryResult<FilterSectorData, FilterSectorVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterSector(vars?: FilterSectorVariables, options?: useDataConnectQueryOptions<FilterSectorData>): UseDataConnectQueryResult<FilterSectorData, FilterSectorVariables>;
Variables
The filterSector Query has an optional argument of type FilterSectorVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterSectorVariables {
sectorNumber?: string | null;
sectorName?: string | null;
sectorType?: SectorType | null;
}
Return Type
Recall that calling the filterSector 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 filterSector Query is of type FilterSectorData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterSectorData {
sectors: ({
id: UUIDString;
sectorNumber: string;
sectorName: string;
sectorType?: SectorType | null;
} & Sector_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterSector's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterSectorVariables } from '@dataconnect/generated';
import { useFilterSector } from '@dataconnect/generated/react'
export default function FilterSectorComponent() {
// The `useFilterSector` Query hook has an optional argument of type `FilterSectorVariables`:
const filterSectorVars: FilterSectorVariables = {
sectorNumber: ..., // optional
sectorName: ..., // optional
sectorType: ..., // 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 = useFilterSector(filterSectorVars);
// Variables can be defined inline as well.
const query = useFilterSector({ sectorNumber: ..., sectorName: ..., sectorType: ..., });
// Since all variables are optional for this Query, you can omit the `FilterSectorVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterSector();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterSector(dataConnect, filterSectorVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterSector(filterSectorVars, 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 = useFilterSector(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 = useFilterSector(dataConnect, filterSectorVars /** 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.sectors);
}
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;
employeeName: string;
vendorId?: string | null;
vendorName?: string | null;
manager?: string | null;
contactNumber?: string | null;
phone?: string | null;
email?: string | null;
department?: StaffDepartment | null;
hubLocation?: string | null;
eventLocation?: string | null;
address?: string | null;
city?: string | null;
track?: string | null;
position?: string | null;
position2?: string | null;
initial?: string | null;
profileType?: ProfileType | null;
employmentType?: EmploymentType | null;
english?: EnglishLevel | null;
englishRequired?: boolean | null;
rate?: number | null;
rating?: number | null;
reliabilityScore?: number | null;
backgroundCheckStatus?: BackgroundCheckStatus | null;
notes?: string | null;
accountingComments?: string | null;
shiftCoveragePercentage?: number | null;
cancellationCount?: number | null;
noShowCount?: number | null;
totalShifts?: number | null;
invoiced?: boolean | null;
checkIn?: string | null;
scheduleDays?: string | null;
replacedBy?: string | null;
action?: string | null;
ro?: string | null;
mon?: 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;
employeeName: string;
vendorId?: string | null;
vendorName?: string | null;
manager?: string | null;
contactNumber?: string | null;
phone?: string | null;
email?: string | null;
department?: StaffDepartment | null;
hubLocation?: string | null;
eventLocation?: string | null;
address?: string | null;
city?: string | null;
track?: string | null;
position?: string | null;
position2?: string | null;
initial?: string | null;
profileType?: ProfileType | null;
employmentType?: EmploymentType | null;
english?: EnglishLevel | null;
rate?: number | null;
rating?: number | null;
reliabilityScore?: number | null;
backgroundCheckStatus?: BackgroundCheckStatus | null;
notes?: string | null;
accountingComments?: string | null;
shiftCoveragePercentage?: number | null;
cancellationCount?: number | null;
noShowCount?: number | null;
totalShifts?: number | null;
invoiced?: boolean | null;
englishRequired?: boolean | null;
checkIn?: string | null;
scheduleDays?: string | null;
replacedBy?: string | null;
action?: string | null;
ro?: string | null;
mon?: 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>;
}
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 {
employeeName?: string | null;
vendorId?: string | null;
department?: StaffDepartment | null;
employmentType?: EmploymentType | null;
english?: EnglishLevel | null;
backgroundCheckStatus?: BackgroundCheckStatus | 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;
employeeName: string;
vendorId?: string | null;
vendorName?: string | null;
department?: StaffDepartment | null;
hubLocation?: string | null;
eventLocation?: string | null;
position?: string | null;
position2?: string | null;
employmentType?: EmploymentType | null;
english?: EnglishLevel | null;
rate?: number | null;
rating?: number | null;
reliabilityScore?: number | null;
backgroundCheckStatus?: BackgroundCheckStatus | null;
notes?: string | null;
invoiced?: boolean | 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 = {
employeeName: ..., // optional
vendorId: ..., // optional
department: ..., // optional
employmentType: ..., // optional
english: ..., // optional
backgroundCheckStatus: ..., // 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({ employeeName: ..., vendorId: ..., department: ..., employmentType: ..., english: ..., backgroundCheckStatus: ..., });
// 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>;
}
listOrder
You can execute the listOrder Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListOrder(dc: DataConnect, options?: useDataConnectQueryOptions<ListOrderData>): UseDataConnectQueryResult<ListOrderData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListOrder(options?: useDataConnectQueryOptions<ListOrderData>): UseDataConnectQueryResult<ListOrderData, undefined>;
Variables
The listOrder Query has no variables.
Return Type
Recall that calling the listOrder 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 listOrder Query is of type ListOrderData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListOrderData {
orders: ({
id: UUIDString;
orderNumber: string;
partnerId: UUIDString;
orderType?: OrderType | null;
orderStatus?: OrderStatus | null;
} & Order_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listOrder's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListOrder } from '@dataconnect/generated/react'
export default function ListOrderComponent() {
// 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 = useListOrder();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListOrder(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListOrder(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListOrder(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.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;
orderNumber: string;
partnerId: UUIDString;
orderType?: OrderType | null;
orderStatus?: OrderStatus | null;
} & 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>;
}
filterOrder
You can execute the filterOrder Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterOrder(dc: DataConnect, vars?: FilterOrderVariables, options?: useDataConnectQueryOptions<FilterOrderData>): UseDataConnectQueryResult<FilterOrderData, FilterOrderVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterOrder(vars?: FilterOrderVariables, options?: useDataConnectQueryOptions<FilterOrderData>): UseDataConnectQueryResult<FilterOrderData, FilterOrderVariables>;
Variables
The filterOrder Query has an optional argument of type FilterOrderVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterOrderVariables {
orderNumber?: string | null;
partnerId?: UUIDString | null;
orderType?: OrderType | null;
orderStatus?: OrderStatus | null;
}
Return Type
Recall that calling the filterOrder 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 filterOrder Query is of type FilterOrderData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterOrderData {
orders: ({
id: UUIDString;
orderNumber: string;
partnerId: UUIDString;
orderType?: OrderType | null;
orderStatus?: OrderStatus | null;
} & Order_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterOrder's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterOrderVariables } from '@dataconnect/generated';
import { useFilterOrder } from '@dataconnect/generated/react'
export default function FilterOrderComponent() {
// The `useFilterOrder` Query hook has an optional argument of type `FilterOrderVariables`:
const filterOrderVars: FilterOrderVariables = {
orderNumber: ..., // optional
partnerId: ..., // optional
orderType: ..., // optional
orderStatus: ..., // 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 = useFilterOrder(filterOrderVars);
// Variables can be defined inline as well.
const query = useFilterOrder({ orderNumber: ..., partnerId: ..., orderType: ..., orderStatus: ..., });
// Since all variables are optional for this Query, you can omit the `FilterOrderVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterOrder();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterOrder(dataConnect, filterOrderVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterOrder(filterOrderVars, 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 = useFilterOrder(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 = useFilterOrder(dataConnect, filterOrderVars /** 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>;
}
listPartner
You can execute the listPartner Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListPartner(dc: DataConnect, options?: useDataConnectQueryOptions<ListPartnerData>): UseDataConnectQueryResult<ListPartnerData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListPartner(options?: useDataConnectQueryOptions<ListPartnerData>): UseDataConnectQueryResult<ListPartnerData, undefined>;
Variables
The listPartner Query has no variables.
Return Type
Recall that calling the listPartner 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 listPartner Query is of type ListPartnerData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListPartnerData {
partners: ({
id: UUIDString;
partnerName: string;
partnerNumber: string;
partnerType?: PartnerType | null;
} & Partner_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listPartner's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListPartner } from '@dataconnect/generated/react'
export default function ListPartnerComponent() {
// 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 = useListPartner();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListPartner(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListPartner(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListPartner(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.partners);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
getPartnerById
You can execute the getPartnerById Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useGetPartnerById(dc: DataConnect, vars: GetPartnerByIdVariables, options?: useDataConnectQueryOptions<GetPartnerByIdData>): UseDataConnectQueryResult<GetPartnerByIdData, GetPartnerByIdVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useGetPartnerById(vars: GetPartnerByIdVariables, options?: useDataConnectQueryOptions<GetPartnerByIdData>): UseDataConnectQueryResult<GetPartnerByIdData, GetPartnerByIdVariables>;
Variables
The getPartnerById Query requires an argument of type GetPartnerByIdVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetPartnerByIdVariables {
id: UUIDString;
}
Return Type
Recall that calling the getPartnerById 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 getPartnerById Query is of type GetPartnerByIdData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface GetPartnerByIdData {
partner?: {
id: UUIDString;
partnerName: string;
partnerNumber: string;
partnerType?: PartnerType | null;
} & Partner_Key;
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using getPartnerById's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, GetPartnerByIdVariables } from '@dataconnect/generated';
import { useGetPartnerById } from '@dataconnect/generated/react'
export default function GetPartnerByIdComponent() {
// The `useGetPartnerById` Query hook requires an argument of type `GetPartnerByIdVariables`:
const getPartnerByIdVars: GetPartnerByIdVariables = {
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 = useGetPartnerById(getPartnerByIdVars);
// Variables can be defined inline as well.
const query = useGetPartnerById({ id: ..., });
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useGetPartnerById(dataConnect, getPartnerByIdVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useGetPartnerById(getPartnerByIdVars, options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useGetPartnerById(dataConnect, getPartnerByIdVars, 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.partner);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
filterPartner
You can execute the filterPartner Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterPartner(dc: DataConnect, vars?: FilterPartnerVariables, options?: useDataConnectQueryOptions<FilterPartnerData>): UseDataConnectQueryResult<FilterPartnerData, FilterPartnerVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterPartner(vars?: FilterPartnerVariables, options?: useDataConnectQueryOptions<FilterPartnerData>): UseDataConnectQueryResult<FilterPartnerData, FilterPartnerVariables>;
Variables
The filterPartner Query has an optional argument of type FilterPartnerVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterPartnerVariables {
partnerName?: string | null;
partnerNumber?: string | null;
partnerType?: PartnerType | null;
}
Return Type
Recall that calling the filterPartner 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 filterPartner Query is of type FilterPartnerData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterPartnerData {
partners: ({
id: UUIDString;
partnerName: string;
partnerNumber: string;
partnerType?: PartnerType | null;
} & Partner_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterPartner's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterPartnerVariables } from '@dataconnect/generated';
import { useFilterPartner } from '@dataconnect/generated/react'
export default function FilterPartnerComponent() {
// The `useFilterPartner` Query hook has an optional argument of type `FilterPartnerVariables`:
const filterPartnerVars: FilterPartnerVariables = {
partnerName: ..., // optional
partnerNumber: ..., // optional
partnerType: ..., // 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 = useFilterPartner(filterPartnerVars);
// Variables can be defined inline as well.
const query = useFilterPartner({ partnerName: ..., partnerNumber: ..., partnerType: ..., });
// Since all variables are optional for this Query, you can omit the `FilterPartnerVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterPartner();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterPartner(dataConnect, filterPartnerVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterPartner(filterPartnerVars, 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 = useFilterPartner(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 = useFilterPartner(dataConnect, filterPartnerVars /** 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.partners);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listVendor
You can execute the listVendor Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListVendor(dc: DataConnect, options?: useDataConnectQueryOptions<ListVendorData>): UseDataConnectQueryResult<ListVendorData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListVendor(options?: useDataConnectQueryOptions<ListVendorData>): UseDataConnectQueryResult<ListVendorData, undefined>;
Variables
The listVendor Query has no variables.
Return Type
Recall that calling the listVendor 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 listVendor Query is of type ListVendorData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListVendorData {
vendors: ({
id: UUIDString;
vendorNumber: string;
legalName: string;
region: VendorRegion;
platformType: VendorPlatformType;
primaryContactEmail: string;
approvalStatus: VendorApprovalStatus;
isActive?: boolean | null;
} & Vendor_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listVendor's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListVendor } from '@dataconnect/generated/react'
export default function ListVendorComponent() {
// 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 = useListVendor();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListVendor(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListVendor(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListVendor(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>;
}
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;
vendorNumber: string;
legalName: string;
region: VendorRegion;
platformType: VendorPlatformType;
primaryContactEmail: string;
approvalStatus: VendorApprovalStatus;
isActive?: boolean | 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>;
}
filterVendors
You can execute the filterVendors Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterVendors(dc: DataConnect, vars?: FilterVendorsVariables, options?: useDataConnectQueryOptions<FilterVendorsData>): UseDataConnectQueryResult<FilterVendorsData, FilterVendorsVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterVendors(vars?: FilterVendorsVariables, options?: useDataConnectQueryOptions<FilterVendorsData>): UseDataConnectQueryResult<FilterVendorsData, FilterVendorsVariables>;
Variables
The filterVendors Query has an optional argument of type FilterVendorsVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterVendorsVariables {
region?: VendorRegion | null;
approvalStatus?: VendorApprovalStatus | null;
isActive?: boolean | null;
vendorNumber?: string | null;
primaryContactEmail?: string | null;
legalName?: string | null;
platformType?: VendorPlatformType | null;
}
Return Type
Recall that calling the filterVendors 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 filterVendors Query is of type FilterVendorsData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterVendorsData {
vendors: ({
id: UUIDString;
vendorNumber: string;
legalName: string;
region: VendorRegion;
platformType: VendorPlatformType;
primaryContactEmail: string;
approvalStatus: VendorApprovalStatus;
isActive?: boolean | null;
} & Vendor_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterVendors's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterVendorsVariables } from '@dataconnect/generated';
import { useFilterVendors } from '@dataconnect/generated/react'
export default function FilterVendorsComponent() {
// The `useFilterVendors` Query hook has an optional argument of type `FilterVendorsVariables`:
const filterVendorsVars: FilterVendorsVariables = {
region: ..., // optional
approvalStatus: ..., // optional
isActive: ..., // optional
vendorNumber: ..., // optional
primaryContactEmail: ..., // optional
legalName: ..., // optional
platformType: ..., // 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 = useFilterVendors(filterVendorsVars);
// Variables can be defined inline as well.
const query = useFilterVendors({ region: ..., approvalStatus: ..., isActive: ..., vendorNumber: ..., primaryContactEmail: ..., legalName: ..., platformType: ..., });
// Since all variables are optional for this Query, you can omit the `FilterVendorsVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterVendors();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterVendors(dataConnect, filterVendorsVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterVendors(filterVendorsVars, 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 = useFilterVendors(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 = useFilterVendors(dataConnect, filterVendorsVars /** 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.vendors);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listWorkforce
You can execute the listWorkforce Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListWorkforce(dc: DataConnect, options?: useDataConnectQueryOptions<ListWorkforceData>): UseDataConnectQueryResult<ListWorkforceData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListWorkforce(options?: useDataConnectQueryOptions<ListWorkforceData>): UseDataConnectQueryResult<ListWorkforceData, undefined>;
Variables
The listWorkforce Query has no variables.
Return Type
Recall that calling the listWorkforce 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 listWorkforce Query is of type ListWorkforceData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListWorkforceData {
workforces: ({
id: UUIDString;
workforceNumber: string;
vendorId: UUIDString;
firstName: string;
lastName: string;
employmentType?: WorkforceEmploymentType | null;
} & Workforce_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listWorkforce's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListWorkforce } from '@dataconnect/generated/react'
export default function ListWorkforceComponent() {
// 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 = useListWorkforce();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListWorkforce(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListWorkforce(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListWorkforce(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.workforces);
}
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;
workforceNumber: string;
vendorId: UUIDString;
firstName: string;
lastName: string;
employmentType?: WorkforceEmploymentType | null;
} & 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>;
}
filterWorkforce
You can execute the filterWorkforce Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterWorkforce(dc: DataConnect, vars?: FilterWorkforceVariables, options?: useDataConnectQueryOptions<FilterWorkforceData>): UseDataConnectQueryResult<FilterWorkforceData, FilterWorkforceVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterWorkforce(vars?: FilterWorkforceVariables, options?: useDataConnectQueryOptions<FilterWorkforceData>): UseDataConnectQueryResult<FilterWorkforceData, FilterWorkforceVariables>;
Variables
The filterWorkforce Query has an optional argument of type FilterWorkforceVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterWorkforceVariables {
workforceNumber?: string | null;
vendorId?: UUIDString | null;
firstName?: string | null;
lastName?: string | null;
employmentType?: WorkforceEmploymentType | null;
}
Return Type
Recall that calling the filterWorkforce 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 filterWorkforce Query is of type FilterWorkforceData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterWorkforceData {
workforces: ({
id: UUIDString;
workforceNumber: string;
vendorId: UUIDString;
firstName: string;
lastName: string;
employmentType?: WorkforceEmploymentType | null;
} & Workforce_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterWorkforce's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterWorkforceVariables } from '@dataconnect/generated';
import { useFilterWorkforce } from '@dataconnect/generated/react'
export default function FilterWorkforceComponent() {
// The `useFilterWorkforce` Query hook has an optional argument of type `FilterWorkforceVariables`:
const filterWorkforceVars: FilterWorkforceVariables = {
workforceNumber: ..., // optional
vendorId: ..., // optional
firstName: ..., // optional
lastName: ..., // optional
employmentType: ..., // 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 = useFilterWorkforce(filterWorkforceVars);
// Variables can be defined inline as well.
const query = useFilterWorkforce({ workforceNumber: ..., vendorId: ..., firstName: ..., lastName: ..., employmentType: ..., });
// Since all variables are optional for this Query, you can omit the `FilterWorkforceVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterWorkforce();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterWorkforce(dataConnect, filterWorkforceVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterWorkforce(filterWorkforceVars, 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 = useFilterWorkforce(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 = useFilterWorkforce(dataConnect, filterWorkforceVars /** 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.workforces);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listActivityLog
You can execute the listActivityLog Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListActivityLog(dc: DataConnect, options?: useDataConnectQueryOptions<ListActivityLogData>): UseDataConnectQueryResult<ListActivityLogData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListActivityLog(options?: useDataConnectQueryOptions<ListActivityLogData>): UseDataConnectQueryResult<ListActivityLogData, undefined>;
Variables
The listActivityLog Query has no variables.
Return Type
Recall that calling the listActivityLog 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 listActivityLog Query is of type ListActivityLogData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListActivityLogData {
activityLogs: ({
id: UUIDString;
title: string;
description: string;
activityType: ActivityType;
userId: string;
isRead?: boolean | null;
iconType?: string | null;
iconColor?: string | null;
} & ActivityLog_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listActivityLog's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListActivityLog } from '@dataconnect/generated/react'
export default function ListActivityLogComponent() {
// 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 = useListActivityLog();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListActivityLog(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListActivityLog(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListActivityLog(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.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;
title: string;
description: string;
activityType: ActivityType;
userId: string;
isRead?: boolean | null;
iconType?: string | null;
iconColor?: 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>;
}
filterActivityLog
You can execute the filterActivityLog Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterActivityLog(dc: DataConnect, vars?: FilterActivityLogVariables, options?: useDataConnectQueryOptions<FilterActivityLogData>): UseDataConnectQueryResult<FilterActivityLogData, FilterActivityLogVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterActivityLog(vars?: FilterActivityLogVariables, options?: useDataConnectQueryOptions<FilterActivityLogData>): UseDataConnectQueryResult<FilterActivityLogData, FilterActivityLogVariables>;
Variables
The filterActivityLog Query has an optional argument of type FilterActivityLogVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterActivityLogVariables {
userId?: string | null;
activityType?: ActivityType | null;
isRead?: boolean | null;
}
Return Type
Recall that calling the filterActivityLog 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 filterActivityLog Query is of type FilterActivityLogData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterActivityLogData {
activityLogs: ({
id: UUIDString;
title: string;
description: string;
activityType: ActivityType;
userId: string;
isRead?: boolean | null;
iconType?: string | null;
iconColor?: string | null;
} & ActivityLog_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterActivityLog's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterActivityLogVariables } from '@dataconnect/generated';
import { useFilterActivityLog } from '@dataconnect/generated/react'
export default function FilterActivityLogComponent() {
// The `useFilterActivityLog` Query hook has an optional argument of type `FilterActivityLogVariables`:
const filterActivityLogVars: FilterActivityLogVariables = {
userId: ..., // optional
activityType: ..., // optional
isRead: ..., // 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 = useFilterActivityLog(filterActivityLogVars);
// Variables can be defined inline as well.
const query = useFilterActivityLog({ userId: ..., activityType: ..., isRead: ..., });
// Since all variables are optional for this Query, you can omit the `FilterActivityLogVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterActivityLog();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterActivityLog(dataConnect, filterActivityLogVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterActivityLog(filterActivityLogVars, 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 = useFilterActivityLog(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 = useFilterActivityLog(dataConnect, filterActivityLogVars /** 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>;
}
listTeam
You can execute the listTeam Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListTeam(dc: DataConnect, vars?: ListTeamVariables, options?: useDataConnectQueryOptions<ListTeamData>): UseDataConnectQueryResult<ListTeamData, ListTeamVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useListTeam(vars?: ListTeamVariables, options?: useDataConnectQueryOptions<ListTeamData>): UseDataConnectQueryResult<ListTeamData, ListTeamVariables>;
Variables
The listTeam Query has an optional argument of type ListTeamVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListTeamVariables {
orderByCreatedDate?: OrderDirection | null;
limit?: number | null;
}
Return Type
Recall that calling the listTeam 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 listTeam Query is of type ListTeamData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListTeamData {
teams: ({
id: UUIDString;
teamName: string;
ownerId: string;
ownerName: string;
ownerRole: TeamOwnerRole;
favoriteStaff?: string | null;
blockedStaff?: string | null;
} & Team_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listTeam's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, ListTeamVariables } from '@dataconnect/generated';
import { useListTeam } from '@dataconnect/generated/react'
export default function ListTeamComponent() {
// The `useListTeam` Query hook has an optional argument of type `ListTeamVariables`:
const listTeamVars: ListTeamVariables = {
orderByCreatedDate: ..., // 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 = useListTeam(listTeamVars);
// Variables can be defined inline as well.
const query = useListTeam({ orderByCreatedDate: ..., limit: ..., });
// Since all variables are optional for this Query, you can omit the `ListTeamVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useListTeam();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListTeam(dataConnect, listTeamVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListTeam(listTeamVars, 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 = useListTeam(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 = useListTeam(dataConnect, listTeamVars /** 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.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: string;
ownerName: string;
ownerRole: TeamOwnerRole;
favoriteStaff?: string | null;
blockedStaff?: 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>;
}
filterTeam
You can execute the filterTeam Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterTeam(dc: DataConnect, vars?: FilterTeamVariables, options?: useDataConnectQueryOptions<FilterTeamData>): UseDataConnectQueryResult<FilterTeamData, FilterTeamVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterTeam(vars?: FilterTeamVariables, options?: useDataConnectQueryOptions<FilterTeamData>): UseDataConnectQueryResult<FilterTeamData, FilterTeamVariables>;
Variables
The filterTeam Query has an optional argument of type FilterTeamVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterTeamVariables {
teamName?: string | null;
ownerId?: string | null;
ownerRole?: TeamOwnerRole | null;
}
Return Type
Recall that calling the filterTeam 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 filterTeam Query is of type FilterTeamData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterTeamData {
teams: ({
id: UUIDString;
teamName: string;
ownerId: string;
ownerName: string;
ownerRole: TeamOwnerRole;
favoriteStaff?: string | null;
blockedStaff?: string | null;
} & Team_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterTeam's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterTeamVariables } from '@dataconnect/generated';
import { useFilterTeam } from '@dataconnect/generated/react'
export default function FilterTeamComponent() {
// The `useFilterTeam` Query hook has an optional argument of type `FilterTeamVariables`:
const filterTeamVars: FilterTeamVariables = {
teamName: ..., // optional
ownerId: ..., // optional
ownerRole: ..., // 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 = useFilterTeam(filterTeamVars);
// Variables can be defined inline as well.
const query = useFilterTeam({ teamName: ..., ownerId: ..., ownerRole: ..., });
// Since all variables are optional for this Query, you can omit the `FilterTeamVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterTeam();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterTeam(dataConnect, filterTeamVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterTeam(filterTeamVars, 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 = useFilterTeam(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 = useFilterTeam(dataConnect, filterTeamVars /** 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.teams);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listVendorRate
You can execute the listVendorRate Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListVendorRate(dc: DataConnect, options?: useDataConnectQueryOptions<ListVendorRateData>): UseDataConnectQueryResult<ListVendorRateData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListVendorRate(options?: useDataConnectQueryOptions<ListVendorRateData>): UseDataConnectQueryResult<ListVendorRateData, undefined>;
Variables
The listVendorRate Query has no variables.
Return Type
Recall that calling the listVendorRate 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 listVendorRate Query is of type ListVendorRateData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListVendorRateData {
vendorRates: ({
id: UUIDString;
vendorName: string;
category: VendorRateCategory;
roleName: string;
employeeWage: number;
markupPercentage?: number | null;
vendorFeePercentage?: number | null;
clientRate: number;
} & VendorRate_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listVendorRate's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListVendorRate } from '@dataconnect/generated/react'
export default function ListVendorRateComponent() {
// 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 = useListVendorRate();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListVendorRate(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListVendorRate(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListVendorRate(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;
vendorName: string;
category: VendorRateCategory;
roleName: string;
employeeWage: number;
markupPercentage?: number | null;
vendorFeePercentage?: number | null;
clientRate: number;
createdDate?: TimestampString | null;
updatedDate?: TimestampString | null;
createdBy?: 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>;
}
filterVendorRates
You can execute the filterVendorRates Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterVendorRates(dc: DataConnect, vars?: FilterVendorRatesVariables, options?: useDataConnectQueryOptions<FilterVendorRatesData>): UseDataConnectQueryResult<FilterVendorRatesData, FilterVendorRatesVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterVendorRates(vars?: FilterVendorRatesVariables, options?: useDataConnectQueryOptions<FilterVendorRatesData>): UseDataConnectQueryResult<FilterVendorRatesData, FilterVendorRatesVariables>;
Variables
The filterVendorRates Query has an optional argument of type FilterVendorRatesVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterVendorRatesVariables {
vendorName?: string | null;
category?: VendorRateCategory | null;
roleName?: string | null;
minClientRate?: number | null;
maxClientRate?: number | null;
}
Return Type
Recall that calling the filterVendorRates 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 filterVendorRates Query is of type FilterVendorRatesData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterVendorRatesData {
vendorRates: ({
id: UUIDString;
vendorName: string;
category: VendorRateCategory;
roleName: string;
employeeWage: number;
markupPercentage?: number | null;
vendorFeePercentage?: number | null;
clientRate: number;
} & VendorRate_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterVendorRates's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterVendorRatesVariables } from '@dataconnect/generated';
import { useFilterVendorRates } from '@dataconnect/generated/react'
export default function FilterVendorRatesComponent() {
// The `useFilterVendorRates` Query hook has an optional argument of type `FilterVendorRatesVariables`:
const filterVendorRatesVars: FilterVendorRatesVariables = {
vendorName: ..., // optional
category: ..., // optional
roleName: ..., // optional
minClientRate: ..., // optional
maxClientRate: ..., // 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 = useFilterVendorRates(filterVendorRatesVars);
// Variables can be defined inline as well.
const query = useFilterVendorRates({ vendorName: ..., category: ..., roleName: ..., minClientRate: ..., maxClientRate: ..., });
// Since all variables are optional for this Query, you can omit the `FilterVendorRatesVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterVendorRates();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterVendorRates(dataConnect, filterVendorRatesVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterVendorRates(filterVendorRatesVars, 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 = useFilterVendorRates(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 = useFilterVendorRates(dataConnect, filterVendorRatesVars /** 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.vendorRates);
}
return <div>Query execution {query.isSuccess ? 'successful' : 'failed'}!</div>;
}
listTeamHub
You can execute the listTeamHub Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListTeamHub(dc: DataConnect, options?: useDataConnectQueryOptions<ListTeamHubData>): UseDataConnectQueryResult<ListTeamHubData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListTeamHub(options?: useDataConnectQueryOptions<ListTeamHubData>): UseDataConnectQueryResult<ListTeamHubData, undefined>;
Variables
The listTeamHub Query has no variables.
Return Type
Recall that calling the listTeamHub 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 listTeamHub Query is of type ListTeamHubData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListTeamHubData {
teamHubs: ({
id: UUIDString;
teamId: UUIDString;
hubName: string;
departments?: string | null;
} & TeamHub_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listTeamHub's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListTeamHub } from '@dataconnect/generated/react'
export default function ListTeamHubComponent() {
// 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 = useListTeamHub();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListTeamHub(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListTeamHub(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListTeamHub(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.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;
departments?: string | 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>;
}
filterTeamHub
You can execute the filterTeamHub Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterTeamHub(dc: DataConnect, vars?: FilterTeamHubVariables, options?: useDataConnectQueryOptions<FilterTeamHubData>): UseDataConnectQueryResult<FilterTeamHubData, FilterTeamHubVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterTeamHub(vars?: FilterTeamHubVariables, options?: useDataConnectQueryOptions<FilterTeamHubData>): UseDataConnectQueryResult<FilterTeamHubData, FilterTeamHubVariables>;
Variables
The filterTeamHub Query has an optional argument of type FilterTeamHubVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterTeamHubVariables {
teamId?: UUIDString | null;
hubName?: string | null;
}
Return Type
Recall that calling the filterTeamHub 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 filterTeamHub Query is of type FilterTeamHubData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterTeamHubData {
teamHubs: ({
id: UUIDString;
teamId: UUIDString;
hubName: string;
departments?: string | null;
} & TeamHub_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterTeamHub's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterTeamHubVariables } from '@dataconnect/generated';
import { useFilterTeamHub } from '@dataconnect/generated/react'
export default function FilterTeamHubComponent() {
// The `useFilterTeamHub` Query hook has an optional argument of type `FilterTeamHubVariables`:
const filterTeamHubVars: FilterTeamHubVariables = {
teamId: ..., // optional
hubName: ..., // 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 = useFilterTeamHub(filterTeamHubVars);
// Variables can be defined inline as well.
const query = useFilterTeamHub({ teamId: ..., hubName: ..., });
// Since all variables are optional for this Query, you can omit the `FilterTeamHubVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterTeamHub();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterTeamHub(dataConnect, filterTeamHubVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterTeamHub(filterTeamHubVars, 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 = useFilterTeamHub(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 = useFilterTeamHub(dataConnect, filterTeamHubVars /** 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>;
}
listBusiness
You can execute the listBusiness Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useListBusiness(dc: DataConnect, options?: useDataConnectQueryOptions<ListBusinessData>): UseDataConnectQueryResult<ListBusinessData, undefined>;
You can also pass in a DataConnect instance to the Query hook function.
useListBusiness(options?: useDataConnectQueryOptions<ListBusinessData>): UseDataConnectQueryResult<ListBusinessData, undefined>;
Variables
The listBusiness Query has no variables.
Return Type
Recall that calling the listBusiness 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 listBusiness Query is of type ListBusinessData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface ListBusinessData {
businesses: ({
id: UUIDString;
businessName: string;
contactName: string;
email?: string | null;
sector?: BusinessSector | null;
rateGroup: BusinessRateGroup;
status?: BusinessStatus | null;
} & Business_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using listBusiness's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig } from '@dataconnect/generated';
import { useListBusiness } from '@dataconnect/generated/react'
export default function ListBusinessComponent() {
// 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 = useListBusiness();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useListBusiness(dataConnect);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useListBusiness(options);
// You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object.
const dataConnect = getDataConnect(connectorConfig);
const options = { staleTime: 5 * 1000 };
const query = useListBusiness(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>;
}
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;
email?: string | null;
sector?: BusinessSector | null;
rateGroup: BusinessRateGroup;
status?: BusinessStatus | 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>;
}
filterBusiness
You can execute the filterBusiness Query using the following Query hook function, which is defined in dataconnect-generated/react/index.d.ts:
useFilterBusiness(dc: DataConnect, vars?: FilterBusinessVariables, options?: useDataConnectQueryOptions<FilterBusinessData>): UseDataConnectQueryResult<FilterBusinessData, FilterBusinessVariables>;
You can also pass in a DataConnect instance to the Query hook function.
useFilterBusiness(vars?: FilterBusinessVariables, options?: useDataConnectQueryOptions<FilterBusinessData>): UseDataConnectQueryResult<FilterBusinessData, FilterBusinessVariables>;
Variables
The filterBusiness Query has an optional argument of type FilterBusinessVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterBusinessVariables {
businessName?: string | null;
contactName?: string | null;
sector?: BusinessSector | null;
rateGroup?: BusinessRateGroup | null;
status?: BusinessStatus | null;
}
Return Type
Recall that calling the filterBusiness 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 filterBusiness Query is of type FilterBusinessData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface FilterBusinessData {
businesses: ({
id: UUIDString;
businessName: string;
contactName: string;
email?: string | null;
sector?: BusinessSector | null;
rateGroup: BusinessRateGroup;
status?: BusinessStatus | null;
} & Business_Key)[];
}
To learn more about the UseQueryResult object, see the TanStack React Query documentation.
Using filterBusiness's Query hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, FilterBusinessVariables } from '@dataconnect/generated';
import { useFilterBusiness } from '@dataconnect/generated/react'
export default function FilterBusinessComponent() {
// The `useFilterBusiness` Query hook has an optional argument of type `FilterBusinessVariables`:
const filterBusinessVars: FilterBusinessVariables = {
businessName: ..., // optional
contactName: ..., // optional
sector: ..., // optional
rateGroup: ..., // 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 = useFilterBusiness(filterBusinessVars);
// Variables can be defined inline as well.
const query = useFilterBusiness({ businessName: ..., contactName: ..., sector: ..., rateGroup: ..., status: ..., });
// Since all variables are optional for this Query, you can omit the `FilterBusinessVariables` argument.
// (as long as you don't want to provide any `options`!)
const query = useFilterBusiness();
// You can also pass in a `DataConnect` instance to the Query hook function.
const dataConnect = getDataConnect(connectorConfig);
const query = useFilterBusiness(dataConnect, filterBusinessVars);
// You can also pass in a `useDataConnectQueryOptions` object to the Query hook function.
const options = { staleTime: 5 * 1000 };
const query = useFilterBusiness(filterBusinessVars, 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 = useFilterBusiness(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 = useFilterBusiness(dataConnect, filterBusinessVars /** 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.businesses);
}
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 krow-connector connector's generated Mutation hook functions to execute each Mutation. You can also follow the examples from the Data Connect documentation.
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;
senderName: string;
content: string;
readBy?: string | 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: ...,
senderName: ...,
content: ...,
readBy: ..., // optional
};
mutation.mutate(createMessageVars);
// Variables can be defined inline as well.
mutation.mutate({ conversationId: ..., senderName: ..., content: ..., readBy: ..., });
// 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;
senderName?: string | null;
content?: string | null;
readBy?: string | 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
senderName: ..., // optional
content: ..., // optional
readBy: ..., // optional
};
mutation.mutate(updateMessageVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., conversationId: ..., senderName: ..., content: ..., readBy: ..., });
// 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>;
}
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 {
employeeName: string;
vendorId?: string | null;
vendorName?: string | null;
manager?: string | null;
contactNumber?: string | null;
phone?: string | null;
email?: string | null;
department?: StaffDepartment | null;
hubLocation?: string | null;
eventLocation?: string | null;
address?: string | null;
city?: string | null;
track?: string | null;
position?: string | null;
position2?: string | null;
initial?: string | null;
profileType?: ProfileType | null;
employmentType?: EmploymentType | null;
english?: EnglishLevel | null;
rate?: number | null;
rating?: number | null;
reliabilityScore?: number | null;
backgroundCheckStatus?: BackgroundCheckStatus | null;
notes?: string | null;
accountingComments?: string | null;
shiftCoveragePercentage?: number | null;
cancellationCount?: number | null;
noShowCount?: number | null;
totalShifts?: number | null;
invoiced?: boolean | null;
englishRequired?: boolean | null;
checkIn?: string | null;
scheduleDays?: string | null;
replacedBy?: string | null;
action?: string | null;
ro?: string | null;
mon?: 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 = {
employeeName: ...,
vendorId: ..., // optional
vendorName: ..., // optional
manager: ..., // optional
contactNumber: ..., // optional
phone: ..., // optional
email: ..., // optional
department: ..., // optional
hubLocation: ..., // optional
eventLocation: ..., // optional
address: ..., // optional
city: ..., // optional
track: ..., // optional
position: ..., // optional
position2: ..., // optional
initial: ..., // optional
profileType: ..., // optional
employmentType: ..., // optional
english: ..., // optional
rate: ..., // optional
rating: ..., // optional
reliabilityScore: ..., // optional
backgroundCheckStatus: ..., // optional
notes: ..., // optional
accountingComments: ..., // optional
shiftCoveragePercentage: ..., // optional
cancellationCount: ..., // optional
noShowCount: ..., // optional
totalShifts: ..., // optional
invoiced: ..., // optional
englishRequired: ..., // optional
checkIn: ..., // optional
scheduleDays: ..., // optional
replacedBy: ..., // optional
action: ..., // optional
ro: ..., // optional
mon: ..., // optional
};
mutation.mutate(createStaffVars);
// Variables can be defined inline as well.
mutation.mutate({ employeeName: ..., vendorId: ..., vendorName: ..., manager: ..., contactNumber: ..., phone: ..., email: ..., department: ..., hubLocation: ..., eventLocation: ..., address: ..., city: ..., track: ..., position: ..., position2: ..., initial: ..., profileType: ..., employmentType: ..., english: ..., rate: ..., rating: ..., reliabilityScore: ..., backgroundCheckStatus: ..., notes: ..., accountingComments: ..., shiftCoveragePercentage: ..., cancellationCount: ..., noShowCount: ..., totalShifts: ..., invoiced: ..., englishRequired: ..., checkIn: ..., scheduleDays: ..., replacedBy: ..., action: ..., ro: ..., mon: ..., });
// 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;
employeeName?: string | null;
vendorId?: string | null;
vendorName?: string | null;
manager?: string | null;
contactNumber?: string | null;
phone?: string | null;
email?: string | null;
department?: StaffDepartment | null;
hubLocation?: string | null;
eventLocation?: string | null;
address?: string | null;
city?: string | null;
track?: string | null;
position?: string | null;
position2?: string | null;
initial?: string | null;
profileType?: ProfileType | null;
employmentType?: EmploymentType | null;
english?: EnglishLevel | null;
englishRequired?: boolean | null;
rate?: number | null;
rating?: number | null;
reliabilityScore?: number | null;
backgroundCheckStatus?: BackgroundCheckStatus | null;
notes?: string | null;
accountingComments?: string | null;
shiftCoveragePercentage?: number | null;
cancellationCount?: number | null;
noShowCount?: number | null;
totalShifts?: number | null;
invoiced?: boolean | null;
checkIn?: string | null;
scheduleDays?: string | null;
replacedBy?: string | null;
action?: string | null;
ro?: string | null;
mon?: 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: ...,
employeeName: ..., // optional
vendorId: ..., // optional
vendorName: ..., // optional
manager: ..., // optional
contactNumber: ..., // optional
phone: ..., // optional
email: ..., // optional
department: ..., // optional
hubLocation: ..., // optional
eventLocation: ..., // optional
address: ..., // optional
city: ..., // optional
track: ..., // optional
position: ..., // optional
position2: ..., // optional
initial: ..., // optional
profileType: ..., // optional
employmentType: ..., // optional
english: ..., // optional
englishRequired: ..., // optional
rate: ..., // optional
rating: ..., // optional
reliabilityScore: ..., // optional
backgroundCheckStatus: ..., // optional
notes: ..., // optional
accountingComments: ..., // optional
shiftCoveragePercentage: ..., // optional
cancellationCount: ..., // optional
noShowCount: ..., // optional
totalShifts: ..., // optional
invoiced: ..., // optional
checkIn: ..., // optional
scheduleDays: ..., // optional
replacedBy: ..., // optional
action: ..., // optional
ro: ..., // optional
mon: ..., // optional
};
mutation.mutate(updateStaffVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., employeeName: ..., vendorId: ..., vendorName: ..., manager: ..., contactNumber: ..., phone: ..., email: ..., department: ..., hubLocation: ..., eventLocation: ..., address: ..., city: ..., track: ..., position: ..., position2: ..., initial: ..., profileType: ..., employmentType: ..., english: ..., englishRequired: ..., rate: ..., rating: ..., reliabilityScore: ..., backgroundCheckStatus: ..., notes: ..., accountingComments: ..., shiftCoveragePercentage: ..., cancellationCount: ..., noShowCount: ..., totalShifts: ..., invoiced: ..., checkIn: ..., scheduleDays: ..., replacedBy: ..., action: ..., ro: ..., mon: ..., });
// 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>;
}
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 {
vendorNumber: string;
legalName: string;
region: VendorRegion;
platformType: VendorPlatformType;
primaryContactEmail: string;
approvalStatus: VendorApprovalStatus;
isActive?: boolean | 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 = {
vendorNumber: ...,
legalName: ...,
region: ...,
platformType: ...,
primaryContactEmail: ...,
approvalStatus: ...,
isActive: ..., // optional
};
mutation.mutate(createVendorVars);
// Variables can be defined inline as well.
mutation.mutate({ vendorNumber: ..., legalName: ..., region: ..., platformType: ..., primaryContactEmail: ..., approvalStatus: ..., isActive: ..., });
// 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;
vendorNumber?: string | null;
legalName?: string | null;
region?: VendorRegion | null;
platformType?: VendorPlatformType | null;
primaryContactEmail?: string | null;
approvalStatus?: VendorApprovalStatus | null;
isActive?: boolean | 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: ...,
vendorNumber: ..., // optional
legalName: ..., // optional
region: ..., // optional
platformType: ..., // optional
primaryContactEmail: ..., // optional
approvalStatus: ..., // optional
isActive: ..., // optional
};
mutation.mutate(updateVendorVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., vendorNumber: ..., legalName: ..., region: ..., platformType: ..., primaryContactEmail: ..., approvalStatus: ..., isActive: ..., });
// 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>;
}
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 {
title: string;
description: string;
activityType: ActivityType;
userId: string;
isRead?: boolean | null;
iconType?: string | null;
iconColor?: string | null;
}
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 = {
title: ...,
description: ...,
activityType: ...,
userId: ...,
isRead: ..., // optional
iconType: ..., // optional
iconColor: ..., // optional
};
mutation.mutate(createActivityLogVars);
// Variables can be defined inline as well.
mutation.mutate({ title: ..., description: ..., activityType: ..., userId: ..., isRead: ..., iconType: ..., iconColor: ..., });
// 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;
title?: string | null;
description?: string | null;
activityType?: ActivityType | null;
userId?: string | null;
isRead?: boolean | null;
iconType?: string | null;
iconColor?: string | 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: ...,
title: ..., // optional
description: ..., // optional
activityType: ..., // optional
userId: ..., // optional
isRead: ..., // optional
iconType: ..., // optional
iconColor: ..., // optional
};
mutation.mutate(updateActivityLogVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., title: ..., description: ..., activityType: ..., userId: ..., isRead: ..., iconType: ..., iconColor: ..., });
// 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>;
}
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>;
}
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 {
assignmentNumber?: string | null;
orderId: UUIDString;
workforceId: UUIDString;
vendorId: UUIDString;
role: string;
assignmentStatus: AssignmentStatus;
scheduledStart: TimestampString;
}
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 = {
assignmentNumber: ..., // optional
orderId: ...,
workforceId: ...,
vendorId: ...,
role: ...,
assignmentStatus: ...,
scheduledStart: ...,
};
mutation.mutate(createAssignmentVars);
// Variables can be defined inline as well.
mutation.mutate({ assignmentNumber: ..., orderId: ..., workforceId: ..., vendorId: ..., role: ..., assignmentStatus: ..., scheduledStart: ..., });
// 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;
assignmentNumber?: string | null;
orderId?: UUIDString | null;
workforceId?: UUIDString | null;
vendorId?: UUIDString | null;
role?: string | null;
assignmentStatus?: AssignmentStatus | null;
scheduledStart?: TimestampString | null;
}
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: ...,
assignmentNumber: ..., // optional
orderId: ..., // optional
workforceId: ..., // optional
vendorId: ..., // optional
role: ..., // optional
assignmentStatus: ..., // optional
scheduledStart: ..., // optional
};
mutation.mutate(updateAssignmentVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., assignmentNumber: ..., orderId: ..., workforceId: ..., vendorId: ..., role: ..., assignmentStatus: ..., scheduledStart: ..., });
// 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>;
}
CreateCertification
You can execute the CreateCertification Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateCertification(options?: useDataConnectMutationOptions<CreateCertificationData, FirebaseError, CreateCertificationVariables>): UseDataConnectMutationResult<CreateCertificationData, CreateCertificationVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateCertification(dc: DataConnect, options?: useDataConnectMutationOptions<CreateCertificationData, FirebaseError, CreateCertificationVariables>): UseDataConnectMutationResult<CreateCertificationData, CreateCertificationVariables>;
Variables
The CreateCertification Mutation requires an argument of type CreateCertificationVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateCertificationVariables {
employeeName: string;
certificationName: string;
certificationType?: CertificationType | null;
status?: CertificationStatus | null;
expiryDate: string;
validationStatus?: CertificationValidationStatus | null;
}
Return Type
Recall that calling the CreateCertification 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 CreateCertification Mutation is of type CreateCertificationData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateCertificationData {
certification_insert: Certification_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using CreateCertification's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateCertificationVariables } from '@dataconnect/generated';
import { useCreateCertification } from '@dataconnect/generated/react'
export default function CreateCertificationComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateCertification();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateCertification(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateCertification(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 = useCreateCertification(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateCertification` Mutation requires an argument of type `CreateCertificationVariables`:
const createCertificationVars: CreateCertificationVariables = {
employeeName: ...,
certificationName: ...,
certificationType: ..., // optional
status: ..., // optional
expiryDate: ...,
validationStatus: ..., // optional
};
mutation.mutate(createCertificationVars);
// Variables can be defined inline as well.
mutation.mutate({ employeeName: ..., certificationName: ..., certificationType: ..., status: ..., expiryDate: ..., validationStatus: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createCertificationVars, 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.certification_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
UpdateCertification
You can execute the UpdateCertification Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateCertification(options?: useDataConnectMutationOptions<UpdateCertificationData, FirebaseError, UpdateCertificationVariables>): UseDataConnectMutationResult<UpdateCertificationData, UpdateCertificationVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateCertification(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateCertificationData, FirebaseError, UpdateCertificationVariables>): UseDataConnectMutationResult<UpdateCertificationData, UpdateCertificationVariables>;
Variables
The UpdateCertification Mutation requires an argument of type UpdateCertificationVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateCertificationVariables {
id: UUIDString;
employeeName?: string | null;
certificationName?: string | null;
certificationType?: CertificationType | null;
status?: CertificationStatus | null;
expiryDate?: string | null;
validationStatus?: CertificationValidationStatus | null;
}
Return Type
Recall that calling the UpdateCertification 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 UpdateCertification Mutation is of type UpdateCertificationData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateCertificationData {
certification_update?: Certification_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using UpdateCertification's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateCertificationVariables } from '@dataconnect/generated';
import { useUpdateCertification } from '@dataconnect/generated/react'
export default function UpdateCertificationComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateCertification();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateCertification(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateCertification(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 = useUpdateCertification(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateCertification` Mutation requires an argument of type `UpdateCertificationVariables`:
const updateCertificationVars: UpdateCertificationVariables = {
id: ...,
employeeName: ..., // optional
certificationName: ..., // optional
certificationType: ..., // optional
status: ..., // optional
expiryDate: ..., // optional
validationStatus: ..., // optional
};
mutation.mutate(updateCertificationVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., employeeName: ..., certificationName: ..., certificationType: ..., status: ..., expiryDate: ..., validationStatus: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateCertificationVars, 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.certification_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
DeleteCertification
You can execute the DeleteCertification Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteCertification(options?: useDataConnectMutationOptions<DeleteCertificationData, FirebaseError, DeleteCertificationVariables>): UseDataConnectMutationResult<DeleteCertificationData, DeleteCertificationVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteCertification(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteCertificationData, FirebaseError, DeleteCertificationVariables>): UseDataConnectMutationResult<DeleteCertificationData, DeleteCertificationVariables>;
Variables
The DeleteCertification Mutation requires an argument of type DeleteCertificationVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteCertificationVariables {
id: UUIDString;
}
Return Type
Recall that calling the DeleteCertification 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 DeleteCertification Mutation is of type DeleteCertificationData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteCertificationData {
certification_delete?: Certification_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using DeleteCertification's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteCertificationVariables } from '@dataconnect/generated';
import { useDeleteCertification } from '@dataconnect/generated/react'
export default function DeleteCertificationComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteCertification();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteCertification(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteCertification(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 = useDeleteCertification(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteCertification` Mutation requires an argument of type `DeleteCertificationVariables`:
const deleteCertificationVars: DeleteCertificationVariables = {
id: ...,
};
mutation.mutate(deleteCertificationVars);
// 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(deleteCertificationVars, 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.certification_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 {
shiftName: string;
startDate: TimestampString;
endDate?: TimestampString | null;
assignedStaff?: 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 = {
shiftName: ...,
startDate: ...,
endDate: ..., // optional
assignedStaff: ..., // optional
};
mutation.mutate(createShiftVars);
// Variables can be defined inline as well.
mutation.mutate({ shiftName: ..., startDate: ..., endDate: ..., assignedStaff: ..., });
// 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;
shiftName?: string | null;
startDate?: TimestampString | null;
endDate?: TimestampString | null;
assignedStaff?: string | 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: ...,
shiftName: ..., // optional
startDate: ..., // optional
endDate: ..., // optional
assignedStaff: ..., // optional
};
mutation.mutate(updateShiftVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., shiftName: ..., startDate: ..., endDate: ..., assignedStaff: ..., });
// 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>;
}
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;
departments?: string | 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: ...,
departments: ..., // optional
};
mutation.mutate(createTeamHubVars);
// Variables can be defined inline as well.
mutation.mutate({ teamId: ..., hubName: ..., 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;
departments?: string | 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
departments: ..., // optional
};
mutation.mutate(updateTeamHubVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., teamId: ..., hubName: ..., 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>;
}
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 {
orderNumber: string;
partnerId: UUIDString;
orderType?: OrderType | null;
orderStatus?: OrderStatus | 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 = {
orderNumber: ...,
partnerId: ...,
orderType: ..., // optional
orderStatus: ..., // optional
};
mutation.mutate(createOrderVars);
// Variables can be defined inline as well.
mutation.mutate({ orderNumber: ..., partnerId: ..., orderType: ..., orderStatus: ..., });
// 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;
orderNumber?: string | null;
partnerId?: UUIDString | null;
orderType?: OrderType | null;
orderStatus?: OrderStatus | 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: ...,
orderNumber: ..., // optional
partnerId: ..., // optional
orderType: ..., // optional
orderStatus: ..., // optional
};
mutation.mutate(updateOrderVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., orderNumber: ..., partnerId: ..., orderType: ..., orderStatus: ..., });
// 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>;
}
CreateSector
You can execute the CreateSector Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateSector(options?: useDataConnectMutationOptions<CreateSectorData, FirebaseError, CreateSectorVariables>): UseDataConnectMutationResult<CreateSectorData, CreateSectorVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateSector(dc: DataConnect, options?: useDataConnectMutationOptions<CreateSectorData, FirebaseError, CreateSectorVariables>): UseDataConnectMutationResult<CreateSectorData, CreateSectorVariables>;
Variables
The CreateSector Mutation requires an argument of type CreateSectorVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateSectorVariables {
sectorNumber: string;
sectorName: string;
sectorType?: SectorType | null;
}
Return Type
Recall that calling the CreateSector 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 CreateSector Mutation is of type CreateSectorData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateSectorData {
sector_insert: Sector_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using CreateSector's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateSectorVariables } from '@dataconnect/generated';
import { useCreateSector } from '@dataconnect/generated/react'
export default function CreateSectorComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateSector();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateSector(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateSector(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 = useCreateSector(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateSector` Mutation requires an argument of type `CreateSectorVariables`:
const createSectorVars: CreateSectorVariables = {
sectorNumber: ...,
sectorName: ...,
sectorType: ..., // optional
};
mutation.mutate(createSectorVars);
// Variables can be defined inline as well.
mutation.mutate({ sectorNumber: ..., sectorName: ..., sectorType: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createSectorVars, 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.sector_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
UpdateSector
You can execute the UpdateSector Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateSector(options?: useDataConnectMutationOptions<UpdateSectorData, FirebaseError, UpdateSectorVariables>): UseDataConnectMutationResult<UpdateSectorData, UpdateSectorVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateSector(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateSectorData, FirebaseError, UpdateSectorVariables>): UseDataConnectMutationResult<UpdateSectorData, UpdateSectorVariables>;
Variables
The UpdateSector Mutation requires an argument of type UpdateSectorVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateSectorVariables {
id: UUIDString;
sectorNumber?: string | null;
sectorName?: string | null;
sectorType?: SectorType | null;
}
Return Type
Recall that calling the UpdateSector 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 UpdateSector Mutation is of type UpdateSectorData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateSectorData {
sector_update?: Sector_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using UpdateSector's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateSectorVariables } from '@dataconnect/generated';
import { useUpdateSector } from '@dataconnect/generated/react'
export default function UpdateSectorComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateSector();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateSector(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateSector(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 = useUpdateSector(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateSector` Mutation requires an argument of type `UpdateSectorVariables`:
const updateSectorVars: UpdateSectorVariables = {
id: ...,
sectorNumber: ..., // optional
sectorName: ..., // optional
sectorType: ..., // optional
};
mutation.mutate(updateSectorVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., sectorNumber: ..., sectorName: ..., sectorType: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateSectorVars, 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.sector_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
DeleteSector
You can execute the DeleteSector Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteSector(options?: useDataConnectMutationOptions<DeleteSectorData, FirebaseError, DeleteSectorVariables>): UseDataConnectMutationResult<DeleteSectorData, DeleteSectorVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteSector(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteSectorData, FirebaseError, DeleteSectorVariables>): UseDataConnectMutationResult<DeleteSectorData, DeleteSectorVariables>;
Variables
The DeleteSector Mutation requires an argument of type DeleteSectorVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteSectorVariables {
id: UUIDString;
}
Return Type
Recall that calling the DeleteSector 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 DeleteSector Mutation is of type DeleteSectorData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteSectorData {
sector_delete?: Sector_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using DeleteSector's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteSectorVariables } from '@dataconnect/generated';
import { useDeleteSector } from '@dataconnect/generated/react'
export default function DeleteSectorComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteSector();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteSector(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteSector(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 = useDeleteSector(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteSector` Mutation requires an argument of type `DeleteSectorVariables`:
const deleteSectorVars: DeleteSectorVariables = {
id: ...,
};
mutation.mutate(deleteSectorVars);
// 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(deleteSectorVars, 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.sector_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;
fullName: string;
role: UserBaseRole;
userRole?: 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: ...,
fullName: ...,
role: ...,
userRole: ..., // optional
};
mutation.mutate(createUserVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., email: ..., fullName: ..., role: ..., userRole: ..., });
// 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;
}
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
};
mutation.mutate(updateUserVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., email: ..., fullName: ..., role: ..., userRole: ..., });
// 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>;
}
CreateTeamMemberInvite
You can execute the CreateTeamMemberInvite Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateTeamMemberInvite(options?: useDataConnectMutationOptions<CreateTeamMemberInviteData, FirebaseError, CreateTeamMemberInviteVariables>): UseDataConnectMutationResult<CreateTeamMemberInviteData, CreateTeamMemberInviteVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateTeamMemberInvite(dc: DataConnect, options?: useDataConnectMutationOptions<CreateTeamMemberInviteData, FirebaseError, CreateTeamMemberInviteVariables>): UseDataConnectMutationResult<CreateTeamMemberInviteData, CreateTeamMemberInviteVariables>;
Variables
The CreateTeamMemberInvite Mutation requires an argument of type CreateTeamMemberInviteVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateTeamMemberInviteVariables {
teamId: UUIDString;
email: string;
inviteStatus: TeamMemberInviteStatus;
}
Return Type
Recall that calling the CreateTeamMemberInvite 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 CreateTeamMemberInvite Mutation is of type CreateTeamMemberInviteData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateTeamMemberInviteData {
teamMemberInvite_insert: TeamMemberInvite_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using CreateTeamMemberInvite's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateTeamMemberInviteVariables } from '@dataconnect/generated';
import { useCreateTeamMemberInvite } from '@dataconnect/generated/react'
export default function CreateTeamMemberInviteComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateTeamMemberInvite();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateTeamMemberInvite(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateTeamMemberInvite(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 = useCreateTeamMemberInvite(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateTeamMemberInvite` Mutation requires an argument of type `CreateTeamMemberInviteVariables`:
const createTeamMemberInviteVars: CreateTeamMemberInviteVariables = {
teamId: ...,
email: ...,
inviteStatus: ...,
};
mutation.mutate(createTeamMemberInviteVars);
// Variables can be defined inline as well.
mutation.mutate({ teamId: ..., email: ..., inviteStatus: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createTeamMemberInviteVars, 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.teamMemberInvite_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
UpdateTeamMemberInvite
You can execute the UpdateTeamMemberInvite Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateTeamMemberInvite(options?: useDataConnectMutationOptions<UpdateTeamMemberInviteData, FirebaseError, UpdateTeamMemberInviteVariables>): UseDataConnectMutationResult<UpdateTeamMemberInviteData, UpdateTeamMemberInviteVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateTeamMemberInvite(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateTeamMemberInviteData, FirebaseError, UpdateTeamMemberInviteVariables>): UseDataConnectMutationResult<UpdateTeamMemberInviteData, UpdateTeamMemberInviteVariables>;
Variables
The UpdateTeamMemberInvite Mutation requires an argument of type UpdateTeamMemberInviteVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateTeamMemberInviteVariables {
id: UUIDString;
teamId?: UUIDString | null;
email?: string | null;
inviteStatus?: TeamMemberInviteStatus | null;
}
Return Type
Recall that calling the UpdateTeamMemberInvite 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 UpdateTeamMemberInvite Mutation is of type UpdateTeamMemberInviteData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateTeamMemberInviteData {
teamMemberInvite_update?: TeamMemberInvite_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using UpdateTeamMemberInvite's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateTeamMemberInviteVariables } from '@dataconnect/generated';
import { useUpdateTeamMemberInvite } from '@dataconnect/generated/react'
export default function UpdateTeamMemberInviteComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateTeamMemberInvite();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateTeamMemberInvite(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateTeamMemberInvite(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 = useUpdateTeamMemberInvite(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateTeamMemberInvite` Mutation requires an argument of type `UpdateTeamMemberInviteVariables`:
const updateTeamMemberInviteVars: UpdateTeamMemberInviteVariables = {
id: ...,
teamId: ..., // optional
email: ..., // optional
inviteStatus: ..., // optional
};
mutation.mutate(updateTeamMemberInviteVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., teamId: ..., email: ..., inviteStatus: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateTeamMemberInviteVars, 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.teamMemberInvite_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
DeleteTeamMemberInvite
You can execute the DeleteTeamMemberInvite Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteTeamMemberInvite(options?: useDataConnectMutationOptions<DeleteTeamMemberInviteData, FirebaseError, DeleteTeamMemberInviteVariables>): UseDataConnectMutationResult<DeleteTeamMemberInviteData, DeleteTeamMemberInviteVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteTeamMemberInvite(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteTeamMemberInviteData, FirebaseError, DeleteTeamMemberInviteVariables>): UseDataConnectMutationResult<DeleteTeamMemberInviteData, DeleteTeamMemberInviteVariables>;
Variables
The DeleteTeamMemberInvite Mutation requires an argument of type DeleteTeamMemberInviteVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteTeamMemberInviteVariables {
id: UUIDString;
}
Return Type
Recall that calling the DeleteTeamMemberInvite 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 DeleteTeamMemberInvite Mutation is of type DeleteTeamMemberInviteData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteTeamMemberInviteData {
teamMemberInvite_delete?: TeamMemberInvite_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using DeleteTeamMemberInvite's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteTeamMemberInviteVariables } from '@dataconnect/generated';
import { useDeleteTeamMemberInvite } from '@dataconnect/generated/react'
export default function DeleteTeamMemberInviteComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteTeamMemberInvite();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteTeamMemberInvite(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteTeamMemberInvite(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 = useDeleteTeamMemberInvite(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteTeamMemberInvite` Mutation requires an argument of type `DeleteTeamMemberInviteVariables`:
const deleteTeamMemberInviteVars: DeleteTeamMemberInviteVariables = {
id: ...,
};
mutation.mutate(deleteTeamMemberInviteVars);
// 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(deleteTeamMemberInviteVars, 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.teamMemberInvite_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
CreateVendorDefaultSetting
You can execute the CreateVendorDefaultSetting Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateVendorDefaultSetting(options?: useDataConnectMutationOptions<CreateVendorDefaultSettingData, FirebaseError, CreateVendorDefaultSettingVariables>): UseDataConnectMutationResult<CreateVendorDefaultSettingData, CreateVendorDefaultSettingVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateVendorDefaultSetting(dc: DataConnect, options?: useDataConnectMutationOptions<CreateVendorDefaultSettingData, FirebaseError, CreateVendorDefaultSettingVariables>): UseDataConnectMutationResult<CreateVendorDefaultSettingData, CreateVendorDefaultSettingVariables>;
Variables
The CreateVendorDefaultSetting Mutation requires an argument of type CreateVendorDefaultSettingVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateVendorDefaultSettingVariables {
vendorName: string;
defaultMarkupPercentage: number;
defaultVendorFeePercentage: number;
}
Return Type
Recall that calling the CreateVendorDefaultSetting 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 CreateVendorDefaultSetting Mutation is of type CreateVendorDefaultSettingData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateVendorDefaultSettingData {
vendorDefaultSetting_insert: VendorDefaultSetting_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using CreateVendorDefaultSetting's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateVendorDefaultSettingVariables } from '@dataconnect/generated';
import { useCreateVendorDefaultSetting } from '@dataconnect/generated/react'
export default function CreateVendorDefaultSettingComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateVendorDefaultSetting();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateVendorDefaultSetting(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateVendorDefaultSetting(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 = useCreateVendorDefaultSetting(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateVendorDefaultSetting` Mutation requires an argument of type `CreateVendorDefaultSettingVariables`:
const createVendorDefaultSettingVars: CreateVendorDefaultSettingVariables = {
vendorName: ...,
defaultMarkupPercentage: ...,
defaultVendorFeePercentage: ...,
};
mutation.mutate(createVendorDefaultSettingVars);
// Variables can be defined inline as well.
mutation.mutate({ vendorName: ..., defaultMarkupPercentage: ..., defaultVendorFeePercentage: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createVendorDefaultSettingVars, 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.vendorDefaultSetting_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
UpdateVendorDefaultSetting
You can execute the UpdateVendorDefaultSetting Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateVendorDefaultSetting(options?: useDataConnectMutationOptions<UpdateVendorDefaultSettingData, FirebaseError, UpdateVendorDefaultSettingVariables>): UseDataConnectMutationResult<UpdateVendorDefaultSettingData, UpdateVendorDefaultSettingVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateVendorDefaultSetting(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateVendorDefaultSettingData, FirebaseError, UpdateVendorDefaultSettingVariables>): UseDataConnectMutationResult<UpdateVendorDefaultSettingData, UpdateVendorDefaultSettingVariables>;
Variables
The UpdateVendorDefaultSetting Mutation requires an argument of type UpdateVendorDefaultSettingVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateVendorDefaultSettingVariables {
id: UUIDString;
vendorName?: string | null;
defaultMarkupPercentage?: number | null;
defaultVendorFeePercentage?: number | null;
}
Return Type
Recall that calling the UpdateVendorDefaultSetting 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 UpdateVendorDefaultSetting Mutation is of type UpdateVendorDefaultSettingData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateVendorDefaultSettingData {
vendorDefaultSetting_update?: VendorDefaultSetting_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using UpdateVendorDefaultSetting's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateVendorDefaultSettingVariables } from '@dataconnect/generated';
import { useUpdateVendorDefaultSetting } from '@dataconnect/generated/react'
export default function UpdateVendorDefaultSettingComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateVendorDefaultSetting();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateVendorDefaultSetting(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateVendorDefaultSetting(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 = useUpdateVendorDefaultSetting(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateVendorDefaultSetting` Mutation requires an argument of type `UpdateVendorDefaultSettingVariables`:
const updateVendorDefaultSettingVars: UpdateVendorDefaultSettingVariables = {
id: ...,
vendorName: ..., // optional
defaultMarkupPercentage: ..., // optional
defaultVendorFeePercentage: ..., // optional
};
mutation.mutate(updateVendorDefaultSettingVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., vendorName: ..., defaultMarkupPercentage: ..., defaultVendorFeePercentage: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateVendorDefaultSettingVars, 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.vendorDefaultSetting_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
DeleteVendorDefaultSetting
You can execute the DeleteVendorDefaultSetting Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteVendorDefaultSetting(options?: useDataConnectMutationOptions<DeleteVendorDefaultSettingData, FirebaseError, DeleteVendorDefaultSettingVariables>): UseDataConnectMutationResult<DeleteVendorDefaultSettingData, DeleteVendorDefaultSettingVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteVendorDefaultSetting(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteVendorDefaultSettingData, FirebaseError, DeleteVendorDefaultSettingVariables>): UseDataConnectMutationResult<DeleteVendorDefaultSettingData, DeleteVendorDefaultSettingVariables>;
Variables
The DeleteVendorDefaultSetting Mutation requires an argument of type DeleteVendorDefaultSettingVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteVendorDefaultSettingVariables {
id: UUIDString;
}
Return Type
Recall that calling the DeleteVendorDefaultSetting 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 DeleteVendorDefaultSetting Mutation is of type DeleteVendorDefaultSettingData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteVendorDefaultSettingData {
vendorDefaultSetting_delete?: VendorDefaultSetting_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using DeleteVendorDefaultSetting's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteVendorDefaultSettingVariables } from '@dataconnect/generated';
import { useDeleteVendorDefaultSetting } from '@dataconnect/generated/react'
export default function DeleteVendorDefaultSettingComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteVendorDefaultSetting();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteVendorDefaultSetting(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteVendorDefaultSetting(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 = useDeleteVendorDefaultSetting(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteVendorDefaultSetting` Mutation requires an argument of type `DeleteVendorDefaultSettingVariables`:
const deleteVendorDefaultSettingVars: DeleteVendorDefaultSettingVariables = {
id: ...,
};
mutation.mutate(deleteVendorDefaultSettingVars);
// 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(deleteVendorDefaultSettingVars, 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.vendorDefaultSetting_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 {
vendorName: string;
category: VendorRateCategory;
roleName: string;
employeeWage: number;
markupPercentage?: number | null;
vendorFeePercentage?: number | null;
clientRate: number;
}
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 = {
vendorName: ...,
category: ...,
roleName: ...,
employeeWage: ...,
markupPercentage: ..., // optional
vendorFeePercentage: ..., // optional
clientRate: ...,
};
mutation.mutate(createVendorRateVars);
// Variables can be defined inline as well.
mutation.mutate({ vendorName: ..., category: ..., roleName: ..., employeeWage: ..., markupPercentage: ..., vendorFeePercentage: ..., clientRate: ..., });
// 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;
vendorName?: string | null;
category?: VendorRateCategory | null;
roleName?: string | null;
employeeWage?: number | null;
markupPercentage?: number | null;
vendorFeePercentage?: number | null;
clientRate?: number | 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: ...,
vendorName: ..., // optional
category: ..., // optional
roleName: ..., // optional
employeeWage: ..., // optional
markupPercentage: ..., // optional
vendorFeePercentage: ..., // optional
clientRate: ..., // optional
};
mutation.mutate(updateVendorRateVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., vendorName: ..., category: ..., roleName: ..., employeeWage: ..., markupPercentage: ..., vendorFeePercentage: ..., clientRate: ..., });
// 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>;
}
CreateEnterprise
You can execute the CreateEnterprise Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateEnterprise(options?: useDataConnectMutationOptions<CreateEnterpriseData, FirebaseError, CreateEnterpriseVariables>): UseDataConnectMutationResult<CreateEnterpriseData, CreateEnterpriseVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateEnterprise(dc: DataConnect, options?: useDataConnectMutationOptions<CreateEnterpriseData, FirebaseError, CreateEnterpriseVariables>): UseDataConnectMutationResult<CreateEnterpriseData, CreateEnterpriseVariables>;
Variables
The CreateEnterprise Mutation requires an argument of type CreateEnterpriseVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateEnterpriseVariables {
enterpriseNumber: string;
enterpriseName: string;
enterpriseCode: string;
}
Return Type
Recall that calling the CreateEnterprise 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 CreateEnterprise Mutation is of type CreateEnterpriseData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateEnterpriseData {
enterprise_insert: Enterprise_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using CreateEnterprise's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateEnterpriseVariables } from '@dataconnect/generated';
import { useCreateEnterprise } from '@dataconnect/generated/react'
export default function CreateEnterpriseComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateEnterprise();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateEnterprise(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateEnterprise(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 = useCreateEnterprise(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateEnterprise` Mutation requires an argument of type `CreateEnterpriseVariables`:
const createEnterpriseVars: CreateEnterpriseVariables = {
enterpriseNumber: ...,
enterpriseName: ...,
enterpriseCode: ...,
};
mutation.mutate(createEnterpriseVars);
// Variables can be defined inline as well.
mutation.mutate({ enterpriseNumber: ..., enterpriseName: ..., enterpriseCode: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createEnterpriseVars, 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.enterprise_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
UpdateEnterprise
You can execute the UpdateEnterprise Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateEnterprise(options?: useDataConnectMutationOptions<UpdateEnterpriseData, FirebaseError, UpdateEnterpriseVariables>): UseDataConnectMutationResult<UpdateEnterpriseData, UpdateEnterpriseVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateEnterprise(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateEnterpriseData, FirebaseError, UpdateEnterpriseVariables>): UseDataConnectMutationResult<UpdateEnterpriseData, UpdateEnterpriseVariables>;
Variables
The UpdateEnterprise Mutation requires an argument of type UpdateEnterpriseVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateEnterpriseVariables {
id: UUIDString;
enterpriseNumber?: string | null;
enterpriseName?: string | null;
enterpriseCode?: string | null;
}
Return Type
Recall that calling the UpdateEnterprise 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 UpdateEnterprise Mutation is of type UpdateEnterpriseData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateEnterpriseData {
enterprise_update?: Enterprise_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using UpdateEnterprise's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateEnterpriseVariables } from '@dataconnect/generated';
import { useUpdateEnterprise } from '@dataconnect/generated/react'
export default function UpdateEnterpriseComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateEnterprise();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateEnterprise(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateEnterprise(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 = useUpdateEnterprise(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateEnterprise` Mutation requires an argument of type `UpdateEnterpriseVariables`:
const updateEnterpriseVars: UpdateEnterpriseVariables = {
id: ...,
enterpriseNumber: ..., // optional
enterpriseName: ..., // optional
enterpriseCode: ..., // optional
};
mutation.mutate(updateEnterpriseVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., enterpriseNumber: ..., enterpriseName: ..., enterpriseCode: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateEnterpriseVars, 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.enterprise_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
DeleteEnterprise
You can execute the DeleteEnterprise Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteEnterprise(options?: useDataConnectMutationOptions<DeleteEnterpriseData, FirebaseError, DeleteEnterpriseVariables>): UseDataConnectMutationResult<DeleteEnterpriseData, DeleteEnterpriseVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteEnterprise(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteEnterpriseData, FirebaseError, DeleteEnterpriseVariables>): UseDataConnectMutationResult<DeleteEnterpriseData, DeleteEnterpriseVariables>;
Variables
The DeleteEnterprise Mutation requires an argument of type DeleteEnterpriseVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteEnterpriseVariables {
id: UUIDString;
}
Return Type
Recall that calling the DeleteEnterprise 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 DeleteEnterprise Mutation is of type DeleteEnterpriseData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteEnterpriseData {
enterprise_delete?: Enterprise_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using DeleteEnterprise's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteEnterpriseVariables } from '@dataconnect/generated';
import { useDeleteEnterprise } from '@dataconnect/generated/react'
export default function DeleteEnterpriseComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteEnterprise();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteEnterprise(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteEnterprise(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 = useDeleteEnterprise(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteEnterprise` Mutation requires an argument of type `DeleteEnterpriseVariables`:
const deleteEnterpriseVars: DeleteEnterpriseVariables = {
id: ...,
};
mutation.mutate(deleteEnterpriseVars);
// 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(deleteEnterpriseVars, 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.enterprise_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
CreatePartner
You can execute the CreatePartner Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreatePartner(options?: useDataConnectMutationOptions<CreatePartnerData, FirebaseError, CreatePartnerVariables>): UseDataConnectMutationResult<CreatePartnerData, CreatePartnerVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreatePartner(dc: DataConnect, options?: useDataConnectMutationOptions<CreatePartnerData, FirebaseError, CreatePartnerVariables>): UseDataConnectMutationResult<CreatePartnerData, CreatePartnerVariables>;
Variables
The CreatePartner Mutation requires an argument of type CreatePartnerVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreatePartnerVariables {
partnerName: string;
partnerNumber: string;
partnerType?: PartnerType | null;
}
Return Type
Recall that calling the CreatePartner 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 CreatePartner Mutation is of type CreatePartnerData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreatePartnerData {
partner_insert: Partner_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using CreatePartner's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreatePartnerVariables } from '@dataconnect/generated';
import { useCreatePartner } from '@dataconnect/generated/react'
export default function CreatePartnerComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreatePartner();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreatePartner(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreatePartner(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 = useCreatePartner(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreatePartner` Mutation requires an argument of type `CreatePartnerVariables`:
const createPartnerVars: CreatePartnerVariables = {
partnerName: ...,
partnerNumber: ...,
partnerType: ..., // optional
};
mutation.mutate(createPartnerVars);
// Variables can be defined inline as well.
mutation.mutate({ partnerName: ..., partnerNumber: ..., partnerType: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createPartnerVars, 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.partner_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
UpdatePartner
You can execute the UpdatePartner Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdatePartner(options?: useDataConnectMutationOptions<UpdatePartnerData, FirebaseError, UpdatePartnerVariables>): UseDataConnectMutationResult<UpdatePartnerData, UpdatePartnerVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdatePartner(dc: DataConnect, options?: useDataConnectMutationOptions<UpdatePartnerData, FirebaseError, UpdatePartnerVariables>): UseDataConnectMutationResult<UpdatePartnerData, UpdatePartnerVariables>;
Variables
The UpdatePartner Mutation requires an argument of type UpdatePartnerVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdatePartnerVariables {
id: UUIDString;
partnerName?: string | null;
partnerNumber?: string | null;
partnerType?: PartnerType | null;
}
Return Type
Recall that calling the UpdatePartner 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 UpdatePartner Mutation is of type UpdatePartnerData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdatePartnerData {
partner_update?: Partner_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using UpdatePartner's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdatePartnerVariables } from '@dataconnect/generated';
import { useUpdatePartner } from '@dataconnect/generated/react'
export default function UpdatePartnerComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdatePartner();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdatePartner(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdatePartner(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 = useUpdatePartner(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdatePartner` Mutation requires an argument of type `UpdatePartnerVariables`:
const updatePartnerVars: UpdatePartnerVariables = {
id: ...,
partnerName: ..., // optional
partnerNumber: ..., // optional
partnerType: ..., // optional
};
mutation.mutate(updatePartnerVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., partnerName: ..., partnerNumber: ..., partnerType: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updatePartnerVars, 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.partner_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
DeletePartner
You can execute the DeletePartner Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeletePartner(options?: useDataConnectMutationOptions<DeletePartnerData, FirebaseError, DeletePartnerVariables>): UseDataConnectMutationResult<DeletePartnerData, DeletePartnerVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeletePartner(dc: DataConnect, options?: useDataConnectMutationOptions<DeletePartnerData, FirebaseError, DeletePartnerVariables>): UseDataConnectMutationResult<DeletePartnerData, DeletePartnerVariables>;
Variables
The DeletePartner Mutation requires an argument of type DeletePartnerVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeletePartnerVariables {
id: UUIDString;
}
Return Type
Recall that calling the DeletePartner 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 DeletePartner Mutation is of type DeletePartnerData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeletePartnerData {
partner_delete?: Partner_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using DeletePartner's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeletePartnerVariables } from '@dataconnect/generated';
import { useDeletePartner } from '@dataconnect/generated/react'
export default function DeletePartnerComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeletePartner();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeletePartner(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeletePartner(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 = useDeletePartner(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeletePartner` Mutation requires an argument of type `DeletePartnerVariables`:
const deletePartnerVars: DeletePartnerVariables = {
id: ...,
};
mutation.mutate(deletePartnerVars);
// 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(deletePartnerVars, 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.partner_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;
memberName: string;
email: string;
role?: TeamMemberRole | null;
isActive?: boolean | 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: ...,
memberName: ...,
email: ...,
role: ..., // optional
isActive: ..., // optional
};
mutation.mutate(createTeamMemberVars);
// Variables can be defined inline as well.
mutation.mutate({ teamId: ..., memberName: ..., email: ..., role: ..., isActive: ..., });
// 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;
teamId?: UUIDString | null;
memberName?: string | null;
email?: string | null;
role?: TeamMemberRole | null;
isActive?: boolean | 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: ...,
teamId: ..., // optional
memberName: ..., // optional
email: ..., // optional
role: ..., // optional
isActive: ..., // optional
};
mutation.mutate(updateTeamMemberVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., teamId: ..., memberName: ..., email: ..., role: ..., isActive: ..., });
// 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>;
}
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>;
}
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>): UseDataConnectMutationResult<CreateConversationData, CreateConversationVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateConversation(dc: DataConnect, options?: useDataConnectMutationOptions<CreateConversationData, FirebaseError, CreateConversationVariables>): UseDataConnectMutationResult<CreateConversationData, CreateConversationVariables>;
Variables
The CreateConversation Mutation requires an argument of type CreateConversationVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateConversationVariables {
participants: string;
conversationType: ConversationType;
relatedTo: UUIDString;
status?: ConversationStatus | 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 requires an argument of type `CreateConversationVariables`:
const createConversationVars: CreateConversationVariables = {
participants: ...,
conversationType: ...,
relatedTo: ...,
status: ..., // optional
};
mutation.mutate(createConversationVars);
// Variables can be defined inline as well.
mutation.mutate({ participants: ..., conversationType: ..., relatedTo: ..., status: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createConversationVars, 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;
participants?: string | null;
conversationType?: ConversationType | null;
relatedTo?: UUIDString | null;
status?: ConversationStatus | 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: ...,
participants: ..., // optional
conversationType: ..., // optional
relatedTo: ..., // optional
status: ..., // optional
};
mutation.mutate(updateConversationVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., participants: ..., conversationType: ..., relatedTo: ..., status: ..., });
// 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>;
}
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>;
}
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 {
invoiceNumber: string;
amount: number;
status: InvoiceStatus;
issueDate: TimestampString;
dueDate: TimestampString;
disputedItems?: string | null;
isAutoGenerated?: boolean | 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 = {
invoiceNumber: ...,
amount: ...,
status: ...,
issueDate: ...,
dueDate: ...,
disputedItems: ..., // optional
isAutoGenerated: ..., // optional
};
mutation.mutate(createInvoiceVars);
// Variables can be defined inline as well.
mutation.mutate({ invoiceNumber: ..., amount: ..., status: ..., issueDate: ..., dueDate: ..., disputedItems: ..., isAutoGenerated: ..., });
// 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;
invoiceNumber?: string | null;
amount?: number | null;
status?: InvoiceStatus | null;
issueDate?: TimestampString | null;
dueDate?: TimestampString | null;
disputedItems?: string | null;
isAutoGenerated?: boolean | 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: ...,
invoiceNumber: ..., // optional
amount: ..., // optional
status: ..., // optional
issueDate: ..., // optional
dueDate: ..., // optional
disputedItems: ..., // optional
isAutoGenerated: ..., // optional
};
mutation.mutate(updateInvoiceVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., invoiceNumber: ..., amount: ..., status: ..., issueDate: ..., dueDate: ..., disputedItems: ..., isAutoGenerated: ..., });
// 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>;
}
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;
email?: string | null;
sector?: BusinessSector | null;
rateGroup: BusinessRateGroup;
status?: BusinessStatus | 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: ...,
email: ..., // optional
sector: ..., // optional
rateGroup: ...,
status: ..., // optional
};
mutation.mutate(createBusinessVars);
// Variables can be defined inline as well.
mutation.mutate({ businessName: ..., contactName: ..., email: ..., sector: ..., rateGroup: ..., status: ..., });
// 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;
email?: string | null;
sector?: BusinessSector | null;
rateGroup?: BusinessRateGroup | null;
status?: BusinessStatus | 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
email: ..., // optional
sector: ..., // optional
rateGroup: ..., // optional
status: ..., // optional
};
mutation.mutate(updateBusinessVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., businessName: ..., contactName: ..., email: ..., sector: ..., rateGroup: ..., status: ..., });
// 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>;
}
CreateEvent
You can execute the CreateEvent Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useCreateEvent(options?: useDataConnectMutationOptions<CreateEventData, FirebaseError, CreateEventVariables>): UseDataConnectMutationResult<CreateEventData, CreateEventVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useCreateEvent(dc: DataConnect, options?: useDataConnectMutationOptions<CreateEventData, FirebaseError, CreateEventVariables>): UseDataConnectMutationResult<CreateEventData, CreateEventVariables>;
Variables
The CreateEvent Mutation requires an argument of type CreateEventVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateEventVariables {
eventName: string;
isRapid?: boolean | null;
isRecurring?: boolean | null;
isMultiDay?: boolean | null;
recurrenceType?: RecurrenceType | null;
recurrenceStartDate?: TimestampString | null;
recurrenceEndDate?: TimestampString | null;
scatterDates?: unknown | null;
multiDayStartDate?: TimestampString | null;
multiDayEndDate?: TimestampString | null;
bufferTimeBefore?: number | null;
bufferTimeAfter?: number | null;
conflictDetectionEnabled?: boolean | null;
detectedConflicts?: unknown | null;
businessId: UUIDString;
businessName?: string | null;
vendorId?: string | null;
vendorName?: string | null;
hub?: string | null;
eventLocation?: string | null;
contractType?: ContractType | null;
poReference?: string | null;
status: EventStatus;
date: string;
shifts?: unknown | null;
addons?: unknown | null;
total?: number | null;
clientName?: string | null;
clientEmail?: string | null;
clientPhone?: string | null;
invoiceId?: UUIDString | null;
notes?: string | null;
requested?: number | null;
assignedStaff?: unknown | null;
department?: string | null;
createdBy?: string | null;
orderType?: string | null;
recurringStartDate?: string | null;
recurringEndDate?: string | null;
recurringDays?: unknown | null;
permanentStartDate?: string | null;
permanentDays?: unknown | null;
includeBackup?: boolean | null;
backupStaffCount?: number | null;
recurringTime?: string | null;
permanentTime?: string | null;
}
Return Type
Recall that calling the CreateEvent 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 CreateEvent Mutation is of type CreateEventData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface CreateEventData {
event_insert: Event_Key;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using CreateEvent's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, CreateEventVariables } from '@dataconnect/generated';
import { useCreateEvent } from '@dataconnect/generated/react'
export default function CreateEventComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useCreateEvent();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useCreateEvent(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useCreateEvent(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 = useCreateEvent(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useCreateEvent` Mutation requires an argument of type `CreateEventVariables`:
const createEventVars: CreateEventVariables = {
eventName: ...,
isRapid: ..., // optional
isRecurring: ..., // optional
isMultiDay: ..., // optional
recurrenceType: ..., // optional
recurrenceStartDate: ..., // optional
recurrenceEndDate: ..., // optional
scatterDates: ..., // optional
multiDayStartDate: ..., // optional
multiDayEndDate: ..., // optional
bufferTimeBefore: ..., // optional
bufferTimeAfter: ..., // optional
conflictDetectionEnabled: ..., // optional
detectedConflicts: ..., // optional
businessId: ...,
businessName: ..., // optional
vendorId: ..., // optional
vendorName: ..., // optional
hub: ..., // optional
eventLocation: ..., // optional
contractType: ..., // optional
poReference: ..., // optional
status: ...,
date: ...,
shifts: ..., // optional
addons: ..., // optional
total: ..., // optional
clientName: ..., // optional
clientEmail: ..., // optional
clientPhone: ..., // optional
invoiceId: ..., // optional
notes: ..., // optional
requested: ..., // optional
assignedStaff: ..., // optional
department: ..., // optional
createdBy: ..., // optional
orderType: ..., // optional
recurringStartDate: ..., // optional
recurringEndDate: ..., // optional
recurringDays: ..., // optional
permanentStartDate: ..., // optional
permanentDays: ..., // optional
includeBackup: ..., // optional
backupStaffCount: ..., // optional
recurringTime: ..., // optional
permanentTime: ..., // optional
};
mutation.mutate(createEventVars);
// Variables can be defined inline as well.
mutation.mutate({ eventName: ..., isRapid: ..., isRecurring: ..., isMultiDay: ..., recurrenceType: ..., recurrenceStartDate: ..., recurrenceEndDate: ..., scatterDates: ..., multiDayStartDate: ..., multiDayEndDate: ..., bufferTimeBefore: ..., bufferTimeAfter: ..., conflictDetectionEnabled: ..., detectedConflicts: ..., businessId: ..., businessName: ..., vendorId: ..., vendorName: ..., hub: ..., eventLocation: ..., contractType: ..., poReference: ..., status: ..., date: ..., shifts: ..., addons: ..., total: ..., clientName: ..., clientEmail: ..., clientPhone: ..., invoiceId: ..., notes: ..., requested: ..., assignedStaff: ..., department: ..., createdBy: ..., orderType: ..., recurringStartDate: ..., recurringEndDate: ..., recurringDays: ..., permanentStartDate: ..., permanentDays: ..., includeBackup: ..., backupStaffCount: ..., recurringTime: ..., permanentTime: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(createEventVars, 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.event_insert);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
UpdateEvent
You can execute the UpdateEvent Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useUpdateEvent(options?: useDataConnectMutationOptions<UpdateEventData, FirebaseError, UpdateEventVariables>): UseDataConnectMutationResult<UpdateEventData, UpdateEventVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useUpdateEvent(dc: DataConnect, options?: useDataConnectMutationOptions<UpdateEventData, FirebaseError, UpdateEventVariables>): UseDataConnectMutationResult<UpdateEventData, UpdateEventVariables>;
Variables
The UpdateEvent Mutation requires an argument of type UpdateEventVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateEventVariables {
id: UUIDString;
eventName?: string | null;
isRapid?: boolean | null;
isRecurring?: boolean | null;
isMultiDay?: boolean | null;
recurrenceType?: RecurrenceType | null;
recurrenceStartDate?: TimestampString | null;
recurrenceEndDate?: TimestampString | null;
scatterDates?: unknown | null;
multiDayStartDate?: TimestampString | null;
multiDayEndDate?: TimestampString | null;
bufferTimeBefore?: number | null;
bufferTimeAfter?: number | null;
conflictDetectionEnabled?: boolean | null;
detectedConflicts?: unknown | null;
businessId?: UUIDString | null;
businessName?: string | null;
vendorId?: string | null;
vendorName?: string | null;
hub?: string | null;
eventLocation?: string | null;
contractType?: ContractType | null;
poReference?: string | null;
status?: EventStatus | null;
date?: string | null;
shifts?: unknown | null;
addons?: unknown | null;
total?: number | null;
clientName?: string | null;
clientEmail?: string | null;
clientPhone?: string | null;
invoiceId?: UUIDString | null;
notes?: string | null;
requested?: number | null;
orderType?: string | null;
department?: string | null;
assignedStaff?: unknown | null;
createdBy?: string | null;
recurringStartDate?: string | null;
recurringEndDate?: string | null;
recurringDays?: unknown | null;
permanentStartDate?: string | null;
permanentDays?: unknown | null;
includeBackup?: boolean | null;
backupStaffCount?: number | null;
recurringTime?: string | null;
permanentTime?: string | null;
}
Return Type
Recall that calling the UpdateEvent 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 UpdateEvent Mutation is of type UpdateEventData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface UpdateEventData {
event_update?: Event_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using UpdateEvent's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, UpdateEventVariables } from '@dataconnect/generated';
import { useUpdateEvent } from '@dataconnect/generated/react'
export default function UpdateEventComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useUpdateEvent();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useUpdateEvent(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useUpdateEvent(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 = useUpdateEvent(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useUpdateEvent` Mutation requires an argument of type `UpdateEventVariables`:
const updateEventVars: UpdateEventVariables = {
id: ...,
eventName: ..., // optional
isRapid: ..., // optional
isRecurring: ..., // optional
isMultiDay: ..., // optional
recurrenceType: ..., // optional
recurrenceStartDate: ..., // optional
recurrenceEndDate: ..., // optional
scatterDates: ..., // optional
multiDayStartDate: ..., // optional
multiDayEndDate: ..., // optional
bufferTimeBefore: ..., // optional
bufferTimeAfter: ..., // optional
conflictDetectionEnabled: ..., // optional
detectedConflicts: ..., // optional
businessId: ..., // optional
businessName: ..., // optional
vendorId: ..., // optional
vendorName: ..., // optional
hub: ..., // optional
eventLocation: ..., // optional
contractType: ..., // optional
poReference: ..., // optional
status: ..., // optional
date: ..., // optional
shifts: ..., // optional
addons: ..., // optional
total: ..., // optional
clientName: ..., // optional
clientEmail: ..., // optional
clientPhone: ..., // optional
invoiceId: ..., // optional
notes: ..., // optional
requested: ..., // optional
orderType: ..., // optional
department: ..., // optional
assignedStaff: ..., // optional
createdBy: ..., // optional
recurringStartDate: ..., // optional
recurringEndDate: ..., // optional
recurringDays: ..., // optional
permanentStartDate: ..., // optional
permanentDays: ..., // optional
includeBackup: ..., // optional
backupStaffCount: ..., // optional
recurringTime: ..., // optional
permanentTime: ..., // optional
};
mutation.mutate(updateEventVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., eventName: ..., isRapid: ..., isRecurring: ..., isMultiDay: ..., recurrenceType: ..., recurrenceStartDate: ..., recurrenceEndDate: ..., scatterDates: ..., multiDayStartDate: ..., multiDayEndDate: ..., bufferTimeBefore: ..., bufferTimeAfter: ..., conflictDetectionEnabled: ..., detectedConflicts: ..., businessId: ..., businessName: ..., vendorId: ..., vendorName: ..., hub: ..., eventLocation: ..., contractType: ..., poReference: ..., status: ..., date: ..., shifts: ..., addons: ..., total: ..., clientName: ..., clientEmail: ..., clientPhone: ..., invoiceId: ..., notes: ..., requested: ..., orderType: ..., department: ..., assignedStaff: ..., createdBy: ..., recurringStartDate: ..., recurringEndDate: ..., recurringDays: ..., permanentStartDate: ..., permanentDays: ..., includeBackup: ..., backupStaffCount: ..., recurringTime: ..., permanentTime: ..., });
// You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
mutation.mutate(updateEventVars, 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.event_update);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}
DeleteEvent
You can execute the DeleteEvent Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteEvent(options?: useDataConnectMutationOptions<DeleteEventData, FirebaseError, DeleteEventVariables>): UseDataConnectMutationResult<DeleteEventData, DeleteEventVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteEvent(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteEventData, FirebaseError, DeleteEventVariables>): UseDataConnectMutationResult<DeleteEventData, DeleteEventVariables>;
Variables
The DeleteEvent Mutation requires an argument of type DeleteEventVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteEventVariables {
id: UUIDString;
}
Return Type
Recall that calling the DeleteEvent 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 DeleteEvent Mutation is of type DeleteEventData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteEventData {
event_delete?: Event_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using DeleteEvent's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteEventVariables } from '@dataconnect/generated';
import { useDeleteEvent } from '@dataconnect/generated/react'
export default function DeleteEventComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteEvent();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteEvent(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteEvent(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 = useDeleteEvent(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteEvent` Mutation requires an argument of type `DeleteEventVariables`:
const deleteEventVars: DeleteEventVariables = {
id: ...,
};
mutation.mutate(deleteEventVars);
// 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(deleteEventVars, 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.event_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: string;
ownerName: string;
ownerRole: TeamOwnerRole;
favoriteStaff?: string | null;
blockedStaff?: string | 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: ...,
favoriteStaff: ..., // optional
blockedStaff: ..., // optional
};
mutation.mutate(createTeamVars);
// Variables can be defined inline as well.
mutation.mutate({ teamName: ..., ownerId: ..., ownerName: ..., ownerRole: ..., 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;
ownerId?: string | null;
ownerName?: string | null;
ownerRole?: TeamOwnerRole | null;
favoriteStaff?: string | null;
blockedStaff?: string | 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
ownerId: ..., // optional
ownerName: ..., // optional
ownerRole: ..., // optional
favoriteStaff: ..., // optional
blockedStaff: ..., // optional
};
mutation.mutate(updateTeamVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., teamName: ..., ownerId: ..., ownerName: ..., ownerRole: ..., 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>;
}
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 {
workforceNumber: string;
vendorId: UUIDString;
firstName: string;
lastName: 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 = {
workforceNumber: ...,
vendorId: ...,
firstName: ...,
lastName: ...,
employmentType: ..., // optional
};
mutation.mutate(createWorkforceVars);
// Variables can be defined inline as well.
mutation.mutate({ workforceNumber: ..., vendorId: ..., firstName: ..., lastName: ..., 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;
vendorId?: UUIDString | null;
firstName?: string | null;
lastName?: string | null;
employmentType?: WorkforceEmploymentType | 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
vendorId: ..., // optional
firstName: ..., // optional
lastName: ..., // optional
employmentType: ..., // optional
};
mutation.mutate(updateWorkforceVars);
// Variables can be defined inline as well.
mutation.mutate({ id: ..., workforceNumber: ..., vendorId: ..., firstName: ..., lastName: ..., employmentType: ..., });
// 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>;
}
DeleteWorkforce
You can execute the DeleteWorkforce Mutation using the UseMutationResult object returned by the following Mutation hook function (which is defined in dataconnect-generated/react/index.d.ts):
useDeleteWorkforce(options?: useDataConnectMutationOptions<DeleteWorkforceData, FirebaseError, DeleteWorkforceVariables>): UseDataConnectMutationResult<DeleteWorkforceData, DeleteWorkforceVariables>;
You can also pass in a DataConnect instance to the Mutation hook function.
useDeleteWorkforce(dc: DataConnect, options?: useDataConnectMutationOptions<DeleteWorkforceData, FirebaseError, DeleteWorkforceVariables>): UseDataConnectMutationResult<DeleteWorkforceData, DeleteWorkforceVariables>;
Variables
The DeleteWorkforce Mutation requires an argument of type DeleteWorkforceVariables, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteWorkforceVariables {
id: UUIDString;
}
Return Type
Recall that calling the DeleteWorkforce 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 DeleteWorkforce Mutation is of type DeleteWorkforceData, which is defined in dataconnect-generated/index.d.ts. It has the following fields:
export interface DeleteWorkforceData {
workforce_delete?: Workforce_Key | null;
}
To learn more about the UseMutationResult object, see the TanStack React Query documentation.
Using DeleteWorkforce's Mutation hook function
import { getDataConnect } from 'firebase/data-connect';
import { connectorConfig, DeleteWorkforceVariables } from '@dataconnect/generated';
import { useDeleteWorkforce } from '@dataconnect/generated/react'
export default function DeleteWorkforceComponent() {
// Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation.
const mutation = useDeleteWorkforce();
// You can also pass in a `DataConnect` instance to the Mutation hook function.
const dataConnect = getDataConnect(connectorConfig);
const mutation = useDeleteWorkforce(dataConnect);
// You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function.
const options = {
onSuccess: () => { console.log('Mutation succeeded!'); }
};
const mutation = useDeleteWorkforce(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 = useDeleteWorkforce(dataConnect, options);
// After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation.
// The `useDeleteWorkforce` Mutation requires an argument of type `DeleteWorkforceVariables`:
const deleteWorkforceVars: DeleteWorkforceVariables = {
id: ...,
};
mutation.mutate(deleteWorkforceVars);
// 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(deleteWorkforceVars, 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_delete);
}
return <div>Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!</div>;
}