elixir-cloud-aai / ga4gh-sdk

Generic SDK and CLI for GA4GH API services
Apache License 2.0
13 stars 2 forks source link

feat(drs): add autogenerated models #70

Open lilachic opened 2 weeks ago

lilachic commented 2 weeks ago

Fixes https://github.com/orgs/elixir-cloud-aai/projects/23/views/1?filterQuery=&pane=issue&itemId=85797382&issue=elixir-cloud-aai%7Cga4gh-sdk%7C55 .

Added: lib/src/clients/drs Added: lib/src/clients/drs/mod.rs Modified: ./lib/src/clients/mod.rs to containd drs module. Autogenerated: lib/src/clients/drs/models/*.rs

Summary by Sourcery

New Features:

sourcery-ai[bot] commented 2 weeks ago

Reviewer's Guide by Sourcery

This PR adds autogenerated DRS (Data Repository Service) client models to the codebase. The models are generated from the OpenAPI specification version 1.4.0 and include all necessary data structures for interacting with a DRS service. The implementation follows Rust's standard practices for serializable data models using serde.

Class diagram for the new DRS models

classDiagram
    class DrsObject {
        +String id
        +Option<String> name
        +String self_uri
        +i64 size
        +String created_time
        +Option<String> updated_time
        +Option<String> version
        +Option<String> mime_type
        +Vec<Checksum> checksums
        +Option<Vec<AccessMethod>> access_methods
        +Option<Vec<ContentsObject>> contents
        +Option<String> description
        +Option<Vec<String>> aliases
        +new(String id, String self_uri, i64 size, String created_time, Vec<Checksum> checksums)
    }

    class AccessMethod {
        +Type type
        +Option<Box<AccessMethodAccessUrl>> access_url
        +Option<String> access_id
        +Option<String> region
        +Option<bool> available
        +Option<Box<AccessMethodAuthorizations>> authorizations
        +new(Type type)
    }

    class GetServiceInfo200Response {
        +String id
        +String name
        +Box<DrsServiceType> type
        +Option<String> description
        +Box<ServiceOrganization> organization
        +Option<String> contact_url
        +Option<String> documentation_url
        +Option<String> created_at
        +Option<String> updated_at
        +Option<String> environment
        +String version
        +i32 max_bulk_request_length
        +new(String id, String name, DrsServiceType type, ServiceOrganization organization, String version, i32 max_bulk_request_length)
    }

    class Service {
        +String id
        +String name
        +Box<ServiceType> type
        +Option<String> description
        +Box<ServiceOrganization> organization
        +Option<String> contact_url
        +Option<String> documentation_url
        +Option<String> created_at
        +Option<String> updated_at
        +Option<String> environment
        +String version
        +new(String id, String name, ServiceType type, ServiceOrganization organization, String version)
    }

    class AccessMethodAuthorizations {
        +Option<String> drs_object_id
        +Option<Vec<SupportedTypes>> supported_types
        +Option<Vec<String>> passport_auth_issuers
        +Option<Vec<String>> bearer_auth_issuers
        +new()
    }

    class Authorizations {
        +Option<String> drs_object_id
        +Option<Vec<SupportedTypes>> supported_types
        +Option<Vec<String>> passport_auth_issuers
        +Option<Vec<String>> bearer_auth_issuers
        +new()
    }

    class BulkAccessUrl {
        +Option<String> drs_object_id
        +Option<String> drs_access_id
        +String url
        +Option<Vec<String>> headers
        +new(String url)
    }

    class ServiceOrganization {
        +String name
        +String url
        +new(String name, String url)
    }

    class Checksum {
        +String checksum
        +String type
        +new(String checksum, String type)
    }

    class AccessMethodAccessUrl {
        +String url
        +Option<Vec<String>> headers
        +new(String url)
    }

    class AccessUrl {
        +String url
        +Option<Vec<String>> headers
        +new(String url)
    }

    class ContentsObject {
        +String name
        +Option<String> id
        +Option<Vec<String>> drs_uri
        +Option<Vec<ContentsObject>> contents
        +new(String name)
    }

    class DrsServiceType {
        +Artifact artifact
        +new(Artifact artifact)
    }

    class ServiceType {
        +String group
        +String artifact
        +String version
        +new(String group, String artifact, String version)
    }

    class Summary {
        +Option<i32> requested
        +Option<i32> resolved
        +Option<i32> unresolved
        +new()
    }

    class Error {
        +Option<String> msg
        +Option<i32> status_code
        +new()
    }

    class GetBulkAccessUrl200Response {
        +Option<Box<Summary>> summary
        +Option<Vec<UnresolvedInner>> unresolved_drs_objects
        +Option<Vec<BulkAccessUrl>> resolved_drs_object_access_urls
        +new()
    }

    class GetBulkObjects200Response {
        +Option<Box<Summary>> summary
        +Option<Vec<UnresolvedInner>> unresolved_drs_objects
        +Option<Vec<DrsObject>> resolved_drs_object
        +new()
    }

    class OptionsBulkObject200Response {
        +Option<Box<Summary>> summary
        +Option<Vec<UnresolvedInner>> unresolved_drs_objects
        +Option<Vec<Authorizations>> resolved_drs_object
        +new()
    }

    class UnresolvedInner {
        +Option<i32> error_code
        +Option<Vec<String>> object_ids
        +new()
    }

    class PostAccessUrlRequest {
        +Option<Vec<String>> passports
        +new()
    }

    class PostObjectRequest {
        +Option<bool> expand
        +Option<Vec<String>> passports
        +new()
    }

    class DrsService {
        +i32 max_bulk_request_length
        +Box<DrsServiceType> type
        +new(i32 max_bulk_request_length, DrsServiceType type)
    }

    class DrsServiceType {
        +Artifact artifact
        +new(Artifact artifact)
    }

    class Artifact {
        <<enumeration>>
        Drs
    }

    class SupportedTypes {
        <<enumeration>>
        None
        BasicAuth
        BearerAuth
        PassportAuth
    }

    class Type {
        <<enumeration>>
        S3
        Gs
        Ftp
        Gsiftp
        Globus
        Htsget
        Https
        File
    }

File-Level Changes

Change Details Files
Added new DRS client module with autogenerated models
  • Created new DRS module directory structure
  • Added DRS module to the clients module exports
  • Generated model structs for DRS objects and services
  • Implemented serialization/deserialization using serde
lib/src/clients/mod.rs
lib/src/clients/drs/mod.rs
lib/src/clients/drs/models/mod.rs
Implemented core DRS data models
  • Added DrsObject model for representing DRS resources
  • Created AccessMethod model for handling different access types
  • Implemented Checksum model for data integrity verification
  • Added ServiceInfo models for DRS service metadata
lib/src/clients/drs/models/drs_object.rs
lib/src/clients/drs/models/access_method.rs
lib/src/clients/drs/models/checksum.rs
lib/src/clients/drs/models/get_service_info_200_response.rs
Added support models for DRS operations
  • Implemented models for bulk operations
  • Added error handling models
  • Created authorization-related models
  • Added request/response models for various DRS endpoints
lib/src/clients/drs/models/bulk_access_url.rs
lib/src/clients/drs/models/error.rs
lib/src/clients/drs/models/authorizations.rs
lib/src/clients/drs/models/post_access_url_request.rs
lib/src/clients/drs/models/post_object_request.rs

Possibly linked issues


Tips and commands #### Interacting with Sourcery - **Trigger a new review:** Comment `@sourcery-ai review` on the pull request. - **Continue discussions:** Reply directly to Sourcery's review comments. - **Generate a GitHub issue from a review comment:** Ask Sourcery to create an issue from a review comment by replying to it. - **Generate a pull request title:** Write `@sourcery-ai` anywhere in the pull request title to generate a title at any time. - **Generate a pull request summary:** Write `@sourcery-ai summary` anywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) to: - Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others. - Change the review language. - Add, remove or edit custom review instructions. - Adjust other review settings. #### Getting Help - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).