aboutsummaryrefslogtreecommitdiffstats
path: root/products/sample/src/main/resources/open-cli-schema/hello-world-http.yaml
blob: 8cad86688275383d97c788e32746d4687f40ca43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
open_cli_schema_version: 1.0
name: weather-report
description: |
    Place this OCS YAML under $OPEN_CLI_HOME/open-cli-schema folder. Then run the commands
    oclip schema-refresh

    It is used to display the temparature and wind speed details from https://openweathermap.org.
    Try to add new commands to display different weather details by exploring this site.

    Sample usage:
    oclip --product tutorial weather-report --host-url http://api.openweathermap.org --zip-code 637301 --country-code in

info:
  product: tutorial
  service: learning
  author: Kanagaraj Manickam kanagaraj.manickam@huawei.com

parameters:
  - name: zip-code
    description: zip-code
    type: string
    short_option: x
    long_option: zip-code
    is_optional: true
    default_value: 637301
  - name: country-code
    description: country-code
    type: string
    short_option: y
    long_option: country-code
    is_optional: true
    default_value: in
  - name: api-code
    description: api-code
    type: string
    short_option: z
    long_option: api-code
    is_optional: true
    default_value: 13cf06b1b379a4b7501c34c2d67a625c

results:
  direction: landscape
  attributes:
    - name: temperature
      description: temperature at city
      scope: short
      type: string
    - name: wind
      description: wind speed
      scope: short
      type: string
http:
  service:
    auth: none
    mode: direct
  request:
    uri: /data/2.5/weather?zip=${zip-code},${country-code}&appid=${api-code}
    method: GET
  success_codes:
    - 200
  result_map:
    temperature: $b{$.main.temp}
    wind: $b{$.wind.speed}