// Copyright 2022 Luca Casonato. All rights reserved. MIT license. /** * Firebase Data Connect API Client for Deno * ========================================= * * Firebase Data Connect is a relational database service for mobile and web apps that lets you build and scale using a fully-managed PostgreSQL database powered by Cloud SQL. The REST API lets developers manage the connections to their database, change the schema of their database, and query the database. * * Docs: https://firebase.google.com/docs/data-connect * Source: https://googleapis.deno.dev/v1/firebasedataconnect:v1beta.ts */ import { auth, CredentialsClient, GoogleAuth, request } from "/_/base@v1/mod.ts"; export { auth, GoogleAuth }; export type { CredentialsClient }; /** * Firebase Data Connect is a relational database service for mobile and web * apps that lets you build and scale using a fully-managed PostgreSQL database * powered by Cloud SQL. The REST API lets developers manage the connections to * their database, change the schema of their database, and query the database. */ export class FirebaseDataConnect { #client: CredentialsClient | undefined; #baseUrl: string; constructor(client?: CredentialsClient, baseUrl: string = "https://firebasedataconnect.googleapis.com/") { this.#client = client; this.#baseUrl = baseUrl; } /** * Gets information about a location. * * @param name Resource name for the location. */ async projectsLocationsGet(name: string): Promise { const url = new URL(`${this.#baseUrl}v1beta/${ name }`); const data = await request(url.href, { client: this.#client, method: "GET", }); return data as Location; } /** * Lists information about the supported locations for this service. * * @param name The resource that owns the locations collection, if applicable. */ async projectsLocationsList(name: string, opts: ProjectsLocationsListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v1beta/${ name }/locations`); if (opts.filter !== undefined) { url.searchParams.append("filter", String(opts.filter)); } if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as ListLocationsResponse; } /** * Starts asynchronous cancellation on a long-running operation. The server * makes a best effort to cancel the operation, but success is not guaranteed. * If the server doesn't support this method, it returns * `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or * other methods to check whether the cancellation succeeded or whether the * operation completed despite cancellation. On successful cancellation, the * operation is not deleted; instead, it becomes an operation with an * Operation.error value with a google.rpc.Status.code of 1, corresponding to * `Code.CANCELLED`. * * @param name The name of the operation resource to be cancelled. */ async projectsLocationsOperationsCancel(name: string, req: CancelOperationRequest): Promise { const url = new URL(`${this.#baseUrl}v1beta/${ name }:cancel`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as Empty; } /** * Deletes a long-running operation. This method indicates that the client is * no longer interested in the operation result. It does not cancel the * operation. If the server doesn't support this method, it returns * `google.rpc.Code.UNIMPLEMENTED`. * * @param name The name of the operation resource to be deleted. */ async projectsLocationsOperationsDelete(name: string): Promise { const url = new URL(`${this.#baseUrl}v1beta/${ name }`); const data = await request(url.href, { client: this.#client, method: "DELETE", }); return data as Empty; } /** * Gets the latest state of a long-running operation. Clients can use this * method to poll the operation result at intervals as recommended by the API * service. * * @param name The name of the operation resource. */ async projectsLocationsOperationsGet(name: string): Promise { const url = new URL(`${this.#baseUrl}v1beta/${ name }`); const data = await request(url.href, { client: this.#client, method: "GET", }); return data as Operation; } /** * Lists operations that match the specified filter in the request. If the * server doesn't support this method, it returns `UNIMPLEMENTED`. * * @param name The name of the operation's parent resource. */ async projectsLocationsOperationsList(name: string, opts: ProjectsLocationsOperationsListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v1beta/${ name }/operations`); if (opts.filter !== undefined) { url.searchParams.append("filter", String(opts.filter)); } if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as ListOperationsResponse; } /** * Creates a new Connector in a given project and location. The operations * are validated against and must be compatible with the active schema. If the * operations and schema are not compatible or if the schema is not present, * this will result in an error. * * @param parent Required. Value for parent. */ async projectsLocationsServicesConnectorsCreate(parent: string, req: Connector, opts: ProjectsLocationsServicesConnectorsCreateOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v1beta/${ parent }/connectors`); if (opts.connectorId !== undefined) { url.searchParams.append("connectorId", String(opts.connectorId)); } if (opts.requestId !== undefined) { url.searchParams.append("requestId", String(opts.requestId)); } if (opts.validateOnly !== undefined) { url.searchParams.append("validateOnly", String(opts.validateOnly)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as Operation; } /** * Deletes a single Connector. * * @param name Required. The name of the connector to delete, in the format: ``` projects/{project}/locations/{location}/services/{service}/connectors/{connector} ``` */ async projectsLocationsServicesConnectorsDelete(name: string, opts: ProjectsLocationsServicesConnectorsDeleteOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v1beta/${ name }`); if (opts.allowMissing !== undefined) { url.searchParams.append("allowMissing", String(opts.allowMissing)); } if (opts.etag !== undefined) { url.searchParams.append("etag", String(opts.etag)); } if (opts.force !== undefined) { url.searchParams.append("force", String(opts.force)); } if (opts.requestId !== undefined) { url.searchParams.append("requestId", String(opts.requestId)); } if (opts.validateOnly !== undefined) { url.searchParams.append("validateOnly", String(opts.validateOnly)); } const data = await request(url.href, { client: this.#client, method: "DELETE", }); return data as Operation; } /** * Execute a predefined mutation in a Connector. * * @param name Required. The resource name of the connector to find the predefined mutation, in the format: ``` projects/{project}/locations/{location}/services/{service}/connectors/{connector} ``` */ async projectsLocationsServicesConnectorsExecuteMutation(name: string, req: ExecuteMutationRequest): Promise { const url = new URL(`${this.#baseUrl}v1beta/${ name }:executeMutation`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as ExecuteMutationResponse; } /** * Execute a predefined query in a Connector. * * @param name Required. The resource name of the connector to find the predefined query, in the format: ``` projects/{project}/locations/{location}/services/{service}/connectors/{connector} ``` */ async projectsLocationsServicesConnectorsExecuteQuery(name: string, req: ExecuteQueryRequest): Promise { const url = new URL(`${this.#baseUrl}v1beta/${ name }:executeQuery`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as ExecuteQueryResponse; } /** * Gets details of a single Connector. * * @param name Required. The name of the connector to retrieve, in the format: ``` projects/{project}/locations/{location}/services/{service}/connectors/{connector} ``` */ async projectsLocationsServicesConnectorsGet(name: string): Promise { const url = new URL(`${this.#baseUrl}v1beta/${ name }`); const data = await request(url.href, { client: this.#client, method: "GET", }); return data as Connector; } /** * Lists Connectors in a given project and location. * * @param parent Required. Value of parent. */ async projectsLocationsServicesConnectorsList(parent: string, opts: ProjectsLocationsServicesConnectorsListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v1beta/${ parent }/connectors`); if (opts.filter !== undefined) { url.searchParams.append("filter", String(opts.filter)); } if (opts.orderBy !== undefined) { url.searchParams.append("orderBy", String(opts.orderBy)); } if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as ListConnectorsResponse; } /** * Updates the parameters of a single Connector, and creates a new * ConnectorRevision with the updated Connector. The operations are validated * against and must be compatible with the live schema. If the operations and * schema are not compatible or if the schema is not present, this will result * in an error. * * @param name Identifier. The relative resource name of the connector, in the format: ``` projects/{project}/locations/{location}/services/{service}/connectors/{connector} ``` */ async projectsLocationsServicesConnectorsPatch(name: string, req: Connector, opts: ProjectsLocationsServicesConnectorsPatchOptions = {}): Promise { opts = serializeProjectsLocationsServicesConnectorsPatchOptions(opts); const url = new URL(`${this.#baseUrl}v1beta/${ name }`); if (opts.allowMissing !== undefined) { url.searchParams.append("allowMissing", String(opts.allowMissing)); } if (opts.requestId !== undefined) { url.searchParams.append("requestId", String(opts.requestId)); } if (opts.updateMask !== undefined) { url.searchParams.append("updateMask", String(opts.updateMask)); } if (opts.validateOnly !== undefined) { url.searchParams.append("validateOnly", String(opts.validateOnly)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PATCH", body, }); return data as Operation; } /** * Creates a new Service in a given project and location. * * @param parent Required. Value of parent. */ async projectsLocationsServicesCreate(parent: string, req: Service, opts: ProjectsLocationsServicesCreateOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v1beta/${ parent }/services`); if (opts.requestId !== undefined) { url.searchParams.append("requestId", String(opts.requestId)); } if (opts.serviceId !== undefined) { url.searchParams.append("serviceId", String(opts.serviceId)); } if (opts.validateOnly !== undefined) { url.searchParams.append("validateOnly", String(opts.validateOnly)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as Operation; } /** * Deletes a single Service. * * @param name Required. The name of the service to delete, in the format: ``` projects/{project}/locations/{location}/services/{service} ``` */ async projectsLocationsServicesDelete(name: string, opts: ProjectsLocationsServicesDeleteOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v1beta/${ name }`); if (opts.allowMissing !== undefined) { url.searchParams.append("allowMissing", String(opts.allowMissing)); } if (opts.etag !== undefined) { url.searchParams.append("etag", String(opts.etag)); } if (opts.force !== undefined) { url.searchParams.append("force", String(opts.force)); } if (opts.requestId !== undefined) { url.searchParams.append("requestId", String(opts.requestId)); } if (opts.validateOnly !== undefined) { url.searchParams.append("validateOnly", String(opts.validateOnly)); } const data = await request(url.href, { client: this.#client, method: "DELETE", }); return data as Operation; } /** * Execute any GraphQL query and mutation against the Firebase Data Connect's * generated GraphQL schema. Grants full read and write access to the * connected data sources. Note: Use introspection query to explore the * generated GraphQL schema. * * @param name Required. The relative resource name of Firebase Data Connect service, in the format: ``` projects/{project}/locations/{location}/services/{service} ``` */ async projectsLocationsServicesExecuteGraphql(name: string, req: GraphqlRequest): Promise { const url = new URL(`${this.#baseUrl}v1beta/${ name }:executeGraphql`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as GraphqlResponse; } /** * Execute any GraphQL query against the Firebase Data Connect's generated * GraphQL schema. Grants full read to the connected data sources. * `ExecuteGraphqlRead` is identical to `ExecuteGraphql` except it only * accepts read-only query. * * @param name Required. The relative resource name of Firebase Data Connect service, in the format: ``` projects/{project}/locations/{location}/services/{service} ``` */ async projectsLocationsServicesExecuteGraphqlRead(name: string, req: GraphqlRequest): Promise { const url = new URL(`${this.#baseUrl}v1beta/${ name }:executeGraphqlRead`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as GraphqlResponse; } /** * Gets details of a single Service. * * @param name Required. The name of the service to retrieve, in the format: ``` projects/{project}/locations/{location}/services/{service} ``` */ async projectsLocationsServicesGet(name: string): Promise { const url = new URL(`${this.#baseUrl}v1beta/${ name }`); const data = await request(url.href, { client: this.#client, method: "GET", }); return data as Service; } /** * Lists Services in a given project and location. * * @param parent Required. Value of parent. */ async projectsLocationsServicesList(parent: string, opts: ProjectsLocationsServicesListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v1beta/${ parent }/services`); if (opts.filter !== undefined) { url.searchParams.append("filter", String(opts.filter)); } if (opts.orderBy !== undefined) { url.searchParams.append("orderBy", String(opts.orderBy)); } if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as ListServicesResponse; } /** * Updates the parameters of a single Service. * * @param name Identifier. The relative resource name of the Firebase Data Connect service, in the format: ``` projects/{project}/locations/{location}/services/{service} ``` Note that the service ID is specific to Firebase Data Connect and does not correspond to any of the instance IDs of the underlying data source connections. */ async projectsLocationsServicesPatch(name: string, req: Service, opts: ProjectsLocationsServicesPatchOptions = {}): Promise { opts = serializeProjectsLocationsServicesPatchOptions(opts); const url = new URL(`${this.#baseUrl}v1beta/${ name }`); if (opts.allowMissing !== undefined) { url.searchParams.append("allowMissing", String(opts.allowMissing)); } if (opts.requestId !== undefined) { url.searchParams.append("requestId", String(opts.requestId)); } if (opts.updateMask !== undefined) { url.searchParams.append("updateMask", String(opts.updateMask)); } if (opts.validateOnly !== undefined) { url.searchParams.append("validateOnly", String(opts.validateOnly)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PATCH", body, }); return data as Operation; } /** * Creates a new Schema in a given project and location. Only creation of * `schemas/main` is supported and calling create with any other schema ID * will result in an error. * * @param parent Required. Value for parent. */ async projectsLocationsServicesSchemasCreate(parent: string, req: Schema, opts: ProjectsLocationsServicesSchemasCreateOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v1beta/${ parent }/schemas`); if (opts.requestId !== undefined) { url.searchParams.append("requestId", String(opts.requestId)); } if (opts.schemaId !== undefined) { url.searchParams.append("schemaId", String(opts.schemaId)); } if (opts.validateOnly !== undefined) { url.searchParams.append("validateOnly", String(opts.validateOnly)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as Operation; } /** * Deletes a single Schema. Because the schema and connectors must be * compatible at all times, if this is called while any connectors are active, * this will result in an error. * * @param name Required. The name of the schema to delete, in the format: ``` projects/{project}/locations/{location}/services/{service}/schemas/{schema} ``` */ async projectsLocationsServicesSchemasDelete(name: string, opts: ProjectsLocationsServicesSchemasDeleteOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v1beta/${ name }`); if (opts.allowMissing !== undefined) { url.searchParams.append("allowMissing", String(opts.allowMissing)); } if (opts.etag !== undefined) { url.searchParams.append("etag", String(opts.etag)); } if (opts.force !== undefined) { url.searchParams.append("force", String(opts.force)); } if (opts.requestId !== undefined) { url.searchParams.append("requestId", String(opts.requestId)); } if (opts.validateOnly !== undefined) { url.searchParams.append("validateOnly", String(opts.validateOnly)); } const data = await request(url.href, { client: this.#client, method: "DELETE", }); return data as Operation; } /** * Gets details of a single Schema. * * @param name Required. The name of the schema to retrieve, in the format: ``` projects/{project}/locations/{location}/services/{service}/schemas/{schema} ``` */ async projectsLocationsServicesSchemasGet(name: string): Promise { const url = new URL(`${this.#baseUrl}v1beta/${ name }`); const data = await request(url.href, { client: this.#client, method: "GET", }); return data as Schema; } /** * Lists Schemas in a given project and location. Note that only * `schemas/main` is supported, so this will always return at most one Schema. * * @param parent Required. Value of parent. */ async projectsLocationsServicesSchemasList(parent: string, opts: ProjectsLocationsServicesSchemasListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v1beta/${ parent }/schemas`); if (opts.filter !== undefined) { url.searchParams.append("filter", String(opts.filter)); } if (opts.orderBy !== undefined) { url.searchParams.append("orderBy", String(opts.orderBy)); } if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as ListSchemasResponse; } /** * Updates the parameters of a single Schema, and creates a new * SchemaRevision with the updated Schema. * * @param name Identifier. The relative resource name of the schema, in the format: ``` projects/{project}/locations/{location}/services/{service}/schemas/{schema} ``` Right now, the only supported schema is "main". */ async projectsLocationsServicesSchemasPatch(name: string, req: Schema, opts: ProjectsLocationsServicesSchemasPatchOptions = {}): Promise { opts = serializeProjectsLocationsServicesSchemasPatchOptions(opts); const url = new URL(`${this.#baseUrl}v1beta/${ name }`); if (opts.allowMissing !== undefined) { url.searchParams.append("allowMissing", String(opts.allowMissing)); } if (opts.requestId !== undefined) { url.searchParams.append("requestId", String(opts.requestId)); } if (opts.updateMask !== undefined) { url.searchParams.append("updateMask", String(opts.updateMask)); } if (opts.validateOnly !== undefined) { url.searchParams.append("validateOnly", String(opts.validateOnly)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PATCH", body, }); return data as Operation; } } /** * The request message for Operations.CancelOperation. */ export interface CancelOperationRequest { } /** * Settings for CloudSQL instance configuration. */ export interface CloudSqlInstance { /** * Required. Name of the CloudSQL instance, in the format: ``` * projects/{project}/locations/{location}/instances/{instance} ``` */ instance?: string; } /** * Connector consists of a set of operations, i.e. queries and mutations. */ export interface Connector { /** * Optional. Stores small amounts of arbitrary data. */ annotations?: { [key: string]: string }; /** * Output only. [Output only] Create time stamp. */ readonly createTime?: Date; /** * Optional. Mutable human-readable name. 63 character limit. */ displayName?: string; /** * Output only. This checksum is computed by the server based on the value of * other fields, and may be sent on update and delete requests to ensure the * client has an up-to-date value before proceeding. * [AIP-154](https://google.aip.dev/154) */ readonly etag?: string; /** * Optional. Labels as key value pairs. */ labels?: { [key: string]: string }; /** * Identifier. The relative resource name of the connector, in the format: * ``` * projects/{project}/locations/{location}/services/{service}/connectors/{connector} * ``` */ name?: string; /** * Output only. A field that if true, indicates that the system is working to * compile and deploy the connector. */ readonly reconciling?: boolean; /** * Required. The source files that comprise the connector. */ source?: Source; /** * Output only. System-assigned, unique identifier. */ readonly uid?: string; /** * Output only. [Output only] Update time stamp. */ readonly updateTime?: Date; } /** * A data source that backs Firebase Data Connect services. */ export interface Datasource { /** * PostgreSQL configurations. */ postgresql?: PostgreSql; } /** * A generic empty message that you can re-use to avoid defining duplicated * empty messages in your APIs. A typical example is to use it as the request or * the response type of an API method. For instance: service Foo { rpc * Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } */ export interface Empty { } /** * The ExecuteMutation request to Firebase Data Connect. */ export interface ExecuteMutationRequest { /** * Required. The name of the GraphQL operation name. Required because all * Connector operations must be named. See * https://graphql.org/learn/queries/#operation-name. */ operationName?: string; /** * Optional. Values for GraphQL variables provided in this request. */ variables?: { [key: string]: any }; } /** * The ExecuteMutation response from Firebase Data Connect. */ export interface ExecuteMutationResponse { /** * The result of executing the requested operation. */ data?: { [key: string]: any }; /** * Errors of this response. */ errors?: GraphqlError[]; } /** * The ExecuteQuery request to Firebase Data Connect. */ export interface ExecuteQueryRequest { /** * Required. The name of the GraphQL operation name. Required because all * Connector operations must be named. See * https://graphql.org/learn/queries/#operation-name. */ operationName?: string; /** * Optional. Values for GraphQL variables provided in this request. */ variables?: { [key: string]: any }; } /** * The ExecuteQuery response from Firebase Data Connect. */ export interface ExecuteQueryResponse { /** * The result of executing the requested operation. */ data?: { [key: string]: any }; /** * Errors of this response. */ errors?: GraphqlError[]; } /** * Individual files. */ export interface File { /** * Required. The file's textual content. */ content?: string; /** * Required. The file name including folder path, if applicable. The path * should be relative to a local workspace (e.g. * dataconnect/(schema|connector)/*.gql) and not an absolute path (e.g. * /absolute/path/(schema|connector)/*.gql). */ path?: string; } /** * GraphqlError conforms to the GraphQL error spec. * https://spec.graphql.org/draft/#sec-Errors Firebase Data Connect API surfaces * `GraphqlError` in various APIs: - Upon compile error, `UpdateSchema` and * `UpdateConnector` return Code.Invalid_Argument with a list of `GraphqlError` * in error details. - Upon query compile error, `ExecuteGraphql` and * `ExecuteGraphqlRead` return Code.OK with a list of `GraphqlError` in response * body. - Upon query execution error, `ExecuteGraphql`, `ExecuteGraphqlRead`, * `ExecuteMutation` and `ExecuteQuery` all return Code.OK with a list of * `GraphqlError` in response body. */ export interface GraphqlError { /** * Additional error information. */ extensions?: GraphqlErrorExtensions; /** * The source locations where the error occurred. Locations should help * developers and toolings identify the source of error quickly. Included in * admin endpoints (`ExecuteGraphql`, `ExecuteGraphqlRead`, `UpdateSchema` and * `UpdateConnector`) to reference the provided GraphQL GQL document. Omitted * in `ExecuteMutation` and `ExecuteQuery` since the caller shouldn't have * access access the underlying GQL source. */ locations?: SourceLocation[]; /** * The detailed error message. The message should help developer understand * the underlying problem without leaking internal data. */ message?: string; /** * The result field which could not be populated due to error. Clients can * use path to identify whether a null result is intentional or caused by a * runtime error. It should be a list of string or index from the root of * GraphQL query document. */ path?: any[]; } /** * GraphqlErrorExtensions contains additional information of `GraphqlError`. */ export interface GraphqlErrorExtensions { /** * The source file name where the error occurred. Included only for * `UpdateSchema` and `UpdateConnector`, it corresponds to `File.path` of the * provided `Source`. */ file?: string; } /** * The GraphQL request to Firebase Data Connect. It strives to match the * GraphQL over HTTP spec. * https://github.com/graphql/graphql-over-http/blob/main/spec/GraphQLOverHTTP.md#post */ export interface GraphqlRequest { /** * Optional. Additional GraphQL request information. */ extensions?: GraphqlRequestExtensions; /** * Optional. The name of the GraphQL operation name. Required only if `query` * contains multiple operations. See * https://graphql.org/learn/queries/#operation-name. */ operationName?: string; /** * Required. The GraphQL query document source. */ query?: string; /** * Optional. Values for GraphQL variables provided in this request. */ variables?: { [key: string]: any }; } /** * GraphqlRequestExtensions contains additional information of * `GraphqlRequest`. */ export interface GraphqlRequestExtensions { /** * Optional. If set, impersonate a request with given Firebase Auth context * and evaluate the auth policies on the operation. If omitted, bypass any * defined auth policies. */ impersonate?: Impersonation; } /** * The GraphQL response from Firebase Data Connect. It strives to match the * GraphQL over HTTP spec. Note: Firebase Data Connect always responds with * `Content-Type: application/json`. * https://github.com/graphql/graphql-over-http/blob/main/spec/GraphQLOverHTTP.md#body */ export interface GraphqlResponse { /** * The result of the execution of the requested operation. If an error was * raised before execution begins, the data entry should not be present in the * result. (a request error: * https://spec.graphql.org/draft/#sec-Errors.Request-Errors) If an error was * raised during the execution that prevented a valid response, the data entry * in the response should be null. (a field error: * https://spec.graphql.org/draft/#sec-Errors.Error-Result-Format) */ data?: { [key: string]: any }; /** * Errors of this response. If the data entry in the response is not present, * the errors entry must be present. It conforms to * https://spec.graphql.org/draft/#sec-Errors. */ errors?: GraphqlError[]; } /** * Impersonation configures the Firebase Auth context to impersonate. */ export interface Impersonation { /** * Evaluate the auth policy with a customized JWT auth token. Should follow * the Firebase Auth token format. * https://firebase.google.com/docs/rules/rules-and-auth For example: a * verified user may have auth_claims of {"sub": , "email_verified": true} */ authClaims?: { [key: string]: any }; /** * Evaluate the auth policy as an unauthenticated request. Can only be set to * true. */ unauthenticated?: boolean; } /** * Message for response to listing Connectors. By default, `connectors.source` * will not be included in the response. To specify the fields included in the * response, the response field mask can be provided by using the query * parameter `$fields` or the header `X-Goog-FieldMask`. */ export interface ListConnectorsResponse { /** * The list of Connectors. */ connectors?: Connector[]; /** * A token, which can be sent as `page_token` to retrieve the next page. If * this field is omitted, there are no subsequent pages. */ nextPageToken?: string; /** * Locations that could not be reached. */ unreachable?: string[]; } /** * The response message for Locations.ListLocations. */ export interface ListLocationsResponse { /** * A list of locations that matches the specified filter in the request. */ locations?: Location[]; /** * The standard List next-page token. */ nextPageToken?: string; } /** * The response message for Operations.ListOperations. */ export interface ListOperationsResponse { /** * The standard List next-page token. */ nextPageToken?: string; /** * A list of operations that matches the specified filter in the request. */ operations?: Operation[]; } /** * Message for response to listing Schemas. By default, `schemas.source` will * not be included in the response. To specify the fields included in the * response, the response field mask can be provided by using the query * parameter `$fields` or the header `X-Goog-FieldMask`. */ export interface ListSchemasResponse { /** * A token, which can be sent as `page_token` to retrieve the next page. If * this field is omitted, there are no subsequent pages. */ nextPageToken?: string; /** * The list of Schemas. */ schemas?: Schema[]; /** * Locations that could not be reached. */ unreachable?: string[]; } /** * Message for response to listing Services. */ export interface ListServicesResponse { /** * A token, which can be sent as `page_token` to retrieve the next page. If * this field is omitted, there are no subsequent pages. */ nextPageToken?: string; /** * The list of Services. */ services?: Service[]; /** * Locations that could not be reached. */ unreachable?: string[]; } /** * A resource that represents a Google Cloud location. */ export interface Location { /** * The friendly name for this location, typically a nearby city name. For * example, "Tokyo". */ displayName?: string; /** * Cross-service attributes for the location. For example * {"cloud.googleapis.com/region": "us-east1"} */ labels?: { [key: string]: string }; /** * The canonical id for this location. For example: `"us-east1"`. */ locationId?: string; /** * Service-specific metadata. For example the available capacity at the given * location. */ metadata?: { [key: string]: any }; /** * Resource name for the location, which may vary between implementations. * For example: `"projects/example-project/locations/us-east1"` */ name?: string; } /** * This resource represents a long-running operation that is the result of a * network API call. */ export interface Operation { /** * If the value is `false`, it means the operation is still in progress. If * `true`, the operation is completed, and either `error` or `response` is * available. */ done?: boolean; /** * The error result of the operation in case of failure or cancellation. */ error?: Status; /** * Service-specific metadata associated with the operation. It typically * contains progress information and common metadata such as create time. Some * services might not provide such metadata. Any method that returns a * long-running operation should document the metadata type, if any. */ metadata?: { [key: string]: any }; /** * The server-assigned name, which is only unique within the same service * that originally returns it. If you use the default HTTP mapping, the `name` * should be a resource name ending with `operations/{unique_id}`. */ name?: string; /** * The normal, successful response of the operation. If the original method * returns no data on success, such as `Delete`, the response is * `google.protobuf.Empty`. If the original method is standard * `Get`/`Create`/`Update`, the response should be the resource. For other * methods, the response should have the type `XxxResponse`, where `Xxx` is * the original method name. For example, if the original method name is * `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`. */ response?: { [key: string]: any }; } /** * Represents the metadata of the long-running operation. Note: This message is * auto-generated by CCFE. CCFE's storage, called Resource Metadata Store (RMS), * holds metadata about long-running operations (i.e. OperationMetadata) and * resources (i.e. ResourceMetadata). OperationMetadata documents the status of * the operation. See [CCFE documentation for sidechannel * data](https://g3doc.corp.google.com/cloud/control2/g3doc/dev/codelab_extras/sidechannel.md?cl=head#sidechannel-data) * and yaqs/4289526912465764352. */ export interface OperationMetadata { /** * Output only. API version used to start the operation. */ readonly apiVersion?: string; /** * Output only. The time the operation was created. */ readonly createTime?: Date; /** * Output only. The time the operation finished running. */ readonly endTime?: Date; /** * Output only. Identifies whether the user has requested cancellation of the * operation. Operations that have been cancelled successfully have * Operation.error value with a google.rpc.Status.code of 1, corresponding to * `Code.CANCELLED`. */ readonly requestedCancellation?: boolean; /** * Output only. Human-readable status of the operation, if any. */ readonly statusMessage?: string; /** * Output only. Server-defined resource path for the target of the operation. */ readonly target?: string; /** * Output only. Name of the verb executed by the operation. */ readonly verb?: string; } /** * Settings for PostgreSQL data source. */ export interface PostgreSql { /** * Cloud SQL configurations. */ cloudSql?: CloudSqlInstance; /** * Required. Name of the PostgreSQL database. */ database?: string; /** * Optional. Configure how much Postgresql schema validation to perform. * Default to `STRICT` if not specified. */ schemaValidation?: | "SQL_SCHEMA_VALIDATION_UNSPECIFIED" | "NONE" | "STRICT" | "COMPATIBLE"; /** * No Postgres data source is linked. If set, don't allow `database` and * `schema_validation` to be configured. */ unlinked?: boolean; } /** * Additional options for FirebaseDataConnect#projectsLocationsList. */ export interface ProjectsLocationsListOptions { /** * A filter to narrow down results to a preferred subset. The filtering * language accepts strings like `"displayName=tokyo"`, and is documented in * more detail in [AIP-160](https://google.aip.dev/160). */ filter?: string; /** * The maximum number of results to return. If not set, the service selects a * default. */ pageSize?: number; /** * A page token received from the `next_page_token` field in the response. * Send that page token to receive the subsequent page. */ pageToken?: string; } /** * Additional options for FirebaseDataConnect#projectsLocationsOperationsList. */ export interface ProjectsLocationsOperationsListOptions { /** * The standard list filter. */ filter?: string; /** * The standard list page size. */ pageSize?: number; /** * The standard list page token. */ pageToken?: string; } /** * Additional options for * FirebaseDataConnect#projectsLocationsServicesConnectorsCreate. */ export interface ProjectsLocationsServicesConnectorsCreateOptions { /** * Required. The ID to use for the connector, which will become the final * component of the connector's resource name. */ connectorId?: string; /** * Optional. An optional request ID to identify requests. Specify a unique * request ID so that if you must retry your request, the server will know to * ignore the request if it has already been completed. The server will * guarantee that for at least 60 minutes since the first request. For * example, consider a situation where you make an initial request and the * request times out. If you make the request again with the same request ID, * the server can check if original operation with the same request ID was * received, and if so, will ignore the second request. This prevents clients * from accidentally creating duplicate commitments. The request ID must be a * valid UUID with the exception that zero UUID is not supported * (00000000-0000-0000-0000-000000000000). */ requestId?: string; /** * Optional. If set, validate the request and preview the Connector, but do * not actually create it. */ validateOnly?: boolean; } /** * Additional options for * FirebaseDataConnect#projectsLocationsServicesConnectorsDelete. */ export interface ProjectsLocationsServicesConnectorsDeleteOptions { /** * Optional. If true and the Connector is not found, the request will succeed * but no action will be taken on the server. */ allowMissing?: boolean; /** * Optional. The etag of the Connector. If this is provided, it must match * the server's etag. */ etag?: string; /** * Optional. If set to true, any child resources (i.e. ConnectorRevisions) * will also be deleted. Otherwise, the request will only work if the * Connector has no child resources. */ force?: boolean; /** * Optional. An optional request ID to identify requests. Specify a unique * request ID so that if you must retry your request, the server will know to * ignore the request if it has already been completed. The server will * guarantee that for at least 60 minutes after the first request. For * example, consider a situation where you make an initial request and the * request times out. If you make the request again with the same request ID, * the server can check if original operation with the same request ID was * received, and if so, will ignore the second request. This prevents clients * from accidentally creating duplicate commitments. The request ID must be a * valid UUID with the exception that zero UUID is not supported * (00000000-0000-0000-0000-000000000000). */ requestId?: string; /** * Optional. If set, validate the request and preview the Connector, but do * not actually delete it. */ validateOnly?: boolean; } /** * Additional options for * FirebaseDataConnect#projectsLocationsServicesConnectorsList. */ export interface ProjectsLocationsServicesConnectorsListOptions { /** * Optional. Filtering results. */ filter?: string; /** * Optional. Hint for how to order the results. */ orderBy?: string; /** * Optional. Requested page size. Server may return fewer items than * requested. If unspecified, server will pick an appropriate default. */ pageSize?: number; /** * Optional. A page token, received from a previous `ListConnectors` call. * Provide this to retrieve the subsequent page. When paginating, all other * parameters provided to `ListConnectors` must match the call that provided * the page token. */ pageToken?: string; } /** * Additional options for * FirebaseDataConnect#projectsLocationsServicesConnectorsPatch. */ export interface ProjectsLocationsServicesConnectorsPatchOptions { /** * Optional. If true and the Connector is not found, a new Connector will be * created. In this case, `update_mask` is ignored. */ allowMissing?: boolean; /** * Optional. An optional request ID to identify requests. Specify a unique * request ID so that if you must retry your request, the server will know to * ignore the request if it has already been completed. The server will * guarantee that for at least 60 minutes since the first request. For * example, consider a situation where you make an initial request and the * request times out. If you make the request again with the same request ID, * the server can check if original operation with the same request ID was * received, and if so, will ignore the second request. This prevents clients * from accidentally creating duplicate commitments. The request ID must be a * valid UUID with the exception that zero UUID is not supported * (00000000-0000-0000-0000-000000000000). */ requestId?: string; /** * Optional. Field mask is used to specify the fields to be overwritten in * the Connector resource by the update. The fields specified in the * update_mask are relative to the resource, not the full request. A field * will be overwritten if it is in the mask. If the user does not provide a * mask then all fields will be overwritten. */ updateMask?: string /* FieldMask */; /** * Optional. If set, validate the request and preview the Connector, but do * not actually update it. */ validateOnly?: boolean; } function serializeProjectsLocationsServicesConnectorsPatchOptions(data: any): ProjectsLocationsServicesConnectorsPatchOptions { return { ...data, updateMask: data["updateMask"] !== undefined ? data["updateMask"] : undefined, }; } function deserializeProjectsLocationsServicesConnectorsPatchOptions(data: any): ProjectsLocationsServicesConnectorsPatchOptions { return { ...data, updateMask: data["updateMask"] !== undefined ? data["updateMask"] : undefined, }; } /** * Additional options for FirebaseDataConnect#projectsLocationsServicesCreate. */ export interface ProjectsLocationsServicesCreateOptions { /** * Optional. An optional request ID to identify requests. Specify a unique * request ID so that if you must retry your request, the server will know to * ignore the request if it has already been completed. The server will * guarantee that for at least 60 minutes since the first request. For * example, consider a situation where you make an initial request and the * request times out. If you make the request again with the same request ID, * the server can check if original operation with the same request ID was * received, and if so, will ignore the second request. This prevents clients * from accidentally creating duplicate commitments. The request ID must be a * valid UUID with the exception that zero UUID is not supported * (00000000-0000-0000-0000-000000000000). */ requestId?: string; /** * Required. The ID to use for the service, which will become the final * component of the service's resource name. */ serviceId?: string; /** * Optional. If set, validate the request and preview the Service, but do not * actually create it. */ validateOnly?: boolean; } /** * Additional options for FirebaseDataConnect#projectsLocationsServicesDelete. */ export interface ProjectsLocationsServicesDeleteOptions { /** * Optional. If true and the Service is not found, the request will succeed * but no action will be taken on the server. */ allowMissing?: boolean; /** * Optional. The etag of the Service. If this is provided, it must match the * server's etag. */ etag?: string; /** * Optional. If set to true, any child resources (i.e. Schema, * SchemaRevisions, Connectors, and ConnectorRevisions) will also be deleted. * Otherwise, the request will only work if the Service has no child * resources. */ force?: boolean; /** * Optional. An optional request ID to identify requests. Specify a unique * request ID so that if you must retry your request, the server will know to * ignore the request if it has already been completed. The server will * guarantee that for at least 60 minutes after the first request. For * example, consider a situation where you make an initial request and the * request times out. If you make the request again with the same request ID, * the server can check if original operation with the same request ID was * received, and if so, will ignore the second request. This prevents clients * from accidentally creating duplicate commitments. The request ID must be a * valid UUID with the exception that zero UUID is not supported * (00000000-0000-0000-0000-000000000000). */ requestId?: string; /** * Optional. If set, validate the request and preview the Service, but do not * actually delete it. */ validateOnly?: boolean; } /** * Additional options for FirebaseDataConnect#projectsLocationsServicesList. */ export interface ProjectsLocationsServicesListOptions { /** * Optional. Filtering results. */ filter?: string; /** * Optional. Hint for how to order the results. */ orderBy?: string; /** * Optional. Requested page size. Server may return fewer items than * requested. If unspecified, server will pick an appropriate default. */ pageSize?: number; /** * Optional. A page token, received from a previous `ListServices` call. * Provide this to retrieve the subsequent page. When paginating, all other * parameters provided to `ListServices` must match the call that provided the * page token. */ pageToken?: string; } /** * Additional options for FirebaseDataConnect#projectsLocationsServicesPatch. */ export interface ProjectsLocationsServicesPatchOptions { /** * Optional. If true and the Service is not found, a new Service will be * created. In this case, `update_mask` is ignored. */ allowMissing?: boolean; /** * Optional. An optional request ID to identify requests. Specify a unique * request ID so that if you must retry your request, the server will know to * ignore the request if it has already been completed. The server will * guarantee that for at least 60 minutes since the first request. For * example, consider a situation where you make an initial request and the * request times out. If you make the request again with the same request ID, * the server can check if original operation with the same request ID was * received, and if so, will ignore the second request. This prevents clients * from accidentally creating duplicate commitments. The request ID must be a * valid UUID with the exception that zero UUID is not supported * (00000000-0000-0000-0000-000000000000). */ requestId?: string; /** * Optional. Field mask is used to specify the fields to be overwritten in * the Service resource by the update. The fields specified in the update_mask * are relative to the resource, not the full request. A field will be * overwritten if it is in the mask. If the user does not provide a mask then * all fields will be overwritten. */ updateMask?: string /* FieldMask */; /** * Optional. If set, validate the request and preview the Service, but do not * actually update it. */ validateOnly?: boolean; } function serializeProjectsLocationsServicesPatchOptions(data: any): ProjectsLocationsServicesPatchOptions { return { ...data, updateMask: data["updateMask"] !== undefined ? data["updateMask"] : undefined, }; } function deserializeProjectsLocationsServicesPatchOptions(data: any): ProjectsLocationsServicesPatchOptions { return { ...data, updateMask: data["updateMask"] !== undefined ? data["updateMask"] : undefined, }; } /** * Additional options for * FirebaseDataConnect#projectsLocationsServicesSchemasCreate. */ export interface ProjectsLocationsServicesSchemasCreateOptions { /** * Optional. An optional request ID to identify requests. Specify a unique * request ID so that if you must retry your request, the server will know to * ignore the request if it has already been completed. The server will * guarantee that for at least 60 minutes since the first request. For * example, consider a situation where you make an initial request and the * request times out. If you make the request again with the same request ID, * the server can check if original operation with the same request ID was * received, and if so, will ignore the second request. This prevents clients * from accidentally creating duplicate commitments. The request ID must be a * valid UUID with the exception that zero UUID is not supported * (00000000-0000-0000-0000-000000000000). */ requestId?: string; /** * Required. The ID to use for the schema, which will become the final * component of the schema's resource name. Currently, only `main` is * supported and any other schema ID will result in an error. */ schemaId?: string; /** * Optional. If set, validate the request and preview the Schema, but do not * actually update it. */ validateOnly?: boolean; } /** * Additional options for * FirebaseDataConnect#projectsLocationsServicesSchemasDelete. */ export interface ProjectsLocationsServicesSchemasDeleteOptions { /** * Optional. If true and the Schema is not found, the request will succeed * but no action will be taken on the server. */ allowMissing?: boolean; /** * Optional. The etag of the Schema. If this is provided, it must match the * server's etag. */ etag?: string; /** * Optional. If set to true, any child resources (i.e. SchemaRevisions) will * also be deleted. */ force?: boolean; /** * Optional. An optional request ID to identify requests. Specify a unique * request ID so that if you must retry your request, the server will know to * ignore the request if it has already been completed. The server will * guarantee that for at least 60 minutes after the first request. For * example, consider a situation where you make an initial request and the * request times out. If you make the request again with the same request ID, * the server can check if original operation with the same request ID was * received, and if so, will ignore the second request. This prevents clients * from accidentally creating duplicate commitments. The request ID must be a * valid UUID with the exception that zero UUID is not supported * (00000000-0000-0000-0000-000000000000). */ requestId?: string; /** * Optional. If set, validate the request and preview the Schema, but do not * actually delete it. */ validateOnly?: boolean; } /** * Additional options for * FirebaseDataConnect#projectsLocationsServicesSchemasList. */ export interface ProjectsLocationsServicesSchemasListOptions { /** * Optional. Filtering results. */ filter?: string; /** * Optional. Hint for how to order the results. */ orderBy?: string; /** * Optional. Requested page size. Server may return fewer items than * requested. If unspecified, server will pick an appropriate default. */ pageSize?: number; /** * Optional. A page token, received from a previous `ListSchemas` call. * Provide this to retrieve the subsequent page. When paginating, all other * parameters provided to `ListSchemas` must match the call that provided the * page token. */ pageToken?: string; } /** * Additional options for * FirebaseDataConnect#projectsLocationsServicesSchemasPatch. */ export interface ProjectsLocationsServicesSchemasPatchOptions { /** * Optional. If true and the Schema is not found, a new Schema will be * created. In this case, `update_mask` is ignored. */ allowMissing?: boolean; /** * Optional. An optional request ID to identify requests. Specify a unique * request ID so that if you must retry your request, the server will know to * ignore the request if it has already been completed. The server will * guarantee that for at least 60 minutes since the first request. For * example, consider a situation where you make an initial request and the * request times out. If you make the request again with the same request ID, * the server can check if original operation with the same request ID was * received, and if so, will ignore the second request. This prevents clients * from accidentally creating duplicate commitments. The request ID must be a * valid UUID with the exception that zero UUID is not supported * (00000000-0000-0000-0000-000000000000). */ requestId?: string; /** * Optional. Field mask is used to specify the fields to be overwritten in * the Schema resource by the update. The fields specified in the update_mask * are relative to the resource, not the full request. A field will be * overwritten if it is in the mask. If the user does not provide a mask then * all fields will be overwritten. */ updateMask?: string /* FieldMask */; /** * Optional. If set, validate the request and preview the Schema, but do not * actually update it. */ validateOnly?: boolean; } function serializeProjectsLocationsServicesSchemasPatchOptions(data: any): ProjectsLocationsServicesSchemasPatchOptions { return { ...data, updateMask: data["updateMask"] !== undefined ? data["updateMask"] : undefined, }; } function deserializeProjectsLocationsServicesSchemasPatchOptions(data: any): ProjectsLocationsServicesSchemasPatchOptions { return { ...data, updateMask: data["updateMask"] !== undefined ? data["updateMask"] : undefined, }; } /** * The application schema of a Firebase Data Connect service. */ export interface Schema { /** * Optional. Stores small amounts of arbitrary data. */ annotations?: { [key: string]: string }; /** * Output only. [Output only] Create time stamp. */ readonly createTime?: Date; /** * Required. The data sources linked in the schema. */ datasources?: Datasource[]; /** * Optional. Mutable human-readable name. 63 character limit. */ displayName?: string; /** * Output only. This checksum is computed by the server based on the value of * other fields, and may be sent on update and delete requests to ensure the * client has an up-to-date value before proceeding. * [AIP-154](https://google.aip.dev/154) */ readonly etag?: string; /** * Optional. Labels as key value pairs. */ labels?: { [key: string]: string }; /** * Identifier. The relative resource name of the schema, in the format: ``` * projects/{project}/locations/{location}/services/{service}/schemas/{schema} * ``` Right now, the only supported schema is "main". */ name?: string; /** * Output only. A field that if true, indicates that the system is working to * compile and deploy the schema. */ readonly reconciling?: boolean; /** * Required. The source files that comprise the application schema. */ source?: Source; /** * Output only. System-assigned, unique identifier. */ readonly uid?: string; /** * Output only. [Output only] Update time stamp. */ readonly updateTime?: Date; } /** * A Firebase Data Connect service. */ export interface Service { /** * Optional. Stores small amounts of arbitrary data. */ annotations?: { [key: string]: string }; /** * Output only. [Output only] Create time stamp. */ readonly createTime?: Date; /** * Optional. Mutable human-readable name. 63 character limit. */ displayName?: string; /** * Output only. This checksum is computed by the server based on the value of * other fields, and may be sent on update and delete requests to ensure the * client has an up-to-date value before proceeding. * [AIP-154](https://google.aip.dev/154) */ readonly etag?: string; /** * Optional. Labels as key value pairs. */ labels?: { [key: string]: string }; /** * Identifier. The relative resource name of the Firebase Data Connect * service, in the format: ``` * projects/{project}/locations/{location}/services/{service} ``` Note that * the service ID is specific to Firebase Data Connect and does not correspond * to any of the instance IDs of the underlying data source connections. */ name?: string; /** * Output only. A field that if true, indicates that the system is working * update the service. */ readonly reconciling?: boolean; /** * Output only. System-assigned, unique identifier. */ readonly uid?: string; /** * Output only. [Output only] Update time stamp. */ readonly updateTime?: Date; } /** * Used to represent a set of source files. */ export interface Source { /** * Required. The files that comprise the source set. */ files?: File[]; } /** * SourceLocation references a location in a GraphQL source. */ export interface SourceLocation { /** * Column number starting at 1. */ column?: number; /** * Line number starting at 1. */ line?: number; } /** * The `Status` type defines a logical error model that is suitable for * different programming environments, including REST APIs and RPC APIs. It is * used by [gRPC](https://github.com/grpc). Each `Status` message contains three * pieces of data: error code, error message, and error details. You can find * out more about this error model and how to work with it in the [API Design * Guide](https://cloud.google.com/apis/design/errors). */ export interface Status { /** * The status code, which should be an enum value of google.rpc.Code. */ code?: number; /** * A list of messages that carry the error details. There is a common set of * message types for APIs to use. */ details?: { [key: string]: any }[]; /** * A developer-facing error message, which should be in English. Any * user-facing error message should be localized and sent in the * google.rpc.Status.details field, or localized by the client. */ message?: string; }