@amerged/ohmyhost-sdk 0.1.40 → 0.1.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -60,6 +60,8 @@ import type {
60
60
  CreateOrganizationResponses,
61
61
  CreateProjectDatabaseAccessErrors,
62
62
  CreateProjectDatabaseAccessResponses,
63
+ CreateProjectDatabaseWebhookErrors,
64
+ CreateProjectDatabaseWebhookResponses,
63
65
  CreateProjectDataChangeErrors,
64
66
  CreateProjectDataChangeResponses,
65
67
  CreateProjectDevAccessTicketErrors,
@@ -74,6 +76,8 @@ import type {
74
76
  CreateWorkspaceMailDomainErrors,
75
77
  CreateWorkspaceMailDomainRequest,
76
78
  CreateWorkspaceMailDomainResponses,
79
+ DatabaseScheduleSetRequest,
80
+ DatabaseWebhookCreateRequest,
77
81
  DeclareApplicationDomainIdentityErrors,
78
82
  DeclareApplicationDomainIdentityResponses,
79
83
  DeleteEnvironmentSecretErrors,
@@ -82,6 +86,10 @@ import type {
82
86
  DeleteManagedMailDomainResponses,
83
87
  DeletePaidProjectDomainErrors,
84
88
  DeletePaidProjectDomainResponses,
89
+ DeleteProjectDatabaseScheduleErrors,
90
+ DeleteProjectDatabaseScheduleResponses,
91
+ DeleteProjectDatabaseWebhookErrors,
92
+ DeleteProjectDatabaseWebhookResponses,
85
93
  DeleteProjectErrors,
86
94
  DeleteProjectResponses,
87
95
  DetachProjectMailDomainBindingErrors,
@@ -143,6 +151,12 @@ import type {
143
151
  GetProjectContextResponses,
144
152
  GetProjectCreditBudgetErrors,
145
153
  GetProjectCreditBudgetResponses,
154
+ GetProjectDatabaseExecutionUsageErrors,
155
+ GetProjectDatabaseExecutionUsageResponses,
156
+ GetProjectDatabaseScheduleErrors,
157
+ GetProjectDatabaseScheduleResponses,
158
+ GetProjectDatabaseWebhookErrors,
159
+ GetProjectDatabaseWebhookResponses,
146
160
  GetProjectErrors,
147
161
  GetProjectExportErrors,
148
162
  GetProjectExportResponses,
@@ -186,6 +200,14 @@ import type {
186
200
  ListManagedSourceVersionsResponses,
187
201
  ListProjectDatabaseAccessErrors,
188
202
  ListProjectDatabaseAccessResponses,
203
+ ListProjectDatabaseScheduleRunsErrors,
204
+ ListProjectDatabaseScheduleRunsResponses,
205
+ ListProjectDatabaseSchedulesErrors,
206
+ ListProjectDatabaseSchedulesResponses,
207
+ ListProjectDatabaseWebhookDeliveriesErrors,
208
+ ListProjectDatabaseWebhookDeliveriesResponses,
209
+ ListProjectDatabaseWebhooksErrors,
210
+ ListProjectDatabaseWebhooksResponses,
189
211
  ListProjectsErrors,
190
212
  ListProjectsResponses,
191
213
  ListUserApiKeysErrors,
@@ -241,6 +263,8 @@ import type {
241
263
  RecordSignupSourceResponses,
242
264
  RegisterFeatureInterestErrors,
243
265
  RegisterFeatureInterestResponses,
266
+ ReplayProjectDatabaseWebhookDeliveryErrors,
267
+ ReplayProjectDatabaseWebhookDeliveryResponses,
244
268
  RestoreManagedSourceErrors,
245
269
  RestoreManagedSourceResponses,
246
270
  RetireWorkspaceMailDomainErrors,
@@ -265,11 +289,15 @@ import type {
265
289
  RollbackDeploymentResponses,
266
290
  RotateProjectDevShareLinkErrors,
267
291
  RotateProjectDevShareLinkResponses,
292
+ RunProjectDatabaseScheduleErrors,
293
+ RunProjectDatabaseScheduleResponses,
268
294
  SetDevAccessModeRequest,
269
295
  SetPoweredByFlagRequest,
270
296
  SetProjectCreditBudgetErrors,
271
297
  SetProjectCreditBudgetRequest,
272
298
  SetProjectCreditBudgetResponses,
299
+ SetProjectDatabaseScheduleErrors,
300
+ SetProjectDatabaseScheduleResponses,
273
301
  SetProjectDevAccessModeErrors,
274
302
  SetProjectDevAccessModeResponses,
275
303
  SetProjectNotesErrors,
@@ -289,6 +317,8 @@ import type {
289
317
  SubmitFeedbackResponses,
290
318
  SwitchManagedSourceErrors,
291
319
  SwitchManagedSourceResponses,
320
+ TestProjectDatabaseWebhookErrors,
321
+ TestProjectDatabaseWebhookResponses,
292
322
  Ulid,
293
323
  UserApiKeyId,
294
324
  VerifyApplicationDomainIdentityErrors,
@@ -1930,7 +1960,7 @@ export const createOrganization = <ThrowOnError extends boolean = true>(
1930
1960
  /**
1931
1961
  * Create or resume an owner's hosted Stripe Checkout
1932
1962
  *
1933
- * Returns a human payment URL, never charges a saved card. Paid is USD 10/month; each top-up pack is USD 10 before tax; a purchase grants 100 credits per dollar up to USD 100 and 125 credits per dollar for the part above, so 10 packs grant 10000 and 20 packs grant 22500 credits. Top-ups require active Paid access and have no time limit during uninterrupted Paid membership; remaining top-ups expire when the workspace returns to Free. Monthly Paid credits expire at billing-period end without rollover. Retry the same offer, packs and Idempotency-Key after uncertainty. Browser return is not payment proof; read this checkout and the organization balance. A conflicting or existing subscription returns billing_purchase_conflict (409); read the original checkout or request an owner billing portal URL instead of another purchase. Works at zero credits.
1963
+ * Returns a human payment URL, never charges a saved card. Paid is USD 10/month; each top-up pack is USD 10 before tax; a purchase grants 100 credits per dollar up to USD 100 and 125 credits per dollar for the part above, so 10 packs grant 10000 and 20 packs grant 22500 credits. Top-ups require active Paid access and never expire, also after the workspace returns to Free. Monthly Paid credits expire at billing-period end without rollover. Retry the same offer, packs and Idempotency-Key after uncertainty. Browser return is not payment proof; read this checkout and the organization balance. A conflicting or existing subscription returns billing_purchase_conflict (409); read the original checkout or request an owner billing portal URL instead of another purchase. Works at zero credits.
1934
1964
  */
1935
1965
  export const createBillingCheckout = <ThrowOnError extends boolean = true>(
1936
1966
  parameters: {
@@ -1983,7 +2013,7 @@ export const createBillingCheckout = <ThrowOnError extends boolean = true>(
1983
2013
  /**
1984
2014
  * Observe and reconcile an owner's original checkout
1985
2015
  *
1986
- * Reads Stripe and reconciles confirmed credits/refunds idempotently. payment_confirmed describes the original Checkout, not spendable credit or current Paid entitlement. Read organization credits for available funding and the organization account's effective plan for Paid coverage; paid_until is the paid Stripe period end, not the end of renewal grace. No new purchase intent or payment is created; an uncertain original Checkout can resume using its stored identity.
2016
+ * Reads Stripe and reconciles confirmed credits/refunds idempotently. payment_confirmed describes the original Checkout, not spendable credit or current Paid entitlement. Read organization credits for available funding and the organization account's effective plan for Paid coverage; paid_until is the end of paid coverage, the paid Stripe period end plus its 14-day renewal grace. No new purchase intent or payment is created; an uncertain original Checkout can resume using its stored identity.
1987
2017
  */
1988
2018
  export const getBillingCheckout = <ThrowOnError extends boolean = true>(
1989
2019
  parameters: {
@@ -2105,7 +2135,7 @@ export const getBillingRecharge = <ThrowOnError extends boolean = true>(
2105
2135
  /**
2106
2136
  * Enable or disable explicitly authorized auto-recharge
2107
2137
  *
2108
- * Owner-only. An agent must obtain explicit approval for off-session charges and the gross monthly spending cap before enabling. Each refill costs USD 9 before tax for 1000 top-up credits when available credits fall below 100. Active Paid access is required to enable recharge and initiate a payment; remaining refill credits expire on downgrade to Free. A saved Stripe card is required; follow setup_url if returned. Current revision prevents stale edits; retry the original Idempotency-Key and payload after uncertainty. Disable prevents new charge initiation; already initiated payments may complete. No subscription or Paid features are created.
2138
+ * Owner-only. An agent must obtain explicit approval for off-session charges and the gross monthly spending cap before enabling. Each refill costs USD 9 before tax for 1000 top-up credits when available credits fall below 100. Active Paid access is required to enable recharge and initiate a payment; bought credits never expire, also after a downgrade to Free. A saved Stripe card is required; follow setup_url if returned. Current revision prevents stale edits; retry the original Idempotency-Key and payload after uncertainty. Disable prevents new charge initiation; already initiated payments may complete. No subscription or Paid features are created.
2109
2139
  */
2110
2140
  export const configureBillingRecharge = <ThrowOnError extends boolean = true>(
2111
2141
  parameters: {
@@ -2162,7 +2192,7 @@ export const configureBillingRecharge = <ThrowOnError extends boolean = true>(
2162
2192
  /**
2163
2193
  * Read the owner's shared organization credit pool
2164
2194
  *
2165
- * Returns posted credits and reservations, in microcredits (one credit is 1000000 microcredits). Monthly entitlement posting is idempotent. Only the organization Owner may read this balance. active_meters names the currently billed sources; unreported usage is not included. platform_overrun_micros is recorded platform exposure, not customer debt. Remains available at zero credit.
2195
+ * Returns the spendable credit and the open reservations, in microcredits (one credit is 1000000 microcredits). available_micros is the monthly credit plus the one-time credit minus the reservations, never below zero. Only the organization Owner may read this balance. active_meters names the currently billed sources; usage that is not billed yet is not included. When the credit is used up, grace_started_at and grace_expires_at name the seven days that keep existing services running. Remains available at zero credit.
2166
2196
  */
2167
2197
  export const getOrganizationCredits = <ThrowOnError extends boolean = true>(
2168
2198
  parameters: {
@@ -2202,16 +2232,14 @@ export const getOrganizationCredits = <ThrowOnError extends boolean = true>(
2202
2232
  };
2203
2233
 
2204
2234
  /**
2205
- * Read monthly measured usage by project and meter
2235
+ * Read recent measured usage by day, project and meter
2206
2236
  *
2207
- * Owner-only event-month ledger totals, including signed corrections posted by as_of. Returns up to 20 projects per page in ID order; use next_cursor with the same month. Current unresolved reservations are separate from measured consumption. Null environment_id means project-shared cost, never guessed Dev allocation. Only posted measurements are included; this is not a complete provider invoice or zero-usage guarantee. Billing may arrive later. No credit is granted or charged by this read; it remains usable at zero credits.
2237
+ * Owner-only. days holds the credit-log charges of the last up to 14 UTC days (today included, oldest first), grouped by day, project and meter. projects holds what each project has used so far in the current UTC month. A null environment_id means a project-shared cost, never a guessed Dev allocation. Only billed usage is included; charges may arrive later, so this is not a complete provider invoice or a zero-usage guarantee. No credit is granted or charged by this read; it remains usable at zero credits.
2208
2238
  */
2209
2239
  export const getOrganizationCreditUsage = <ThrowOnError extends boolean = true>(
2210
2240
  parameters: {
2211
2241
  "X-Request-Id"?: string;
2212
2242
  organization_id: Ulid;
2213
- month: string;
2214
- cursor?: Ulid;
2215
2243
  },
2216
2244
  options?: Options<never, ThrowOnError>,
2217
2245
  ): RequestResult<
@@ -2227,8 +2255,6 @@ export const getOrganizationCreditUsage = <ThrowOnError extends boolean = true>(
2227
2255
  args: [
2228
2256
  { in: "headers", key: "X-Request-Id" },
2229
2257
  { in: "path", key: "organization_id" },
2230
- { in: "query", key: "month" },
2231
- { in: "query", key: "cursor" },
2232
2258
  ],
2233
2259
  },
2234
2260
  ],
@@ -4733,6 +4759,672 @@ export const revokeProjectDatabaseAccess = <ThrowOnError extends boolean = true>
4733
4759
  });
4734
4760
  };
4735
4761
 
4762
+ /**
4763
+ * List the project's database webhooks
4764
+ *
4765
+ * Returns every webhook of the selected environment without signing secrets.
4766
+ */
4767
+ export const listProjectDatabaseWebhooks = <ThrowOnError extends boolean = true>(
4768
+ parameters: {
4769
+ "X-Request-Id"?: string;
4770
+ project_id: Ulid;
4771
+ environment?: "dev" | "prod";
4772
+ },
4773
+ options?: Options<never, ThrowOnError>,
4774
+ ): RequestResult<
4775
+ ListProjectDatabaseWebhooksResponses,
4776
+ ListProjectDatabaseWebhooksErrors,
4777
+ ThrowOnError,
4778
+ "data"
4779
+ > => {
4780
+ const params = buildClientParams(
4781
+ [parameters],
4782
+ [
4783
+ {
4784
+ args: [
4785
+ { in: "headers", key: "X-Request-Id" },
4786
+ { in: "path", key: "project_id" },
4787
+ { in: "query", key: "environment" },
4788
+ ],
4789
+ },
4790
+ ],
4791
+ );
4792
+ return (options?.client ?? client).get<
4793
+ ListProjectDatabaseWebhooksResponses,
4794
+ ListProjectDatabaseWebhooksErrors,
4795
+ ThrowOnError,
4796
+ "data"
4797
+ >({
4798
+ responseStyle: "data",
4799
+ security: [{ scheme: "bearer", type: "http" }],
4800
+ url: "/v1/projects/{project_id}/database/webhooks",
4801
+ ...options,
4802
+ ...params,
4803
+ });
4804
+ };
4805
+
4806
+ /**
4807
+ * Create a signed webhook for database lifecycle events
4808
+ *
4809
+ * Subscribes one HTTPS receiver to database lifecycle events of one environment. The signing secret is returned exactly once and is never retrievable again. Deliveries are retried and end dead-lettered when retries stop. At most five webhooks exist per project environment.
4810
+ */
4811
+ export const createProjectDatabaseWebhook = <ThrowOnError extends boolean = true>(
4812
+ parameters: {
4813
+ "X-Request-Id"?: string;
4814
+ "Idempotency-Key": string;
4815
+ project_id: Ulid;
4816
+ environment: "dev" | "prod";
4817
+ databaseWebhookCreateRequest: DatabaseWebhookCreateRequest;
4818
+ },
4819
+ options?: Options<never, ThrowOnError>,
4820
+ ): RequestResult<
4821
+ CreateProjectDatabaseWebhookResponses,
4822
+ CreateProjectDatabaseWebhookErrors,
4823
+ ThrowOnError,
4824
+ "data"
4825
+ > => {
4826
+ const params = buildClientParams(
4827
+ [parameters],
4828
+ [
4829
+ {
4830
+ args: [
4831
+ { in: "headers", key: "X-Request-Id" },
4832
+ { in: "headers", key: "Idempotency-Key" },
4833
+ { in: "path", key: "project_id" },
4834
+ { in: "query", key: "environment" },
4835
+ { key: "databaseWebhookCreateRequest", map: "body" },
4836
+ ],
4837
+ },
4838
+ ],
4839
+ );
4840
+ return (options?.client ?? client).post<
4841
+ CreateProjectDatabaseWebhookResponses,
4842
+ CreateProjectDatabaseWebhookErrors,
4843
+ ThrowOnError,
4844
+ "data"
4845
+ >({
4846
+ responseStyle: "data",
4847
+ security: [{ scheme: "bearer", type: "http" }],
4848
+ url: "/v1/projects/{project_id}/database/webhooks",
4849
+ ...options,
4850
+ ...params,
4851
+ headers: {
4852
+ "Content-Type": "application/json",
4853
+ ...options?.headers,
4854
+ ...params.headers,
4855
+ },
4856
+ });
4857
+ };
4858
+
4859
+ /**
4860
+ * Delete one database webhook
4861
+ *
4862
+ * Stops deliveries to the webhook. Deleting an already deleted webhook answers not found.
4863
+ */
4864
+ export const deleteProjectDatabaseWebhook = <ThrowOnError extends boolean = true>(
4865
+ parameters: {
4866
+ "X-Request-Id"?: string;
4867
+ project_id: Ulid;
4868
+ webhook_id: string;
4869
+ environment: "dev" | "prod";
4870
+ },
4871
+ options?: Options<never, ThrowOnError>,
4872
+ ): RequestResult<
4873
+ DeleteProjectDatabaseWebhookResponses,
4874
+ DeleteProjectDatabaseWebhookErrors,
4875
+ ThrowOnError,
4876
+ "data"
4877
+ > => {
4878
+ const params = buildClientParams(
4879
+ [parameters],
4880
+ [
4881
+ {
4882
+ args: [
4883
+ { in: "headers", key: "X-Request-Id" },
4884
+ { in: "path", key: "project_id" },
4885
+ { in: "path", key: "webhook_id" },
4886
+ { in: "query", key: "environment" },
4887
+ ],
4888
+ },
4889
+ ],
4890
+ );
4891
+ return (options?.client ?? client).delete<
4892
+ DeleteProjectDatabaseWebhookResponses,
4893
+ DeleteProjectDatabaseWebhookErrors,
4894
+ ThrowOnError,
4895
+ "data"
4896
+ >({
4897
+ responseStyle: "data",
4898
+ security: [{ scheme: "bearer", type: "http" }],
4899
+ url: "/v1/projects/{project_id}/database/webhooks/{webhook_id}",
4900
+ ...options,
4901
+ ...params,
4902
+ });
4903
+ };
4904
+
4905
+ /**
4906
+ * Read one database webhook
4907
+ *
4908
+ * Returns one webhook without its signing secret.
4909
+ */
4910
+ export const getProjectDatabaseWebhook = <ThrowOnError extends boolean = true>(
4911
+ parameters: {
4912
+ "X-Request-Id"?: string;
4913
+ project_id: Ulid;
4914
+ webhook_id: string;
4915
+ environment?: "dev" | "prod";
4916
+ },
4917
+ options?: Options<never, ThrowOnError>,
4918
+ ): RequestResult<
4919
+ GetProjectDatabaseWebhookResponses,
4920
+ GetProjectDatabaseWebhookErrors,
4921
+ ThrowOnError,
4922
+ "data"
4923
+ > => {
4924
+ const params = buildClientParams(
4925
+ [parameters],
4926
+ [
4927
+ {
4928
+ args: [
4929
+ { in: "headers", key: "X-Request-Id" },
4930
+ { in: "path", key: "project_id" },
4931
+ { in: "path", key: "webhook_id" },
4932
+ { in: "query", key: "environment" },
4933
+ ],
4934
+ },
4935
+ ],
4936
+ );
4937
+ return (options?.client ?? client).get<
4938
+ GetProjectDatabaseWebhookResponses,
4939
+ GetProjectDatabaseWebhookErrors,
4940
+ ThrowOnError,
4941
+ "data"
4942
+ >({
4943
+ responseStyle: "data",
4944
+ security: [{ scheme: "bearer", type: "http" }],
4945
+ url: "/v1/projects/{project_id}/database/webhooks/{webhook_id}",
4946
+ ...options,
4947
+ ...params,
4948
+ });
4949
+ };
4950
+
4951
+ /**
4952
+ * Send one test delivery to a database webhook
4953
+ *
4954
+ * Sends one signed test request to the webhook URL and reports the outcome synchronously. Each call sends one request; the platform allows one test per webhook every five seconds.
4955
+ */
4956
+ export const testProjectDatabaseWebhook = <ThrowOnError extends boolean = true>(
4957
+ parameters: {
4958
+ "X-Request-Id"?: string;
4959
+ project_id: Ulid;
4960
+ webhook_id: string;
4961
+ environment: "dev" | "prod";
4962
+ },
4963
+ options?: Options<never, ThrowOnError>,
4964
+ ): RequestResult<
4965
+ TestProjectDatabaseWebhookResponses,
4966
+ TestProjectDatabaseWebhookErrors,
4967
+ ThrowOnError,
4968
+ "data"
4969
+ > => {
4970
+ const params = buildClientParams(
4971
+ [parameters],
4972
+ [
4973
+ {
4974
+ args: [
4975
+ { in: "headers", key: "X-Request-Id" },
4976
+ { in: "path", key: "project_id" },
4977
+ { in: "path", key: "webhook_id" },
4978
+ { in: "query", key: "environment" },
4979
+ ],
4980
+ },
4981
+ ],
4982
+ );
4983
+ return (options?.client ?? client).post<
4984
+ TestProjectDatabaseWebhookResponses,
4985
+ TestProjectDatabaseWebhookErrors,
4986
+ ThrowOnError,
4987
+ "data"
4988
+ >({
4989
+ responseStyle: "data",
4990
+ security: [{ scheme: "bearer", type: "http" }],
4991
+ url: "/v1/projects/{project_id}/database/webhooks/{webhook_id}/test",
4992
+ ...options,
4993
+ ...params,
4994
+ });
4995
+ };
4996
+
4997
+ /**
4998
+ * List database webhook deliveries
4999
+ *
5000
+ * Returns the newest deliveries first, optionally for one webhook, with the state of each delivery and its last attempt.
5001
+ */
5002
+ export const listProjectDatabaseWebhookDeliveries = <ThrowOnError extends boolean = true>(
5003
+ parameters: {
5004
+ "X-Request-Id"?: string;
5005
+ project_id: Ulid;
5006
+ environment?: "dev" | "prod";
5007
+ webhook_id?: string;
5008
+ limit?: number;
5009
+ cursor?: string;
5010
+ },
5011
+ options?: Options<never, ThrowOnError>,
5012
+ ): RequestResult<
5013
+ ListProjectDatabaseWebhookDeliveriesResponses,
5014
+ ListProjectDatabaseWebhookDeliveriesErrors,
5015
+ ThrowOnError,
5016
+ "data"
5017
+ > => {
5018
+ const params = buildClientParams(
5019
+ [parameters],
5020
+ [
5021
+ {
5022
+ args: [
5023
+ { in: "headers", key: "X-Request-Id" },
5024
+ { in: "path", key: "project_id" },
5025
+ { in: "query", key: "environment" },
5026
+ { in: "query", key: "webhook_id" },
5027
+ { in: "query", key: "limit" },
5028
+ { in: "query", key: "cursor" },
5029
+ ],
5030
+ },
5031
+ ],
5032
+ );
5033
+ return (options?.client ?? client).get<
5034
+ ListProjectDatabaseWebhookDeliveriesResponses,
5035
+ ListProjectDatabaseWebhookDeliveriesErrors,
5036
+ ThrowOnError,
5037
+ "data"
5038
+ >({
5039
+ responseStyle: "data",
5040
+ security: [{ scheme: "bearer", type: "http" }],
5041
+ url: "/v1/projects/{project_id}/database/webhook-deliveries",
5042
+ ...options,
5043
+ ...params,
5044
+ });
5045
+ };
5046
+
5047
+ /**
5048
+ * Replay one database webhook delivery
5049
+ *
5050
+ * Queues a new attempt for a delivery that is no longer being retried. Each call queues one more attempt, and the delivery returns to pending until it is delivered or dead-lettered again.
5051
+ */
5052
+ export const replayProjectDatabaseWebhookDelivery = <ThrowOnError extends boolean = true>(
5053
+ parameters: {
5054
+ "X-Request-Id"?: string;
5055
+ project_id: Ulid;
5056
+ delivery_id: string;
5057
+ environment: "dev" | "prod";
5058
+ },
5059
+ options?: Options<never, ThrowOnError>,
5060
+ ): RequestResult<
5061
+ ReplayProjectDatabaseWebhookDeliveryResponses,
5062
+ ReplayProjectDatabaseWebhookDeliveryErrors,
5063
+ ThrowOnError,
5064
+ "data"
5065
+ > => {
5066
+ const params = buildClientParams(
5067
+ [parameters],
5068
+ [
5069
+ {
5070
+ args: [
5071
+ { in: "headers", key: "X-Request-Id" },
5072
+ { in: "path", key: "project_id" },
5073
+ { in: "path", key: "delivery_id" },
5074
+ { in: "query", key: "environment" },
5075
+ ],
5076
+ },
5077
+ ],
5078
+ );
5079
+ return (options?.client ?? client).post<
5080
+ ReplayProjectDatabaseWebhookDeliveryResponses,
5081
+ ReplayProjectDatabaseWebhookDeliveryErrors,
5082
+ ThrowOnError,
5083
+ "data"
5084
+ >({
5085
+ responseStyle: "data",
5086
+ security: [{ scheme: "bearer", type: "http" }],
5087
+ url: "/v1/projects/{project_id}/database/webhook-deliveries/{delivery_id}/replay",
5088
+ ...options,
5089
+ ...params,
5090
+ });
5091
+ };
5092
+
5093
+ /**
5094
+ * List the project's database schedules
5095
+ *
5096
+ * Returns every schedule of the selected environment.
5097
+ */
5098
+ export const listProjectDatabaseSchedules = <ThrowOnError extends boolean = true>(
5099
+ parameters: {
5100
+ "X-Request-Id"?: string;
5101
+ project_id: Ulid;
5102
+ environment?: "dev" | "prod";
5103
+ },
5104
+ options?: Options<never, ThrowOnError>,
5105
+ ): RequestResult<
5106
+ ListProjectDatabaseSchedulesResponses,
5107
+ ListProjectDatabaseSchedulesErrors,
5108
+ ThrowOnError,
5109
+ "data"
5110
+ > => {
5111
+ const params = buildClientParams(
5112
+ [parameters],
5113
+ [
5114
+ {
5115
+ args: [
5116
+ { in: "headers", key: "X-Request-Id" },
5117
+ { in: "path", key: "project_id" },
5118
+ { in: "query", key: "environment" },
5119
+ ],
5120
+ },
5121
+ ],
5122
+ );
5123
+ return (options?.client ?? client).get<
5124
+ ListProjectDatabaseSchedulesResponses,
5125
+ ListProjectDatabaseSchedulesErrors,
5126
+ ThrowOnError,
5127
+ "data"
5128
+ >({
5129
+ responseStyle: "data",
5130
+ security: [{ scheme: "bearer", type: "http" }],
5131
+ url: "/v1/projects/{project_id}/database/schedules",
5132
+ ...options,
5133
+ ...params,
5134
+ });
5135
+ };
5136
+
5137
+ /**
5138
+ * Delete one database schedule
5139
+ *
5140
+ * Removes the schedule.
5141
+ */
5142
+ export const deleteProjectDatabaseSchedule = <ThrowOnError extends boolean = true>(
5143
+ parameters: {
5144
+ "X-Request-Id"?: string;
5145
+ project_id: Ulid;
5146
+ name: string;
5147
+ environment: "dev" | "prod";
5148
+ },
5149
+ options?: Options<never, ThrowOnError>,
5150
+ ): RequestResult<
5151
+ DeleteProjectDatabaseScheduleResponses,
5152
+ DeleteProjectDatabaseScheduleErrors,
5153
+ ThrowOnError,
5154
+ "data"
5155
+ > => {
5156
+ const params = buildClientParams(
5157
+ [parameters],
5158
+ [
5159
+ {
5160
+ args: [
5161
+ { in: "headers", key: "X-Request-Id" },
5162
+ { in: "path", key: "project_id" },
5163
+ { in: "path", key: "name" },
5164
+ { in: "query", key: "environment" },
5165
+ ],
5166
+ },
5167
+ ],
5168
+ );
5169
+ return (options?.client ?? client).delete<
5170
+ DeleteProjectDatabaseScheduleResponses,
5171
+ DeleteProjectDatabaseScheduleErrors,
5172
+ ThrowOnError,
5173
+ "data"
5174
+ >({
5175
+ responseStyle: "data",
5176
+ security: [{ scheme: "bearer", type: "http" }],
5177
+ url: "/v1/projects/{project_id}/database/schedules/{name}",
5178
+ ...options,
5179
+ ...params,
5180
+ });
5181
+ };
5182
+
5183
+ /**
5184
+ * Read one database schedule
5185
+ */
5186
+ export const getProjectDatabaseSchedule = <ThrowOnError extends boolean = true>(
5187
+ parameters: {
5188
+ "X-Request-Id"?: string;
5189
+ project_id: Ulid;
5190
+ name: string;
5191
+ environment?: "dev" | "prod";
5192
+ },
5193
+ options?: Options<never, ThrowOnError>,
5194
+ ): RequestResult<
5195
+ GetProjectDatabaseScheduleResponses,
5196
+ GetProjectDatabaseScheduleErrors,
5197
+ ThrowOnError,
5198
+ "data"
5199
+ > => {
5200
+ const params = buildClientParams(
5201
+ [parameters],
5202
+ [
5203
+ {
5204
+ args: [
5205
+ { in: "headers", key: "X-Request-Id" },
5206
+ { in: "path", key: "project_id" },
5207
+ { in: "path", key: "name" },
5208
+ { in: "query", key: "environment" },
5209
+ ],
5210
+ },
5211
+ ],
5212
+ );
5213
+ return (options?.client ?? client).get<
5214
+ GetProjectDatabaseScheduleResponses,
5215
+ GetProjectDatabaseScheduleErrors,
5216
+ ThrowOnError,
5217
+ "data"
5218
+ >({
5219
+ responseStyle: "data",
5220
+ security: [{ scheme: "bearer", type: "http" }],
5221
+ url: "/v1/projects/{project_id}/database/schedules/{name}",
5222
+ ...options,
5223
+ ...params,
5224
+ });
5225
+ };
5226
+
5227
+ /**
5228
+ * Create or replace one database schedule
5229
+ *
5230
+ * Creates the named schedule or replaces it. Each run executes the statements as the application's own runtime role, so row-level security applies as for the application. A run that does not finish within timeout_ms is cancelled.
5231
+ */
5232
+ export const setProjectDatabaseSchedule = <ThrowOnError extends boolean = true>(
5233
+ parameters: {
5234
+ "X-Request-Id"?: string;
5235
+ project_id: Ulid;
5236
+ name: string;
5237
+ environment: "dev" | "prod";
5238
+ databaseScheduleSetRequest: DatabaseScheduleSetRequest;
5239
+ },
5240
+ options?: Options<never, ThrowOnError>,
5241
+ ): RequestResult<
5242
+ SetProjectDatabaseScheduleResponses,
5243
+ SetProjectDatabaseScheduleErrors,
5244
+ ThrowOnError,
5245
+ "data"
5246
+ > => {
5247
+ const params = buildClientParams(
5248
+ [parameters],
5249
+ [
5250
+ {
5251
+ args: [
5252
+ { in: "headers", key: "X-Request-Id" },
5253
+ { in: "path", key: "project_id" },
5254
+ { in: "path", key: "name" },
5255
+ { in: "query", key: "environment" },
5256
+ { key: "databaseScheduleSetRequest", map: "body" },
5257
+ ],
5258
+ },
5259
+ ],
5260
+ );
5261
+ return (options?.client ?? client).put<
5262
+ SetProjectDatabaseScheduleResponses,
5263
+ SetProjectDatabaseScheduleErrors,
5264
+ ThrowOnError,
5265
+ "data"
5266
+ >({
5267
+ responseStyle: "data",
5268
+ security: [{ scheme: "bearer", type: "http" }],
5269
+ url: "/v1/projects/{project_id}/database/schedules/{name}",
5270
+ ...options,
5271
+ ...params,
5272
+ headers: {
5273
+ "Content-Type": "application/json",
5274
+ ...options?.headers,
5275
+ ...params.headers,
5276
+ },
5277
+ });
5278
+ };
5279
+
5280
+ /**
5281
+ * List the recent runs of one database schedule
5282
+ *
5283
+ * Returns the newest runs first, with the outcome of each run.
5284
+ */
5285
+ export const listProjectDatabaseScheduleRuns = <ThrowOnError extends boolean = true>(
5286
+ parameters: {
5287
+ "X-Request-Id"?: string;
5288
+ project_id: Ulid;
5289
+ name: string;
5290
+ environment?: "dev" | "prod";
5291
+ limit?: number;
5292
+ },
5293
+ options?: Options<never, ThrowOnError>,
5294
+ ): RequestResult<
5295
+ ListProjectDatabaseScheduleRunsResponses,
5296
+ ListProjectDatabaseScheduleRunsErrors,
5297
+ ThrowOnError,
5298
+ "data"
5299
+ > => {
5300
+ const params = buildClientParams(
5301
+ [parameters],
5302
+ [
5303
+ {
5304
+ args: [
5305
+ { in: "headers", key: "X-Request-Id" },
5306
+ { in: "path", key: "project_id" },
5307
+ { in: "path", key: "name" },
5308
+ { in: "query", key: "environment" },
5309
+ { in: "query", key: "limit" },
5310
+ ],
5311
+ },
5312
+ ],
5313
+ );
5314
+ return (options?.client ?? client).get<
5315
+ ListProjectDatabaseScheduleRunsResponses,
5316
+ ListProjectDatabaseScheduleRunsErrors,
5317
+ ThrowOnError,
5318
+ "data"
5319
+ >({
5320
+ responseStyle: "data",
5321
+ security: [{ scheme: "bearer", type: "http" }],
5322
+ url: "/v1/projects/{project_id}/database/schedules/{name}/runs",
5323
+ ...options,
5324
+ ...params,
5325
+ });
5326
+ };
5327
+
5328
+ /**
5329
+ * Queue one immediate run of a database schedule
5330
+ *
5331
+ * Queues one manual run. The run is refused while the schedule is disabled or while a run is already queued.
5332
+ */
5333
+ export const runProjectDatabaseSchedule = <ThrowOnError extends boolean = true>(
5334
+ parameters: {
5335
+ "X-Request-Id"?: string;
5336
+ project_id: Ulid;
5337
+ name: string;
5338
+ environment: "dev" | "prod";
5339
+ },
5340
+ options?: Options<never, ThrowOnError>,
5341
+ ): RequestResult<
5342
+ RunProjectDatabaseScheduleResponses,
5343
+ RunProjectDatabaseScheduleErrors,
5344
+ ThrowOnError,
5345
+ "data"
5346
+ > => {
5347
+ const params = buildClientParams(
5348
+ [parameters],
5349
+ [
5350
+ {
5351
+ args: [
5352
+ { in: "headers", key: "X-Request-Id" },
5353
+ { in: "path", key: "project_id" },
5354
+ { in: "path", key: "name" },
5355
+ { in: "query", key: "environment" },
5356
+ ],
5357
+ },
5358
+ ],
5359
+ );
5360
+ return (options?.client ?? client).post<
5361
+ RunProjectDatabaseScheduleResponses,
5362
+ RunProjectDatabaseScheduleErrors,
5363
+ ThrowOnError,
5364
+ "data"
5365
+ >({
5366
+ responseStyle: "data",
5367
+ security: [{ scheme: "bearer", type: "http" }],
5368
+ url: "/v1/projects/{project_id}/database/schedules/{name}/run",
5369
+ ...options,
5370
+ ...params,
5371
+ });
5372
+ };
5373
+
5374
+ /**
5375
+ * Read metered database execution usage
5376
+ *
5377
+ * Returns schedule runs and webhook attempts per time window. Only completed windows are final; the current window may still change. Windows are UTC and at most 31 days long. Rejected, skipped, event and delivery counts are reported but not billed.
5378
+ */
5379
+ export const getProjectDatabaseExecutionUsage = <ThrowOnError extends boolean = true>(
5380
+ parameters: {
5381
+ "X-Request-Id"?: string;
5382
+ project_id: Ulid;
5383
+ environment?: "dev" | "prod";
5384
+ from: string;
5385
+ to: string;
5386
+ granularity: "hour" | "day";
5387
+ limit?: number;
5388
+ cursor?: string;
5389
+ },
5390
+ options?: Options<never, ThrowOnError>,
5391
+ ): RequestResult<
5392
+ GetProjectDatabaseExecutionUsageResponses,
5393
+ GetProjectDatabaseExecutionUsageErrors,
5394
+ ThrowOnError,
5395
+ "data"
5396
+ > => {
5397
+ const params = buildClientParams(
5398
+ [parameters],
5399
+ [
5400
+ {
5401
+ args: [
5402
+ { in: "headers", key: "X-Request-Id" },
5403
+ { in: "path", key: "project_id" },
5404
+ { in: "query", key: "environment" },
5405
+ { in: "query", key: "from" },
5406
+ { in: "query", key: "to" },
5407
+ { in: "query", key: "granularity" },
5408
+ { in: "query", key: "limit" },
5409
+ { in: "query", key: "cursor" },
5410
+ ],
5411
+ },
5412
+ ],
5413
+ );
5414
+ return (options?.client ?? client).get<
5415
+ GetProjectDatabaseExecutionUsageResponses,
5416
+ GetProjectDatabaseExecutionUsageErrors,
5417
+ ThrowOnError,
5418
+ "data"
5419
+ >({
5420
+ responseStyle: "data",
5421
+ security: [{ scheme: "bearer", type: "http" }],
5422
+ url: "/v1/projects/{project_id}/database/execution-usage",
5423
+ ...options,
5424
+ ...params,
5425
+ });
5426
+ };
5427
+
4736
5428
  /**
4737
5429
  * Plan a deployment rollback
4738
5430
  *