Skip to content

Commit

Permalink
support Harvest
Browse files Browse the repository at this point in the history
  • Loading branch information
bearmini committed Nov 30, 2016
1 parent b5bccd1 commit 1d23268
Show file tree
Hide file tree
Showing 10 changed files with 343 additions and 13 deletions.
37 changes: 37 additions & 0 deletions generators/assets/i18n/soracom-api.text.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,37 @@
}
}
},
"get_data_from_subscriber": {
"get": {
"summary": "Get data sent from a subscriber.",
"description": "Returns a list of data entries sent from a subscriber that match a certain criteria. If the total number of entries does not fit in one page, a URL for accessing the next page is returned in the 'Link' header of the response.",
"parameters": {
"imsi": {
"description": "IMSI of the target subscriber that generated data entries."
},
"from": {
"description": "Start time for the data entries search range (unixtime in milliseconds)."
},
"to": {
"description": "End time for the data entries search range (unixtime in milliseconds)."
},
"sort": {
"description": "Sort order of the data entries. Either descending (latest data entry first) or ascending (oldest data entry first)."
},
"limit": {
"description": "Maximum number of data entries to retrieve."
},
"last_evaluated_key": {
"description": "The value of `time` in the last log entry retrieved in the previous page. By specifying this parameter, you can continue to retrieve the list from the next page onward."
}
},
"responses": {
"status200": {
"description": "A list of data entries."
}
}
}
},
"cli": {
"summary": "Manage subscribers.",
"description": "Manage subscribers."
Expand Down Expand Up @@ -2190,6 +2221,12 @@
"description": "List or register coupons."
}
},
"data": {
"cli": {
"summary": "Get stored data from subscribers.",
"description": "Get stored data from subscribers."
}
},
"products": {
"cli": {
"summary": "List products.",
Expand Down
41 changes: 39 additions & 2 deletions generators/assets/i18n/soracom-api.text.ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@
"description": "対象のSubscriberのIMSI"
},
"imeiLock": {
"description": "Subscriberに指定するIMEI lockの設定 (オンラインのSubscriberの現在のIMEIにロックするにはIMEIはしてしなくてもよい"
"description": "Subscriberに指定するIMEI lockの設定 (オンラインのSubscriberの現在のIMEIにロックするにはIMEIは指定しなくてもよい"
}
},
"responses": {
Expand Down Expand Up @@ -1040,6 +1040,37 @@
}
}
},
"get_data_from_subscriber": {
"get": {
"summary": "Get data sent from a subscriber.",
"description": "指定されたサブスクライバーから送られたデータの中で、条件に合うエントリのリストを返す。データエントリの総数が1ページに収まらない場合は、次のページにアクセスするためのURLを`Link`ヘッダに含めて返す。",
"parameters": {
"imsi": {
"description": "データ取得対象のサブスクライバーのIMSI"
},
"from": {
"description": "取得対象の期間の始まり (unixtime ミリ秒単位)"
},
"to": {
"description": "取得対象の期間の終わり (unixtime ミリ秒単位)"
},
"sort": {
"description": "データエントリのソート順。下降順(最新のデータが先頭)もしくは上昇順(最も古いデータが先頭)。"
},
"limit": {
"description": "取得するデータエントリ数の上限"
},
"last_evaluated_key": {
"description": "前ページで取得した最後のデータエントリのタイムスタンプ。このパラメータを指定することで次のデータエントリ以降のリストを取得できる。"
}
},
"responses": {
"status200": {
"description": "データエントリのリスト"
}
}
}
},
"cli": {
"summary": "サブスクライバー (SIM) に関する操作を行います。",
"description": "サブスクライバー (SIM) に関する操作を行います。"
Expand Down Expand Up @@ -2140,7 +2171,7 @@
"description": "取得するログエントリ数の上限"
},
"last_evaluated_key": {
"description": "全ページで取得した最後のログエントリのタイムスタンプ。このパラメータを指定することで次のログエントリ以降のリストを取得できる。"
"description": "前ページで取得した最後のログエントリのタイムスタンプ。このパラメータを指定することで次のログエントリ以降のリストを取得できる。"
}
},
"responses": {
Expand Down Expand Up @@ -2190,6 +2221,12 @@
"description": "登録済みクーポンを確認したりアカウントへのクーポン登録を行います。"
}
},
"data": {
"cli": {
"summary": "SIM からアップロードされて格納されているデータを取得します。",
"description": "SIM からアップロードされて格納されているデータを取得します。"
}
},
"products": {
"cli": {
"summary": "商品一覧を取得します。",
Expand Down
37 changes: 37 additions & 0 deletions generators/assets/i18n/soracom-api.text.zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,37 @@
}
}
},
"get_data_from_subscriber": {
"get": {
"summary": "Get data sent from a subscriber.",
"description": "Returns a list of data entries sent from a subscriber that match a certain criteria. If the total number of entries does not fit in one page, a URL for accessing the next page is returned in the 'Link' header of the response.",
"parameters": {
"imsi": {
"description": "IMSI of the target subscriber that generated data entries."
},
"from": {
"description": "Start time for the data entries search range (unixtime in milliseconds)."
},
"to": {
"description": "End time for the data entries search range (unixtime in milliseconds)."
},
"sort": {
"description": "Sort order of the data entries. Either descending (latest data entry first) or ascending (oldest data entry first). Default "
},
"limit": {
"description": "Maximum number of data entries to retrieve."
},
"last_evaluated_key": {
"description": "The value of `time` in the last log entry retrieved in the previous page. By specifying this parameter, you can continue to retrieve the list from the next page onward."
}
},
"responses": {
"status200": {
"description": "A list of data entries."
}
}
}
},
"cli": {
"summary": "Manage subscribers.",
"description": "Manage subscribers."
Expand Down Expand Up @@ -2191,6 +2222,12 @@

}
},
"data": {
"cli": {
"summary": "Get stored data from subscribers.",
"description": "Get stored data from subscribers."
}
},
"products": {
"cli": {
"summary": "List products.",
Expand Down
69 changes: 66 additions & 3 deletions generators/assets/soracom-api.ftl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1844,6 +1844,59 @@ paths:
404:
description: ${subscribers.delete_subscriber_transfer_token.delete.responses.status404.description}

'/subscribers/{imsi}/data':
get:
summary: ${subscribers.get_data_from_subscriber.get.summary}
description: ${subscribers.get_data_from_subscriber.get.description}
operationId: getDataFromSubscriber
security:
- api_key: []
- api_token: []
x-soracom-cli:
- data get
parameters:
- name: imsi
in: path
description: ${subscribers.get_data_from_subscriber.get.parameters.imsi.description}
required: true
type: string
- name: from
in: query
description: ${subscribers.get_data_from_subscriber.get.parameters.from.description}
required: false
type: integer
- name: to
in: query
description: ${subscribers.get_data_from_subscriber.get.parameters.to.description}
required: false
type: integer
- name: sort
in: query
description: ${subscribers.get_data_from_subscriber.get.parameters.sort.description}
required: false
type: string
enum: [desc, asc]
default: desc
- name: limit
in: query
description: ${subscribers.get_data_from_subscriber.get.parameters.limit.description}
required: false
type: integer
- name: last_evaluated_key
in: query
description: ${subscribers.get_data_from_subscriber.get.parameters.last_evaluated_key.description}
required: false
type: string
tags:
- Subscriber
responses:
200:
description: ${subscribers.get_data_from_subscriber.get.responses.status200.description}
schema:
type: array
items:
'$ref': '#/definitions/DataEntry'

# Billing
'/bills':
get:
Expand Down Expand Up @@ -2932,7 +2985,7 @@ paths:
- SoracomAir
- SoracomBeam
- SoracomFunnel
- SoracomEndose
- SoracomEndorse
- name: parameters
in: body
description: ${groups.put_configuration_parameters.put.parameters.parameters.description}
Expand Down Expand Up @@ -2976,7 +3029,7 @@ paths:
- SoracomAir
- SoracomBeam
- SoracomFunnel
- SoracomEndose
- SoracomEndorse
- name: name
in: path
description: ${groups.delete_configuration_parameter.delete.parameters.name.description}
Expand Down Expand Up @@ -3561,7 +3614,6 @@ paths:
items:
'$ref': '#/definitions/LogEntry'


definitions:

Subscriber:
Expand Down Expand Up @@ -4816,3 +4868,14 @@ definitions:
format: int64
body:
type: object

# Data
DataEntry:
properties:
time:
type: integer
format: int64
content:
type: string
contentType:
type: string
8 changes: 8 additions & 0 deletions generators/cmd/src/gen_trunk_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ func generateTrunkCommands(templateDir, outputDir string) error {
ParentCommandVariableName: "RootCmd",
FileName: "credentials.go",
},
{
Use: "data",
Short: "data.cli.summary",
Long: "data.cli.description",
CommandVariableName: "DataCmd",
ParentCommandVariableName: "RootCmd",
FileName: "data.go",
},
{
Use: "event-handlers",
Short: "event_handlers.cli.summary",
Expand Down
16 changes: 16 additions & 0 deletions soracom/generated/cmd/data.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package cmd

import (
"github.com/spf13/cobra"
)

func init() {
RootCmd.AddCommand(DataCmd)
}

// DataCmd defines 'data' subcommand
var DataCmd = &cobra.Command{
Use: "data",
Short: TR("data.cli.summary"),
Long: TR(`data.cli.description`),
}
Loading

0 comments on commit 1d23268

Please sign in to comment.