---
# [샘플] 네트워크 / HTTP / FTP

property:
  workspace: /path/to/project
  version: 1.0.0

pipeline:
  id: main
  workflow:
  - exe: http-get          # HTTP GET → 응답 저장
  - exe: json-parse        # 응답 JSON 파싱
  - exe: http-post         # HTTP POST
  - exe: ftp-upload        # FTP 업로드
  - exe: ftp-download      # FTP 다운로드
  - exe: upload-file       # HTTP multipart 파일 업로드

commands:
# HTTP GET, 응답 body 저장
- command: WebRequest
  id: http-get
  param:
    url: https://api.example.com/status
    method: GET
    headers:
      Authorization: Bearer your-token
    setResponse: <@property.apiResponse>

# 응답 JSON에서 값 추출
- command: JsonReader
  id: json-parse
  param:
    json: <!property.apiResponse>
    pair:
    - from: status
      setValue: <@property.apiStatus>
    - from: version
      setValue: <@property.serverVersion>

# HTTP POST
- command: WebRequest
  id: http-post
  param:
    url: https://api.example.com/deploy
    method: POST
    headers:
      Content-Type: application/json
      Authorization: Bearer your-token
    fields:
      appId: com.example.app
      version: <!property.version>
    setResponse: <@property.deployResponse>

# HTTP multipart 파일 업로드
- command: WebFile
  id: upload-file
  param:
    url: https://api.example.com/files
    fields:
      appId: com.example.app
    filePart: file
    fileMimeType: octet-stream
    files:
    - <!property.workspace>/release/app.ipa
    setResponse: <@property.uploadResponse>

# FTP 업로드 (map: local relative path → remote path)
- command: Upload
  id: ftp-upload
  param:
    host: ftp.example.com
    sftp: false
    port: 21
    user: ftp-user
    password: ftp-password
    map:
      "release/app.ipa": "/public/releases/app.ipa"

# FTP 다운로드 (map: local relative path → remote path)
- command: Download
  id: ftp-download
  param:
    host: ftp.example.com
    sftp: false
    port: 21
    user: ftp-user
    password: ftp-password
    map:
      "config/app.json": "/public/config/app.json"

# GitHub CLI 임의 명령
- command: GitHub
  id: gh-info
  param:
    commands:
    - repo info

# Pull Request 생성
- command: GitHubPullRequestCreate
  id: pr-create
  param:
    title: "feat: add new feature"
    body: "This PR adds a new feature"
    branch: main
    setURL: <@property.prURL>
    setNumber: <@property.prNumber>

# Pull Request 목록 조회
- command: GitHubPullRequestList
  id: pr-list
  param:
    keys:
    - number
    - title
    - state
    targetKey: state
    targetValue: open
    setValue: <@property.openPRs>

# Pull Request 닫기
- command: GitHubPullRequestClose
  id: pr-close
  param:
    number: "42"
