;
```
### Variables
The `CreateVendor` Mutation requires an argument of type `CreateVendorVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields:
```javascript
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](../index.d.ts). It has the following fields:
```javascript
export interface CreateVendorData {
vendor_insert: Vendor_Key;
}
```
To learn more about the `UseMutationResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation).
### Using `CreateVendor`'s Mutation hook function
```javascript
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 Loading...
;
}
if (mutation.isError) {
return Error: {mutation.error.message}
;
}
// 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 Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!
;
}
```
## 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](./index.d.ts)):
```javascript
useUpdateVendor(options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
You can also pass in a `DataConnect` instance to the Mutation hook function.
```javascript
useUpdateVendor(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
### Variables
The `UpdateVendor` Mutation requires an argument of type `UpdateVendorVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields:
```javascript
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](../index.d.ts). It has the following fields:
```javascript
export interface UpdateVendorData {
vendor_update?: Vendor_Key | null;
}
```
To learn more about the `UseMutationResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation).
### Using `UpdateVendor`'s Mutation hook function
```javascript
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 Loading...
;
}
if (mutation.isError) {
return Error: {mutation.error.message}
;
}
// 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 Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!
;
}
```
## 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](./index.d.ts)):
```javascript
useDeleteVendor(options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
You can also pass in a `DataConnect` instance to the Mutation hook function.
```javascript
useDeleteVendor(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
### Variables
The `DeleteVendor` Mutation requires an argument of type `DeleteVendorVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields:
```javascript
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](../index.d.ts). It has the following fields:
```javascript
export interface DeleteVendorData {
vendor_delete?: Vendor_Key | null;
}
```
To learn more about the `UseMutationResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation).
### Using `DeleteVendor`'s Mutation hook function
```javascript
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 Loading...
;
}
if (mutation.isError) {
return Error: {mutation.error.message}
;
}
// 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 Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!
;
}
```
## 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](./index.d.ts)):
```javascript
useCreateInvoice(options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
You can also pass in a `DataConnect` instance to the Mutation hook function.
```javascript
useCreateInvoice(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
### Variables
The `CreateInvoice` Mutation requires an argument of type `CreateInvoiceVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields:
```javascript
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](../index.d.ts). It has the following fields:
```javascript
export interface CreateInvoiceData {
invoice_insert: Invoice_Key;
}
```
To learn more about the `UseMutationResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation).
### Using `CreateInvoice`'s Mutation hook function
```javascript
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 Loading...
;
}
if (mutation.isError) {
return Error: {mutation.error.message}
;
}
// 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 Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!
;
}
```
## 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](./index.d.ts)):
```javascript
useUpdateInvoice(options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
You can also pass in a `DataConnect` instance to the Mutation hook function.
```javascript
useUpdateInvoice(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
### Variables
The `UpdateInvoice` Mutation requires an argument of type `UpdateInvoiceVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields:
```javascript
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](../index.d.ts). It has the following fields:
```javascript
export interface UpdateInvoiceData {
invoice_update?: Invoice_Key | null;
}
```
To learn more about the `UseMutationResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation).
### Using `UpdateInvoice`'s Mutation hook function
```javascript
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 Loading...
;
}
if (mutation.isError) {
return Error: {mutation.error.message}
;
}
// 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 Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!
;
}
```
## 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](./index.d.ts)):
```javascript
useDeleteInvoice(options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
You can also pass in a `DataConnect` instance to the Mutation hook function.
```javascript
useDeleteInvoice(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
### Variables
The `DeleteInvoice` Mutation requires an argument of type `DeleteInvoiceVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields:
```javascript
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](../index.d.ts). It has the following fields:
```javascript
export interface DeleteInvoiceData {
invoice_delete?: Invoice_Key | null;
}
```
To learn more about the `UseMutationResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation).
### Using `DeleteInvoice`'s Mutation hook function
```javascript
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 Loading...
;
}
if (mutation.isError) {
return Error: {mutation.error.message}
;
}
// 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 Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!
;
}
```
## 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](./index.d.ts)):
```javascript
useCreateStaff(options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
You can also pass in a `DataConnect` instance to the Mutation hook function.
```javascript
useCreateStaff(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
### Variables
The `CreateStaff` Mutation requires an argument of type `CreateStaffVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields:
```javascript
export interface CreateStaffVariables {
employeeName: string;
vendorId?: UUIDString | null;
email?: string | null;
position?: string | null;
employmentType: EmploymentType;
rating?: number | null;
reliabilityScore?: number | null;
backgroundCheckStatus: BackgroundCheckStatus;
certifications?: 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](../index.d.ts). It has the following fields:
```javascript
export interface CreateStaffData {
staff_insert: Staff_Key;
}
```
To learn more about the `UseMutationResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation).
### Using `CreateStaff`'s Mutation hook function
```javascript
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
email: ..., // optional
position: ..., // optional
employmentType: ...,
rating: ..., // optional
reliabilityScore: ..., // optional
backgroundCheckStatus: ...,
certifications: ..., // optional
};
mutation.mutate(createStaffVars);
// Variables can be defined inline as well.
mutation.mutate({ employeeName: ..., vendorId: ..., email: ..., position: ..., employmentType: ..., rating: ..., reliabilityScore: ..., backgroundCheckStatus: ..., certifications: ..., });
// 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 Loading...
;
}
if (mutation.isError) {
return Error: {mutation.error.message}
;
}
// 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 Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!
;
}
```
## 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](./index.d.ts)):
```javascript
useCreateVendorDefaultSetting(options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
You can also pass in a `DataConnect` instance to the Mutation hook function.
```javascript
useCreateVendorDefaultSetting(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
### Variables
The `CreateVendorDefaultSetting` Mutation requires an argument of type `CreateVendorDefaultSettingVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields:
```javascript
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](../index.d.ts). It has the following fields:
```javascript
export interface CreateVendorDefaultSettingData {
vendorDefaultSetting_insert: VendorDefaultSetting_Key;
}
```
To learn more about the `UseMutationResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation).
### Using `CreateVendorDefaultSetting`'s Mutation hook function
```javascript
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 Loading...
;
}
if (mutation.isError) {
return Error: {mutation.error.message}
;
}
// 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 Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!
;
}
```
## 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](./index.d.ts)):
```javascript
useUpdateVendorDefaultSetting(options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
You can also pass in a `DataConnect` instance to the Mutation hook function.
```javascript
useUpdateVendorDefaultSetting(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
### Variables
The `UpdateVendorDefaultSetting` Mutation requires an argument of type `UpdateVendorDefaultSettingVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields:
```javascript
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](../index.d.ts). It has the following fields:
```javascript
export interface UpdateVendorDefaultSettingData {
vendorDefaultSetting_update?: VendorDefaultSetting_Key | null;
}
```
To learn more about the `UseMutationResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation).
### Using `UpdateVendorDefaultSetting`'s Mutation hook function
```javascript
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 Loading...
;
}
if (mutation.isError) {
return Error: {mutation.error.message}
;
}
// 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 Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!
;
}
```
## 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](./index.d.ts)):
```javascript
useDeleteVendorDefaultSetting(options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
You can also pass in a `DataConnect` instance to the Mutation hook function.
```javascript
useDeleteVendorDefaultSetting(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
### Variables
The `DeleteVendorDefaultSetting` Mutation requires an argument of type `DeleteVendorDefaultSettingVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields:
```javascript
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](../index.d.ts). It has the following fields:
```javascript
export interface DeleteVendorDefaultSettingData {
vendorDefaultSetting_delete?: VendorDefaultSetting_Key | null;
}
```
To learn more about the `UseMutationResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation).
### Using `DeleteVendorDefaultSetting`'s Mutation hook function
```javascript
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 Loading...
;
}
if (mutation.isError) {
return Error: {mutation.error.message}
;
}
// 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 Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!
;
}
```
## 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](./index.d.ts)):
```javascript
useCreateVendorRate(options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
You can also pass in a `DataConnect` instance to the Mutation hook function.
```javascript
useCreateVendorRate(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
### Variables
The `CreateVendorRate` Mutation requires an argument of type `CreateVendorRateVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields:
```javascript
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](../index.d.ts). It has the following fields:
```javascript
export interface CreateVendorRateData {
vendorRate_insert: VendorRate_Key;
}
```
To learn more about the `UseMutationResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation).
### Using `CreateVendorRate`'s Mutation hook function
```javascript
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 Loading...
;
}
if (mutation.isError) {
return Error: {mutation.error.message}
;
}
// 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 Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!
;
}
```
## 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](./index.d.ts)):
```javascript
useUpdateVendorRate(options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
You can also pass in a `DataConnect` instance to the Mutation hook function.
```javascript
useUpdateVendorRate(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
### Variables
The `UpdateVendorRate` Mutation requires an argument of type `UpdateVendorRateVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields:
```javascript
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](../index.d.ts). It has the following fields:
```javascript
export interface UpdateVendorRateData {
vendorRate_update?: VendorRate_Key | null;
}
```
To learn more about the `UseMutationResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation).
### Using `UpdateVendorRate`'s Mutation hook function
```javascript
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 Loading...
;
}
if (mutation.isError) {
return Error: {mutation.error.message}
;
}
// 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 Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!
;
}
```
## 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](./index.d.ts)):
```javascript
useDeleteVendorRate(options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
You can also pass in a `DataConnect` instance to the Mutation hook function.
```javascript
useDeleteVendorRate(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
### Variables
The `DeleteVendorRate` Mutation requires an argument of type `DeleteVendorRateVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields:
```javascript
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](../index.d.ts). It has the following fields:
```javascript
export interface DeleteVendorRateData {
vendorRate_delete?: VendorRate_Key | null;
}
```
To learn more about the `UseMutationResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation).
### Using `DeleteVendorRate`'s Mutation hook function
```javascript
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 Loading...
;
}
if (mutation.isError) {
return Error: {mutation.error.message}
;
}
// 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 Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!
;
}
```
## 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](./index.d.ts)):
```javascript
useCreateEvent(options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
You can also pass in a `DataConnect` instance to the Mutation hook function.
```javascript
useCreateEvent(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
### Variables
The `CreateEvent` Mutation requires an argument of type `CreateEventVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields:
```javascript
export interface CreateEventVariables {
eventName: string;
isRapid?: boolean | null;
isRecurring?: boolean | null;
isMultiDay?: boolean | null;
recurrenceType?: RecurrenceType | null;
recurrenceStartDate?: TimestampString | null;
recurrenceEndDate?: TimestampString | null;
scatterDates?: string | null;
multiDayStartDate?: TimestampString | null;
multiDayEndDate?: TimestampString | null;
bufferTimeBefore?: number | null;
bufferTimeAfter?: number | null;
conflictDetectionEnabled?: boolean | null;
detectedConflicts?: string | null;
businessId: UUIDString;
businessName?: string | null;
vendorId?: UUIDString | null;
vendorName?: string | null;
hub?: string | null;
eventLocation?: string | null;
contractType?: ContractType | null;
poReference?: string | null;
status: EventStatus;
date: TimestampString;
shifts?: string | null;
addons?: string | null;
total?: number | null;
clientName?: string | null;
clientEmail?: string | null;
clientPhone?: string | null;
invoiceId?: UUIDString | null;
notes?: string | null;
requested?: number | null;
assignedStaff?: 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](../index.d.ts). It has the following fields:
```javascript
export interface CreateEventData {
event_insert: Event_Key;
}
```
To learn more about the `UseMutationResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation).
### Using `CreateEvent`'s Mutation hook function
```javascript
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
};
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: ..., });
// 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 Loading...
;
}
if (mutation.isError) {
return Error: {mutation.error.message}
;
}
// 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 Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!
;
}
```
## 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](./index.d.ts)):
```javascript
useUpdateEvent(options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
You can also pass in a `DataConnect` instance to the Mutation hook function.
```javascript
useUpdateEvent(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
### Variables
The `UpdateEvent` Mutation requires an argument of type `UpdateEventVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields:
```javascript
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?: string | null;
multiDayStartDate?: TimestampString | null;
multiDayEndDate?: TimestampString | null;
bufferTimeBefore?: number | null;
bufferTimeAfter?: number | null;
conflictDetectionEnabled?: boolean | null;
detectedConflicts?: string | null;
businessId?: UUIDString | null;
businessName?: string | null;
vendorId?: UUIDString | null;
vendorName?: string | null;
hub?: string | null;
eventLocation?: string | null;
contractType?: ContractType | null;
poReference?: string | null;
status?: EventStatus | null;
date?: TimestampString | null;
shifts?: string | null;
addons?: string | null;
total?: number | null;
clientName?: string | null;
clientEmail?: string | null;
clientPhone?: string | null;
invoiceId?: UUIDString | null;
notes?: string | null;
requested?: number | null;
assignedStaff?: 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](../index.d.ts). It has the following fields:
```javascript
export interface UpdateEventData {
event_update?: Event_Key | null;
}
```
To learn more about the `UseMutationResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation).
### Using `UpdateEvent`'s Mutation hook function
```javascript
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
assignedStaff: ..., // 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: ..., assignedStaff: ..., });
// 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 Loading...
;
}
if (mutation.isError) {
return Error: {mutation.error.message}
;
}
// 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 Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!
;
}
```
## 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](./index.d.ts)):
```javascript
useDeleteEvent(options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
You can also pass in a `DataConnect` instance to the Mutation hook function.
```javascript
useDeleteEvent(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult;
```
### Variables
The `DeleteEvent` Mutation requires an argument of type `DeleteEventVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields:
```javascript
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](../index.d.ts). It has the following fields:
```javascript
export interface DeleteEventData {
event_delete?: Event_Key | null;
}
```
To learn more about the `UseMutationResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation).
### Using `DeleteEvent`'s Mutation hook function
```javascript
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 Loading...
;
}
if (mutation.isError) {
return Error: {mutation.error.message}
;
}
// 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 Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!
;
}
```