downloader_t Derived Type

type, public :: downloader_t

This type could be entirely avoided but it is quite practical because it can be mocked for testing.


Type-Bound Procedures

procedure, public, nopass :: get_file

  • private subroutine get_file(url, tmp_pkg_file, error)

    Download a file from a url using either curl or wget.

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: url
    character(len=*), intent(in) :: tmp_pkg_file
    type(error_t), intent(out), allocatable :: error

procedure, public, nopass :: get_pkg_data

  • private subroutine get_pkg_data(url, version, tmp_pkg_file, json, error)

    Perform an http get request, save output to file, and parse json.

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: url
    type(version_t), intent(in), allocatable :: version
    character(len=*), intent(in) :: tmp_pkg_file
    type(json_object), intent(out) :: json
    type(error_t), intent(out), allocatable :: error

procedure, public, nopass :: unpack

  • private subroutine unpack(tmp_pkg_file, destination, error)

    Unpack a tarball to a destination.

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: tmp_pkg_file

    Path to tarball.

    character(len=*), intent(in) :: destination

    Destination to unpack to.

    type(error_t), intent(out), allocatable :: error

    Error handling.

procedure, public, nopass :: upload_form

  • private subroutine upload_form(endpoint, form_data, verbose, error)

    Perform an http post request with form data.

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: endpoint

    Endpoint to upload to.

    type(string_t), intent(in) :: form_data(:)

    Form data to upload.

    logical, intent(in) :: verbose

    Print additional information if true.

    type(error_t), intent(out), allocatable :: error

    Error handling.