将任何 OpenAPI 规范转换为生产就绪的 Pascal 代码,具备完整的类型安全性和 IntelliSense 支持。
导入任何 OpenAPI 或 Swagger 规范,让 sgcOpenAPI 生成整洁、符合惯例的 Object Pascal 接口,立即用于您的项目。
立即使用适用于主流云服务提供商的即用型 Pascal SDK。所有 SDK 定期更新,以匹配最新的 API 规范。
三个简单步骤,从 API 规范到完全集成的 Pascal 代码。
以 JSON 或 YAML 格式加载您的 OpenAPI 3.x 规范文件。Swagger 1.x 和 2.x 规范会自动检测并转换为 OpenAPI 3.x 模式。
解析器分析端点、参数、请求/响应模型和身份验证方案,然后生成具有正确类型映射的整洁、符合惯例的 Pascal 代码。
将生成的单元放入您的 Delphi 项目。完整的类型安全性、IntelliSense 支持和零外部依赖。立即开始调用 API。
支持 Delphi 和 Pascal 工具链的所有主要版本。
完整支持 Delphi 7 至 RAD Studio 13。VCL 和 FireMonkey 框架,支持设计时组件注册。
原生 C++ Builder 支持,带有包装头文件。兼容 C++ Builder 2007 至 C++ Builder 13。
查看生成的 Pascal SDK 在实践中的样子 — 整洁、类型安全、即用即得。
uses sgcOpenAPI_PetStore; // Generated from petstore.yaml procedure TForm1.btnGetPetClick(Sender: TObject); var Client: TsgcOpenAPI_PetStoreClient; Pet: TsgcOpenAPI_Pet; begin Client := TsgcOpenAPI_PetStoreClient.Create(nil); try Client.BaseURL := 'https://petstore.swagger.io/v2'; Client.ApiKey := 'your-api-key'; // Type-safe API call with IntelliSense Pet := Client.GetPetById(42); try Memo1.Lines.Add('Name: ' + Pet.Name); Memo1.Lines.Add('Status: ' + Pet.Status); Memo1.Lines.Add('Category: ' + Pet.Category.Name); finally Pet.Free; end; finally Client.Free; end; end; procedure TForm1.btnListPetsClick(Sender: TObject); var Client: TsgcOpenAPI_PetStoreClient; Pets: TsgcOpenAPI_PetList; i: Integer; begin Client := TsgcOpenAPI_PetStoreClient.Create(nil); try Client.BaseURL := 'https://petstore.swagger.io/v2'; // Strongly-typed list of Pet objects Pets := Client.FindPetsByStatus('available'); try for i := 0 to Pets.Count - 1 do ListBox1.Items.Add(Pets[i].Name); finally Pets.Free; end; finally Client.Free; end; end;