Skip to content

Commit 24416dd

Browse files
committed
feat(artifact): add ListFilesAdmin RPC for admin file listing
1 parent 859099b commit 24416dd

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

artifact/v1alpha/artifact_private_service.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,12 @@ service ArtifactPrivateService {
139139
// in the file table but lose their KB association (orphaned). Used during
140140
// KB consolidation migrations after files have been moved to another KB.
141141
rpc DeleteKnowledgeBaseAdmin(DeleteKnowledgeBaseAdminRequest) returns (DeleteKnowledgeBaseAdminResponse);
142+
143+
// List files in a knowledge base (admin only)
144+
//
145+
// Lists all files in a knowledge base without ACL checks. Unlike the public
146+
// ListKnowledgeBaseFiles endpoint which requires authentication context, this
147+
// admin endpoint allows internal services to list files during migrations and
148+
// administrative operations.
149+
rpc ListFilesAdmin(ListFilesAdminRequest) returns (ListFilesAdminResponse);
142150
}

artifact/v1alpha/knowledge_base.proto

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ syntax = "proto3";
22

33
package artifact.v1alpha;
44

5+
// File definitions
6+
import "artifact/v1alpha/file.proto";
57
// Google API
68
import "google/api/field_behavior.proto";
79
import "google/api/resource.proto";
@@ -377,3 +379,28 @@ message DeleteKnowledgeBaseAdminRequest {
377379
message DeleteKnowledgeBaseAdminResponse {
378380
// Empty response on success.
379381
}
382+
383+
// ListFilesAdminRequest represents a request to list files in a knowledge base
384+
// (admin only).
385+
message ListFilesAdminRequest {
386+
// The resource name of the knowledge base.
387+
// Format: `namespaces/{namespace}/knowledge-bases/{knowledge_base}`
388+
string parent = 1 [
389+
(google.api.field_behavior) = REQUIRED,
390+
(google.api.resource_reference) = {type: "api.instill.tech/KnowledgeBase"}
391+
];
392+
// Maximum number of files to return. Default is 100.
393+
int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
394+
// Page token for pagination.
395+
string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
396+
}
397+
398+
// ListFilesAdminResponse represents a response for listing files (admin only).
399+
message ListFilesAdminResponse {
400+
// The files in the knowledge base.
401+
repeated File files = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
402+
// Token for the next page.
403+
string next_page_token = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
404+
// Total number of files.
405+
int32 total_size = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
406+
}

0 commit comments

Comments
 (0)