pierre-sdk 0.1.0.dev4__py3-none-any.whl

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.
@@ -0,0 +1,1437 @@
1
+ # Generated by sdkgen. Do not edit this file.
2
+ """The named schemas of the API, with the wire name of each field."""
3
+
4
+ from typing import Dict, List, Literal, Optional, Union
5
+
6
+ from pierre._compat import NotRequired, TypedDict
7
+
8
+ __all__ = [
9
+ "ArchiveOptions",
10
+ "BaseRepo",
11
+ "BaseRepoAuth",
12
+ "BlameLine",
13
+ "BlobChunk",
14
+ "Branch",
15
+ "BranchListItem",
16
+ "Commit",
17
+ "CommitWriteResponse",
18
+ "DiffChunk",
19
+ "DiffStats",
20
+ "FileDiff",
21
+ "FileEntry",
22
+ "FileLastCommit",
23
+ "FileOperation",
24
+ "FileWithMetadata",
25
+ "FilteredFile",
26
+ "GitCredential",
27
+ "GitIdentity",
28
+ "GitPushEvent",
29
+ "GitSyncFailedEvent",
30
+ "GitSyncStartedEvent",
31
+ "GitSyncSucceededEvent",
32
+ "GrepContext",
33
+ "GrepFileFilters",
34
+ "GrepFileMatch",
35
+ "GrepLimits",
36
+ "GrepLine",
37
+ "GrepPagination",
38
+ "GrepQuery",
39
+ "GrepResolvedQuery",
40
+ "GrepResolvedRef",
41
+ "MergeSourceState",
42
+ "MergeTargetState",
43
+ "Meta",
44
+ "MetaIPs",
45
+ "MetaProvider",
46
+ "NotesRef",
47
+ "NotesWriteResponse",
48
+ "NotesWriteResult",
49
+ "PreviewMergeBlob",
50
+ "PreviewMergeConflict",
51
+ "PreviewMergeFilteredConflict",
52
+ "RefUpdateResult",
53
+ "ReposArchiveGetRequest",
54
+ "ReposBlameGetResponse",
55
+ "ReposBranchesCreateRequest",
56
+ "ReposBranchesCreateResponse",
57
+ "ReposBranchesDeleteRequest",
58
+ "ReposBranchesDeleteResponse",
59
+ "ReposBranchesGetResponse",
60
+ "ReposBranchesListResponse",
61
+ "ReposCommitsCreateFromDiffRequest",
62
+ "ReposCommitsCreateRequest",
63
+ "ReposCommitsGetResponse",
64
+ "ReposCommitsListResponse",
65
+ "ReposCommitsRestoreRequest",
66
+ "ReposCommitsRestoreResponse",
67
+ "ReposCreateRequest",
68
+ "ReposCreateResponse",
69
+ "ReposDeleteResponse",
70
+ "ReposDiffGetResponse",
71
+ "ReposFilesListResponse",
72
+ "ReposFilesMetadataListResponse",
73
+ "ReposGitCredentialsCreateRequest",
74
+ "ReposGitCredentialsUpdateRequest",
75
+ "ReposGrepRequest",
76
+ "ReposGrepResponse",
77
+ "ReposListResponse",
78
+ "ReposMergeRequest",
79
+ "ReposMergeResponse",
80
+ "ReposNotesAppendRequest",
81
+ "ReposNotesCreateRequest",
82
+ "ReposNotesDeleteRequest",
83
+ "ReposNotesGetResponse",
84
+ "ReposNotesRefsListResponse",
85
+ "ReposPreviewMergeResponse",
86
+ "ReposTagsCreateRequest",
87
+ "ReposTagsCreateResponse",
88
+ "ReposTagsDeleteResponse",
89
+ "ReposTagsGetResponse",
90
+ "ReposTagsListResponse",
91
+ "ReposUpdateRequest",
92
+ "ReposUpdateResponse",
93
+ "ReposUpstreamDeleteResponse",
94
+ "ReposUpstreamPullRequest",
95
+ "ReposUpstreamPullResponse",
96
+ "Repository",
97
+ "RestoredCommit",
98
+ "Tag",
99
+ "TagListItem",
100
+ "UpstreamConfig",
101
+ "UpstreamRepo",
102
+ "WebhookRepository",
103
+ "WrittenCommit",
104
+ ]
105
+
106
+
107
+ class ArchiveOptions(TypedDict):
108
+ """Output settings for an archive, such as a prefix for every file path."""
109
+
110
+ # Prefix to add to every file path inside the archive.
111
+ prefix: NotRequired[str]
112
+
113
+
114
+ class BaseRepo(TypedDict):
115
+ """Code Storage repository that a new repository copies once. The deprecated form, with provider and operation, also describes a sync or a fork."""
116
+
117
+ # Authentication for the source repository. A copy requires auth.token.
118
+ auth: NotRequired["BaseRepoAuth"]
119
+ # Deprecated: use the top-level default_branch for a copy or a sync.
120
+ default_branch: NotRequired[str]
121
+ # Name of the Code Storage repository to copy. In the deprecated form, the repository name on the provider.
122
+ name: str
123
+ # Deprecated: base_repo without provider is a copy, and upstream is a sync. In the deprecated form, sync (the default) or fork.
124
+ operation: NotRequired[Union[Literal["fork", "sync"], str]]
125
+ # Deprecated: omit it for a copy, and use upstream.owner for a sync.
126
+ owner: NotRequired[str]
127
+ # Deprecated: omit it for a copy, and use upstream for a sync. In the deprecated form, the provider of the source.
128
+ provider: NotRequired[
129
+ Union[
130
+ Literal[
131
+ "bitbucket",
132
+ "code.storage",
133
+ "codeberg",
134
+ "forgejo",
135
+ "gitea",
136
+ "github",
137
+ "gitlab",
138
+ "sourcehut",
139
+ "sr.ht",
140
+ ],
141
+ str,
142
+ ]
143
+ ]
144
+ # Branch, tag, or commit SHA to copy. It defaults to the HEAD of the source repository.
145
+ ref: NotRequired[str]
146
+ # Deprecated: use ref, which accepts a commit SHA.
147
+ sha: NotRequired[str]
148
+ # Deprecated: use upstream.host.
149
+ upstream_host: NotRequired[str]
150
+
151
+
152
+ class BaseRepoAuth(TypedDict):
153
+ """Authentication used to access the base repository for sync or fork operations."""
154
+
155
+ # Deprecated: use upstream.access for a public GitHub sync. A copy needs no auth_type.
156
+ auth_type: NotRequired[Union[Literal["jwt", "public"], str]]
157
+ # JWT with git:read on the source repository. A copy requires it.
158
+ token: NotRequired[str]
159
+
160
+
161
+ class BlameLine(TypedDict):
162
+ """Single blame entry describing the commit and author responsible for a line."""
163
+
164
+ # Author email of the commit that last touched this line.
165
+ author_email: str
166
+ # Author of the commit that last touched this line.
167
+ author_name: str
168
+ # Author timestamp in RFC 3339 format.
169
+ author_time: str
170
+ # Commit SHA that last touched this line.
171
+ commit_sha: str
172
+ # Committer email of the commit that last touched this line.
173
+ committer_email: str
174
+ # Committer of the commit that last touched this line.
175
+ committer_name: str
176
+ # Committer timestamp in RFC 3339 format.
177
+ committer_time: str
178
+ # Line number in the current file.
179
+ line_number: int
180
+ # Line number in the original file before any renames or moves.
181
+ original_line_number: int
182
+ # Original repository-relative path the line was introduced at.
183
+ original_path: str
184
+ # Commit SHA prior to the current commit when known.
185
+ previous_commit_sha: NotRequired[str]
186
+ # First line of the commit message.
187
+ summary: str
188
+
189
+
190
+ class BlobChunk(TypedDict):
191
+ """Part of the content of one file in a create-commit NDJSON body. Send the chunks of a file in order, and set `eof` on the last one."""
192
+
193
+ # Ties the chunk to a file operation.
194
+ content_id: str
195
+ # Base64-encoded payload (decoded payload must be at most 4 MiB per chunk).
196
+ data: str
197
+ # Set true on the final chunk for that content_id.
198
+ eof: bool
199
+
200
+
201
+ class Branch(TypedDict):
202
+ """A branch."""
203
+
204
+ # ISO 8601 creation timestamp.
205
+ created_at: str
206
+ # HEAD commit SHA for the branch.
207
+ head_sha: str
208
+ # Branch name.
209
+ name: str
210
+
211
+
212
+ class BranchListItem(Branch):
213
+ """A branch in a list, with its pagination cursor."""
214
+
215
+ # Opaque pagination token for this branch entry.
216
+ cursor: str
217
+
218
+
219
+ class Commit(TypedDict):
220
+ """Commit metadata. For a signed commit, repos.commits.get also returns the armored signature and the signed payload."""
221
+
222
+ # Commit author email.
223
+ author_email: str
224
+ # Commit author name.
225
+ author_name: str
226
+ # Commit committer timestamp in RFC 3339 format. A rebase or cherry-pick sets it to a later time than the author timestamp.
227
+ committer_date: NotRequired[str]
228
+ # Commit committer email.
229
+ committer_email: str
230
+ # Commit committer name.
231
+ committer_name: str
232
+ # Commit author timestamp in RFC 3339 format.
233
+ date: str
234
+ # The commit message. In repos.commits.get responses, the full message. In repos.commits.list responses, only the subject line: the first paragraph of the message as one line, without the body and the trailers.
235
+ message: str
236
+ # Parent commit SHAs in Git parent order. Empty for root commits.
237
+ parent_shas: List[str]
238
+ # The signed payload: the raw commit object with the gpgsig header removed. This is the exact data the signature is computed over. Present in repos.commits.get responses when the commit is signed.
239
+ payload: NotRequired[str]
240
+ # The commit SHA.
241
+ sha: str
242
+ # Armored signature from the commit's gpgsig header (OpenPGP or SSH). Present in repos.commits.get responses when the commit is signed.
243
+ signature: NotRequired[str]
244
+
245
+
246
+ class CommitWriteResponse(TypedDict):
247
+ """Result of applying an NDJSON commit pack, including the resulting commit and branch update."""
248
+
249
+ # Commit object information generated by the storage service.
250
+ commit: "WrittenCommit"
251
+ # Final branch update outcome.
252
+ result: "RefUpdateResult"
253
+
254
+
255
+ class DiffChunk(TypedDict):
256
+ """Part of the Git patch in a create-commit-from-diff NDJSON body. Send the chunks in order, and set `eof` on the last one."""
257
+
258
+ # Base64-encoded diff bytes. Decoded payloads must be at most 4 MiB. Combined diff must be compatible with git apply --cached --binary.
259
+ data: str
260
+ # Set true on the final chunk to signal end-of-stream.
261
+ eof: bool
262
+
263
+
264
+ class DiffStats(TypedDict):
265
+ """Aggregate diff statistics across all files."""
266
+
267
+ # Total added lines across the diff.
268
+ additions: int
269
+ # Total line changes (additions plus deletions).
270
+ changes: int
271
+ # Total deleted lines across the diff.
272
+ deletions: int
273
+ # Number of files changed.
274
+ files: int
275
+
276
+
277
+ class FileDiff(TypedDict):
278
+ """Per-file diff entry including the raw unified diff text."""
279
+
280
+ # Added lines in this file.
281
+ additions: int
282
+ # File size in bytes.
283
+ bytes: int
284
+ # Deleted lines in this file.
285
+ deletions: int
286
+ # Whether the file ends with a newline.
287
+ is_eof: bool
288
+ # Previous file path for renamed files.
289
+ old_path: NotRequired[str]
290
+ # Repository-relative file path (new location for renames).
291
+ path: str
292
+ # Raw unified diff content.
293
+ raw: str
294
+ # Git status code: A (added), M (modified), D (deleted), R (renamed), C (copied), or T (type changed).
295
+ state: str
296
+
297
+
298
+ class FileEntry(TypedDict):
299
+ """Tree entry in a list-files response, including the repository-rooted path, six-digit Git mode, and derived type."""
300
+
301
+ # Six-digit Git mode for the entry.
302
+ mode: str
303
+ # Repository-rooted path.
304
+ path: str
305
+ # Entry type: blob, tree, symlink, or submodule.
306
+ type: str
307
+
308
+
309
+ class FileLastCommit(TypedDict):
310
+ """Commit metadata shared by one or more files in a list-files-with-metadata response."""
311
+
312
+ # Author display name for the commit.
313
+ author: str
314
+ # RFC 3339 author date for the commit.
315
+ date: str
316
+ # The subject line of the commit message: the first paragraph of the message as one line, without the body and the trailers. repos.commits.get returns the full message.
317
+ message: str
318
+ # History-order rank relative to the resolved ref: 0 is the commit closest to the ref tip (newest in history), larger values are older. Derived from a topological walk rather than author dates, so callers can rank a folder's latest change by the smallest order among its files.
319
+ order: int
320
+
321
+
322
+ class FileOperation(TypedDict):
323
+ """A file that a commit adds, replaces, or deletes."""
324
+
325
+ # Identifier that blob chunks reference for this file. Required for upsert.
326
+ content_id: NotRequired[str]
327
+ # File mode such as 100644 or 100755. Defaults to 100644.
328
+ mode: NotRequired[str]
329
+ # upsert (default) to add or replace content, or delete to remove a file.
330
+ operation: NotRequired[str]
331
+ # Repository-relative path, with no leading slash.
332
+ path: str
333
+
334
+
335
+ class FileWithMetadata(TypedDict):
336
+ """File entry in a list-files-with-metadata response, including mode, type, and the SHA of the most recent commit that touched it."""
337
+
338
+ # Commit SHA of the most recent commit that touched this file.
339
+ last_commit_sha: str
340
+ # File mode as stored in Git, for example 100644.
341
+ mode: str
342
+ # Repository-relative file path.
343
+ path: str
344
+ # File size in bytes.
345
+ size: int
346
+ # Derived file type: blob, tree, symlink, or submodule.
347
+ type: str
348
+
349
+
350
+ class FilteredFile(TypedDict):
351
+ """Per-file diff entry that was excluded from inline diff output because of size or file-type rules."""
352
+
353
+ # File size in bytes.
354
+ bytes: int
355
+ # Whether the file ends with a newline.
356
+ is_eof: bool
357
+ # Previous file path for renamed files.
358
+ old_path: NotRequired[str]
359
+ # Repository-relative file path (new location for renames). Excluded from inline diff content because of size or file-type rules.
360
+ path: str
361
+ # Git status code: A (added), M (modified), D (deleted), R (renamed), C (copied), or T (type changed).
362
+ state: str
363
+
364
+
365
+ class GitCredential(TypedDict):
366
+ """Stored Git credential summary returned after a credential is created or updated."""
367
+
368
+ # Credential creation timestamp in ISO 8601 format.
369
+ created_at: NotRequired[str]
370
+ # Credential ID returned when the credential is created.
371
+ id: str
372
+
373
+
374
+ class GitIdentity(TypedDict):
375
+ """Author or committer identity for a commit."""
376
+
377
+ # Email address.
378
+ email: str
379
+ # Display name.
380
+ name: str
381
+
382
+
383
+ class GitPushEvent(TypedDict):
384
+ """A Git ref update. The type field and the X-Pierre-Event header identify this payload as push."""
385
+
386
+ # The event type. `verify_webhook` always sets it.
387
+ type: Literal["push"]
388
+ # The new commit SHA. All zeros for a deleted ref.
389
+ after: str
390
+ # The previous commit SHA. All zeros for a newly created ref.
391
+ before: str
392
+ # Deprecated: use org. The internal ID of the customer that owns the repository.
393
+ customer_id: str
394
+ # The organization name. It is the iss claim of the JWTs that the organization signs. It can be absent on older deliveries.
395
+ org: NotRequired[str]
396
+ # When the push occurred, as an RFC 3339 timestamp.
397
+ pushed_at: str
398
+ # The full Git ref name, for example refs/heads/main.
399
+ ref: str
400
+ # The repository that produced the event.
401
+ repository: "WebhookRepository"
402
+
403
+
404
+ class GitSyncFailedEvent(TypedDict):
405
+ """Sent when a repository sync run fails, including failures after retries are exhausted and infrastructure failures. Internal cancellations do not produce this event. run_count includes the run that just finished."""
406
+
407
+ # The event type. `verify_webhook` always sets it.
408
+ type: Literal["repo.sync.failed"]
409
+ # When the sync run finished, as an RFC 3339 timestamp.
410
+ completed_at: str
411
+ # The failure message.
412
+ error: str
413
+ # Whether the repository had never synced successfully before this run began.
414
+ is_first_sync: bool
415
+ # The sync lifecycle ID. It can be absent on older deliveries.
416
+ lifecycle_id: NotRequired[str]
417
+ # The organization name. It is the iss claim of the JWTs that the organization signs. It can be absent on older deliveries.
418
+ org: NotRequired[str]
419
+ # The repository that produced the event.
420
+ repository: "WebhookRepository"
421
+ # Completed sync runs. For started events, this excludes the current run. For succeeded and failed events, it includes the current run.
422
+ run_count: int
423
+ # When the sync run began, as an RFC 3339 timestamp.
424
+ started_at: str
425
+
426
+
427
+ class GitSyncStartedEvent(TypedDict):
428
+ """Sent when a repository sync run begins, before the upstream fetch starts. run_count counts previously completed runs."""
429
+
430
+ # The event type. `verify_webhook` always sets it.
431
+ type: Literal["repo.sync.started"]
432
+ # Whether the repository had never synced successfully before this run began.
433
+ is_first_sync: bool
434
+ # The sync lifecycle ID. It can be absent on older deliveries.
435
+ lifecycle_id: NotRequired[str]
436
+ # The organization name. It is the iss claim of the JWTs that the organization signs. It can be absent on older deliveries.
437
+ org: NotRequired[str]
438
+ # The repository that produced the event.
439
+ repository: "WebhookRepository"
440
+ # Completed sync runs. For started events, this excludes the current run. For succeeded and failed events, it includes the current run.
441
+ run_count: int
442
+ # When the sync run began, as an RFC 3339 timestamp.
443
+ started_at: str
444
+
445
+
446
+ class GitSyncSucceededEvent(TypedDict):
447
+ """Sent when a repository sync run completes successfully. run_count includes the run that just finished."""
448
+
449
+ # The event type. `verify_webhook` always sets it.
450
+ type: Literal["repo.sync.succeeded"]
451
+ # When the sync run finished, as an RFC 3339 timestamp.
452
+ completed_at: str
453
+ # Whether the repository had never synced successfully before this run began.
454
+ is_first_sync: bool
455
+ # The sync lifecycle ID. It can be absent on older deliveries.
456
+ lifecycle_id: NotRequired[str]
457
+ # The organization name. It is the iss claim of the JWTs that the organization signs. It can be absent on older deliveries.
458
+ org: NotRequired[str]
459
+ # The repository that produced the event.
460
+ repository: "WebhookRepository"
461
+ # Completed sync runs. For started events, this excludes the current run. For succeeded and failed events, it includes the current run.
462
+ run_count: int
463
+ # When the sync run began, as an RFC 3339 timestamp.
464
+ started_at: str
465
+
466
+
467
+ class GrepContext(TypedDict):
468
+ """Number of context lines to return before and after each match."""
469
+
470
+ # Number of lines to include after each match.
471
+ after: NotRequired[int]
472
+ # Number of lines to include before each match.
473
+ before: NotRequired[int]
474
+
475
+
476
+ class GrepFileFilters(TypedDict):
477
+ """Glob and extension filters that select the files to search."""
478
+
479
+ # Glob patterns for files to exclude.
480
+ exclude_globs: NotRequired[List[str]]
481
+ # File extensions to filter by (e.g. [".js", ".py"]).
482
+ extension_filters: NotRequired[List[str]]
483
+ # Glob patterns for files to include.
484
+ include_globs: NotRequired[List[str]]
485
+
486
+
487
+ class GrepFileMatch(TypedDict):
488
+ """Matches grouped under a single file path."""
489
+
490
+ # Lines returned for the match, including optional context lines.
491
+ lines: List["GrepLine"]
492
+ # Repository-relative file path that matched.
493
+ path: str
494
+
495
+
496
+ class GrepLimits(TypedDict):
497
+ """Limits on the total lines and on the matches for each file in a grep response."""
498
+
499
+ # Maximum total lines to return (default 2000, max 2000).
500
+ max_lines: NotRequired[int]
501
+ # Maximum matches returned per file (default 200).
502
+ max_matches_per_file: NotRequired[int]
503
+
504
+
505
+ class GrepLine(TypedDict):
506
+ """Single line returned by grep, either a match or a surrounding context line."""
507
+
508
+ # Line number in the file.
509
+ line_number: int
510
+ # Line text content.
511
+ text: str
512
+ # match for lines satisfying the pattern, or context for surrounding context lines.
513
+ type: str
514
+
515
+
516
+ class GrepPagination(TypedDict):
517
+ """Cursor and page size for grep matches."""
518
+
519
+ # Pagination cursor returned by a previous grep response.
520
+ cursor: NotRequired[str]
521
+ # Maximum number of matches to return (default 200).
522
+ limit: NotRequired[int]
523
+
524
+
525
+ class GrepQuery(TypedDict):
526
+ """Pattern to search for, and whether the search is case-sensitive."""
527
+
528
+ # Defaults to true when omitted.
529
+ case_sensitive: NotRequired[bool]
530
+ # Regular expression or literal pattern to search for.
531
+ pattern: str
532
+
533
+
534
+ class GrepResolvedQuery(TypedDict):
535
+ """Query settings that the server used for the search."""
536
+
537
+ # Echoed case-sensitivity setting.
538
+ case_sensitive: bool
539
+ # Echoed pattern that was searched.
540
+ pattern: str
541
+
542
+
543
+ class GrepResolvedRef(TypedDict):
544
+ """Ref and resolved commit that the search ran against."""
545
+
546
+ # Resolved commit SHA the grep ran against.
547
+ commit: str
548
+ # Ref that was grepped.
549
+ ref: str
550
+
551
+
552
+ class MergeSourceState(TypedDict):
553
+ """Resolved source ref state for a merge response."""
554
+
555
+ # Deprecated: use ref. Source branch name.
556
+ branch: str
557
+ # Whether the source ref was resolved under the ephemeral namespace.
558
+ ephemeral: bool
559
+ # The source ref the merge reads.
560
+ ref: str
561
+ # Resolved source SHA.
562
+ sha: str
563
+
564
+
565
+ class MergeTargetState(TypedDict):
566
+ """Resolved target ref state for a merge response, including the previous and new tip SHAs."""
567
+
568
+ # Target branch name.
569
+ branch: str
570
+ # Whether the target ref was resolved under the ephemeral namespace.
571
+ ephemeral: bool
572
+ # New target tip SHA after the merge.
573
+ new_sha: str
574
+ # Previous target tip SHA before the merge.
575
+ old_sha: str
576
+
577
+
578
+ class Meta(TypedDict):
579
+ """Cloud location and inbound IP addresses of the Code Storage cluster that serves the current organisation."""
580
+
581
+ # Public IPv4 addresses, in CIDR notation, that accept inbound traffic for the organisation. Allow these in firewall rules that restrict outbound connections to Code Storage.
582
+ ips: "MetaIPs"
583
+ # Cloud provider and region that host the organisation.
584
+ provider: "MetaProvider"
585
+
586
+
587
+ class MetaIPs(TypedDict):
588
+ """Inbound IPv4 address ranges of the cluster, grouped by the kind of traffic they accept."""
589
+
590
+ # Addresses that accept HTTP API traffic. Empty when no addresses are published for the organisation's cluster.
591
+ api: List[str]
592
+ # Addresses that accept Git over HTTPS traffic. Empty when no addresses are published for the organisation's cluster.
593
+ git: List[str]
594
+
595
+
596
+ class MetaProvider(TypedDict):
597
+ """Cloud provider and region of the cluster that serves the current organisation."""
598
+
599
+ # Cloud provider that hosts the organisation, such as aws or gcp. Empty when the gateway cannot determine its location.
600
+ name: str
601
+ # Cloud provider region that hosts the organisation. Empty when the gateway cannot determine its location.
602
+ region: str
603
+
604
+
605
+ class NotesRef(TypedDict):
606
+ """Git notes ref entry including its full ref name and current tip SHA."""
607
+
608
+ # Opaque pagination token for this notes ref entry.
609
+ cursor: str
610
+ # Full notes ref name.
611
+ ref: str
612
+ # Current tip SHA stored in the notes ref.
613
+ sha: str
614
+
615
+
616
+ class NotesWriteResponse(TypedDict):
617
+ """Result of a notes write operation, including the resulting notes ref state."""
618
+
619
+ # Previous notes ref commit SHA.
620
+ base_commit: NotRequired[str]
621
+ # New notes ref SHA after the operation.
622
+ new_ref_sha: str
623
+ # The notes ref the operation updates.
624
+ notes_ref: str
625
+ # Operation result with success, status, and optional message.
626
+ result: "NotesWriteResult"
627
+ # The commit SHA the note is attached to.
628
+ sha: str
629
+ # Deprecated: use notes_ref. The notes ref the operation updates.
630
+ target_ref: str
631
+
632
+
633
+ class NotesWriteResult(TypedDict):
634
+ """Result of a notes write: whether it succeeded, a status, and an optional message."""
635
+
636
+ # Optional human-readable message.
637
+ message: NotRequired[str]
638
+ # Status code (e.g. ok).
639
+ status: str
640
+ # Whether the operation succeeded.
641
+ success: bool
642
+
643
+
644
+ class PreviewMergeBlob(TypedDict):
645
+ """Single Git blob rendered as part of a merge conflict preview."""
646
+
647
+ # Whether the blob appears to be binary content.
648
+ binary: bool
649
+ # UTF-8 text content when available and not binary.
650
+ content: NotRequired[str]
651
+ # Git object ID for this blob.
652
+ oid: NotRequired[str]
653
+ # Whether content was truncated by server-side limits.
654
+ truncated: bool
655
+
656
+
657
+ class PreviewMergeConflict(TypedDict):
658
+ """Inline conflict content for a single conflicted repository path."""
659
+
660
+ # Base stage blob.
661
+ base: "PreviewMergeBlob"
662
+ # Target branch stage blob.
663
+ ours: "PreviewMergeBlob"
664
+ # Repository path for this conflict.
665
+ path: str
666
+ # Best-effort merged blob content, usually with conflict markers for text conflicts.
667
+ result: "PreviewMergeBlob"
668
+ # Source branch stage blob.
669
+ theirs: "PreviewMergeBlob"
670
+
671
+
672
+ class PreviewMergeFilteredConflict(TypedDict):
673
+ """Conflict omitted from inline content because of request or server limits."""
674
+
675
+ # Repository path omitted from inline conflict content.
676
+ path: str
677
+ # Reason the conflict content was omitted.
678
+ reason: str
679
+
680
+
681
+ class RefUpdateResult(TypedDict):
682
+ """Branch update outcome for an operation that writes a commit."""
683
+
684
+ # Deprecated: use target_branch. The branch the operation updates.
685
+ branch: str
686
+ # Optional human-readable message.
687
+ message: NotRequired[str]
688
+ # New tip SHA after the update.
689
+ new_sha: str
690
+ # Previous tip SHA (40-char hex; all zeros when the branch did not previously exist).
691
+ old_sha: str
692
+ # Status code (ok, conflict, precondition_failed, etc.).
693
+ status: Union[
694
+ Literal[
695
+ "conflict",
696
+ "failed",
697
+ "forbidden",
698
+ "internal",
699
+ "invalid",
700
+ "not_found",
701
+ "ok",
702
+ "payload_too_large",
703
+ "precondition_failed",
704
+ "timeout",
705
+ "unauthorized",
706
+ "unavailable",
707
+ ],
708
+ str,
709
+ ]
710
+ # Whether the operation succeeded.
711
+ success: bool
712
+ # The branch the operation updates.
713
+ target_branch: str
714
+
715
+
716
+ class ReposArchiveGetRequest(TypedDict):
717
+ """Archive options describing the ref to snapshot and the include or exclude filters applied to the resulting tarball."""
718
+
719
+ # Optional archive output settings.
720
+ archive: NotRequired["ArchiveOptions"]
721
+ # Exclude files matching these glob patterns after include filtering.
722
+ exclude_globs: NotRequired[List[str]]
723
+ # Only include files matching these glob patterns.
724
+ include_globs: NotRequired[List[str]]
725
+ # Maximum blob size to include in the archive, in bytes.
726
+ max_blob_size: NotRequired[int]
727
+ # Branch, tag, or commit to archive. When omitted, the default branch or HEAD is used.
728
+ ref: NotRequired[str]
729
+
730
+
731
+ class ReposBlameGetResponse(TypedDict):
732
+ """Per-line blame information for the requested file at the resolved revision."""
733
+
734
+ # Commit SHA the blame was computed at.
735
+ commit_sha: str
736
+ # Per-line blame results in file order.
737
+ lines: List["BlameLine"]
738
+ # Repository-relative file path that was blamed.
739
+ path: str
740
+ # Resolved ref used for the blame.
741
+ ref: str
742
+
743
+
744
+ class ReposBranchesCreateRequest(TypedDict):
745
+ """Create-branch request body describing the new branch and its base ref."""
746
+
747
+ # Deprecated: use base_ref. Preferred source branch name.
748
+ base_branch: NotRequired[str]
749
+ # Whether the base branch should be resolved from the ephemeral namespace.
750
+ base_is_ephemeral: NotRequired[bool]
751
+ # Optional source ref or revision. Provide base_ref or the deprecated base_branch.
752
+ base_ref: NotRequired[str]
753
+ # Allow non-fast-forward updates when recreating an existing named branch. Requires target_branch.
754
+ force: NotRequired[bool]
755
+ # Optional pack hint. A branch name the backend prefers as the delta base when it builds the thin pack. It does not change the source or the result.
756
+ preferred_base: NotRequired[str]
757
+ # Optional destination branch name. Omit it to let the server allocate a name.
758
+ target_branch: NotRequired[str]
759
+ # Whether the new branch should be created in the ephemeral namespace.
760
+ target_is_ephemeral: NotRequired[bool]
761
+
762
+
763
+ class ReposBranchesCreateResponse(TypedDict):
764
+ """Result of creating a branch, including the resulting ref state."""
765
+
766
+ # Resolved commit SHA at the new branch tip.
767
+ commit_sha: NotRequired[str]
768
+ # Human-readable result message.
769
+ message: str
770
+ # Destination branch name.
771
+ target_branch: str
772
+ # Whether the created branch is ephemeral.
773
+ target_is_ephemeral: bool
774
+
775
+
776
+ class ReposBranchesDeleteRequest(TypedDict):
777
+ """Deprecated branch deletion body. Use the target_branch and ephemeral query parameters."""
778
+
779
+ # Deprecated: use the ephemeral query parameter. Delete the branch from the ephemeral namespace instead of the default namespace.
780
+ ephemeral: NotRequired[bool]
781
+ # Deprecated: use the target_branch query parameter. Branch name to delete.
782
+ name: NotRequired[str]
783
+ # Deprecated: use the target_branch query parameter. Branch name to delete. Must not start with refs/.
784
+ target_branch: NotRequired[str]
785
+
786
+
787
+ class ReposBranchesDeleteResponse(TypedDict):
788
+ """Result of deleting a branch."""
789
+
790
+ # Whether the deleted branch lived in the ephemeral namespace.
791
+ ephemeral: bool
792
+ # Human-readable result message.
793
+ message: str
794
+ # Deprecated: use target_branch. Deleted branch name.
795
+ name: str
796
+ # Deleted branch name.
797
+ target_branch: str
798
+
799
+
800
+ class ReposBranchesGetResponse(TypedDict):
801
+ """One branch that matches an exact short name."""
802
+
803
+ # The branch that has the requested name.
804
+ branch: "Branch"
805
+
806
+
807
+ class ReposBranchesListResponse(TypedDict):
808
+ """Paginated list of branches for the repository."""
809
+
810
+ # List of branch objects.
811
+ branches: List["BranchListItem"]
812
+ # Whether another page is available.
813
+ has_more: bool
814
+ # Opaque cursor for the next page. Pass it as `cursor` to read the next page. Absent when there are no more results.
815
+ next_cursor: NotRequired[str]
816
+
817
+
818
+ class ReposCommitsCreateFromDiffRequest(TypedDict):
819
+ """Metadata line of a create-commit-from-diff NDJSON body: the target branch and the commit message and identities. The `diff_chunk` lines that follow carry the patch."""
820
+
821
+ # Author identity for the commit.
822
+ author: "GitIdentity"
823
+ # Source branch to seed from when target_branch does not exist yet.
824
+ base_branch: NotRequired[str]
825
+ # When true, interpret base_branch as ephemeral.
826
+ base_is_ephemeral: NotRequired[bool]
827
+ # Commit message for the new commit.
828
+ commit_message: str
829
+ # Committer identity. Defaults to author when omitted.
830
+ committer: NotRequired["GitIdentity"]
831
+ # Deprecated: use target_is_ephemeral. When true, write the target branch under the ephemeral namespace.
832
+ ephemeral: NotRequired[bool]
833
+ # Deprecated: use base_is_ephemeral. When true, interpret base_branch as ephemeral.
834
+ ephemeral_base: NotRequired[bool]
835
+ # Deprecated: use expected_target_sha. Guard ensuring the branch tip matches before applying the patch.
836
+ expected_head_sha: NotRequired[str]
837
+ # Guard ensuring the target branch tip matches before applying the patch.
838
+ expected_target_sha: NotRequired[str]
839
+ # Destination branch name.
840
+ target_branch: str
841
+ # When true, write the target branch under the ephemeral namespace.
842
+ target_is_ephemeral: NotRequired[bool]
843
+
844
+
845
+ class ReposCommitsCreateRequest(TypedDict):
846
+ """Metadata line of a create-commit NDJSON body: the target branch, the commit message and identities, and the file operations. The `blob_chunk` lines that follow carry the file content."""
847
+
848
+ # Author identity for the commit.
849
+ author: "GitIdentity"
850
+ # Source branch to copy when target_branch does not yet exist.
851
+ base_branch: NotRequired[str]
852
+ # When true, interpret base_branch as ephemeral.
853
+ base_is_ephemeral: NotRequired[bool]
854
+ # Commit message for the new commit.
855
+ commit_message: str
856
+ # Committer identity. Defaults to author when omitted.
857
+ committer: NotRequired["GitIdentity"]
858
+ # Deprecated: use target_is_ephemeral. When true, write the target branch under the ephemeral namespace.
859
+ ephemeral: NotRequired[bool]
860
+ # Deprecated: use base_is_ephemeral. When true, interpret base_branch as ephemeral.
861
+ ephemeral_base: NotRequired[bool]
862
+ # Deprecated: use expected_target_sha. Commit SHA that must match the branch tip before writing.
863
+ expected_head_sha: NotRequired[str]
864
+ # Commit SHA that must match the target branch tip before writing. Omit to fast-forward unconditionally.
865
+ expected_target_sha: NotRequired[str]
866
+ # File operations applied in this commit.
867
+ files: List["FileOperation"]
868
+ # Destination branch name (no refs/ prefix).
869
+ target_branch: str
870
+ # When true, write the target branch under the ephemeral namespace.
871
+ target_is_ephemeral: NotRequired[bool]
872
+
873
+
874
+ class ReposCommitsGetResponse(TypedDict):
875
+ """Commit metadata for a single resolved revision, without diff content."""
876
+
877
+ # Resolved commit metadata.
878
+ commit: "Commit"
879
+
880
+
881
+ class ReposCommitsListResponse(TypedDict):
882
+ """Paginated commit history for the repository, optionally filtered by branch."""
883
+
884
+ # List of commit objects.
885
+ commits: List["Commit"]
886
+ # Whether another page is available.
887
+ has_more: bool
888
+ # Opaque cursor for the next page. Pass it as `cursor` to read the next page. Absent when there are no more results.
889
+ next_cursor: NotRequired[str]
890
+
891
+
892
+ class ReposCommitsRestoreRequest(TypedDict):
893
+ """Metadata line of a restore-commit NDJSON body: the branch to reset, the revision to reset it to, and the commit identities. The body has no other line."""
894
+
895
+ # Author identity for the restore commit.
896
+ author: "GitIdentity"
897
+ # Branch, tag, or commit to reset the branch to. Provide base_ref or the deprecated target_commit_sha.
898
+ base_ref: NotRequired[str]
899
+ # Commit message for the restore commit. Defaults to a message that names the branch and the commit.
900
+ commit_message: NotRequired[str]
901
+ # Committer identity. Defaults to author when omitted.
902
+ committer: NotRequired["GitIdentity"]
903
+ # Deprecated: use expected_target_sha. Guard ensuring the current tip matches before applying the restore.
904
+ expected_head_sha: NotRequired[str]
905
+ # Guard ensuring the target branch tip matches before applying the restore.
906
+ expected_target_sha: NotRequired[str]
907
+ # Branch name to reset (no refs/ prefix).
908
+ target_branch: str
909
+ # Deprecated: use base_ref. Commit to reset the branch to.
910
+ target_commit_sha: NotRequired[str]
911
+
912
+
913
+ class ReposCommitsRestoreResponse(TypedDict):
914
+ """Result of a restore commit operation, including the created commit and the branch update."""
915
+
916
+ # Created restore commit metadata.
917
+ commit: "RestoredCommit"
918
+ # Branch update result.
919
+ result: "RefUpdateResult"
920
+
921
+
922
+ class ReposCreateRequest(TypedDict):
923
+ """Create-repository request body. It supplies the optional repository name, default branch, and Git Sync or fork configuration."""
924
+
925
+ # Code Storage repository to copy once. The new repository keeps no link to it. Do not set it together with upstream.
926
+ base_repo: NotRequired["BaseRepo"]
927
+ # Default branch for the new repository. When omitted, a copy takes the default branch of the source, a sync from GitHub takes the default branch of the GitHub repository, and any other repository uses main.
928
+ default_branch: NotRequired[str]
929
+ # Name of the new repository. It can contain a slash.
930
+ repo_name: NotRequired[str]
931
+ # External Git host to keep syncing from. The link lasts, and the repository can sync again. Do not set it together with base_repo.
932
+ upstream: NotRequired["UpstreamConfig"]
933
+
934
+
935
+ class ReposCreateResponse(TypedDict):
936
+ """Result of creating a repository, including its repository name."""
937
+
938
+ # Deprecated: use repo_name. Repository name or path, not a full URL.
939
+ http_url: str
940
+ # Human-readable result: the repository was created, or it already exists. The status gives the same result: 201 or 200.
941
+ message: str
942
+ # Deprecated: use repo_name. Stable repository identifier.
943
+ repo_id: str
944
+ # Repository name or path. It can contain a slash. It matches the JWT repo claim.
945
+ repo_name: str
946
+
947
+
948
+ class ReposDeleteResponse(TypedDict):
949
+ """Confirmation that the repository deletion has been accepted."""
950
+
951
+ # Human-readable deletion status message.
952
+ message: str
953
+ # Deprecated: use repo_name. Stable repository identifier.
954
+ repo_id: str
955
+ # Repository name or path. It can contain a slash. It matches the JWT repo claim.
956
+ repo_name: str
957
+
958
+
959
+ class ReposDiffGetResponse(TypedDict):
960
+ """Diff for a single commit, including merge base when applicable, aggregate stats, and per-file changes."""
961
+
962
+ # The commit that the base revision (base_ref) resolved to. Empty for a single-commit diff. Use it to record the exact base of the comparison.
963
+ base_sha: NotRequired[str]
964
+ # Files returned with inline diff content.
965
+ files: List["FileDiff"]
966
+ # Files filtered out of inline diff output because of size or file-type rules.
967
+ filtered_files: List["FilteredFile"]
968
+ # The merge base of base_ref and ref: the commit where the diff starts. Empty for a single-commit diff.
969
+ merge_base_sha: NotRequired[str]
970
+ # The commit SHA to diff.
971
+ sha: str
972
+ # Aggregate diff statistics.
973
+ stats: "DiffStats"
974
+
975
+
976
+ class ReposFilesListResponse(TypedDict):
977
+ """Paginated tree entries in the repository at the resolved revision."""
978
+
979
+ # Tree entries for the resolved revision.
980
+ entries: List["FileEntry"]
981
+ # Whether another page is available.
982
+ has_more: bool
983
+ # Opaque cursor for the next page. Pass it as `cursor` to read the next page. Absent when there are no more results.
984
+ next_cursor: NotRequired[str]
985
+ # Flat blob-only path list. Mirrors the path of every entry whose type is "blob". Convenience shape for callers that just want file paths; use entries when you need type/mode.
986
+ paths: List[str]
987
+ # The resolved reference (branch name or commit SHA) that was used.
988
+ ref: str
989
+
990
+
991
+ class ReposFilesMetadataListResponse(TypedDict):
992
+ """Files in the repository at the resolved revision, each annotated with mode, type, and the latest commit that changed it."""
993
+
994
+ # Commit metadata keyed by last_commit_sha so repeated commits are only sent once.
995
+ commits: Dict[str, "FileLastCommit"]
996
+ # Files in the resolved revision, each annotated with the latest commit that changed it.
997
+ files: List["FileWithMetadata"]
998
+ # Whether another page is available.
999
+ has_more: bool
1000
+ # Opaque cursor for the next page. Pass it as `cursor` to read the next page. Absent when there are no more results.
1001
+ next_cursor: NotRequired[str]
1002
+ # The resolved ref or commit used to generate the listing.
1003
+ ref: str
1004
+
1005
+
1006
+ class ReposGitCredentialsCreateRequest(TypedDict):
1007
+ """Request body for storing a new HTTPS Git credential when the repository is identified via the URL path."""
1008
+
1009
+ # Password or access token for the upstream provider.
1010
+ password: str
1011
+ # Username for HTTPS authentication. Optional. With no username, requests to the upstream send the token as the password with the username `x-token-auth` for Bitbucket and `oauth2` for GitLab, and as the username for Gitea, Forgejo, and Codeberg. sr.ht takes no credential over HTTPS: it serves private repositories and pushes only over SSH.
1012
+ username: NotRequired[str]
1013
+
1014
+
1015
+ class ReposGitCredentialsUpdateRequest(TypedDict):
1016
+ """Request body for rotating an existing HTTPS Git credential when the credential is identified via the URL path."""
1017
+
1018
+ # Updated password or access token for the upstream provider.
1019
+ password: str
1020
+ # Username for HTTPS authentication. Optional. With no username, requests to the upstream send the token as the password with the username `x-token-auth` for Bitbucket and `oauth2` for GitLab, and as the username for Gitea, Forgejo, and Codeberg. sr.ht takes no credential over HTTPS: it serves private repositories and pushes only over SSH. An omitted username clears the stored one.
1021
+ username: NotRequired[str]
1022
+
1023
+
1024
+ class ReposGrepRequest(TypedDict):
1025
+ """Grep request describing the pattern, ref, filters, limits, and pagination for a repository content search."""
1026
+
1027
+ # Lines of context to include before and after each match.
1028
+ context: NotRequired["GrepContext"]
1029
+ # Whether ref should be resolved from the ephemeral namespace.
1030
+ ephemeral: NotRequired[bool]
1031
+ # Optional include and exclude filters applied before matching.
1032
+ file_filters: NotRequired["GrepFileFilters"]
1033
+ # Maximum line and per-file match limits.
1034
+ limits: NotRequired["GrepLimits"]
1035
+ # Cursor-based pagination controls for large result sets.
1036
+ pagination: NotRequired["GrepPagination"]
1037
+ # Optional path prefixes used to narrow the search before pattern matching.
1038
+ paths: NotRequired[List[str]]
1039
+ # Pattern configuration.
1040
+ query: "GrepQuery"
1041
+ # Preferred branch, tag, or commit to search.
1042
+ ref: NotRequired[str]
1043
+ # Deprecated: use ref. Legacy ref field retained for backwards compatibility.
1044
+ rev: NotRequired[str]
1045
+
1046
+
1047
+ class ReposGrepResponse(TypedDict):
1048
+ """Grep results grouped per file, including the resolved ref and pagination state."""
1049
+
1050
+ # Whether additional matches remain.
1051
+ has_more: bool
1052
+ # True when the result set is incomplete because the server-side output cap was reached. Matches beyond the cap exist in the repo but cannot be retrieved by paging: narrow the query (pattern, paths, file filters) or raise max_lines if it was set below the maximum. next_cursor still pages through everything collected below the cap.
1053
+ incomplete_results: bool
1054
+ # Files that matched the query, each with matching and context lines.
1055
+ matches: List["GrepFileMatch"]
1056
+ # Opaque cursor for the next page, if any.
1057
+ next_cursor: Optional[str]
1058
+ # The effective query settings used by the server.
1059
+ query: "GrepResolvedQuery"
1060
+ # Resolved repository ref and commit used for the search.
1061
+ repo: "GrepResolvedRef"
1062
+
1063
+
1064
+ class ReposListResponse(TypedDict):
1065
+ """Paginated list of repositories for the current organisation."""
1066
+
1067
+ # Whether another page is available.
1068
+ has_more: bool
1069
+ # Opaque cursor for the next page. Pass it as `cursor` to read the next page. Absent when there are no more results.
1070
+ next_cursor: NotRequired[str]
1071
+ # Repositories in the current page.
1072
+ repos: List["Repository"]
1073
+
1074
+
1075
+ class ReposMergeRequest(TypedDict):
1076
+ """Merge request body specifying source and target branches, optional pinned source SHA, merge strategy, optional squash flag, and optional retry-on-target-move behavior, which is currently unsupported for GitHub-backed public targets."""
1077
+
1078
+ # Permit merges between unrelated histories.
1079
+ allow_unrelated_histories: NotRequired[bool]
1080
+ # Author identity used when the backend creates a merge commit. Required for merge-commit strategies.
1081
+ author: NotRequired["GitIdentity"]
1082
+ # Commit message used when a merge commit is created.
1083
+ commit_message: NotRequired[str]
1084
+ # Committer identity for the merge commit. Defaults to author when omitted.
1085
+ committer: NotRequired["GitIdentity"]
1086
+ # Optional source commit guard. The merge uses this commit instead of the current tip of source_ref, and fails if source_ref does not contain it when the merge starts. A later advance of source_ref does not change the merged commit.
1087
+ expected_source_sha: NotRequired[str]
1088
+ # Optional branch tip guard. The merge fails if the target has moved since this SHA.
1089
+ expected_target_sha: NotRequired[str]
1090
+ # Deprecated: use source_ref. Source branch to merge from.
1091
+ source_branch: NotRequired[str]
1092
+ # Whether source_ref should be resolved from the ephemeral namespace.
1093
+ source_is_ephemeral: NotRequired[bool]
1094
+ # Branch or refs/heads ref to merge from. The merge reads the source and never updates it. Provide source_ref or the deprecated source_branch.
1095
+ source_ref: NotRequired[str]
1096
+ # When true, collapse the source into a single new commit whose only parent is the current target tip. Defaults to false, which preserves the standard merge/fast-forward behavior. Incompatible with the ff_only strategy.
1097
+ squash: NotRequired[bool]
1098
+ # Merge strategy. merge creates a merge commit when needed, ff_only rejects non-fast-forward merges, and ff_prefer fast-forwards when possible before falling back to a merge commit.
1099
+ strategy: Union[Literal["ff_only", "ff_prefer", "merge"], str]
1100
+ # Destination branch to update. A merge always updates a branch.
1101
+ target_branch: str
1102
+ # Whether target_branch should be resolved from the ephemeral namespace.
1103
+ target_is_ephemeral: NotRequired[bool]
1104
+
1105
+
1106
+ class ReposMergeResponse(TypedDict):
1107
+ """Merge outcome including the resulting commit, source and target state, merge base information, and retry attempt counters when applicable."""
1108
+
1109
+ # Commit SHA for the merge result. For a fast-forward or no-op, this is the resulting target tip.
1110
+ commit_sha: str
1111
+ # Merge base SHA when one exists and the backend reports it.
1112
+ merge_base_sha: NotRequired[str]
1113
+ # Number of commits promoted from source onto target.
1114
+ promoted_commits: int
1115
+ # Merge outcome: merge_commit, fast_forward, no_op, squash, or unknown.
1116
+ result: str
1117
+ # Source ref metadata with branch, ephemeral, and resolved sha.
1118
+ source: "MergeSourceState"
1119
+ # Target ref metadata with branch, ephemeral, previous old_sha, and resulting new_sha.
1120
+ target: "MergeTargetState"
1121
+ # Tree SHA for the resulting commit or target tip.
1122
+ tree_sha: str
1123
+
1124
+
1125
+ class ReposNotesAppendRequest(TypedDict):
1126
+ """Append-note request describing the Git object, the text to add, and the optional notes ref guard."""
1127
+
1128
+ # Author object with name and email for the notes commit.
1129
+ author: NotRequired["GitIdentity"]
1130
+ # Optional compare-and-swap guard for the notes ref. Provide expected_notes_ref_sha or the deprecated expected_ref_sha.
1131
+ expected_notes_ref_sha: NotRequired[str]
1132
+ # Deprecated: use expected_notes_ref_sha. Optional compare-and-swap guard for the notes ref.
1133
+ expected_ref_sha: NotRequired[str]
1134
+ # Plain text to add to the note.
1135
+ note: str
1136
+ # Optional notes ref to target. A bare name like reviews is placed under refs/notes/; a fully-qualified refs/notes/* ref is also accepted. Defaults to refs/notes/commits. Provide notes_ref or the deprecated ref.
1137
+ notes_ref: NotRequired[str]
1138
+ # Git object the note attaches to: a full object SHA (a commit, tree, blob, or annotated tag), or a branch, tag, or other revision that resolves to a commit. Provide object_ref or the deprecated sha.
1139
+ object_ref: NotRequired[str]
1140
+ # Deprecated: use notes_ref. Optional notes ref to target.
1141
+ ref: NotRequired[str]
1142
+ # Deprecated: use object_ref. Git object SHA to attach the note to.
1143
+ sha: NotRequired[str]
1144
+
1145
+
1146
+ class ReposNotesCreateRequest(TypedDict):
1147
+ """Create-note request describing the Git object, the note content, and the optional notes ref guard."""
1148
+
1149
+ # Deprecated: use POST /notes/append to append. add creates a note and fails if one already exists. append adds text to the note, and creates the note if none exists.
1150
+ action: NotRequired[str]
1151
+ # Author object with name and email for the notes commit.
1152
+ author: NotRequired["GitIdentity"]
1153
+ # Optional compare-and-swap guard for the notes ref. Provide expected_notes_ref_sha or the deprecated expected_ref_sha.
1154
+ expected_notes_ref_sha: NotRequired[str]
1155
+ # Deprecated: use expected_notes_ref_sha. Optional compare-and-swap guard for the notes ref.
1156
+ expected_ref_sha: NotRequired[str]
1157
+ # Plain-text note content. Required.
1158
+ note: NotRequired[str]
1159
+ # Optional notes ref to target. A bare name like reviews is placed under refs/notes/; a fully-qualified refs/notes/* ref is also accepted. Defaults to refs/notes/commits. Provide notes_ref or the deprecated ref.
1160
+ notes_ref: NotRequired[str]
1161
+ # Git object the note attaches to: a full object SHA (a commit, tree, blob, or annotated tag), or a branch, tag, or other revision that resolves to a commit. Provide object_ref or the deprecated sha.
1162
+ object_ref: NotRequired[str]
1163
+ # Deprecated: use notes_ref. Optional notes ref to target.
1164
+ ref: NotRequired[str]
1165
+ # Deprecated: use object_ref. Git object SHA to attach the note to.
1166
+ sha: NotRequired[str]
1167
+
1168
+
1169
+ class ReposNotesDeleteRequest(TypedDict):
1170
+ """Deprecated delete-note body. Use the object_ref, notes_ref, and expected_notes_ref_sha query parameters."""
1171
+
1172
+ # Deprecated: a delete ignores action.
1173
+ action: NotRequired[str]
1174
+ # Deprecated: no replacement. Without author, the notes commit of a delete has the default author. Author object with name and email for the notes commit.
1175
+ author: NotRequired["GitIdentity"]
1176
+ # Deprecated: use the expected_notes_ref_sha query parameter. Optional compare-and-swap guard for the notes ref.
1177
+ expected_notes_ref_sha: NotRequired[str]
1178
+ # Deprecated: use the expected_notes_ref_sha query parameter. Optional compare-and-swap guard for the notes ref.
1179
+ expected_ref_sha: NotRequired[str]
1180
+ # Deprecated: a delete ignores note.
1181
+ note: NotRequired[str]
1182
+ # Deprecated: use the notes_ref query parameter. Optional notes ref to target.
1183
+ notes_ref: NotRequired[str]
1184
+ # Deprecated: use the object_ref query parameter. Git object the note attaches to.
1185
+ object_ref: NotRequired[str]
1186
+ # Deprecated: use the notes_ref query parameter. Optional notes ref to target.
1187
+ ref: NotRequired[str]
1188
+ # Deprecated: use the object_ref query parameter. Git object SHA the note attaches to.
1189
+ sha: NotRequired[str]
1190
+
1191
+
1192
+ class ReposNotesGetResponse(TypedDict):
1193
+ """A single Git note attached to a commit, including the current notes ref tip."""
1194
+
1195
+ # The note content.
1196
+ note: str
1197
+ # Current SHA of the notes ref the note was read from.
1198
+ ref_sha: str
1199
+ # The commit SHA.
1200
+ sha: str
1201
+
1202
+
1203
+ class ReposNotesRefsListResponse(TypedDict):
1204
+ """Paginated list of Git notes refs under the requested prefix."""
1205
+
1206
+ # Whether another page is available.
1207
+ has_more: bool
1208
+ # Opaque cursor for the next page. Pass it as `cursor` to read the next page. Absent when there are no more results.
1209
+ next_cursor: NotRequired[str]
1210
+ # Normalized notes ref prefix used for the listing.
1211
+ prefix: str
1212
+ # List of notes refs.
1213
+ refs: List["NotesRef"]
1214
+
1215
+
1216
+ class ReposPreviewMergeResponse(TypedDict):
1217
+ """Read-only merge preview result, including clean or conflicted status and optional inline conflict content."""
1218
+
1219
+ # Repository paths that conflicted during the merge preview.
1220
+ conflict_paths: List[str]
1221
+ # Inline conflict content, populated only when include_content=true.
1222
+ conflicts: List["PreviewMergeConflict"]
1223
+ # Conflicts omitted from inline content because of request or server limits.
1224
+ filtered_conflicts: NotRequired[List["PreviewMergeFilteredConflict"]]
1225
+ # Merge base SHA used for the preview.
1226
+ merge_base_sha: NotRequired[str]
1227
+ # Operation result if applied: merge_commit, fast_forward, or no_op.
1228
+ result: Union[Literal["fast_forward", "merge_commit", "no_op"], str]
1229
+ # Source branch requested by the caller.
1230
+ source_branch: str
1231
+ # Resolved source branch tip SHA.
1232
+ source_tip_sha: str
1233
+ # Preview status: clean or conflicted.
1234
+ status: Union[Literal["clean", "conflicted"], str]
1235
+ # Target branch requested by the caller.
1236
+ target_branch: str
1237
+ # Resolved target branch tip SHA.
1238
+ target_tip_sha: str
1239
+
1240
+
1241
+ class ReposTagsCreateRequest(TypedDict):
1242
+ """Create-tag request body describing the new tag and the commit it points to."""
1243
+
1244
+ # Tag name. Must be a valid Git ref name and must not start with refs/.
1245
+ name: str
1246
+ # Branch, tag, or commit the tag should point to. Provide ref or the deprecated target.
1247
+ ref: NotRequired[str]
1248
+ # Deprecated: use ref. Commit the tag should point to.
1249
+ target: NotRequired[str]
1250
+
1251
+
1252
+ class ReposTagsCreateResponse(TypedDict):
1253
+ """Result of creating a tag."""
1254
+
1255
+ # Human-readable result message.
1256
+ message: str
1257
+ # Tag name.
1258
+ name: str
1259
+ # Commit SHA the tag points to.
1260
+ sha: str
1261
+
1262
+
1263
+ class ReposTagsDeleteResponse(TypedDict):
1264
+ """Result of deleting a tag."""
1265
+
1266
+ # Human-readable result message.
1267
+ message: str
1268
+ # Tag name.
1269
+ name: str
1270
+
1271
+
1272
+ class ReposTagsGetResponse(TypedDict):
1273
+ """One tag that matches an exact short name."""
1274
+
1275
+ # The tag that has the requested name.
1276
+ tag: "Tag"
1277
+
1278
+
1279
+ class ReposTagsListResponse(TypedDict):
1280
+ """Paginated list of tags for the repository."""
1281
+
1282
+ # Whether another page is available.
1283
+ has_more: bool
1284
+ # Opaque cursor for the next page. Pass it as `cursor` to read the next page. Absent when there are no more results.
1285
+ next_cursor: NotRequired[str]
1286
+ # List of tag objects.
1287
+ tags: List["TagListItem"]
1288
+
1289
+
1290
+ class ReposUpdateRequest(TypedDict):
1291
+ """Repository settings to patch, such as the default branch."""
1292
+
1293
+ # New default branch name for the Code Storage repository.
1294
+ default_branch: NotRequired[str]
1295
+
1296
+
1297
+ class ReposUpdateResponse(TypedDict):
1298
+ """Repository state after applying the patch."""
1299
+
1300
+ # Updated default branch name.
1301
+ default_branch: str
1302
+ # Deprecated: use repo_name. Stable repository identifier.
1303
+ id: str
1304
+ # Deprecated: use repo_name. Stable repository identifier.
1305
+ repo_id: str
1306
+ # Repository name or path. It can contain a slash. It matches the JWT repo claim.
1307
+ repo_name: str
1308
+ # Deprecated: use repo_name. Repository name or path, not a full URL.
1309
+ url: str
1310
+
1311
+
1312
+ class ReposUpstreamDeleteResponse(TypedDict):
1313
+ """Confirmation that the upstream link has been detached from the repository."""
1314
+
1315
+ # Human-readable detach status message.
1316
+ message: str
1317
+
1318
+
1319
+ class ReposUpstreamPullRequest(TypedDict):
1320
+ """Deprecated upstream pull body. Its fields have no effect, so send no body."""
1321
+
1322
+ # Deprecated: omit it. The field has no effect, and no response returns a token for it. A pull syncs every branch and tag of the upstream.
1323
+ after: NotRequired[str]
1324
+ # Deprecated: omit it. The field has no effect: a pull syncs every branch and tag of the upstream.
1325
+ ref: NotRequired[str]
1326
+
1327
+
1328
+ class ReposUpstreamPullResponse(TypedDict):
1329
+ """Acknowledgement that an upstream sync has been initiated; the sync itself runs asynchronously."""
1330
+
1331
+ # Human-readable status message.
1332
+ message: str
1333
+
1334
+
1335
+ class Repository(TypedDict):
1336
+ """A repository, including its Git Sync upstream when one is configured."""
1337
+
1338
+ # Deprecated: use upstream. The upstream of the repository, when it has one.
1339
+ base_repo: NotRequired["UpstreamRepo"]
1340
+ # ISO 8601 creation timestamp.
1341
+ created_at: str
1342
+ # Default branch name.
1343
+ default_branch: str
1344
+ # Deprecated: use repo_name. Stable repository identifier.
1345
+ repo_id: str
1346
+ # Repository name or path. It can contain a slash. It matches the JWT repo claim.
1347
+ repo_name: str
1348
+ # External Git host that the repository keeps syncing from. Absent when the repository has no upstream.
1349
+ upstream: NotRequired["UpstreamRepo"]
1350
+ # Deprecated: use repo_name. Repository name or path, not a full URL.
1351
+ url: str
1352
+
1353
+
1354
+ class RestoredCommit(TypedDict):
1355
+ """Commit object generated by a restore-commit operation."""
1356
+
1357
+ # SHA of the new restore commit.
1358
+ commit_sha: str
1359
+ # Size of the generated pack in bytes.
1360
+ pack_bytes: int
1361
+ # Branch that was reset.
1362
+ target_branch: str
1363
+ # Tree SHA of the restore commit.
1364
+ tree_sha: str
1365
+
1366
+
1367
+ class Tag(TypedDict):
1368
+ """A tag."""
1369
+
1370
+ # Tag name.
1371
+ name: str
1372
+ # Dereferenced commit SHA for the tag.
1373
+ sha: str
1374
+
1375
+
1376
+ class TagListItem(Tag):
1377
+ """A tag in a list, with its pagination cursor."""
1378
+
1379
+ # Opaque pagination token for this tag entry.
1380
+ cursor: str
1381
+
1382
+
1383
+ class UpstreamConfig(TypedDict):
1384
+ """External Git host that a new repository keeps syncing from."""
1385
+
1386
+ # GitHub only. app (the default) reads through the GitHub App installation of the organization. public mirrors a public repository without an installation, and syncs only on request.
1387
+ access: NotRequired[Union[Literal["app", "public"], str]]
1388
+ # Bare hostname of a self-hosted provider, such as gitlab.example.com. It defaults to the public host of the provider.
1389
+ host: NotRequired[str]
1390
+ # Repository name on the upstream provider.
1391
+ name: str
1392
+ # Repository owner or namespace on the upstream provider.
1393
+ owner: str
1394
+ # External Git host of the upstream repository.
1395
+ provider: Union[
1396
+ Literal[
1397
+ "bitbucket", "codeberg", "forgejo", "gitea", "github", "gitlab", "sourcehut", "sr.ht"
1398
+ ],
1399
+ str,
1400
+ ]
1401
+
1402
+
1403
+ class UpstreamRepo(TypedDict):
1404
+ """Git Sync upstream of a repository."""
1405
+
1406
+ # Upstream repository name.
1407
+ name: NotRequired[str]
1408
+ # Upstream repository owner or namespace.
1409
+ owner: NotRequired[str]
1410
+ # Upstream provider name.
1411
+ provider: str
1412
+
1413
+
1414
+ class WebhookRepository(TypedDict):
1415
+ """The repository that produced the event."""
1416
+
1417
+ # The internal repository ID.
1418
+ id: str
1419
+ # The repository name, for example team/project. It can be absent on older deliveries.
1420
+ repo_name: NotRequired[str]
1421
+ # Deprecated: use repo_name, which has the same value. The repository name, for example team/project.
1422
+ url: str
1423
+
1424
+
1425
+ class WrittenCommit(TypedDict):
1426
+ """Commit object information generated when a pack is applied."""
1427
+
1428
+ # Number of blobs included in the pack.
1429
+ blob_count: int
1430
+ # SHA of the new commit.
1431
+ commit_sha: str
1432
+ # Size of the generated pack in bytes.
1433
+ pack_bytes: int
1434
+ # Branch the commit was written to.
1435
+ target_branch: str
1436
+ # Tree SHA of the new commit.
1437
+ tree_sha: str