Highly ambitious ATProtocol AppView service and sdks
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

update xrpc naming .list -> .listRecords, .get -> .getRecords etc

Chad Miller 7b48ab01 22a11265

+42 -40
+5 -5
api/scripts/generate-typescript.ts
··· 910 910 const recordType = obj._recordType as string; 911 911 methodDecl.addStatements([ 912 912 `const requestParams = { ...params, slice: this.sliceUri };`, 913 - `return await this.makeRequest<ListRecordsResponse<${recordType}>>('${collectionPath}.list', 'GET', requestParams);`, 913 + `return await this.makeRequest<ListRecordsResponse<${recordType}>>('${collectionPath}.listRecords', 'GET', requestParams);`, 914 914 ]); 915 915 } else if (method.name === "getRecord") { 916 916 const recordType = obj._recordType as string; 917 917 methodDecl.addStatements([ 918 918 `const requestParams = { ...params, slice: this.sliceUri };`, 919 - `return await this.makeRequest<RecordResponse<${recordType}>>('${collectionPath}.get', 'GET', requestParams);`, 919 + `return await this.makeRequest<RecordResponse<${recordType}>>('${collectionPath}.getRecord', 'GET', requestParams);`, 920 920 ]); 921 921 } else if (method.name === "searchRecords") { 922 922 const recordType = obj._recordType as string; ··· 928 928 methodDecl.addStatements([ 929 929 `const recordWithType = { $type: '${collectionPath}', ...record };`, 930 930 `const payload = useSelfRkey ? { ...recordWithType, rkey: 'self' } : recordWithType;`, 931 - `return await this.makeRequest<{ uri: string; cid: string }>('${collectionPath}.create', 'POST', payload);`, 931 + `return await this.makeRequest<{ uri: string; cid: string }>('${collectionPath}.createRecord', 'POST', payload);`, 932 932 ]); 933 933 } else if (method.name === "updateRecord") { 934 934 methodDecl.addStatements([ 935 935 `const recordWithType = { $type: '${collectionPath}', ...record };`, 936 - `return await this.makeRequest<{ uri: string; cid: string }>('${collectionPath}.update', 'POST', { rkey, record: recordWithType });`, 936 + `return await this.makeRequest<{ uri: string; cid: string }>('${collectionPath}.updateRecord', 'POST', { rkey, record: recordWithType });`, 937 937 ]); 938 938 } else if (method.name === "deleteRecord") { 939 939 methodDecl.addStatements([ 940 - `return await this.makeRequest<void>('${collectionPath}.delete', 'POST', { rkey });`, 940 + `return await this.makeRequest<void>('${collectionPath}.deleteRecord', 'POST', { rkey });`, 941 941 ]); 942 942 } 943 943 }
+5 -5
api/src/handler_openapi_spec.rs
··· 186 186 187 187 fn create_collection_paths(collection: &str, slice_uri: &str, lexicon_data: Option<&serde_json::Value>, paths: &mut HashMap<String, HashMap<String, OpenApiOperation>>) { 188 188 // List operation (GET) 189 - let list_path = format!("/{}.list", collection); 189 + let list_path = format!("/{}.listRecords", collection); 190 190 let mut list_operations = HashMap::new(); 191 191 list_operations.insert("get".to_string(), OpenApiOperation { 192 192 operation_id: format!("list{}", collection.replace(".", "_")), ··· 277 277 paths.insert(list_path, list_operations); 278 278 279 279 // Get operation (GET) 280 - let get_path = format!("/{}.get", collection); 280 + let get_path = format!("/{}.getRecord", collection); 281 281 let mut get_operations = HashMap::new(); 282 282 get_operations.insert("get".to_string(), OpenApiOperation { 283 283 operation_id: format!("get{}", collection.replace(".", "_")), ··· 400 400 paths.insert(search_path, search_operations); 401 401 402 402 // Create operation (POST) 403 - let create_path = format!("/{}.create", collection); 403 + let create_path = format!("/{}.createRecord", collection); 404 404 let mut create_operations = HashMap::new(); 405 405 406 406 // Generate schema from lexicon if available ··· 440 440 paths.insert(create_path, create_operations); 441 441 442 442 // Update operation (POST) 443 - let update_path = format!("/{}.update", collection); 443 + let update_path = format!("/{}.updateRecord", collection); 444 444 let mut update_operations = HashMap::new(); 445 445 update_operations.insert("post".to_string(), OpenApiOperation { 446 446 operation_id: format!("update{}", collection.replace(".", "_")), ··· 484 484 paths.insert(update_path, update_operations); 485 485 486 486 // Delete operation (POST) 487 - let delete_path = format!("/{}.delete", collection); 487 + let delete_path = format!("/{}.deleteRecord", collection); 488 488 let mut delete_operations = HashMap::new(); 489 489 delete_operations.insert("post".to_string(), OpenApiOperation { 490 490 operation_id: format!("delete{}", collection.replace(".", "_")),
+12 -12
api/src/handler_xrpc_dynamic.rs
··· 64 64 State(state): State<AppState>, 65 65 Query(params): Query<serde_json::Value>, 66 66 ) -> Result<Json<serde_json::Value>, StatusCode> { 67 - // Parse the XRPC method (e.g., "social.grain.gallery.list") 68 - if method.ends_with(".list") { 69 - let collection = method.trim_end_matches(".list").to_string(); 67 + // Parse the XRPC method (e.g., "social.grain.gallery.listRecords") 68 + if method.ends_with(".listRecords") { 69 + let collection = method.trim_end_matches(".listRecords").to_string(); 70 70 dynamic_list_records_handler(collection, state, params).await 71 - } else if method.ends_with(".get") { 72 - let collection = method.trim_end_matches(".get").to_string(); 71 + } else if method.ends_with(".getRecord") { 72 + let collection = method.trim_end_matches(".getRecord").to_string(); 73 73 dynamic_get_record_impl(collection, state, params).await 74 74 } else if method.ends_with(".searchRecords") { 75 75 let collection = method.trim_end_matches(".searchRecords").to_string(); ··· 89 89 Json(body): Json<serde_json::Value>, 90 90 ) -> Result<Json<serde_json::Value>, StatusCode> { 91 91 92 - // Handle dynamic collection methods (e.g., social.grain.gallery.create) 93 - if method.ends_with(".create") { 94 - let collection = method.trim_end_matches(".create").to_string(); 92 + // Handle dynamic collection methods (e.g., social.grain.gallery.createRecord) 93 + if method.ends_with(".createRecord") { 94 + let collection = method.trim_end_matches(".createRecord").to_string(); 95 95 dynamic_collection_create_impl(state, headers, body, collection).await 96 - } else if method.ends_with(".update") { 97 - let collection = method.trim_end_matches(".update").to_string(); 96 + } else if method.ends_with(".updateRecord") { 97 + let collection = method.trim_end_matches(".updateRecord").to_string(); 98 98 dynamic_collection_update_impl(state, headers, body, collection).await 99 - } else if method.ends_with(".delete") { 100 - let collection = method.trim_end_matches(".delete").to_string(); 99 + } else if method.ends_with(".deleteRecord") { 100 + let collection = method.trim_end_matches(".deleteRecord").to_string(); 101 101 dynamic_collection_delete_impl(state, headers, body, collection).await 102 102 } else { 103 103 Err(StatusCode::NOT_FOUND)
+20 -18
frontend/src/client.ts
··· 1 1 // Generated TypeScript client for AT Protocol records 2 - // Generated at: 2025-08-28 00:21:00 UTC 2 + // Generated at: 2025-08-28 20:17:41 UTC 3 3 // Lexicons: 3 4 4 5 5 /** ··· 383 383 ): Promise<ListRecordsResponse<SocialSlicesSliceRecord>> { 384 384 const requestParams = { ...params, slice: this.sliceUri }; 385 385 return await this.makeRequest<ListRecordsResponse<SocialSlicesSliceRecord>>( 386 - "social.slices.slice.list", 386 + "social.slices.slice.listRecords", 387 387 "GET", 388 388 requestParams 389 389 ); ··· 394 394 ): Promise<RecordResponse<SocialSlicesSliceRecord>> { 395 395 const requestParams = { ...params, slice: this.sliceUri }; 396 396 return await this.makeRequest<RecordResponse<SocialSlicesSliceRecord>>( 397 - "social.slices.slice.get", 397 + "social.slices.slice.getRecord", 398 398 "GET", 399 399 requestParams 400 400 ); ··· 420 420 ? { ...recordWithType, rkey: "self" } 421 421 : recordWithType; 422 422 return await this.makeRequest<{ uri: string; cid: string }>( 423 - "social.slices.slice.create", 423 + "social.slices.slice.createRecord", 424 424 "POST", 425 425 payload 426 426 ); ··· 432 432 ): Promise<{ uri: string; cid: string }> { 433 433 const recordWithType = { $type: "social.slices.slice", ...record }; 434 434 return await this.makeRequest<{ uri: string; cid: string }>( 435 - "social.slices.slice.update", 435 + "social.slices.slice.updateRecord", 436 436 "POST", 437 437 { rkey, record: recordWithType } 438 438 ); 439 439 } 440 440 441 441 async deleteRecord(rkey: string): Promise<void> { 442 - return await this.makeRequest<void>("social.slices.slice.delete", "POST", { 443 - rkey, 444 - }); 442 + return await this.makeRequest<void>( 443 + "social.slices.slice.deleteRecord", 444 + "POST", 445 + { rkey } 446 + ); 445 447 } 446 448 447 449 async codegen(request: CodegenXrpcRequest): Promise<CodegenXrpcResponse> { ··· 519 521 const requestParams = { ...params, slice: this.sliceUri }; 520 522 return await this.makeRequest< 521 523 ListRecordsResponse<SocialSlicesLexiconRecord> 522 - >("social.slices.lexicon.list", "GET", requestParams); 524 + >("social.slices.lexicon.listRecords", "GET", requestParams); 523 525 } 524 526 525 527 async getRecord( ··· 527 529 ): Promise<RecordResponse<SocialSlicesLexiconRecord>> { 528 530 const requestParams = { ...params, slice: this.sliceUri }; 529 531 return await this.makeRequest<RecordResponse<SocialSlicesLexiconRecord>>( 530 - "social.slices.lexicon.get", 532 + "social.slices.lexicon.getRecord", 531 533 "GET", 532 534 requestParams 533 535 ); ··· 551 553 ? { ...recordWithType, rkey: "self" } 552 554 : recordWithType; 553 555 return await this.makeRequest<{ uri: string; cid: string }>( 554 - "social.slices.lexicon.create", 556 + "social.slices.lexicon.createRecord", 555 557 "POST", 556 558 payload 557 559 ); ··· 563 565 ): Promise<{ uri: string; cid: string }> { 564 566 const recordWithType = { $type: "social.slices.lexicon", ...record }; 565 567 return await this.makeRequest<{ uri: string; cid: string }>( 566 - "social.slices.lexicon.update", 568 + "social.slices.lexicon.updateRecord", 567 569 "POST", 568 570 { rkey, record: recordWithType } 569 571 ); ··· 571 573 572 574 async deleteRecord(rkey: string): Promise<void> { 573 575 return await this.makeRequest<void>( 574 - "social.slices.lexicon.delete", 576 + "social.slices.lexicon.deleteRecord", 575 577 "POST", 576 578 { rkey } 577 579 ); ··· 592 594 const requestParams = { ...params, slice: this.sliceUri }; 593 595 return await this.makeRequest< 594 596 ListRecordsResponse<SocialSlicesActorProfileRecord> 595 - >("social.slices.actor.profile.list", "GET", requestParams); 597 + >("social.slices.actor.profile.listRecords", "GET", requestParams); 596 598 } 597 599 598 600 async getRecord( ··· 601 603 const requestParams = { ...params, slice: this.sliceUri }; 602 604 return await this.makeRequest< 603 605 RecordResponse<SocialSlicesActorProfileRecord> 604 - >("social.slices.actor.profile.get", "GET", requestParams); 606 + >("social.slices.actor.profile.getRecord", "GET", requestParams); 605 607 } 606 608 607 609 async searchRecords( ··· 622 624 ? { ...recordWithType, rkey: "self" } 623 625 : recordWithType; 624 626 return await this.makeRequest<{ uri: string; cid: string }>( 625 - "social.slices.actor.profile.create", 627 + "social.slices.actor.profile.createRecord", 626 628 "POST", 627 629 payload 628 630 ); ··· 634 636 ): Promise<{ uri: string; cid: string }> { 635 637 const recordWithType = { $type: "social.slices.actor.profile", ...record }; 636 638 return await this.makeRequest<{ uri: string; cid: string }>( 637 - "social.slices.actor.profile.update", 639 + "social.slices.actor.profile.updateRecord", 638 640 "POST", 639 641 { rkey, record: recordWithType } 640 642 ); ··· 642 644 643 645 async deleteRecord(rkey: string): Promise<void> { 644 646 return await this.makeRequest<void>( 645 - "social.slices.actor.profile.delete", 647 + "social.slices.actor.profile.deleteRecord", 646 648 "POST", 647 649 { rkey } 648 650 );