functions-api-client-internal.d.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*! firebase-admin v12.1.1 */
  2. /*!
  3. * @license
  4. * Copyright 2021 Google Inc.
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the "License");
  7. * you may not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. import { PrefixedFirebaseError } from '../utils/error';
  19. /**
  20. * Task is a limited subset of https://cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues.tasks#resource:-task
  21. * containing the relevant fields for enqueueing tasks that tirgger Cloud Functions.
  22. */
  23. export interface Task {
  24. name?: string;
  25. scheduleTime?: string;
  26. dispatchDeadline?: string;
  27. httpRequest: {
  28. url: string;
  29. oidcToken?: {
  30. serviceAccountEmail: string;
  31. };
  32. body: string;
  33. headers: {
  34. [key: string]: string;
  35. };
  36. };
  37. }
  38. export declare const FUNCTIONS_ERROR_CODE_MAPPING: {
  39. [key: string]: FunctionsErrorCode;
  40. };
  41. export type FunctionsErrorCode = 'aborted' | 'invalid-argument' | 'invalid-credential' | 'internal-error' | 'failed-precondition' | 'permission-denied' | 'unauthenticated' | 'not-found' | 'unknown-error' | 'task-already-exists';
  42. /**
  43. * Firebase Functions error code structure. This extends PrefixedFirebaseError.
  44. *
  45. * @param code - The error code.
  46. * @param message - The error message.
  47. * @constructor
  48. */
  49. export declare class FirebaseFunctionsError extends PrefixedFirebaseError {
  50. constructor(code: FunctionsErrorCode, message: string);
  51. }