Data Plugin Examples

Usage

Executing gtmhub-codegen data will generate a .yml file with default values in the directory the command is executed in.

All available options can be listed by executing gtmhub-codegen data -h which will display the help text explaining all available flags/options.

Default values, no parameters passed

The default YAML file looks like this:

kind: rest
baseUrl: 
dateFormat: yyyy-MM-dd HH:mm:ss
connectionTest:
    uri: ""
    verb: GET
    headers:
        accept: ""
        authorization: 'Bearer {connectorSettings.authorization}'
    params:
schema:
    types:
        -
            title: ""
            key: ""
            fields:
                uri: ""
                verb: GET
                headers:
                    authorization: 'Bearer {connectorSettings.authorization}'
                params:
                response:
                    collection: ""
                    mapping: {title: "", name: "", type: ""}
            staticFields:
                -
                    name: ""
                    title: ""
                    type: ""
            download:
                uri: ""
                verb: GET
                headers:
                    authorization: 'Bearer {connectorSettings.authorization}'
                params:
                response:
                    collection: ""
                paging:
                    kind: rest
                    settings: {take: ""}
    dataTypeMappings:
        varchar: string
        varchar_options: string
        monetary: double
        double: double
        date: date
        int: integer
        status: string
        enum: string
        stage: long

Default values, url parameter passed

Executing gtmhub-codegen data -url http://example.com will generate a .yml file with the following content:

kind: rest
baseUrl: http://example.com
dateFormat: yyyy-MM-dd HH:mm:ss
connectionTest:
    uri: ""
    verb: GET
    headers:
        accept: ""
        authorization: 'Bearer {connectorSettings.authorization}'
    params:
schema:
    types:
        -
            title: ""
            key: ""
            fields:
                uri: ""
                verb: GET
                headers:
                    authorization: 'Bearer {connectorSettings.authorization}'
                params:
                response:
                    collection: ""
                    mapping: {title: "", name: "", type: ""}
            staticFields:
                -
                    name: ""
                    title: ""
                    type: ""
            download:
                uri: ""
                verb: GET
                headers:
                    authorization: 'Bearer {connectorSettings.authorization}'
                params:
                response:
                    collection: ""
                paging:
                    kind: rest
                    settings: {take: ""}
    dataTypeMappings:
        varchar: string
        varchar_options: string
        monetary: double
        double: double
        date: date
        int: integer
        status: string
        enum: string
        stage: long

url and authType parameters passed

Executing gtmhub-codegen data -url http://example.com -authType basic will generate a .yml fille with the following content:

kind: rest
baseUrl: http://example.com
dateFormat: yyyy-MM-dd HH:mm:ss
connectionTest:
    uri: ""
    verb: GET
    headers:
        accept: ""
        authorization: 'Basic {connectorSettings.authorization}'
    params:
schema:
    types:
        -
            title: ""
            key: ""
            fields:
                uri: ""
                verb: GET
                headers:
                    authorization: 'Basic {connectorSettings.authorization}'
                params:
                response:
                    collection: ""
                    mapping: {title: "", name: "", type: ""}
            staticFields:
                -
                    name: ""
                    title: ""
                    type: ""
            download:
                uri: ""
                verb: GET
                headers:
                    authorization: 'Basic {connectorSettings.authorization}'
                params:
                response:
                    collection: ""
                paging:
                    kind: rest
                    settings: {take: ""}
    dataTypeMappings:
        varchar: string
        varchar_options: string
        monetary: double
        double: double
        date: date
        int: integer
        status: string
        enum: string
        stage: long