From 61aa979d358caba354ba38712d157ceb4e37398c Mon Sep 17 00:00:00 2001 From: minchao Date: Thu, 23 Jan 2020 00:59:01 +0800 Subject: [PATCH] OpenAPI Specification change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 公車 V2 新增逐筆更新資料。 - 軌道 V2 新增桃園捷運營運最新消息資料。 - 軌道 V2 新增桃園捷運營運通阻資料。 - 公車 V2 改版。 - 軌道 V2 台鐵車站資料新增必填欄位 `StationUID`。 --- CHANGELOG.md | 14 +- ...imated_time_of_arrival_udp_1_parameters.go | 387 ++ ...timated_time_of_arrival_udp_1_responses.go | 107 + ...stimated_time_of_arrival_udp_parameters.go | 366 ++ ...estimated_time_of_arrival_udp_responses.go | 107 + ...real_time_by_frequency_udp_1_parameters.go | 419 +++ ..._real_time_by_frequency_udp_1_responses.go | 107 + ...i_real_time_by_frequency_udp_parameters.go | 398 +++ ...pi_real_time_by_frequency_udp_responses.go | 107 + ..._bus_api_real_time_near_stop_parameters.go | 5 +- ...pi_real_time_near_stop_udp_1_parameters.go | 387 ++ ...api_real_time_near_stop_udp_1_responses.go | 107 + ..._api_real_time_near_stop_udp_parameters.go | 366 ++ ...s_api_real_time_near_stop_udp_responses.go | 107 + .../city_bus_api_station_group_parameters.go | 398 +++ .../city_bus_api_station_group_responses.go | 107 + bus/v2/client/city_bus/city_bus_client.go | 281 +- ...imated_time_of_arrival_udp_1_parameters.go | 366 ++ ...timated_time_of_arrival_udp_1_responses.go | 107 + ...stimated_time_of_arrival_udp_parameters.go | 345 ++ ...estimated_time_of_arrival_udp_responses.go | 107 + ...real_time_by_frequency_udp_1_parameters.go | 398 +++ ..._real_time_by_frequency_udp_1_responses.go | 107 + ...i_real_time_by_frequency_udp_parameters.go | 377 ++ ...pi_real_time_by_frequency_udp_responses.go | 107 + ...bus_api_real_time_near_stop1_parameters.go | 21 + ..._bus_api_real_time_near_stop1_responses.go | 4 +- ..._bus_api_real_time_near_stop2_responses.go | 107 - ..._bus_api_real_time_near_stop_parameters.go | 345 ++ ...y_bus_api_real_time_near_stop_responses.go | 107 + ...i_real_time_near_stop_udp_1_parameters.go} | 120 +- ...api_real_time_near_stop_udp_1_responses.go | 107 + ..._api_real_time_near_stop_udp_parameters.go | 345 ++ ...s_api_real_time_near_stop_udp_responses.go | 107 + ...r_city_bus_api_station_group_parameters.go | 377 ++ ...er_city_bus_api_station_group_responses.go | 107 + .../inter_city_bus/inter_city_bus_client.go | 301 +- .../service_d_t_o_version2_bus_bus_station.go | 17 + ...ce_d_t_o_version2_bus_bus_station_group.go | 175 + .../service_d_t_o_version2_bus_bus_stop.go | 17 + .../models/service_d_t_o_version2_bus_stop.go | 17 + oas.bus.v2.json | 3136 +++++++++++++---- oas.bus.v3.json | 2 +- oas.rail.v2.json | 857 ++++- oas.rail.v3.json | 10 +- oas.tourism.v2.json | 134 +- .../client/m_o_t_c_transport_api_v2_client.go | 7 + .../metro/metro_api_alert_parameters.go | 363 ++ .../client/metro/metro_api_alert_responses.go | 70 + .../client/metro/metro_api_news_parameters.go | 363 ++ .../client/metro/metro_api_news_responses.go | 70 + rail/v2/client/metro/metro_client.go | 75 + .../rail_api_operator_parameters.go | 313 ++ .../rail_basic/rail_api_operator_responses.go | 68 + .../v2/client/rail_basic/rail_basic_client.go | 66 + ...sion2_rail_metro_m_r_t_alert_list_alert.go | 160 + ...ersion2_rail_metro_m_r_t_news_list_news.go | 160 + .../service_d_t_o_version2_base_operator.go | 199 ++ ...sion2_rail_metro_m_r_t_alert_list_alert.go | 198 ++ ...rail_metro_m_r_t_alert_list_alert_scope.go | 241 ++ ...metro_m_r_t_alert_list_alert_scope_line.go | 46 + ...r_t_alert_list_alert_scope_line_section.go | 58 + ...ro_m_r_t_alert_list_alert_scope_network.go | 43 + ...etro_m_r_t_alert_list_alert_scope_route.go | 46 + ...ro_m_r_t_alert_list_alert_scope_station.go | 46 + ...etro_m_r_t_alert_list_alert_scope_train.go | 43 + ...ersion2_rail_metro_m_r_t_news_list_news.go | 179 + ...rvice_d_t_o_version3_rail_t_r_a_station.go | 17 + ...api_real_time_by_frequency1_parameters.go} | 120 +- ..._api_real_time_by_frequency1_responses.go} | 26 +- ...us_api_real_time_near_stop1_parameters.go} | 112 +- ...bus_api_real_time_near_stop1_responses.go} | 26 +- tourism/v2/client/tourism/tourism_client.go | 28 +- .../models/service_d_t_o_version2_bus_stop.go | 17 + 74 files changed, 14014 insertions(+), 1243 deletions(-) create mode 100644 bus/v2/client/city_bus/city_bus_api_estimated_time_of_arrival_udp_1_parameters.go create mode 100644 bus/v2/client/city_bus/city_bus_api_estimated_time_of_arrival_udp_1_responses.go create mode 100644 bus/v2/client/city_bus/city_bus_api_estimated_time_of_arrival_udp_parameters.go create mode 100644 bus/v2/client/city_bus/city_bus_api_estimated_time_of_arrival_udp_responses.go create mode 100644 bus/v2/client/city_bus/city_bus_api_real_time_by_frequency_udp_1_parameters.go create mode 100644 bus/v2/client/city_bus/city_bus_api_real_time_by_frequency_udp_1_responses.go create mode 100644 bus/v2/client/city_bus/city_bus_api_real_time_by_frequency_udp_parameters.go create mode 100644 bus/v2/client/city_bus/city_bus_api_real_time_by_frequency_udp_responses.go create mode 100644 bus/v2/client/city_bus/city_bus_api_real_time_near_stop_udp_1_parameters.go create mode 100644 bus/v2/client/city_bus/city_bus_api_real_time_near_stop_udp_1_responses.go create mode 100644 bus/v2/client/city_bus/city_bus_api_real_time_near_stop_udp_parameters.go create mode 100644 bus/v2/client/city_bus/city_bus_api_real_time_near_stop_udp_responses.go create mode 100644 bus/v2/client/city_bus/city_bus_api_station_group_parameters.go create mode 100644 bus/v2/client/city_bus/city_bus_api_station_group_responses.go create mode 100644 bus/v2/client/inter_city_bus/inter_city_bus_api_estimated_time_of_arrival_udp_1_parameters.go create mode 100644 bus/v2/client/inter_city_bus/inter_city_bus_api_estimated_time_of_arrival_udp_1_responses.go create mode 100644 bus/v2/client/inter_city_bus/inter_city_bus_api_estimated_time_of_arrival_udp_parameters.go create mode 100644 bus/v2/client/inter_city_bus/inter_city_bus_api_estimated_time_of_arrival_udp_responses.go create mode 100644 bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_by_frequency_udp_1_parameters.go create mode 100644 bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_by_frequency_udp_1_responses.go create mode 100644 bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_by_frequency_udp_parameters.go create mode 100644 bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_by_frequency_udp_responses.go delete mode 100644 bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop2_responses.go create mode 100644 bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop_parameters.go create mode 100644 bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop_responses.go rename bus/v2/client/inter_city_bus/{inter_city_bus_api_real_time_near_stop2_parameters.go => inter_city_bus_api_real_time_near_stop_udp_1_parameters.go} (57%) create mode 100644 bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop_udp_1_responses.go create mode 100644 bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop_udp_parameters.go create mode 100644 bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop_udp_responses.go create mode 100644 bus/v2/client/inter_city_bus/inter_city_bus_api_station_group_parameters.go create mode 100644 bus/v2/client/inter_city_bus/inter_city_bus_api_station_group_responses.go create mode 100644 bus/v2/models/service_d_t_o_version2_bus_bus_station_group.go create mode 100644 rail/v2/client/metro/metro_api_alert_parameters.go create mode 100644 rail/v2/client/metro/metro_api_alert_responses.go create mode 100644 rail/v2/client/metro/metro_api_news_parameters.go create mode 100644 rail/v2/client/metro/metro_api_news_responses.go create mode 100644 rail/v2/client/rail_basic/rail_api_operator_parameters.go create mode 100644 rail/v2/client/rail_basic/rail_api_operator_responses.go create mode 100644 rail/v2/client/rail_basic/rail_basic_client.go create mode 100644 rail/v2/models/m_o_t_c_api_rail_models_m_r_t_real_time_wrapper_service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert.go create mode 100644 rail/v2/models/m_o_t_c_api_rail_models_m_r_t_real_time_wrapper_service_d_t_o_version2_rail_metro_m_r_t_news_list_news.go create mode 100644 rail/v2/models/service_d_t_o_version2_base_operator.go create mode 100644 rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert.go create mode 100644 rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope.go create mode 100644 rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope_line.go create mode 100644 rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope_line_section.go create mode 100644 rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope_network.go create mode 100644 rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope_route.go create mode 100644 rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope_station.go create mode 100644 rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope_train.go create mode 100644 rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_news_list_news.go rename tourism/v2/client/tourism/{taiwan_trip_bus_api_real_time_by_frequency2_parameters.go => taiwan_trip_bus_api_real_time_by_frequency1_parameters.go} (64%) rename tourism/v2/client/tourism/{taiwan_trip_bus_api_real_time_by_frequency2_responses.go => taiwan_trip_bus_api_real_time_by_frequency1_responses.go} (59%) rename tourism/v2/client/tourism/{taiwan_trip_bus_api_real_time_near_stop2_parameters.go => taiwan_trip_bus_api_real_time_near_stop1_parameters.go} (61%) rename tourism/v2/client/tourism/{taiwan_trip_bus_api_real_time_near_stop2_responses.go => taiwan_trip_bus_api_real_time_near_stop1_responses.go} (58%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e8387ad..63e54b1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,17 @@ ## [Unreleased] +## [0.4.0] - 2020-01-23 + +### Added +- 公車 V2 新增逐筆更新資料。 +- 軌道 V2 新增桃園捷運營運最新消息資料。 +- 軌道 V2 新增桃園捷運營運通阻資料。 + +### Changed +- 公車 V2 改版。 +- 軌道 V2 台鐵車站資料新增必填欄位 `StationUID`。 + ## [0.3.0] - 2019-12-21 ### Added @@ -50,7 +61,8 @@ ### Added - 首次發行,提供基本、航空、公車、軌道、自行車與觀光等 PTX API 用戶端程式庫。 -[Unreleased]: https://github.com/minchao/go-ptx/compare/v0.3.0...HEAD +[Unreleased]: https://github.com/minchao/go-ptx/compare/v0.4.0...HEAD +[0.4.0]: https://github.com/minchao/go-ptx/compare/v0.3.0...v0.4.0 [0.3.0]: https://github.com/minchao/go-ptx/compare/v0.2.0...v0.3.0 [0.2.0]: https://github.com/minchao/go-ptx/compare/v0.1.0...v0.2.0 [0.1.0]: https://github.com/minchao/go-ptx/compare/v0.0.1...v0.1.0 diff --git a/bus/v2/client/city_bus/city_bus_api_estimated_time_of_arrival_udp_1_parameters.go b/bus/v2/client/city_bus/city_bus_api_estimated_time_of_arrival_udp_1_parameters.go new file mode 100644 index 00000000..c46df84c --- /dev/null +++ b/bus/v2/client/city_bus/city_bus_api_estimated_time_of_arrival_udp_1_parameters.go @@ -0,0 +1,387 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/swag" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewCityBusAPIEstimatedTimeOfArrivalUDP1Params creates a new CityBusAPIEstimatedTimeOfArrivalUDP1Params object +// with the default values initialized. +func NewCityBusAPIEstimatedTimeOfArrivalUDP1Params() *CityBusAPIEstimatedTimeOfArrivalUDP1Params { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIEstimatedTimeOfArrivalUDP1Params{ + DollarTop: &dollarTopDefault, + + timeout: cr.DefaultTimeout, + } +} + +// NewCityBusAPIEstimatedTimeOfArrivalUDP1ParamsWithTimeout creates a new CityBusAPIEstimatedTimeOfArrivalUDP1Params object +// with the default values initialized, and the ability to set a timeout on a request +func NewCityBusAPIEstimatedTimeOfArrivalUDP1ParamsWithTimeout(timeout time.Duration) *CityBusAPIEstimatedTimeOfArrivalUDP1Params { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIEstimatedTimeOfArrivalUDP1Params{ + DollarTop: &dollarTopDefault, + + timeout: timeout, + } +} + +// NewCityBusAPIEstimatedTimeOfArrivalUDP1ParamsWithContext creates a new CityBusAPIEstimatedTimeOfArrivalUDP1Params object +// with the default values initialized, and the ability to set a context for a request +func NewCityBusAPIEstimatedTimeOfArrivalUDP1ParamsWithContext(ctx context.Context) *CityBusAPIEstimatedTimeOfArrivalUDP1Params { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIEstimatedTimeOfArrivalUDP1Params{ + DollarTop: &dollarTopDefault, + + Context: ctx, + } +} + +// NewCityBusAPIEstimatedTimeOfArrivalUDP1ParamsWithHTTPClient creates a new CityBusAPIEstimatedTimeOfArrivalUDP1Params object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewCityBusAPIEstimatedTimeOfArrivalUDP1ParamsWithHTTPClient(client *http.Client) *CityBusAPIEstimatedTimeOfArrivalUDP1Params { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIEstimatedTimeOfArrivalUDP1Params{ + DollarTop: &dollarTopDefault, + HTTPClient: client, + } +} + +/*CityBusAPIEstimatedTimeOfArrivalUDP1Params contains all the parameters to send to the API endpoint +for the city bus Api estimated time of arrival UDP 1 operation typically these are written to a http.Request +*/ +type CityBusAPIEstimatedTimeOfArrivalUDP1Params struct { + + /*DollarFilter + 過濾 + + */ + DollarFilter *string + /*DollarFormat + 指定來源格式 + + */ + DollarFormat string + /*DollarOrderby + 排序 + + */ + DollarOrderby *string + /*DollarSelect + 挑選 + + */ + DollarSelect *string + /*DollarSkip + 跳過前幾筆 + + */ + DollarSkip *string + /*DollarTop + 取前幾筆 + + */ + DollarTop *int64 + /*City + 欲查詢縣市 + + */ + City string + /*RouteName + 繁體中文路線名稱,如'307' + + */ + RouteName string + /*Health + 加入參數'?health=true'即可查詢此API服務的健康狀態 + + */ + Health *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the city bus Api estimated time of arrival UDP 1 params +func (o *CityBusAPIEstimatedTimeOfArrivalUDP1Params) WithTimeout(timeout time.Duration) *CityBusAPIEstimatedTimeOfArrivalUDP1Params { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the city bus Api estimated time of arrival UDP 1 params +func (o *CityBusAPIEstimatedTimeOfArrivalUDP1Params) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the city bus Api estimated time of arrival UDP 1 params +func (o *CityBusAPIEstimatedTimeOfArrivalUDP1Params) WithContext(ctx context.Context) *CityBusAPIEstimatedTimeOfArrivalUDP1Params { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the city bus Api estimated time of arrival UDP 1 params +func (o *CityBusAPIEstimatedTimeOfArrivalUDP1Params) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the city bus Api estimated time of arrival UDP 1 params +func (o *CityBusAPIEstimatedTimeOfArrivalUDP1Params) WithHTTPClient(client *http.Client) *CityBusAPIEstimatedTimeOfArrivalUDP1Params { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the city bus Api estimated time of arrival UDP 1 params +func (o *CityBusAPIEstimatedTimeOfArrivalUDP1Params) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDollarFilter adds the dollarFilter to the city bus Api estimated time of arrival UDP 1 params +func (o *CityBusAPIEstimatedTimeOfArrivalUDP1Params) WithDollarFilter(dollarFilter *string) *CityBusAPIEstimatedTimeOfArrivalUDP1Params { + o.SetDollarFilter(dollarFilter) + return o +} + +// SetDollarFilter adds the dollarFilter to the city bus Api estimated time of arrival UDP 1 params +func (o *CityBusAPIEstimatedTimeOfArrivalUDP1Params) SetDollarFilter(dollarFilter *string) { + o.DollarFilter = dollarFilter +} + +// WithDollarFormat adds the dollarFormat to the city bus Api estimated time of arrival UDP 1 params +func (o *CityBusAPIEstimatedTimeOfArrivalUDP1Params) WithDollarFormat(dollarFormat string) *CityBusAPIEstimatedTimeOfArrivalUDP1Params { + o.SetDollarFormat(dollarFormat) + return o +} + +// SetDollarFormat adds the dollarFormat to the city bus Api estimated time of arrival UDP 1 params +func (o *CityBusAPIEstimatedTimeOfArrivalUDP1Params) SetDollarFormat(dollarFormat string) { + o.DollarFormat = dollarFormat +} + +// WithDollarOrderby adds the dollarOrderby to the city bus Api estimated time of arrival UDP 1 params +func (o *CityBusAPIEstimatedTimeOfArrivalUDP1Params) WithDollarOrderby(dollarOrderby *string) *CityBusAPIEstimatedTimeOfArrivalUDP1Params { + o.SetDollarOrderby(dollarOrderby) + return o +} + +// SetDollarOrderby adds the dollarOrderby to the city bus Api estimated time of arrival UDP 1 params +func (o *CityBusAPIEstimatedTimeOfArrivalUDP1Params) SetDollarOrderby(dollarOrderby *string) { + o.DollarOrderby = dollarOrderby +} + +// WithDollarSelect adds the dollarSelect to the city bus Api estimated time of arrival UDP 1 params +func (o *CityBusAPIEstimatedTimeOfArrivalUDP1Params) WithDollarSelect(dollarSelect *string) *CityBusAPIEstimatedTimeOfArrivalUDP1Params { + o.SetDollarSelect(dollarSelect) + return o +} + +// SetDollarSelect adds the dollarSelect to the city bus Api estimated time of arrival UDP 1 params +func (o *CityBusAPIEstimatedTimeOfArrivalUDP1Params) SetDollarSelect(dollarSelect *string) { + o.DollarSelect = dollarSelect +} + +// WithDollarSkip adds the dollarSkip to the city bus Api estimated time of arrival UDP 1 params +func (o *CityBusAPIEstimatedTimeOfArrivalUDP1Params) WithDollarSkip(dollarSkip *string) *CityBusAPIEstimatedTimeOfArrivalUDP1Params { + o.SetDollarSkip(dollarSkip) + return o +} + +// SetDollarSkip adds the dollarSkip to the city bus Api estimated time of arrival UDP 1 params +func (o *CityBusAPIEstimatedTimeOfArrivalUDP1Params) SetDollarSkip(dollarSkip *string) { + o.DollarSkip = dollarSkip +} + +// WithDollarTop adds the dollarTop to the city bus Api estimated time of arrival UDP 1 params +func (o *CityBusAPIEstimatedTimeOfArrivalUDP1Params) WithDollarTop(dollarTop *int64) *CityBusAPIEstimatedTimeOfArrivalUDP1Params { + o.SetDollarTop(dollarTop) + return o +} + +// SetDollarTop adds the dollarTop to the city bus Api estimated time of arrival UDP 1 params +func (o *CityBusAPIEstimatedTimeOfArrivalUDP1Params) SetDollarTop(dollarTop *int64) { + o.DollarTop = dollarTop +} + +// WithCity adds the city to the city bus Api estimated time of arrival UDP 1 params +func (o *CityBusAPIEstimatedTimeOfArrivalUDP1Params) WithCity(city string) *CityBusAPIEstimatedTimeOfArrivalUDP1Params { + o.SetCity(city) + return o +} + +// SetCity adds the city to the city bus Api estimated time of arrival UDP 1 params +func (o *CityBusAPIEstimatedTimeOfArrivalUDP1Params) SetCity(city string) { + o.City = city +} + +// WithRouteName adds the routeName to the city bus Api estimated time of arrival UDP 1 params +func (o *CityBusAPIEstimatedTimeOfArrivalUDP1Params) WithRouteName(routeName string) *CityBusAPIEstimatedTimeOfArrivalUDP1Params { + o.SetRouteName(routeName) + return o +} + +// SetRouteName adds the routeName to the city bus Api estimated time of arrival UDP 1 params +func (o *CityBusAPIEstimatedTimeOfArrivalUDP1Params) SetRouteName(routeName string) { + o.RouteName = routeName +} + +// WithHealth adds the health to the city bus Api estimated time of arrival UDP 1 params +func (o *CityBusAPIEstimatedTimeOfArrivalUDP1Params) WithHealth(health *string) *CityBusAPIEstimatedTimeOfArrivalUDP1Params { + o.SetHealth(health) + return o +} + +// SetHealth adds the health to the city bus Api estimated time of arrival UDP 1 params +func (o *CityBusAPIEstimatedTimeOfArrivalUDP1Params) SetHealth(health *string) { + o.Health = health +} + +// WriteToRequest writes these params to a swagger request +func (o *CityBusAPIEstimatedTimeOfArrivalUDP1Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.DollarFilter != nil { + + // query param $filter + var qrDollarFilter string + if o.DollarFilter != nil { + qrDollarFilter = *o.DollarFilter + } + qDollarFilter := qrDollarFilter + if qDollarFilter != "" { + if err := r.SetQueryParam("$filter", qDollarFilter); err != nil { + return err + } + } + + } + + // query param $format + qrDollarFormat := o.DollarFormat + qDollarFormat := qrDollarFormat + if qDollarFormat != "" { + if err := r.SetQueryParam("$format", qDollarFormat); err != nil { + return err + } + } + + if o.DollarOrderby != nil { + + // query param $orderby + var qrDollarOrderby string + if o.DollarOrderby != nil { + qrDollarOrderby = *o.DollarOrderby + } + qDollarOrderby := qrDollarOrderby + if qDollarOrderby != "" { + if err := r.SetQueryParam("$orderby", qDollarOrderby); err != nil { + return err + } + } + + } + + if o.DollarSelect != nil { + + // query param $select + var qrDollarSelect string + if o.DollarSelect != nil { + qrDollarSelect = *o.DollarSelect + } + qDollarSelect := qrDollarSelect + if qDollarSelect != "" { + if err := r.SetQueryParam("$select", qDollarSelect); err != nil { + return err + } + } + + } + + if o.DollarSkip != nil { + + // query param $skip + var qrDollarSkip string + if o.DollarSkip != nil { + qrDollarSkip = *o.DollarSkip + } + qDollarSkip := qrDollarSkip + if qDollarSkip != "" { + if err := r.SetQueryParam("$skip", qDollarSkip); err != nil { + return err + } + } + + } + + if o.DollarTop != nil { + + // query param $top + var qrDollarTop int64 + if o.DollarTop != nil { + qrDollarTop = *o.DollarTop + } + qDollarTop := swag.FormatInt64(qrDollarTop) + if qDollarTop != "" { + if err := r.SetQueryParam("$top", qDollarTop); err != nil { + return err + } + } + + } + + // path param City + if err := r.SetPathParam("City", o.City); err != nil { + return err + } + + // path param RouteName + if err := r.SetPathParam("RouteName", o.RouteName); err != nil { + return err + } + + if o.Health != nil { + + // query param health + var qrHealth string + if o.Health != nil { + qrHealth = *o.Health + } + qHealth := qrHealth + if qHealth != "" { + if err := r.SetQueryParam("health", qHealth); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/bus/v2/client/city_bus/city_bus_api_estimated_time_of_arrival_udp_1_responses.go b/bus/v2/client/city_bus/city_bus_api_estimated_time_of_arrival_udp_1_responses.go new file mode 100644 index 00000000..5243837e --- /dev/null +++ b/bus/v2/client/city_bus/city_bus_api_estimated_time_of_arrival_udp_1_responses.go @@ -0,0 +1,107 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/minchao/go-ptx/bus/v2/models" +) + +// CityBusAPIEstimatedTimeOfArrivalUDP1Reader is a Reader for the CityBusAPIEstimatedTimeOfArrivalUDP1 structure. +type CityBusAPIEstimatedTimeOfArrivalUDP1Reader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CityBusAPIEstimatedTimeOfArrivalUDP1Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCityBusAPIEstimatedTimeOfArrivalUdp1OK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 299: + result := NewCityBusAPIEstimatedTimeOfArrivalUdp1Status299() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewCityBusAPIEstimatedTimeOfArrivalUdp1OK creates a CityBusAPIEstimatedTimeOfArrivalUdp1OK with default headers values +func NewCityBusAPIEstimatedTimeOfArrivalUdp1OK() *CityBusAPIEstimatedTimeOfArrivalUdp1OK { + return &CityBusAPIEstimatedTimeOfArrivalUdp1OK{} +} + +/*CityBusAPIEstimatedTimeOfArrivalUdp1OK handles this case with default header values. + +OK +*/ +type CityBusAPIEstimatedTimeOfArrivalUdp1OK struct { + Payload []*models.ServiceDTOVersion2BusBusN1EstimateTime +} + +func (o *CityBusAPIEstimatedTimeOfArrivalUdp1OK) Error() string { + return fmt.Sprintf("[GET /v2/Bus/EstimatedTimeOfArrival/Streaming/City/{City}/{RouteName}][%d] cityBusApiEstimatedTimeOfArrivalUdp1OK %+v", 200, o.Payload) +} + +func (o *CityBusAPIEstimatedTimeOfArrivalUdp1OK) GetPayload() []*models.ServiceDTOVersion2BusBusN1EstimateTime { + return o.Payload +} + +func (o *CityBusAPIEstimatedTimeOfArrivalUdp1OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewCityBusAPIEstimatedTimeOfArrivalUdp1Status299 creates a CityBusAPIEstimatedTimeOfArrivalUdp1Status299 with default headers values +func NewCityBusAPIEstimatedTimeOfArrivalUdp1Status299() *CityBusAPIEstimatedTimeOfArrivalUdp1Status299 { + return &CityBusAPIEstimatedTimeOfArrivalUdp1Status299{} +} + +/*CityBusAPIEstimatedTimeOfArrivalUdp1Status299 handles this case with default header values. + +加入參數'?health=true'即可查詢此API服務的健康狀態 +*/ +type CityBusAPIEstimatedTimeOfArrivalUdp1Status299 struct { + Payload *models.ServiceDTOVersion3BaseHealth +} + +func (o *CityBusAPIEstimatedTimeOfArrivalUdp1Status299) Error() string { + return fmt.Sprintf("[GET /v2/Bus/EstimatedTimeOfArrival/Streaming/City/{City}/{RouteName}][%d] cityBusApiEstimatedTimeOfArrivalUdp1Status299 %+v", 299, o.Payload) +} + +func (o *CityBusAPIEstimatedTimeOfArrivalUdp1Status299) GetPayload() *models.ServiceDTOVersion3BaseHealth { + return o.Payload +} + +func (o *CityBusAPIEstimatedTimeOfArrivalUdp1Status299) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceDTOVersion3BaseHealth) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/bus/v2/client/city_bus/city_bus_api_estimated_time_of_arrival_udp_parameters.go b/bus/v2/client/city_bus/city_bus_api_estimated_time_of_arrival_udp_parameters.go new file mode 100644 index 00000000..51d2d0d5 --- /dev/null +++ b/bus/v2/client/city_bus/city_bus_api_estimated_time_of_arrival_udp_parameters.go @@ -0,0 +1,366 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/swag" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewCityBusAPIEstimatedTimeOfArrivalUDPParams creates a new CityBusAPIEstimatedTimeOfArrivalUDPParams object +// with the default values initialized. +func NewCityBusAPIEstimatedTimeOfArrivalUDPParams() *CityBusAPIEstimatedTimeOfArrivalUDPParams { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIEstimatedTimeOfArrivalUDPParams{ + DollarTop: &dollarTopDefault, + + timeout: cr.DefaultTimeout, + } +} + +// NewCityBusAPIEstimatedTimeOfArrivalUDPParamsWithTimeout creates a new CityBusAPIEstimatedTimeOfArrivalUDPParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewCityBusAPIEstimatedTimeOfArrivalUDPParamsWithTimeout(timeout time.Duration) *CityBusAPIEstimatedTimeOfArrivalUDPParams { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIEstimatedTimeOfArrivalUDPParams{ + DollarTop: &dollarTopDefault, + + timeout: timeout, + } +} + +// NewCityBusAPIEstimatedTimeOfArrivalUDPParamsWithContext creates a new CityBusAPIEstimatedTimeOfArrivalUDPParams object +// with the default values initialized, and the ability to set a context for a request +func NewCityBusAPIEstimatedTimeOfArrivalUDPParamsWithContext(ctx context.Context) *CityBusAPIEstimatedTimeOfArrivalUDPParams { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIEstimatedTimeOfArrivalUDPParams{ + DollarTop: &dollarTopDefault, + + Context: ctx, + } +} + +// NewCityBusAPIEstimatedTimeOfArrivalUDPParamsWithHTTPClient creates a new CityBusAPIEstimatedTimeOfArrivalUDPParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewCityBusAPIEstimatedTimeOfArrivalUDPParamsWithHTTPClient(client *http.Client) *CityBusAPIEstimatedTimeOfArrivalUDPParams { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIEstimatedTimeOfArrivalUDPParams{ + DollarTop: &dollarTopDefault, + HTTPClient: client, + } +} + +/*CityBusAPIEstimatedTimeOfArrivalUDPParams contains all the parameters to send to the API endpoint +for the city bus Api estimated time of arrival UDP operation typically these are written to a http.Request +*/ +type CityBusAPIEstimatedTimeOfArrivalUDPParams struct { + + /*DollarFilter + 過濾 + + */ + DollarFilter *string + /*DollarFormat + 指定來源格式 + + */ + DollarFormat string + /*DollarOrderby + 排序 + + */ + DollarOrderby *string + /*DollarSelect + 挑選 + + */ + DollarSelect *string + /*DollarSkip + 跳過前幾筆 + + */ + DollarSkip *string + /*DollarTop + 取前幾筆 + + */ + DollarTop *int64 + /*City + 欲查詢縣市 + + */ + City string + /*Health + 加入參數'?health=true'即可查詢此API服務的健康狀態 + + */ + Health *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the city bus Api estimated time of arrival UDP params +func (o *CityBusAPIEstimatedTimeOfArrivalUDPParams) WithTimeout(timeout time.Duration) *CityBusAPIEstimatedTimeOfArrivalUDPParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the city bus Api estimated time of arrival UDP params +func (o *CityBusAPIEstimatedTimeOfArrivalUDPParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the city bus Api estimated time of arrival UDP params +func (o *CityBusAPIEstimatedTimeOfArrivalUDPParams) WithContext(ctx context.Context) *CityBusAPIEstimatedTimeOfArrivalUDPParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the city bus Api estimated time of arrival UDP params +func (o *CityBusAPIEstimatedTimeOfArrivalUDPParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the city bus Api estimated time of arrival UDP params +func (o *CityBusAPIEstimatedTimeOfArrivalUDPParams) WithHTTPClient(client *http.Client) *CityBusAPIEstimatedTimeOfArrivalUDPParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the city bus Api estimated time of arrival UDP params +func (o *CityBusAPIEstimatedTimeOfArrivalUDPParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDollarFilter adds the dollarFilter to the city bus Api estimated time of arrival UDP params +func (o *CityBusAPIEstimatedTimeOfArrivalUDPParams) WithDollarFilter(dollarFilter *string) *CityBusAPIEstimatedTimeOfArrivalUDPParams { + o.SetDollarFilter(dollarFilter) + return o +} + +// SetDollarFilter adds the dollarFilter to the city bus Api estimated time of arrival UDP params +func (o *CityBusAPIEstimatedTimeOfArrivalUDPParams) SetDollarFilter(dollarFilter *string) { + o.DollarFilter = dollarFilter +} + +// WithDollarFormat adds the dollarFormat to the city bus Api estimated time of arrival UDP params +func (o *CityBusAPIEstimatedTimeOfArrivalUDPParams) WithDollarFormat(dollarFormat string) *CityBusAPIEstimatedTimeOfArrivalUDPParams { + o.SetDollarFormat(dollarFormat) + return o +} + +// SetDollarFormat adds the dollarFormat to the city bus Api estimated time of arrival UDP params +func (o *CityBusAPIEstimatedTimeOfArrivalUDPParams) SetDollarFormat(dollarFormat string) { + o.DollarFormat = dollarFormat +} + +// WithDollarOrderby adds the dollarOrderby to the city bus Api estimated time of arrival UDP params +func (o *CityBusAPIEstimatedTimeOfArrivalUDPParams) WithDollarOrderby(dollarOrderby *string) *CityBusAPIEstimatedTimeOfArrivalUDPParams { + o.SetDollarOrderby(dollarOrderby) + return o +} + +// SetDollarOrderby adds the dollarOrderby to the city bus Api estimated time of arrival UDP params +func (o *CityBusAPIEstimatedTimeOfArrivalUDPParams) SetDollarOrderby(dollarOrderby *string) { + o.DollarOrderby = dollarOrderby +} + +// WithDollarSelect adds the dollarSelect to the city bus Api estimated time of arrival UDP params +func (o *CityBusAPIEstimatedTimeOfArrivalUDPParams) WithDollarSelect(dollarSelect *string) *CityBusAPIEstimatedTimeOfArrivalUDPParams { + o.SetDollarSelect(dollarSelect) + return o +} + +// SetDollarSelect adds the dollarSelect to the city bus Api estimated time of arrival UDP params +func (o *CityBusAPIEstimatedTimeOfArrivalUDPParams) SetDollarSelect(dollarSelect *string) { + o.DollarSelect = dollarSelect +} + +// WithDollarSkip adds the dollarSkip to the city bus Api estimated time of arrival UDP params +func (o *CityBusAPIEstimatedTimeOfArrivalUDPParams) WithDollarSkip(dollarSkip *string) *CityBusAPIEstimatedTimeOfArrivalUDPParams { + o.SetDollarSkip(dollarSkip) + return o +} + +// SetDollarSkip adds the dollarSkip to the city bus Api estimated time of arrival UDP params +func (o *CityBusAPIEstimatedTimeOfArrivalUDPParams) SetDollarSkip(dollarSkip *string) { + o.DollarSkip = dollarSkip +} + +// WithDollarTop adds the dollarTop to the city bus Api estimated time of arrival UDP params +func (o *CityBusAPIEstimatedTimeOfArrivalUDPParams) WithDollarTop(dollarTop *int64) *CityBusAPIEstimatedTimeOfArrivalUDPParams { + o.SetDollarTop(dollarTop) + return o +} + +// SetDollarTop adds the dollarTop to the city bus Api estimated time of arrival UDP params +func (o *CityBusAPIEstimatedTimeOfArrivalUDPParams) SetDollarTop(dollarTop *int64) { + o.DollarTop = dollarTop +} + +// WithCity adds the city to the city bus Api estimated time of arrival UDP params +func (o *CityBusAPIEstimatedTimeOfArrivalUDPParams) WithCity(city string) *CityBusAPIEstimatedTimeOfArrivalUDPParams { + o.SetCity(city) + return o +} + +// SetCity adds the city to the city bus Api estimated time of arrival UDP params +func (o *CityBusAPIEstimatedTimeOfArrivalUDPParams) SetCity(city string) { + o.City = city +} + +// WithHealth adds the health to the city bus Api estimated time of arrival UDP params +func (o *CityBusAPIEstimatedTimeOfArrivalUDPParams) WithHealth(health *string) *CityBusAPIEstimatedTimeOfArrivalUDPParams { + o.SetHealth(health) + return o +} + +// SetHealth adds the health to the city bus Api estimated time of arrival UDP params +func (o *CityBusAPIEstimatedTimeOfArrivalUDPParams) SetHealth(health *string) { + o.Health = health +} + +// WriteToRequest writes these params to a swagger request +func (o *CityBusAPIEstimatedTimeOfArrivalUDPParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.DollarFilter != nil { + + // query param $filter + var qrDollarFilter string + if o.DollarFilter != nil { + qrDollarFilter = *o.DollarFilter + } + qDollarFilter := qrDollarFilter + if qDollarFilter != "" { + if err := r.SetQueryParam("$filter", qDollarFilter); err != nil { + return err + } + } + + } + + // query param $format + qrDollarFormat := o.DollarFormat + qDollarFormat := qrDollarFormat + if qDollarFormat != "" { + if err := r.SetQueryParam("$format", qDollarFormat); err != nil { + return err + } + } + + if o.DollarOrderby != nil { + + // query param $orderby + var qrDollarOrderby string + if o.DollarOrderby != nil { + qrDollarOrderby = *o.DollarOrderby + } + qDollarOrderby := qrDollarOrderby + if qDollarOrderby != "" { + if err := r.SetQueryParam("$orderby", qDollarOrderby); err != nil { + return err + } + } + + } + + if o.DollarSelect != nil { + + // query param $select + var qrDollarSelect string + if o.DollarSelect != nil { + qrDollarSelect = *o.DollarSelect + } + qDollarSelect := qrDollarSelect + if qDollarSelect != "" { + if err := r.SetQueryParam("$select", qDollarSelect); err != nil { + return err + } + } + + } + + if o.DollarSkip != nil { + + // query param $skip + var qrDollarSkip string + if o.DollarSkip != nil { + qrDollarSkip = *o.DollarSkip + } + qDollarSkip := qrDollarSkip + if qDollarSkip != "" { + if err := r.SetQueryParam("$skip", qDollarSkip); err != nil { + return err + } + } + + } + + if o.DollarTop != nil { + + // query param $top + var qrDollarTop int64 + if o.DollarTop != nil { + qrDollarTop = *o.DollarTop + } + qDollarTop := swag.FormatInt64(qrDollarTop) + if qDollarTop != "" { + if err := r.SetQueryParam("$top", qDollarTop); err != nil { + return err + } + } + + } + + // path param City + if err := r.SetPathParam("City", o.City); err != nil { + return err + } + + if o.Health != nil { + + // query param health + var qrHealth string + if o.Health != nil { + qrHealth = *o.Health + } + qHealth := qrHealth + if qHealth != "" { + if err := r.SetQueryParam("health", qHealth); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/bus/v2/client/city_bus/city_bus_api_estimated_time_of_arrival_udp_responses.go b/bus/v2/client/city_bus/city_bus_api_estimated_time_of_arrival_udp_responses.go new file mode 100644 index 00000000..5e8963b9 --- /dev/null +++ b/bus/v2/client/city_bus/city_bus_api_estimated_time_of_arrival_udp_responses.go @@ -0,0 +1,107 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/minchao/go-ptx/bus/v2/models" +) + +// CityBusAPIEstimatedTimeOfArrivalUDPReader is a Reader for the CityBusAPIEstimatedTimeOfArrivalUDP structure. +type CityBusAPIEstimatedTimeOfArrivalUDPReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CityBusAPIEstimatedTimeOfArrivalUDPReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCityBusAPIEstimatedTimeOfArrivalUDPOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 299: + result := NewCityBusAPIEstimatedTimeOfArrivalUDPStatus299() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewCityBusAPIEstimatedTimeOfArrivalUDPOK creates a CityBusAPIEstimatedTimeOfArrivalUDPOK with default headers values +func NewCityBusAPIEstimatedTimeOfArrivalUDPOK() *CityBusAPIEstimatedTimeOfArrivalUDPOK { + return &CityBusAPIEstimatedTimeOfArrivalUDPOK{} +} + +/*CityBusAPIEstimatedTimeOfArrivalUDPOK handles this case with default header values. + +OK +*/ +type CityBusAPIEstimatedTimeOfArrivalUDPOK struct { + Payload []*models.ServiceDTOVersion2BusBusN1EstimateTime +} + +func (o *CityBusAPIEstimatedTimeOfArrivalUDPOK) Error() string { + return fmt.Sprintf("[GET /v2/Bus/EstimatedTimeOfArrival/Streaming/City/{City}][%d] cityBusApiEstimatedTimeOfArrivalUdpOK %+v", 200, o.Payload) +} + +func (o *CityBusAPIEstimatedTimeOfArrivalUDPOK) GetPayload() []*models.ServiceDTOVersion2BusBusN1EstimateTime { + return o.Payload +} + +func (o *CityBusAPIEstimatedTimeOfArrivalUDPOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewCityBusAPIEstimatedTimeOfArrivalUDPStatus299 creates a CityBusAPIEstimatedTimeOfArrivalUDPStatus299 with default headers values +func NewCityBusAPIEstimatedTimeOfArrivalUDPStatus299() *CityBusAPIEstimatedTimeOfArrivalUDPStatus299 { + return &CityBusAPIEstimatedTimeOfArrivalUDPStatus299{} +} + +/*CityBusAPIEstimatedTimeOfArrivalUDPStatus299 handles this case with default header values. + +加入參數'?health=true'即可查詢此API服務的健康狀態 +*/ +type CityBusAPIEstimatedTimeOfArrivalUDPStatus299 struct { + Payload *models.ServiceDTOVersion3BaseHealth +} + +func (o *CityBusAPIEstimatedTimeOfArrivalUDPStatus299) Error() string { + return fmt.Sprintf("[GET /v2/Bus/EstimatedTimeOfArrival/Streaming/City/{City}][%d] cityBusApiEstimatedTimeOfArrivalUdpStatus299 %+v", 299, o.Payload) +} + +func (o *CityBusAPIEstimatedTimeOfArrivalUDPStatus299) GetPayload() *models.ServiceDTOVersion3BaseHealth { + return o.Payload +} + +func (o *CityBusAPIEstimatedTimeOfArrivalUDPStatus299) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceDTOVersion3BaseHealth) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/bus/v2/client/city_bus/city_bus_api_real_time_by_frequency_udp_1_parameters.go b/bus/v2/client/city_bus/city_bus_api_real_time_by_frequency_udp_1_parameters.go new file mode 100644 index 00000000..317c509f --- /dev/null +++ b/bus/v2/client/city_bus/city_bus_api_real_time_by_frequency_udp_1_parameters.go @@ -0,0 +1,419 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/swag" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewCityBusAPIRealTimeByFrequencyUDP1Params creates a new CityBusAPIRealTimeByFrequencyUDP1Params object +// with the default values initialized. +func NewCityBusAPIRealTimeByFrequencyUDP1Params() *CityBusAPIRealTimeByFrequencyUDP1Params { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIRealTimeByFrequencyUDP1Params{ + DollarTop: &dollarTopDefault, + + timeout: cr.DefaultTimeout, + } +} + +// NewCityBusAPIRealTimeByFrequencyUDP1ParamsWithTimeout creates a new CityBusAPIRealTimeByFrequencyUDP1Params object +// with the default values initialized, and the ability to set a timeout on a request +func NewCityBusAPIRealTimeByFrequencyUDP1ParamsWithTimeout(timeout time.Duration) *CityBusAPIRealTimeByFrequencyUDP1Params { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIRealTimeByFrequencyUDP1Params{ + DollarTop: &dollarTopDefault, + + timeout: timeout, + } +} + +// NewCityBusAPIRealTimeByFrequencyUDP1ParamsWithContext creates a new CityBusAPIRealTimeByFrequencyUDP1Params object +// with the default values initialized, and the ability to set a context for a request +func NewCityBusAPIRealTimeByFrequencyUDP1ParamsWithContext(ctx context.Context) *CityBusAPIRealTimeByFrequencyUDP1Params { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIRealTimeByFrequencyUDP1Params{ + DollarTop: &dollarTopDefault, + + Context: ctx, + } +} + +// NewCityBusAPIRealTimeByFrequencyUDP1ParamsWithHTTPClient creates a new CityBusAPIRealTimeByFrequencyUDP1Params object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewCityBusAPIRealTimeByFrequencyUDP1ParamsWithHTTPClient(client *http.Client) *CityBusAPIRealTimeByFrequencyUDP1Params { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIRealTimeByFrequencyUDP1Params{ + DollarTop: &dollarTopDefault, + HTTPClient: client, + } +} + +/*CityBusAPIRealTimeByFrequencyUDP1Params contains all the parameters to send to the API endpoint +for the city bus Api real time by frequency UDP 1 operation typically these are written to a http.Request +*/ +type CityBusAPIRealTimeByFrequencyUDP1Params struct { + + /*DollarFilter + 過濾 + + */ + DollarFilter *string + /*DollarFormat + 指定來源格式 + + */ + DollarFormat string + /*DollarOrderby + 排序 + + */ + DollarOrderby *string + /*DollarSelect + 挑選 + + */ + DollarSelect *string + /*DollarSkip + 跳過前幾筆 + + */ + DollarSkip *string + /*DollarSpatialFilter + 空間過濾 + + */ + DollarSpatialFilter *string + /*DollarTop + 取前幾筆 + + */ + DollarTop *int64 + /*City + 欲查詢縣市 + + */ + City string + /*RouteName + 繁體中文路線名稱,如'307' + + */ + RouteName string + /*Health + 加入參數'?health=true'即可查詢此API服務的健康狀態 + + */ + Health *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the city bus Api real time by frequency UDP 1 params +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) WithTimeout(timeout time.Duration) *CityBusAPIRealTimeByFrequencyUDP1Params { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the city bus Api real time by frequency UDP 1 params +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the city bus Api real time by frequency UDP 1 params +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) WithContext(ctx context.Context) *CityBusAPIRealTimeByFrequencyUDP1Params { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the city bus Api real time by frequency UDP 1 params +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the city bus Api real time by frequency UDP 1 params +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) WithHTTPClient(client *http.Client) *CityBusAPIRealTimeByFrequencyUDP1Params { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the city bus Api real time by frequency UDP 1 params +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDollarFilter adds the dollarFilter to the city bus Api real time by frequency UDP 1 params +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) WithDollarFilter(dollarFilter *string) *CityBusAPIRealTimeByFrequencyUDP1Params { + o.SetDollarFilter(dollarFilter) + return o +} + +// SetDollarFilter adds the dollarFilter to the city bus Api real time by frequency UDP 1 params +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) SetDollarFilter(dollarFilter *string) { + o.DollarFilter = dollarFilter +} + +// WithDollarFormat adds the dollarFormat to the city bus Api real time by frequency UDP 1 params +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) WithDollarFormat(dollarFormat string) *CityBusAPIRealTimeByFrequencyUDP1Params { + o.SetDollarFormat(dollarFormat) + return o +} + +// SetDollarFormat adds the dollarFormat to the city bus Api real time by frequency UDP 1 params +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) SetDollarFormat(dollarFormat string) { + o.DollarFormat = dollarFormat +} + +// WithDollarOrderby adds the dollarOrderby to the city bus Api real time by frequency UDP 1 params +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) WithDollarOrderby(dollarOrderby *string) *CityBusAPIRealTimeByFrequencyUDP1Params { + o.SetDollarOrderby(dollarOrderby) + return o +} + +// SetDollarOrderby adds the dollarOrderby to the city bus Api real time by frequency UDP 1 params +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) SetDollarOrderby(dollarOrderby *string) { + o.DollarOrderby = dollarOrderby +} + +// WithDollarSelect adds the dollarSelect to the city bus Api real time by frequency UDP 1 params +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) WithDollarSelect(dollarSelect *string) *CityBusAPIRealTimeByFrequencyUDP1Params { + o.SetDollarSelect(dollarSelect) + return o +} + +// SetDollarSelect adds the dollarSelect to the city bus Api real time by frequency UDP 1 params +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) SetDollarSelect(dollarSelect *string) { + o.DollarSelect = dollarSelect +} + +// WithDollarSkip adds the dollarSkip to the city bus Api real time by frequency UDP 1 params +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) WithDollarSkip(dollarSkip *string) *CityBusAPIRealTimeByFrequencyUDP1Params { + o.SetDollarSkip(dollarSkip) + return o +} + +// SetDollarSkip adds the dollarSkip to the city bus Api real time by frequency UDP 1 params +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) SetDollarSkip(dollarSkip *string) { + o.DollarSkip = dollarSkip +} + +// WithDollarSpatialFilter adds the dollarSpatialFilter to the city bus Api real time by frequency UDP 1 params +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) WithDollarSpatialFilter(dollarSpatialFilter *string) *CityBusAPIRealTimeByFrequencyUDP1Params { + o.SetDollarSpatialFilter(dollarSpatialFilter) + return o +} + +// SetDollarSpatialFilter adds the dollarSpatialFilter to the city bus Api real time by frequency UDP 1 params +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) SetDollarSpatialFilter(dollarSpatialFilter *string) { + o.DollarSpatialFilter = dollarSpatialFilter +} + +// WithDollarTop adds the dollarTop to the city bus Api real time by frequency UDP 1 params +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) WithDollarTop(dollarTop *int64) *CityBusAPIRealTimeByFrequencyUDP1Params { + o.SetDollarTop(dollarTop) + return o +} + +// SetDollarTop adds the dollarTop to the city bus Api real time by frequency UDP 1 params +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) SetDollarTop(dollarTop *int64) { + o.DollarTop = dollarTop +} + +// WithCity adds the city to the city bus Api real time by frequency UDP 1 params +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) WithCity(city string) *CityBusAPIRealTimeByFrequencyUDP1Params { + o.SetCity(city) + return o +} + +// SetCity adds the city to the city bus Api real time by frequency UDP 1 params +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) SetCity(city string) { + o.City = city +} + +// WithRouteName adds the routeName to the city bus Api real time by frequency UDP 1 params +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) WithRouteName(routeName string) *CityBusAPIRealTimeByFrequencyUDP1Params { + o.SetRouteName(routeName) + return o +} + +// SetRouteName adds the routeName to the city bus Api real time by frequency UDP 1 params +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) SetRouteName(routeName string) { + o.RouteName = routeName +} + +// WithHealth adds the health to the city bus Api real time by frequency UDP 1 params +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) WithHealth(health *string) *CityBusAPIRealTimeByFrequencyUDP1Params { + o.SetHealth(health) + return o +} + +// SetHealth adds the health to the city bus Api real time by frequency UDP 1 params +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) SetHealth(health *string) { + o.Health = health +} + +// WriteToRequest writes these params to a swagger request +func (o *CityBusAPIRealTimeByFrequencyUDP1Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.DollarFilter != nil { + + // query param $filter + var qrDollarFilter string + if o.DollarFilter != nil { + qrDollarFilter = *o.DollarFilter + } + qDollarFilter := qrDollarFilter + if qDollarFilter != "" { + if err := r.SetQueryParam("$filter", qDollarFilter); err != nil { + return err + } + } + + } + + // query param $format + qrDollarFormat := o.DollarFormat + qDollarFormat := qrDollarFormat + if qDollarFormat != "" { + if err := r.SetQueryParam("$format", qDollarFormat); err != nil { + return err + } + } + + if o.DollarOrderby != nil { + + // query param $orderby + var qrDollarOrderby string + if o.DollarOrderby != nil { + qrDollarOrderby = *o.DollarOrderby + } + qDollarOrderby := qrDollarOrderby + if qDollarOrderby != "" { + if err := r.SetQueryParam("$orderby", qDollarOrderby); err != nil { + return err + } + } + + } + + if o.DollarSelect != nil { + + // query param $select + var qrDollarSelect string + if o.DollarSelect != nil { + qrDollarSelect = *o.DollarSelect + } + qDollarSelect := qrDollarSelect + if qDollarSelect != "" { + if err := r.SetQueryParam("$select", qDollarSelect); err != nil { + return err + } + } + + } + + if o.DollarSkip != nil { + + // query param $skip + var qrDollarSkip string + if o.DollarSkip != nil { + qrDollarSkip = *o.DollarSkip + } + qDollarSkip := qrDollarSkip + if qDollarSkip != "" { + if err := r.SetQueryParam("$skip", qDollarSkip); err != nil { + return err + } + } + + } + + if o.DollarSpatialFilter != nil { + + // query param $spatialFilter + var qrDollarSpatialFilter string + if o.DollarSpatialFilter != nil { + qrDollarSpatialFilter = *o.DollarSpatialFilter + } + qDollarSpatialFilter := qrDollarSpatialFilter + if qDollarSpatialFilter != "" { + if err := r.SetQueryParam("$spatialFilter", qDollarSpatialFilter); err != nil { + return err + } + } + + } + + if o.DollarTop != nil { + + // query param $top + var qrDollarTop int64 + if o.DollarTop != nil { + qrDollarTop = *o.DollarTop + } + qDollarTop := swag.FormatInt64(qrDollarTop) + if qDollarTop != "" { + if err := r.SetQueryParam("$top", qDollarTop); err != nil { + return err + } + } + + } + + // path param City + if err := r.SetPathParam("City", o.City); err != nil { + return err + } + + // path param RouteName + if err := r.SetPathParam("RouteName", o.RouteName); err != nil { + return err + } + + if o.Health != nil { + + // query param health + var qrHealth string + if o.Health != nil { + qrHealth = *o.Health + } + qHealth := qrHealth + if qHealth != "" { + if err := r.SetQueryParam("health", qHealth); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/bus/v2/client/city_bus/city_bus_api_real_time_by_frequency_udp_1_responses.go b/bus/v2/client/city_bus/city_bus_api_real_time_by_frequency_udp_1_responses.go new file mode 100644 index 00000000..b48a6dc8 --- /dev/null +++ b/bus/v2/client/city_bus/city_bus_api_real_time_by_frequency_udp_1_responses.go @@ -0,0 +1,107 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/minchao/go-ptx/bus/v2/models" +) + +// CityBusAPIRealTimeByFrequencyUDP1Reader is a Reader for the CityBusAPIRealTimeByFrequencyUDP1 structure. +type CityBusAPIRealTimeByFrequencyUDP1Reader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CityBusAPIRealTimeByFrequencyUDP1Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCityBusAPIRealTimeByFrequencyUdp1OK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 299: + result := NewCityBusAPIRealTimeByFrequencyUdp1Status299() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewCityBusAPIRealTimeByFrequencyUdp1OK creates a CityBusAPIRealTimeByFrequencyUdp1OK with default headers values +func NewCityBusAPIRealTimeByFrequencyUdp1OK() *CityBusAPIRealTimeByFrequencyUdp1OK { + return &CityBusAPIRealTimeByFrequencyUdp1OK{} +} + +/*CityBusAPIRealTimeByFrequencyUdp1OK handles this case with default header values. + +OK +*/ +type CityBusAPIRealTimeByFrequencyUdp1OK struct { + Payload []*models.ServiceDTOVersion2BusBusA1Data +} + +func (o *CityBusAPIRealTimeByFrequencyUdp1OK) Error() string { + return fmt.Sprintf("[GET /v2/Bus/RealTimeByFrequency/Streaming/City/{City}/{RouteName}][%d] cityBusApiRealTimeByFrequencyUdp1OK %+v", 200, o.Payload) +} + +func (o *CityBusAPIRealTimeByFrequencyUdp1OK) GetPayload() []*models.ServiceDTOVersion2BusBusA1Data { + return o.Payload +} + +func (o *CityBusAPIRealTimeByFrequencyUdp1OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewCityBusAPIRealTimeByFrequencyUdp1Status299 creates a CityBusAPIRealTimeByFrequencyUdp1Status299 with default headers values +func NewCityBusAPIRealTimeByFrequencyUdp1Status299() *CityBusAPIRealTimeByFrequencyUdp1Status299 { + return &CityBusAPIRealTimeByFrequencyUdp1Status299{} +} + +/*CityBusAPIRealTimeByFrequencyUdp1Status299 handles this case with default header values. + +加入參數'?health=true'即可查詢此API服務的健康狀態 +*/ +type CityBusAPIRealTimeByFrequencyUdp1Status299 struct { + Payload *models.ServiceDTOVersion3BaseHealth +} + +func (o *CityBusAPIRealTimeByFrequencyUdp1Status299) Error() string { + return fmt.Sprintf("[GET /v2/Bus/RealTimeByFrequency/Streaming/City/{City}/{RouteName}][%d] cityBusApiRealTimeByFrequencyUdp1Status299 %+v", 299, o.Payload) +} + +func (o *CityBusAPIRealTimeByFrequencyUdp1Status299) GetPayload() *models.ServiceDTOVersion3BaseHealth { + return o.Payload +} + +func (o *CityBusAPIRealTimeByFrequencyUdp1Status299) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceDTOVersion3BaseHealth) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/bus/v2/client/city_bus/city_bus_api_real_time_by_frequency_udp_parameters.go b/bus/v2/client/city_bus/city_bus_api_real_time_by_frequency_udp_parameters.go new file mode 100644 index 00000000..34406874 --- /dev/null +++ b/bus/v2/client/city_bus/city_bus_api_real_time_by_frequency_udp_parameters.go @@ -0,0 +1,398 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/swag" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewCityBusAPIRealTimeByFrequencyUDPParams creates a new CityBusAPIRealTimeByFrequencyUDPParams object +// with the default values initialized. +func NewCityBusAPIRealTimeByFrequencyUDPParams() *CityBusAPIRealTimeByFrequencyUDPParams { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIRealTimeByFrequencyUDPParams{ + DollarTop: &dollarTopDefault, + + timeout: cr.DefaultTimeout, + } +} + +// NewCityBusAPIRealTimeByFrequencyUDPParamsWithTimeout creates a new CityBusAPIRealTimeByFrequencyUDPParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewCityBusAPIRealTimeByFrequencyUDPParamsWithTimeout(timeout time.Duration) *CityBusAPIRealTimeByFrequencyUDPParams { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIRealTimeByFrequencyUDPParams{ + DollarTop: &dollarTopDefault, + + timeout: timeout, + } +} + +// NewCityBusAPIRealTimeByFrequencyUDPParamsWithContext creates a new CityBusAPIRealTimeByFrequencyUDPParams object +// with the default values initialized, and the ability to set a context for a request +func NewCityBusAPIRealTimeByFrequencyUDPParamsWithContext(ctx context.Context) *CityBusAPIRealTimeByFrequencyUDPParams { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIRealTimeByFrequencyUDPParams{ + DollarTop: &dollarTopDefault, + + Context: ctx, + } +} + +// NewCityBusAPIRealTimeByFrequencyUDPParamsWithHTTPClient creates a new CityBusAPIRealTimeByFrequencyUDPParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewCityBusAPIRealTimeByFrequencyUDPParamsWithHTTPClient(client *http.Client) *CityBusAPIRealTimeByFrequencyUDPParams { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIRealTimeByFrequencyUDPParams{ + DollarTop: &dollarTopDefault, + HTTPClient: client, + } +} + +/*CityBusAPIRealTimeByFrequencyUDPParams contains all the parameters to send to the API endpoint +for the city bus Api real time by frequency UDP operation typically these are written to a http.Request +*/ +type CityBusAPIRealTimeByFrequencyUDPParams struct { + + /*DollarFilter + 過濾 + + */ + DollarFilter *string + /*DollarFormat + 指定來源格式 + + */ + DollarFormat string + /*DollarOrderby + 排序 + + */ + DollarOrderby *string + /*DollarSelect + 挑選 + + */ + DollarSelect *string + /*DollarSkip + 跳過前幾筆 + + */ + DollarSkip *string + /*DollarSpatialFilter + 空間過濾 + + */ + DollarSpatialFilter *string + /*DollarTop + 取前幾筆 + + */ + DollarTop *int64 + /*City + 欲查詢縣市 + + */ + City string + /*Health + 加入參數'?health=true'即可查詢此API服務的健康狀態 + + */ + Health *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the city bus Api real time by frequency UDP params +func (o *CityBusAPIRealTimeByFrequencyUDPParams) WithTimeout(timeout time.Duration) *CityBusAPIRealTimeByFrequencyUDPParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the city bus Api real time by frequency UDP params +func (o *CityBusAPIRealTimeByFrequencyUDPParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the city bus Api real time by frequency UDP params +func (o *CityBusAPIRealTimeByFrequencyUDPParams) WithContext(ctx context.Context) *CityBusAPIRealTimeByFrequencyUDPParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the city bus Api real time by frequency UDP params +func (o *CityBusAPIRealTimeByFrequencyUDPParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the city bus Api real time by frequency UDP params +func (o *CityBusAPIRealTimeByFrequencyUDPParams) WithHTTPClient(client *http.Client) *CityBusAPIRealTimeByFrequencyUDPParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the city bus Api real time by frequency UDP params +func (o *CityBusAPIRealTimeByFrequencyUDPParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDollarFilter adds the dollarFilter to the city bus Api real time by frequency UDP params +func (o *CityBusAPIRealTimeByFrequencyUDPParams) WithDollarFilter(dollarFilter *string) *CityBusAPIRealTimeByFrequencyUDPParams { + o.SetDollarFilter(dollarFilter) + return o +} + +// SetDollarFilter adds the dollarFilter to the city bus Api real time by frequency UDP params +func (o *CityBusAPIRealTimeByFrequencyUDPParams) SetDollarFilter(dollarFilter *string) { + o.DollarFilter = dollarFilter +} + +// WithDollarFormat adds the dollarFormat to the city bus Api real time by frequency UDP params +func (o *CityBusAPIRealTimeByFrequencyUDPParams) WithDollarFormat(dollarFormat string) *CityBusAPIRealTimeByFrequencyUDPParams { + o.SetDollarFormat(dollarFormat) + return o +} + +// SetDollarFormat adds the dollarFormat to the city bus Api real time by frequency UDP params +func (o *CityBusAPIRealTimeByFrequencyUDPParams) SetDollarFormat(dollarFormat string) { + o.DollarFormat = dollarFormat +} + +// WithDollarOrderby adds the dollarOrderby to the city bus Api real time by frequency UDP params +func (o *CityBusAPIRealTimeByFrequencyUDPParams) WithDollarOrderby(dollarOrderby *string) *CityBusAPIRealTimeByFrequencyUDPParams { + o.SetDollarOrderby(dollarOrderby) + return o +} + +// SetDollarOrderby adds the dollarOrderby to the city bus Api real time by frequency UDP params +func (o *CityBusAPIRealTimeByFrequencyUDPParams) SetDollarOrderby(dollarOrderby *string) { + o.DollarOrderby = dollarOrderby +} + +// WithDollarSelect adds the dollarSelect to the city bus Api real time by frequency UDP params +func (o *CityBusAPIRealTimeByFrequencyUDPParams) WithDollarSelect(dollarSelect *string) *CityBusAPIRealTimeByFrequencyUDPParams { + o.SetDollarSelect(dollarSelect) + return o +} + +// SetDollarSelect adds the dollarSelect to the city bus Api real time by frequency UDP params +func (o *CityBusAPIRealTimeByFrequencyUDPParams) SetDollarSelect(dollarSelect *string) { + o.DollarSelect = dollarSelect +} + +// WithDollarSkip adds the dollarSkip to the city bus Api real time by frequency UDP params +func (o *CityBusAPIRealTimeByFrequencyUDPParams) WithDollarSkip(dollarSkip *string) *CityBusAPIRealTimeByFrequencyUDPParams { + o.SetDollarSkip(dollarSkip) + return o +} + +// SetDollarSkip adds the dollarSkip to the city bus Api real time by frequency UDP params +func (o *CityBusAPIRealTimeByFrequencyUDPParams) SetDollarSkip(dollarSkip *string) { + o.DollarSkip = dollarSkip +} + +// WithDollarSpatialFilter adds the dollarSpatialFilter to the city bus Api real time by frequency UDP params +func (o *CityBusAPIRealTimeByFrequencyUDPParams) WithDollarSpatialFilter(dollarSpatialFilter *string) *CityBusAPIRealTimeByFrequencyUDPParams { + o.SetDollarSpatialFilter(dollarSpatialFilter) + return o +} + +// SetDollarSpatialFilter adds the dollarSpatialFilter to the city bus Api real time by frequency UDP params +func (o *CityBusAPIRealTimeByFrequencyUDPParams) SetDollarSpatialFilter(dollarSpatialFilter *string) { + o.DollarSpatialFilter = dollarSpatialFilter +} + +// WithDollarTop adds the dollarTop to the city bus Api real time by frequency UDP params +func (o *CityBusAPIRealTimeByFrequencyUDPParams) WithDollarTop(dollarTop *int64) *CityBusAPIRealTimeByFrequencyUDPParams { + o.SetDollarTop(dollarTop) + return o +} + +// SetDollarTop adds the dollarTop to the city bus Api real time by frequency UDP params +func (o *CityBusAPIRealTimeByFrequencyUDPParams) SetDollarTop(dollarTop *int64) { + o.DollarTop = dollarTop +} + +// WithCity adds the city to the city bus Api real time by frequency UDP params +func (o *CityBusAPIRealTimeByFrequencyUDPParams) WithCity(city string) *CityBusAPIRealTimeByFrequencyUDPParams { + o.SetCity(city) + return o +} + +// SetCity adds the city to the city bus Api real time by frequency UDP params +func (o *CityBusAPIRealTimeByFrequencyUDPParams) SetCity(city string) { + o.City = city +} + +// WithHealth adds the health to the city bus Api real time by frequency UDP params +func (o *CityBusAPIRealTimeByFrequencyUDPParams) WithHealth(health *string) *CityBusAPIRealTimeByFrequencyUDPParams { + o.SetHealth(health) + return o +} + +// SetHealth adds the health to the city bus Api real time by frequency UDP params +func (o *CityBusAPIRealTimeByFrequencyUDPParams) SetHealth(health *string) { + o.Health = health +} + +// WriteToRequest writes these params to a swagger request +func (o *CityBusAPIRealTimeByFrequencyUDPParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.DollarFilter != nil { + + // query param $filter + var qrDollarFilter string + if o.DollarFilter != nil { + qrDollarFilter = *o.DollarFilter + } + qDollarFilter := qrDollarFilter + if qDollarFilter != "" { + if err := r.SetQueryParam("$filter", qDollarFilter); err != nil { + return err + } + } + + } + + // query param $format + qrDollarFormat := o.DollarFormat + qDollarFormat := qrDollarFormat + if qDollarFormat != "" { + if err := r.SetQueryParam("$format", qDollarFormat); err != nil { + return err + } + } + + if o.DollarOrderby != nil { + + // query param $orderby + var qrDollarOrderby string + if o.DollarOrderby != nil { + qrDollarOrderby = *o.DollarOrderby + } + qDollarOrderby := qrDollarOrderby + if qDollarOrderby != "" { + if err := r.SetQueryParam("$orderby", qDollarOrderby); err != nil { + return err + } + } + + } + + if o.DollarSelect != nil { + + // query param $select + var qrDollarSelect string + if o.DollarSelect != nil { + qrDollarSelect = *o.DollarSelect + } + qDollarSelect := qrDollarSelect + if qDollarSelect != "" { + if err := r.SetQueryParam("$select", qDollarSelect); err != nil { + return err + } + } + + } + + if o.DollarSkip != nil { + + // query param $skip + var qrDollarSkip string + if o.DollarSkip != nil { + qrDollarSkip = *o.DollarSkip + } + qDollarSkip := qrDollarSkip + if qDollarSkip != "" { + if err := r.SetQueryParam("$skip", qDollarSkip); err != nil { + return err + } + } + + } + + if o.DollarSpatialFilter != nil { + + // query param $spatialFilter + var qrDollarSpatialFilter string + if o.DollarSpatialFilter != nil { + qrDollarSpatialFilter = *o.DollarSpatialFilter + } + qDollarSpatialFilter := qrDollarSpatialFilter + if qDollarSpatialFilter != "" { + if err := r.SetQueryParam("$spatialFilter", qDollarSpatialFilter); err != nil { + return err + } + } + + } + + if o.DollarTop != nil { + + // query param $top + var qrDollarTop int64 + if o.DollarTop != nil { + qrDollarTop = *o.DollarTop + } + qDollarTop := swag.FormatInt64(qrDollarTop) + if qDollarTop != "" { + if err := r.SetQueryParam("$top", qDollarTop); err != nil { + return err + } + } + + } + + // path param City + if err := r.SetPathParam("City", o.City); err != nil { + return err + } + + if o.Health != nil { + + // query param health + var qrHealth string + if o.Health != nil { + qrHealth = *o.Health + } + qHealth := qrHealth + if qHealth != "" { + if err := r.SetQueryParam("health", qHealth); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/bus/v2/client/city_bus/city_bus_api_real_time_by_frequency_udp_responses.go b/bus/v2/client/city_bus/city_bus_api_real_time_by_frequency_udp_responses.go new file mode 100644 index 00000000..883caf0b --- /dev/null +++ b/bus/v2/client/city_bus/city_bus_api_real_time_by_frequency_udp_responses.go @@ -0,0 +1,107 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/minchao/go-ptx/bus/v2/models" +) + +// CityBusAPIRealTimeByFrequencyUDPReader is a Reader for the CityBusAPIRealTimeByFrequencyUDP structure. +type CityBusAPIRealTimeByFrequencyUDPReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CityBusAPIRealTimeByFrequencyUDPReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCityBusAPIRealTimeByFrequencyUDPOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 299: + result := NewCityBusAPIRealTimeByFrequencyUDPStatus299() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewCityBusAPIRealTimeByFrequencyUDPOK creates a CityBusAPIRealTimeByFrequencyUDPOK with default headers values +func NewCityBusAPIRealTimeByFrequencyUDPOK() *CityBusAPIRealTimeByFrequencyUDPOK { + return &CityBusAPIRealTimeByFrequencyUDPOK{} +} + +/*CityBusAPIRealTimeByFrequencyUDPOK handles this case with default header values. + +OK +*/ +type CityBusAPIRealTimeByFrequencyUDPOK struct { + Payload []*models.ServiceDTOVersion2BusBusA1Data +} + +func (o *CityBusAPIRealTimeByFrequencyUDPOK) Error() string { + return fmt.Sprintf("[GET /v2/Bus/RealTimeByFrequency/Streaming/City/{City}][%d] cityBusApiRealTimeByFrequencyUdpOK %+v", 200, o.Payload) +} + +func (o *CityBusAPIRealTimeByFrequencyUDPOK) GetPayload() []*models.ServiceDTOVersion2BusBusA1Data { + return o.Payload +} + +func (o *CityBusAPIRealTimeByFrequencyUDPOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewCityBusAPIRealTimeByFrequencyUDPStatus299 creates a CityBusAPIRealTimeByFrequencyUDPStatus299 with default headers values +func NewCityBusAPIRealTimeByFrequencyUDPStatus299() *CityBusAPIRealTimeByFrequencyUDPStatus299 { + return &CityBusAPIRealTimeByFrequencyUDPStatus299{} +} + +/*CityBusAPIRealTimeByFrequencyUDPStatus299 handles this case with default header values. + +加入參數'?health=true'即可查詢此API服務的健康狀態 +*/ +type CityBusAPIRealTimeByFrequencyUDPStatus299 struct { + Payload *models.ServiceDTOVersion3BaseHealth +} + +func (o *CityBusAPIRealTimeByFrequencyUDPStatus299) Error() string { + return fmt.Sprintf("[GET /v2/Bus/RealTimeByFrequency/Streaming/City/{City}][%d] cityBusApiRealTimeByFrequencyUdpStatus299 %+v", 299, o.Payload) +} + +func (o *CityBusAPIRealTimeByFrequencyUDPStatus299) GetPayload() *models.ServiceDTOVersion3BaseHealth { + return o.Payload +} + +func (o *CityBusAPIRealTimeByFrequencyUDPStatus299) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceDTOVersion3BaseHealth) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/bus/v2/client/city_bus/city_bus_api_real_time_near_stop_parameters.go b/bus/v2/client/city_bus/city_bus_api_real_time_near_stop_parameters.go index feb57728..615e1892 100644 --- a/bus/v2/client/city_bus/city_bus_api_real_time_near_stop_parameters.go +++ b/bus/v2/client/city_bus/city_bus_api_real_time_near_stop_parameters.go @@ -104,7 +104,10 @@ type CityBusAPIRealTimeNearStopParams struct { */ DollarTop *int64 - /*City*/ + /*City + 欲查詢縣市 + + */ City string /*Health 加入參數'?health=true'即可查詢此API服務的健康狀態 diff --git a/bus/v2/client/city_bus/city_bus_api_real_time_near_stop_udp_1_parameters.go b/bus/v2/client/city_bus/city_bus_api_real_time_near_stop_udp_1_parameters.go new file mode 100644 index 00000000..757fdf3f --- /dev/null +++ b/bus/v2/client/city_bus/city_bus_api_real_time_near_stop_udp_1_parameters.go @@ -0,0 +1,387 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/swag" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewCityBusAPIRealTimeNearStopUDP1Params creates a new CityBusAPIRealTimeNearStopUDP1Params object +// with the default values initialized. +func NewCityBusAPIRealTimeNearStopUDP1Params() *CityBusAPIRealTimeNearStopUDP1Params { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIRealTimeNearStopUDP1Params{ + DollarTop: &dollarTopDefault, + + timeout: cr.DefaultTimeout, + } +} + +// NewCityBusAPIRealTimeNearStopUDP1ParamsWithTimeout creates a new CityBusAPIRealTimeNearStopUDP1Params object +// with the default values initialized, and the ability to set a timeout on a request +func NewCityBusAPIRealTimeNearStopUDP1ParamsWithTimeout(timeout time.Duration) *CityBusAPIRealTimeNearStopUDP1Params { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIRealTimeNearStopUDP1Params{ + DollarTop: &dollarTopDefault, + + timeout: timeout, + } +} + +// NewCityBusAPIRealTimeNearStopUDP1ParamsWithContext creates a new CityBusAPIRealTimeNearStopUDP1Params object +// with the default values initialized, and the ability to set a context for a request +func NewCityBusAPIRealTimeNearStopUDP1ParamsWithContext(ctx context.Context) *CityBusAPIRealTimeNearStopUDP1Params { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIRealTimeNearStopUDP1Params{ + DollarTop: &dollarTopDefault, + + Context: ctx, + } +} + +// NewCityBusAPIRealTimeNearStopUDP1ParamsWithHTTPClient creates a new CityBusAPIRealTimeNearStopUDP1Params object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewCityBusAPIRealTimeNearStopUDP1ParamsWithHTTPClient(client *http.Client) *CityBusAPIRealTimeNearStopUDP1Params { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIRealTimeNearStopUDP1Params{ + DollarTop: &dollarTopDefault, + HTTPClient: client, + } +} + +/*CityBusAPIRealTimeNearStopUDP1Params contains all the parameters to send to the API endpoint +for the city bus Api real time near stop UDP 1 operation typically these are written to a http.Request +*/ +type CityBusAPIRealTimeNearStopUDP1Params struct { + + /*DollarFilter + 過濾 + + */ + DollarFilter *string + /*DollarFormat + 指定來源格式 + + */ + DollarFormat string + /*DollarOrderby + 排序 + + */ + DollarOrderby *string + /*DollarSelect + 挑選 + + */ + DollarSelect *string + /*DollarSkip + 跳過前幾筆 + + */ + DollarSkip *string + /*DollarTop + 取前幾筆 + + */ + DollarTop *int64 + /*City + 欲查詢縣市 + + */ + City string + /*RouteName + 繁體中文路線名稱,如'307' + + */ + RouteName string + /*Health + 加入參數'?health=true'即可查詢此API服務的健康狀態 + + */ + Health *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the city bus Api real time near stop UDP 1 params +func (o *CityBusAPIRealTimeNearStopUDP1Params) WithTimeout(timeout time.Duration) *CityBusAPIRealTimeNearStopUDP1Params { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the city bus Api real time near stop UDP 1 params +func (o *CityBusAPIRealTimeNearStopUDP1Params) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the city bus Api real time near stop UDP 1 params +func (o *CityBusAPIRealTimeNearStopUDP1Params) WithContext(ctx context.Context) *CityBusAPIRealTimeNearStopUDP1Params { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the city bus Api real time near stop UDP 1 params +func (o *CityBusAPIRealTimeNearStopUDP1Params) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the city bus Api real time near stop UDP 1 params +func (o *CityBusAPIRealTimeNearStopUDP1Params) WithHTTPClient(client *http.Client) *CityBusAPIRealTimeNearStopUDP1Params { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the city bus Api real time near stop UDP 1 params +func (o *CityBusAPIRealTimeNearStopUDP1Params) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDollarFilter adds the dollarFilter to the city bus Api real time near stop UDP 1 params +func (o *CityBusAPIRealTimeNearStopUDP1Params) WithDollarFilter(dollarFilter *string) *CityBusAPIRealTimeNearStopUDP1Params { + o.SetDollarFilter(dollarFilter) + return o +} + +// SetDollarFilter adds the dollarFilter to the city bus Api real time near stop UDP 1 params +func (o *CityBusAPIRealTimeNearStopUDP1Params) SetDollarFilter(dollarFilter *string) { + o.DollarFilter = dollarFilter +} + +// WithDollarFormat adds the dollarFormat to the city bus Api real time near stop UDP 1 params +func (o *CityBusAPIRealTimeNearStopUDP1Params) WithDollarFormat(dollarFormat string) *CityBusAPIRealTimeNearStopUDP1Params { + o.SetDollarFormat(dollarFormat) + return o +} + +// SetDollarFormat adds the dollarFormat to the city bus Api real time near stop UDP 1 params +func (o *CityBusAPIRealTimeNearStopUDP1Params) SetDollarFormat(dollarFormat string) { + o.DollarFormat = dollarFormat +} + +// WithDollarOrderby adds the dollarOrderby to the city bus Api real time near stop UDP 1 params +func (o *CityBusAPIRealTimeNearStopUDP1Params) WithDollarOrderby(dollarOrderby *string) *CityBusAPIRealTimeNearStopUDP1Params { + o.SetDollarOrderby(dollarOrderby) + return o +} + +// SetDollarOrderby adds the dollarOrderby to the city bus Api real time near stop UDP 1 params +func (o *CityBusAPIRealTimeNearStopUDP1Params) SetDollarOrderby(dollarOrderby *string) { + o.DollarOrderby = dollarOrderby +} + +// WithDollarSelect adds the dollarSelect to the city bus Api real time near stop UDP 1 params +func (o *CityBusAPIRealTimeNearStopUDP1Params) WithDollarSelect(dollarSelect *string) *CityBusAPIRealTimeNearStopUDP1Params { + o.SetDollarSelect(dollarSelect) + return o +} + +// SetDollarSelect adds the dollarSelect to the city bus Api real time near stop UDP 1 params +func (o *CityBusAPIRealTimeNearStopUDP1Params) SetDollarSelect(dollarSelect *string) { + o.DollarSelect = dollarSelect +} + +// WithDollarSkip adds the dollarSkip to the city bus Api real time near stop UDP 1 params +func (o *CityBusAPIRealTimeNearStopUDP1Params) WithDollarSkip(dollarSkip *string) *CityBusAPIRealTimeNearStopUDP1Params { + o.SetDollarSkip(dollarSkip) + return o +} + +// SetDollarSkip adds the dollarSkip to the city bus Api real time near stop UDP 1 params +func (o *CityBusAPIRealTimeNearStopUDP1Params) SetDollarSkip(dollarSkip *string) { + o.DollarSkip = dollarSkip +} + +// WithDollarTop adds the dollarTop to the city bus Api real time near stop UDP 1 params +func (o *CityBusAPIRealTimeNearStopUDP1Params) WithDollarTop(dollarTop *int64) *CityBusAPIRealTimeNearStopUDP1Params { + o.SetDollarTop(dollarTop) + return o +} + +// SetDollarTop adds the dollarTop to the city bus Api real time near stop UDP 1 params +func (o *CityBusAPIRealTimeNearStopUDP1Params) SetDollarTop(dollarTop *int64) { + o.DollarTop = dollarTop +} + +// WithCity adds the city to the city bus Api real time near stop UDP 1 params +func (o *CityBusAPIRealTimeNearStopUDP1Params) WithCity(city string) *CityBusAPIRealTimeNearStopUDP1Params { + o.SetCity(city) + return o +} + +// SetCity adds the city to the city bus Api real time near stop UDP 1 params +func (o *CityBusAPIRealTimeNearStopUDP1Params) SetCity(city string) { + o.City = city +} + +// WithRouteName adds the routeName to the city bus Api real time near stop UDP 1 params +func (o *CityBusAPIRealTimeNearStopUDP1Params) WithRouteName(routeName string) *CityBusAPIRealTimeNearStopUDP1Params { + o.SetRouteName(routeName) + return o +} + +// SetRouteName adds the routeName to the city bus Api real time near stop UDP 1 params +func (o *CityBusAPIRealTimeNearStopUDP1Params) SetRouteName(routeName string) { + o.RouteName = routeName +} + +// WithHealth adds the health to the city bus Api real time near stop UDP 1 params +func (o *CityBusAPIRealTimeNearStopUDP1Params) WithHealth(health *string) *CityBusAPIRealTimeNearStopUDP1Params { + o.SetHealth(health) + return o +} + +// SetHealth adds the health to the city bus Api real time near stop UDP 1 params +func (o *CityBusAPIRealTimeNearStopUDP1Params) SetHealth(health *string) { + o.Health = health +} + +// WriteToRequest writes these params to a swagger request +func (o *CityBusAPIRealTimeNearStopUDP1Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.DollarFilter != nil { + + // query param $filter + var qrDollarFilter string + if o.DollarFilter != nil { + qrDollarFilter = *o.DollarFilter + } + qDollarFilter := qrDollarFilter + if qDollarFilter != "" { + if err := r.SetQueryParam("$filter", qDollarFilter); err != nil { + return err + } + } + + } + + // query param $format + qrDollarFormat := o.DollarFormat + qDollarFormat := qrDollarFormat + if qDollarFormat != "" { + if err := r.SetQueryParam("$format", qDollarFormat); err != nil { + return err + } + } + + if o.DollarOrderby != nil { + + // query param $orderby + var qrDollarOrderby string + if o.DollarOrderby != nil { + qrDollarOrderby = *o.DollarOrderby + } + qDollarOrderby := qrDollarOrderby + if qDollarOrderby != "" { + if err := r.SetQueryParam("$orderby", qDollarOrderby); err != nil { + return err + } + } + + } + + if o.DollarSelect != nil { + + // query param $select + var qrDollarSelect string + if o.DollarSelect != nil { + qrDollarSelect = *o.DollarSelect + } + qDollarSelect := qrDollarSelect + if qDollarSelect != "" { + if err := r.SetQueryParam("$select", qDollarSelect); err != nil { + return err + } + } + + } + + if o.DollarSkip != nil { + + // query param $skip + var qrDollarSkip string + if o.DollarSkip != nil { + qrDollarSkip = *o.DollarSkip + } + qDollarSkip := qrDollarSkip + if qDollarSkip != "" { + if err := r.SetQueryParam("$skip", qDollarSkip); err != nil { + return err + } + } + + } + + if o.DollarTop != nil { + + // query param $top + var qrDollarTop int64 + if o.DollarTop != nil { + qrDollarTop = *o.DollarTop + } + qDollarTop := swag.FormatInt64(qrDollarTop) + if qDollarTop != "" { + if err := r.SetQueryParam("$top", qDollarTop); err != nil { + return err + } + } + + } + + // path param City + if err := r.SetPathParam("City", o.City); err != nil { + return err + } + + // path param RouteName + if err := r.SetPathParam("RouteName", o.RouteName); err != nil { + return err + } + + if o.Health != nil { + + // query param health + var qrHealth string + if o.Health != nil { + qrHealth = *o.Health + } + qHealth := qrHealth + if qHealth != "" { + if err := r.SetQueryParam("health", qHealth); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/bus/v2/client/city_bus/city_bus_api_real_time_near_stop_udp_1_responses.go b/bus/v2/client/city_bus/city_bus_api_real_time_near_stop_udp_1_responses.go new file mode 100644 index 00000000..3341f525 --- /dev/null +++ b/bus/v2/client/city_bus/city_bus_api_real_time_near_stop_udp_1_responses.go @@ -0,0 +1,107 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/minchao/go-ptx/bus/v2/models" +) + +// CityBusAPIRealTimeNearStopUDP1Reader is a Reader for the CityBusAPIRealTimeNearStopUDP1 structure. +type CityBusAPIRealTimeNearStopUDP1Reader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CityBusAPIRealTimeNearStopUDP1Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCityBusAPIRealTimeNearStopUdp1OK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 299: + result := NewCityBusAPIRealTimeNearStopUdp1Status299() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewCityBusAPIRealTimeNearStopUdp1OK creates a CityBusAPIRealTimeNearStopUdp1OK with default headers values +func NewCityBusAPIRealTimeNearStopUdp1OK() *CityBusAPIRealTimeNearStopUdp1OK { + return &CityBusAPIRealTimeNearStopUdp1OK{} +} + +/*CityBusAPIRealTimeNearStopUdp1OK handles this case with default header values. + +OK +*/ +type CityBusAPIRealTimeNearStopUdp1OK struct { + Payload []*models.ServiceDTOVersion2BusBusA2Data +} + +func (o *CityBusAPIRealTimeNearStopUdp1OK) Error() string { + return fmt.Sprintf("[GET /v2/Bus/RealTimeNearStop/Streaming/City/{City}/{RouteName}][%d] cityBusApiRealTimeNearStopUdp1OK %+v", 200, o.Payload) +} + +func (o *CityBusAPIRealTimeNearStopUdp1OK) GetPayload() []*models.ServiceDTOVersion2BusBusA2Data { + return o.Payload +} + +func (o *CityBusAPIRealTimeNearStopUdp1OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewCityBusAPIRealTimeNearStopUdp1Status299 creates a CityBusAPIRealTimeNearStopUdp1Status299 with default headers values +func NewCityBusAPIRealTimeNearStopUdp1Status299() *CityBusAPIRealTimeNearStopUdp1Status299 { + return &CityBusAPIRealTimeNearStopUdp1Status299{} +} + +/*CityBusAPIRealTimeNearStopUdp1Status299 handles this case with default header values. + +加入參數'?health=true'即可查詢此API服務的健康狀態 +*/ +type CityBusAPIRealTimeNearStopUdp1Status299 struct { + Payload *models.ServiceDTOVersion3BaseHealth +} + +func (o *CityBusAPIRealTimeNearStopUdp1Status299) Error() string { + return fmt.Sprintf("[GET /v2/Bus/RealTimeNearStop/Streaming/City/{City}/{RouteName}][%d] cityBusApiRealTimeNearStopUdp1Status299 %+v", 299, o.Payload) +} + +func (o *CityBusAPIRealTimeNearStopUdp1Status299) GetPayload() *models.ServiceDTOVersion3BaseHealth { + return o.Payload +} + +func (o *CityBusAPIRealTimeNearStopUdp1Status299) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceDTOVersion3BaseHealth) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/bus/v2/client/city_bus/city_bus_api_real_time_near_stop_udp_parameters.go b/bus/v2/client/city_bus/city_bus_api_real_time_near_stop_udp_parameters.go new file mode 100644 index 00000000..4086924f --- /dev/null +++ b/bus/v2/client/city_bus/city_bus_api_real_time_near_stop_udp_parameters.go @@ -0,0 +1,366 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/swag" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewCityBusAPIRealTimeNearStopUDPParams creates a new CityBusAPIRealTimeNearStopUDPParams object +// with the default values initialized. +func NewCityBusAPIRealTimeNearStopUDPParams() *CityBusAPIRealTimeNearStopUDPParams { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIRealTimeNearStopUDPParams{ + DollarTop: &dollarTopDefault, + + timeout: cr.DefaultTimeout, + } +} + +// NewCityBusAPIRealTimeNearStopUDPParamsWithTimeout creates a new CityBusAPIRealTimeNearStopUDPParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewCityBusAPIRealTimeNearStopUDPParamsWithTimeout(timeout time.Duration) *CityBusAPIRealTimeNearStopUDPParams { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIRealTimeNearStopUDPParams{ + DollarTop: &dollarTopDefault, + + timeout: timeout, + } +} + +// NewCityBusAPIRealTimeNearStopUDPParamsWithContext creates a new CityBusAPIRealTimeNearStopUDPParams object +// with the default values initialized, and the ability to set a context for a request +func NewCityBusAPIRealTimeNearStopUDPParamsWithContext(ctx context.Context) *CityBusAPIRealTimeNearStopUDPParams { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIRealTimeNearStopUDPParams{ + DollarTop: &dollarTopDefault, + + Context: ctx, + } +} + +// NewCityBusAPIRealTimeNearStopUDPParamsWithHTTPClient creates a new CityBusAPIRealTimeNearStopUDPParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewCityBusAPIRealTimeNearStopUDPParamsWithHTTPClient(client *http.Client) *CityBusAPIRealTimeNearStopUDPParams { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIRealTimeNearStopUDPParams{ + DollarTop: &dollarTopDefault, + HTTPClient: client, + } +} + +/*CityBusAPIRealTimeNearStopUDPParams contains all the parameters to send to the API endpoint +for the city bus Api real time near stop UDP operation typically these are written to a http.Request +*/ +type CityBusAPIRealTimeNearStopUDPParams struct { + + /*DollarFilter + 過濾 + + */ + DollarFilter *string + /*DollarFormat + 指定來源格式 + + */ + DollarFormat string + /*DollarOrderby + 排序 + + */ + DollarOrderby *string + /*DollarSelect + 挑選 + + */ + DollarSelect *string + /*DollarSkip + 跳過前幾筆 + + */ + DollarSkip *string + /*DollarTop + 取前幾筆 + + */ + DollarTop *int64 + /*City + 欲查詢縣市 + + */ + City string + /*Health + 加入參數'?health=true'即可查詢此API服務的健康狀態 + + */ + Health *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the city bus Api real time near stop UDP params +func (o *CityBusAPIRealTimeNearStopUDPParams) WithTimeout(timeout time.Duration) *CityBusAPIRealTimeNearStopUDPParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the city bus Api real time near stop UDP params +func (o *CityBusAPIRealTimeNearStopUDPParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the city bus Api real time near stop UDP params +func (o *CityBusAPIRealTimeNearStopUDPParams) WithContext(ctx context.Context) *CityBusAPIRealTimeNearStopUDPParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the city bus Api real time near stop UDP params +func (o *CityBusAPIRealTimeNearStopUDPParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the city bus Api real time near stop UDP params +func (o *CityBusAPIRealTimeNearStopUDPParams) WithHTTPClient(client *http.Client) *CityBusAPIRealTimeNearStopUDPParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the city bus Api real time near stop UDP params +func (o *CityBusAPIRealTimeNearStopUDPParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDollarFilter adds the dollarFilter to the city bus Api real time near stop UDP params +func (o *CityBusAPIRealTimeNearStopUDPParams) WithDollarFilter(dollarFilter *string) *CityBusAPIRealTimeNearStopUDPParams { + o.SetDollarFilter(dollarFilter) + return o +} + +// SetDollarFilter adds the dollarFilter to the city bus Api real time near stop UDP params +func (o *CityBusAPIRealTimeNearStopUDPParams) SetDollarFilter(dollarFilter *string) { + o.DollarFilter = dollarFilter +} + +// WithDollarFormat adds the dollarFormat to the city bus Api real time near stop UDP params +func (o *CityBusAPIRealTimeNearStopUDPParams) WithDollarFormat(dollarFormat string) *CityBusAPIRealTimeNearStopUDPParams { + o.SetDollarFormat(dollarFormat) + return o +} + +// SetDollarFormat adds the dollarFormat to the city bus Api real time near stop UDP params +func (o *CityBusAPIRealTimeNearStopUDPParams) SetDollarFormat(dollarFormat string) { + o.DollarFormat = dollarFormat +} + +// WithDollarOrderby adds the dollarOrderby to the city bus Api real time near stop UDP params +func (o *CityBusAPIRealTimeNearStopUDPParams) WithDollarOrderby(dollarOrderby *string) *CityBusAPIRealTimeNearStopUDPParams { + o.SetDollarOrderby(dollarOrderby) + return o +} + +// SetDollarOrderby adds the dollarOrderby to the city bus Api real time near stop UDP params +func (o *CityBusAPIRealTimeNearStopUDPParams) SetDollarOrderby(dollarOrderby *string) { + o.DollarOrderby = dollarOrderby +} + +// WithDollarSelect adds the dollarSelect to the city bus Api real time near stop UDP params +func (o *CityBusAPIRealTimeNearStopUDPParams) WithDollarSelect(dollarSelect *string) *CityBusAPIRealTimeNearStopUDPParams { + o.SetDollarSelect(dollarSelect) + return o +} + +// SetDollarSelect adds the dollarSelect to the city bus Api real time near stop UDP params +func (o *CityBusAPIRealTimeNearStopUDPParams) SetDollarSelect(dollarSelect *string) { + o.DollarSelect = dollarSelect +} + +// WithDollarSkip adds the dollarSkip to the city bus Api real time near stop UDP params +func (o *CityBusAPIRealTimeNearStopUDPParams) WithDollarSkip(dollarSkip *string) *CityBusAPIRealTimeNearStopUDPParams { + o.SetDollarSkip(dollarSkip) + return o +} + +// SetDollarSkip adds the dollarSkip to the city bus Api real time near stop UDP params +func (o *CityBusAPIRealTimeNearStopUDPParams) SetDollarSkip(dollarSkip *string) { + o.DollarSkip = dollarSkip +} + +// WithDollarTop adds the dollarTop to the city bus Api real time near stop UDP params +func (o *CityBusAPIRealTimeNearStopUDPParams) WithDollarTop(dollarTop *int64) *CityBusAPIRealTimeNearStopUDPParams { + o.SetDollarTop(dollarTop) + return o +} + +// SetDollarTop adds the dollarTop to the city bus Api real time near stop UDP params +func (o *CityBusAPIRealTimeNearStopUDPParams) SetDollarTop(dollarTop *int64) { + o.DollarTop = dollarTop +} + +// WithCity adds the city to the city bus Api real time near stop UDP params +func (o *CityBusAPIRealTimeNearStopUDPParams) WithCity(city string) *CityBusAPIRealTimeNearStopUDPParams { + o.SetCity(city) + return o +} + +// SetCity adds the city to the city bus Api real time near stop UDP params +func (o *CityBusAPIRealTimeNearStopUDPParams) SetCity(city string) { + o.City = city +} + +// WithHealth adds the health to the city bus Api real time near stop UDP params +func (o *CityBusAPIRealTimeNearStopUDPParams) WithHealth(health *string) *CityBusAPIRealTimeNearStopUDPParams { + o.SetHealth(health) + return o +} + +// SetHealth adds the health to the city bus Api real time near stop UDP params +func (o *CityBusAPIRealTimeNearStopUDPParams) SetHealth(health *string) { + o.Health = health +} + +// WriteToRequest writes these params to a swagger request +func (o *CityBusAPIRealTimeNearStopUDPParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.DollarFilter != nil { + + // query param $filter + var qrDollarFilter string + if o.DollarFilter != nil { + qrDollarFilter = *o.DollarFilter + } + qDollarFilter := qrDollarFilter + if qDollarFilter != "" { + if err := r.SetQueryParam("$filter", qDollarFilter); err != nil { + return err + } + } + + } + + // query param $format + qrDollarFormat := o.DollarFormat + qDollarFormat := qrDollarFormat + if qDollarFormat != "" { + if err := r.SetQueryParam("$format", qDollarFormat); err != nil { + return err + } + } + + if o.DollarOrderby != nil { + + // query param $orderby + var qrDollarOrderby string + if o.DollarOrderby != nil { + qrDollarOrderby = *o.DollarOrderby + } + qDollarOrderby := qrDollarOrderby + if qDollarOrderby != "" { + if err := r.SetQueryParam("$orderby", qDollarOrderby); err != nil { + return err + } + } + + } + + if o.DollarSelect != nil { + + // query param $select + var qrDollarSelect string + if o.DollarSelect != nil { + qrDollarSelect = *o.DollarSelect + } + qDollarSelect := qrDollarSelect + if qDollarSelect != "" { + if err := r.SetQueryParam("$select", qDollarSelect); err != nil { + return err + } + } + + } + + if o.DollarSkip != nil { + + // query param $skip + var qrDollarSkip string + if o.DollarSkip != nil { + qrDollarSkip = *o.DollarSkip + } + qDollarSkip := qrDollarSkip + if qDollarSkip != "" { + if err := r.SetQueryParam("$skip", qDollarSkip); err != nil { + return err + } + } + + } + + if o.DollarTop != nil { + + // query param $top + var qrDollarTop int64 + if o.DollarTop != nil { + qrDollarTop = *o.DollarTop + } + qDollarTop := swag.FormatInt64(qrDollarTop) + if qDollarTop != "" { + if err := r.SetQueryParam("$top", qDollarTop); err != nil { + return err + } + } + + } + + // path param City + if err := r.SetPathParam("City", o.City); err != nil { + return err + } + + if o.Health != nil { + + // query param health + var qrHealth string + if o.Health != nil { + qrHealth = *o.Health + } + qHealth := qrHealth + if qHealth != "" { + if err := r.SetQueryParam("health", qHealth); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/bus/v2/client/city_bus/city_bus_api_real_time_near_stop_udp_responses.go b/bus/v2/client/city_bus/city_bus_api_real_time_near_stop_udp_responses.go new file mode 100644 index 00000000..bd387525 --- /dev/null +++ b/bus/v2/client/city_bus/city_bus_api_real_time_near_stop_udp_responses.go @@ -0,0 +1,107 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/minchao/go-ptx/bus/v2/models" +) + +// CityBusAPIRealTimeNearStopUDPReader is a Reader for the CityBusAPIRealTimeNearStopUDP structure. +type CityBusAPIRealTimeNearStopUDPReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CityBusAPIRealTimeNearStopUDPReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCityBusAPIRealTimeNearStopUDPOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 299: + result := NewCityBusAPIRealTimeNearStopUDPStatus299() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewCityBusAPIRealTimeNearStopUDPOK creates a CityBusAPIRealTimeNearStopUDPOK with default headers values +func NewCityBusAPIRealTimeNearStopUDPOK() *CityBusAPIRealTimeNearStopUDPOK { + return &CityBusAPIRealTimeNearStopUDPOK{} +} + +/*CityBusAPIRealTimeNearStopUDPOK handles this case with default header values. + +OK +*/ +type CityBusAPIRealTimeNearStopUDPOK struct { + Payload []*models.ServiceDTOVersion2BusBusA2Data +} + +func (o *CityBusAPIRealTimeNearStopUDPOK) Error() string { + return fmt.Sprintf("[GET /v2/Bus/RealTimeNearStop/Streaming/City/{City}][%d] cityBusApiRealTimeNearStopUdpOK %+v", 200, o.Payload) +} + +func (o *CityBusAPIRealTimeNearStopUDPOK) GetPayload() []*models.ServiceDTOVersion2BusBusA2Data { + return o.Payload +} + +func (o *CityBusAPIRealTimeNearStopUDPOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewCityBusAPIRealTimeNearStopUDPStatus299 creates a CityBusAPIRealTimeNearStopUDPStatus299 with default headers values +func NewCityBusAPIRealTimeNearStopUDPStatus299() *CityBusAPIRealTimeNearStopUDPStatus299 { + return &CityBusAPIRealTimeNearStopUDPStatus299{} +} + +/*CityBusAPIRealTimeNearStopUDPStatus299 handles this case with default header values. + +加入參數'?health=true'即可查詢此API服務的健康狀態 +*/ +type CityBusAPIRealTimeNearStopUDPStatus299 struct { + Payload *models.ServiceDTOVersion3BaseHealth +} + +func (o *CityBusAPIRealTimeNearStopUDPStatus299) Error() string { + return fmt.Sprintf("[GET /v2/Bus/RealTimeNearStop/Streaming/City/{City}][%d] cityBusApiRealTimeNearStopUdpStatus299 %+v", 299, o.Payload) +} + +func (o *CityBusAPIRealTimeNearStopUDPStatus299) GetPayload() *models.ServiceDTOVersion3BaseHealth { + return o.Payload +} + +func (o *CityBusAPIRealTimeNearStopUDPStatus299) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceDTOVersion3BaseHealth) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/bus/v2/client/city_bus/city_bus_api_station_group_parameters.go b/bus/v2/client/city_bus/city_bus_api_station_group_parameters.go new file mode 100644 index 00000000..32923b9e --- /dev/null +++ b/bus/v2/client/city_bus/city_bus_api_station_group_parameters.go @@ -0,0 +1,398 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/swag" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewCityBusAPIStationGroupParams creates a new CityBusAPIStationGroupParams object +// with the default values initialized. +func NewCityBusAPIStationGroupParams() *CityBusAPIStationGroupParams { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIStationGroupParams{ + DollarTop: &dollarTopDefault, + + timeout: cr.DefaultTimeout, + } +} + +// NewCityBusAPIStationGroupParamsWithTimeout creates a new CityBusAPIStationGroupParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewCityBusAPIStationGroupParamsWithTimeout(timeout time.Duration) *CityBusAPIStationGroupParams { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIStationGroupParams{ + DollarTop: &dollarTopDefault, + + timeout: timeout, + } +} + +// NewCityBusAPIStationGroupParamsWithContext creates a new CityBusAPIStationGroupParams object +// with the default values initialized, and the ability to set a context for a request +func NewCityBusAPIStationGroupParamsWithContext(ctx context.Context) *CityBusAPIStationGroupParams { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIStationGroupParams{ + DollarTop: &dollarTopDefault, + + Context: ctx, + } +} + +// NewCityBusAPIStationGroupParamsWithHTTPClient creates a new CityBusAPIStationGroupParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewCityBusAPIStationGroupParamsWithHTTPClient(client *http.Client) *CityBusAPIStationGroupParams { + var ( + dollarTopDefault = int64(30) + ) + return &CityBusAPIStationGroupParams{ + DollarTop: &dollarTopDefault, + HTTPClient: client, + } +} + +/*CityBusAPIStationGroupParams contains all the parameters to send to the API endpoint +for the city bus Api station group operation typically these are written to a http.Request +*/ +type CityBusAPIStationGroupParams struct { + + /*DollarFilter + 過濾 + + */ + DollarFilter *string + /*DollarFormat + 指定來源格式 + + */ + DollarFormat string + /*DollarOrderby + 排序 + + */ + DollarOrderby *string + /*DollarSelect + 挑選 + + */ + DollarSelect *string + /*DollarSkip + 跳過前幾筆 + + */ + DollarSkip *string + /*DollarSpatialFilter + 空間過濾 + + */ + DollarSpatialFilter *string + /*DollarTop + 取前幾筆 + + */ + DollarTop *int64 + /*City + 欲查詢縣市 + + */ + City string + /*Health + 加入參數'?health=true'即可查詢此API服務的健康狀態 + + */ + Health *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the city bus Api station group params +func (o *CityBusAPIStationGroupParams) WithTimeout(timeout time.Duration) *CityBusAPIStationGroupParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the city bus Api station group params +func (o *CityBusAPIStationGroupParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the city bus Api station group params +func (o *CityBusAPIStationGroupParams) WithContext(ctx context.Context) *CityBusAPIStationGroupParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the city bus Api station group params +func (o *CityBusAPIStationGroupParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the city bus Api station group params +func (o *CityBusAPIStationGroupParams) WithHTTPClient(client *http.Client) *CityBusAPIStationGroupParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the city bus Api station group params +func (o *CityBusAPIStationGroupParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDollarFilter adds the dollarFilter to the city bus Api station group params +func (o *CityBusAPIStationGroupParams) WithDollarFilter(dollarFilter *string) *CityBusAPIStationGroupParams { + o.SetDollarFilter(dollarFilter) + return o +} + +// SetDollarFilter adds the dollarFilter to the city bus Api station group params +func (o *CityBusAPIStationGroupParams) SetDollarFilter(dollarFilter *string) { + o.DollarFilter = dollarFilter +} + +// WithDollarFormat adds the dollarFormat to the city bus Api station group params +func (o *CityBusAPIStationGroupParams) WithDollarFormat(dollarFormat string) *CityBusAPIStationGroupParams { + o.SetDollarFormat(dollarFormat) + return o +} + +// SetDollarFormat adds the dollarFormat to the city bus Api station group params +func (o *CityBusAPIStationGroupParams) SetDollarFormat(dollarFormat string) { + o.DollarFormat = dollarFormat +} + +// WithDollarOrderby adds the dollarOrderby to the city bus Api station group params +func (o *CityBusAPIStationGroupParams) WithDollarOrderby(dollarOrderby *string) *CityBusAPIStationGroupParams { + o.SetDollarOrderby(dollarOrderby) + return o +} + +// SetDollarOrderby adds the dollarOrderby to the city bus Api station group params +func (o *CityBusAPIStationGroupParams) SetDollarOrderby(dollarOrderby *string) { + o.DollarOrderby = dollarOrderby +} + +// WithDollarSelect adds the dollarSelect to the city bus Api station group params +func (o *CityBusAPIStationGroupParams) WithDollarSelect(dollarSelect *string) *CityBusAPIStationGroupParams { + o.SetDollarSelect(dollarSelect) + return o +} + +// SetDollarSelect adds the dollarSelect to the city bus Api station group params +func (o *CityBusAPIStationGroupParams) SetDollarSelect(dollarSelect *string) { + o.DollarSelect = dollarSelect +} + +// WithDollarSkip adds the dollarSkip to the city bus Api station group params +func (o *CityBusAPIStationGroupParams) WithDollarSkip(dollarSkip *string) *CityBusAPIStationGroupParams { + o.SetDollarSkip(dollarSkip) + return o +} + +// SetDollarSkip adds the dollarSkip to the city bus Api station group params +func (o *CityBusAPIStationGroupParams) SetDollarSkip(dollarSkip *string) { + o.DollarSkip = dollarSkip +} + +// WithDollarSpatialFilter adds the dollarSpatialFilter to the city bus Api station group params +func (o *CityBusAPIStationGroupParams) WithDollarSpatialFilter(dollarSpatialFilter *string) *CityBusAPIStationGroupParams { + o.SetDollarSpatialFilter(dollarSpatialFilter) + return o +} + +// SetDollarSpatialFilter adds the dollarSpatialFilter to the city bus Api station group params +func (o *CityBusAPIStationGroupParams) SetDollarSpatialFilter(dollarSpatialFilter *string) { + o.DollarSpatialFilter = dollarSpatialFilter +} + +// WithDollarTop adds the dollarTop to the city bus Api station group params +func (o *CityBusAPIStationGroupParams) WithDollarTop(dollarTop *int64) *CityBusAPIStationGroupParams { + o.SetDollarTop(dollarTop) + return o +} + +// SetDollarTop adds the dollarTop to the city bus Api station group params +func (o *CityBusAPIStationGroupParams) SetDollarTop(dollarTop *int64) { + o.DollarTop = dollarTop +} + +// WithCity adds the city to the city bus Api station group params +func (o *CityBusAPIStationGroupParams) WithCity(city string) *CityBusAPIStationGroupParams { + o.SetCity(city) + return o +} + +// SetCity adds the city to the city bus Api station group params +func (o *CityBusAPIStationGroupParams) SetCity(city string) { + o.City = city +} + +// WithHealth adds the health to the city bus Api station group params +func (o *CityBusAPIStationGroupParams) WithHealth(health *string) *CityBusAPIStationGroupParams { + o.SetHealth(health) + return o +} + +// SetHealth adds the health to the city bus Api station group params +func (o *CityBusAPIStationGroupParams) SetHealth(health *string) { + o.Health = health +} + +// WriteToRequest writes these params to a swagger request +func (o *CityBusAPIStationGroupParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.DollarFilter != nil { + + // query param $filter + var qrDollarFilter string + if o.DollarFilter != nil { + qrDollarFilter = *o.DollarFilter + } + qDollarFilter := qrDollarFilter + if qDollarFilter != "" { + if err := r.SetQueryParam("$filter", qDollarFilter); err != nil { + return err + } + } + + } + + // query param $format + qrDollarFormat := o.DollarFormat + qDollarFormat := qrDollarFormat + if qDollarFormat != "" { + if err := r.SetQueryParam("$format", qDollarFormat); err != nil { + return err + } + } + + if o.DollarOrderby != nil { + + // query param $orderby + var qrDollarOrderby string + if o.DollarOrderby != nil { + qrDollarOrderby = *o.DollarOrderby + } + qDollarOrderby := qrDollarOrderby + if qDollarOrderby != "" { + if err := r.SetQueryParam("$orderby", qDollarOrderby); err != nil { + return err + } + } + + } + + if o.DollarSelect != nil { + + // query param $select + var qrDollarSelect string + if o.DollarSelect != nil { + qrDollarSelect = *o.DollarSelect + } + qDollarSelect := qrDollarSelect + if qDollarSelect != "" { + if err := r.SetQueryParam("$select", qDollarSelect); err != nil { + return err + } + } + + } + + if o.DollarSkip != nil { + + // query param $skip + var qrDollarSkip string + if o.DollarSkip != nil { + qrDollarSkip = *o.DollarSkip + } + qDollarSkip := qrDollarSkip + if qDollarSkip != "" { + if err := r.SetQueryParam("$skip", qDollarSkip); err != nil { + return err + } + } + + } + + if o.DollarSpatialFilter != nil { + + // query param $spatialFilter + var qrDollarSpatialFilter string + if o.DollarSpatialFilter != nil { + qrDollarSpatialFilter = *o.DollarSpatialFilter + } + qDollarSpatialFilter := qrDollarSpatialFilter + if qDollarSpatialFilter != "" { + if err := r.SetQueryParam("$spatialFilter", qDollarSpatialFilter); err != nil { + return err + } + } + + } + + if o.DollarTop != nil { + + // query param $top + var qrDollarTop int64 + if o.DollarTop != nil { + qrDollarTop = *o.DollarTop + } + qDollarTop := swag.FormatInt64(qrDollarTop) + if qDollarTop != "" { + if err := r.SetQueryParam("$top", qDollarTop); err != nil { + return err + } + } + + } + + // path param City + if err := r.SetPathParam("City", o.City); err != nil { + return err + } + + if o.Health != nil { + + // query param health + var qrHealth string + if o.Health != nil { + qrHealth = *o.Health + } + qHealth := qrHealth + if qHealth != "" { + if err := r.SetQueryParam("health", qHealth); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/bus/v2/client/city_bus/city_bus_api_station_group_responses.go b/bus/v2/client/city_bus/city_bus_api_station_group_responses.go new file mode 100644 index 00000000..69c77026 --- /dev/null +++ b/bus/v2/client/city_bus/city_bus_api_station_group_responses.go @@ -0,0 +1,107 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/minchao/go-ptx/bus/v2/models" +) + +// CityBusAPIStationGroupReader is a Reader for the CityBusAPIStationGroup structure. +type CityBusAPIStationGroupReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CityBusAPIStationGroupReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCityBusAPIStationGroupOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 299: + result := NewCityBusAPIStationGroupStatus299() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewCityBusAPIStationGroupOK creates a CityBusAPIStationGroupOK with default headers values +func NewCityBusAPIStationGroupOK() *CityBusAPIStationGroupOK { + return &CityBusAPIStationGroupOK{} +} + +/*CityBusAPIStationGroupOK handles this case with default header values. + +OK +*/ +type CityBusAPIStationGroupOK struct { + Payload []*models.ServiceDTOVersion2BusBusStationGroup +} + +func (o *CityBusAPIStationGroupOK) Error() string { + return fmt.Sprintf("[GET /v2/Bus/StationGroup/City/{City}][%d] cityBusApiStationGroupOK %+v", 200, o.Payload) +} + +func (o *CityBusAPIStationGroupOK) GetPayload() []*models.ServiceDTOVersion2BusBusStationGroup { + return o.Payload +} + +func (o *CityBusAPIStationGroupOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewCityBusAPIStationGroupStatus299 creates a CityBusAPIStationGroupStatus299 with default headers values +func NewCityBusAPIStationGroupStatus299() *CityBusAPIStationGroupStatus299 { + return &CityBusAPIStationGroupStatus299{} +} + +/*CityBusAPIStationGroupStatus299 handles this case with default header values. + +加入參數'?health=true'即可查詢此API服務的健康狀態 +*/ +type CityBusAPIStationGroupStatus299 struct { + Payload *models.ServiceDTOVersion3BaseHealth +} + +func (o *CityBusAPIStationGroupStatus299) Error() string { + return fmt.Sprintf("[GET /v2/Bus/StationGroup/City/{City}][%d] cityBusApiStationGroupStatus299 %+v", 299, o.Payload) +} + +func (o *CityBusAPIStationGroupStatus299) GetPayload() *models.ServiceDTOVersion3BaseHealth { + return o.Payload +} + +func (o *CityBusAPIStationGroupStatus299) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceDTOVersion3BaseHealth) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/bus/v2/client/city_bus/city_bus_client.go b/bus/v2/client/city_bus/city_bus_client.go index 51ae7560..d94155fb 100644 --- a/bus/v2/client/city_bus/city_bus_client.go +++ b/bus/v2/client/city_bus/city_bus_client.go @@ -141,7 +141,8 @@ func (a *Client) CityBusAPIDisplayStopOfRoute1(params *CityBusAPIDisplayStopOfRo CityBusAPIEstimatedTimeOfArrival 取得指定s 縣市 的公車預估到站資料 n1 批次更新 ### 市區公車之預估到站資料(N1) ### -[部分縣市] 當 StopStatus = 1(尚未發車) 且 EstimateTime > 0 (有值) 的情形, 屬正常情形, 雖目前尚未發車, 但提供EstimateTime值為預計多久後開始發車之時間。 +- [部分縣市] 當 StopStatus = 1(尚未發車) 且 EstimateTime > 0 (有值) 的情形, 屬正常情形, 雖目前尚未發車, 但提供EstimateTime值為預計多久後開始發車之時間。 +- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html)) */ func (a *Client) CityBusAPIEstimatedTimeOfArrival(params *CityBusAPIEstimatedTimeOfArrivalParams) (*CityBusAPIEstimatedTimeOfArrivalOK, *CityBusAPIEstimatedTimeOfArrivalStatus299, error) { // TODO: Validate the params before sending @@ -179,7 +180,8 @@ func (a *Client) CityBusAPIEstimatedTimeOfArrival(params *CityBusAPIEstimatedTim CityBusAPIEstimatedTimeOfArrival1 取得指定s 縣市 路線名稱 的公車預估到站資料 n1 批次更新 ### 市區公車之預估到站資料(N1) ### -[部分縣市] 當 StopStatus = 1(尚未發車) 且 EstimateTime > 0 (有值) 的情形, 屬正常情形, 雖目前尚未發車, 但提供EstimateTime值為預計多久後開始發車之時間。 +- [部分縣市] 當 StopStatus = 1(尚未發車) 且 EstimateTime > 0 (有值) 的情形, 屬正常情形, 雖目前尚未發車, 但提供EstimateTime值為預計多久後開始發車之時間。 +- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html)) */ func (a *Client) CityBusAPIEstimatedTimeOfArrival1(params *CityBusAPIEstimatedTimeOfArrival1Params) (*CityBusAPIEstimatedTimeOfArrival1OK, *CityBusAPIEstimatedTimeOfArrival1Status299, error) { // TODO: Validate the params before sending @@ -213,6 +215,86 @@ func (a *Client) CityBusAPIEstimatedTimeOfArrival1(params *CityBusAPIEstimatedTi panic(msg) } +/* +CityBusAPIEstimatedTimeOfArrivalUDP 取得指定s 縣市 的公車預估到站資料 n1 逐筆更新 + +### 市區公車之預估到站資料(N1) ### +- [部分縣市] 當 StopStatus = 1(尚未發車) 且 EstimateTime > 0 (有值) 的情形, 屬正常情形, 雖目前尚未發車, 但提供EstimateTime值為預計多久後開始發車之時間。 +- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html)) +- N1僅於該路線上有任一車輛離站時,來源端才會重新計算並發佈,因此使用者需自行處理時間遞減機制,或以EstimateTime-(收到資料時間-SrcTrasTime)(秒)作為實際預估抵達時間。 +*/ +func (a *Client) CityBusAPIEstimatedTimeOfArrivalUDP(params *CityBusAPIEstimatedTimeOfArrivalUDPParams) (*CityBusAPIEstimatedTimeOfArrivalUDPOK, *CityBusAPIEstimatedTimeOfArrivalUDPStatus299, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCityBusAPIEstimatedTimeOfArrivalUDPParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "CityBusApi_EstimatedTimeOfArrival_UDP", + Method: "GET", + PathPattern: "/v2/Bus/EstimatedTimeOfArrival/Streaming/City/{City}", + ProducesMediaTypes: []string{"application/json", "text/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"https"}, + Params: params, + Reader: &CityBusAPIEstimatedTimeOfArrivalUDPReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, nil, err + } + switch value := result.(type) { + case *CityBusAPIEstimatedTimeOfArrivalUDPOK: + return value, nil, nil + case *CityBusAPIEstimatedTimeOfArrivalUDPStatus299: + return nil, value, nil + } + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for city_bus: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +CityBusAPIEstimatedTimeOfArrivalUDP1 取得指定s 縣市 路線名稱 的公車預估到站資料 n1 逐筆更新 + +### 市區公車之預估到站資料(N1) ### +- [部分縣市] 當 StopStatus = 1(尚未發車) 且 EstimateTime > 0 (有值) 的情形, 屬正常情形, 雖目前尚未發車, 但提供EstimateTime值為預計多久後開始發車之時間。 +- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html)) +- N1僅於該路線上有任一車輛離站時,來源端才會重新計算並發佈,因此使用者需自行處理時間遞減機制,或以EstimateTime-(收到資料時間-SrcTrasTime)(秒)作為實際預估抵達時間。 +*/ +func (a *Client) CityBusAPIEstimatedTimeOfArrivalUDP1(params *CityBusAPIEstimatedTimeOfArrivalUDP1Params) (*CityBusAPIEstimatedTimeOfArrivalUdp1OK, *CityBusAPIEstimatedTimeOfArrivalUdp1Status299, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCityBusAPIEstimatedTimeOfArrivalUDP1Params() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "CityBusApi_EstimatedTimeOfArrival_UDP_1", + Method: "GET", + PathPattern: "/v2/Bus/EstimatedTimeOfArrival/Streaming/City/{City}/{RouteName}", + ProducesMediaTypes: []string{"application/json", "text/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"https"}, + Params: params, + Reader: &CityBusAPIEstimatedTimeOfArrivalUDP1Reader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, nil, err + } + switch value := result.(type) { + case *CityBusAPIEstimatedTimeOfArrivalUdp1OK: + return value, nil, nil + case *CityBusAPIEstimatedTimeOfArrivalUdp1Status299: + return nil, value, nil + } + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for city_bus: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + /* CityBusAPINews 取得指定s 縣市 的市區公車最新消息資料 @@ -291,6 +373,7 @@ func (a *Client) CityBusAPIOperator(params *CityBusAPIOperatorParams) (*CityBusA CityBusAPIRealTimeByFrequency 取得指定s 縣市 的公車動態定時資料 a1 批次更新 ### 市區公車之定時資料(A1) ### +- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html)) */ func (a *Client) CityBusAPIRealTimeByFrequency(params *CityBusAPIRealTimeByFrequencyParams) (*CityBusAPIRealTimeByFrequencyOK, *CityBusAPIRealTimeByFrequencyStatus299, error) { // TODO: Validate the params before sending @@ -328,6 +411,7 @@ func (a *Client) CityBusAPIRealTimeByFrequency(params *CityBusAPIRealTimeByFrequ CityBusAPIRealTimeByFrequency1 取得指定s 縣市 路線名稱 的公車動態定時資料 a1 批次更新 ### 市區公車之定時資料(A1) ### +- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html)) */ func (a *Client) CityBusAPIRealTimeByFrequency1(params *CityBusAPIRealTimeByFrequency1Params) (*CityBusAPIRealTimeByFrequency1OK, *CityBusAPIRealTimeByFrequency1Status299, error) { // TODO: Validate the params before sending @@ -361,12 +445,87 @@ func (a *Client) CityBusAPIRealTimeByFrequency1(params *CityBusAPIRealTimeByFreq panic(msg) } +/* +CityBusAPIRealTimeByFrequencyUDP 取得指定s 縣市 的公車動態定時資料 a1 逐筆更新 + +### 市區公車之定時資料(A1) ### +- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html)) +*/ +func (a *Client) CityBusAPIRealTimeByFrequencyUDP(params *CityBusAPIRealTimeByFrequencyUDPParams) (*CityBusAPIRealTimeByFrequencyUDPOK, *CityBusAPIRealTimeByFrequencyUDPStatus299, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCityBusAPIRealTimeByFrequencyUDPParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "CityBusApi_RealTimeByFrequency_UDP", + Method: "GET", + PathPattern: "/v2/Bus/RealTimeByFrequency/Streaming/City/{City}", + ProducesMediaTypes: []string{"application/json", "text/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"https"}, + Params: params, + Reader: &CityBusAPIRealTimeByFrequencyUDPReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, nil, err + } + switch value := result.(type) { + case *CityBusAPIRealTimeByFrequencyUDPOK: + return value, nil, nil + case *CityBusAPIRealTimeByFrequencyUDPStatus299: + return nil, value, nil + } + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for city_bus: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +CityBusAPIRealTimeByFrequencyUDP1 取得指定s 縣市 路線名稱 的公車動態定時資料 a1 逐筆更新 + +### 市區公車之定時資料(A1) ### +- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html)) +*/ +func (a *Client) CityBusAPIRealTimeByFrequencyUDP1(params *CityBusAPIRealTimeByFrequencyUDP1Params) (*CityBusAPIRealTimeByFrequencyUdp1OK, *CityBusAPIRealTimeByFrequencyUdp1Status299, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCityBusAPIRealTimeByFrequencyUDP1Params() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "CityBusApi_RealTimeByFrequency_UDP_1", + Method: "GET", + PathPattern: "/v2/Bus/RealTimeByFrequency/Streaming/City/{City}/{RouteName}", + ProducesMediaTypes: []string{"application/json", "text/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"https"}, + Params: params, + Reader: &CityBusAPIRealTimeByFrequencyUDP1Reader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, nil, err + } + switch value := result.(type) { + case *CityBusAPIRealTimeByFrequencyUdp1OK: + return value, nil, nil + case *CityBusAPIRealTimeByFrequencyUdp1Status299: + return nil, value, nil + } + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for city_bus: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + /* CityBusAPIRealTimeNearStop 取得指定s 縣市 的公車動態定點資料 a2 批次更新 ### 市區公車之定點資料(A2) ### -欲查詢縣市公車動態定點資料(A2) -- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/bus.html)) +- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html)) */ func (a *Client) CityBusAPIRealTimeNearStop(params *CityBusAPIRealTimeNearStopParams) (*CityBusAPIRealTimeNearStopOK, *CityBusAPIRealTimeNearStopStatus299, error) { // TODO: Validate the params before sending @@ -404,6 +563,7 @@ func (a *Client) CityBusAPIRealTimeNearStop(params *CityBusAPIRealTimeNearStopPa CityBusAPIRealTimeNearStop1 取得指定s 縣市 路線名稱 的公車動態定點資料 a2 批次更新 ### 市區公車之定點資料(A2) ### +- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html)) */ func (a *Client) CityBusAPIRealTimeNearStop1(params *CityBusAPIRealTimeNearStop1Params) (*CityBusAPIRealTimeNearStop1OK, *CityBusAPIRealTimeNearStop1Status299, error) { // TODO: Validate the params before sending @@ -437,6 +597,82 @@ func (a *Client) CityBusAPIRealTimeNearStop1(params *CityBusAPIRealTimeNearStop1 panic(msg) } +/* +CityBusAPIRealTimeNearStopUDP 取得指定s 縣市 的公車動態定點資料 a2 逐筆更新 + +### 市區公車之定點資料(A2) ### +- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html)) +*/ +func (a *Client) CityBusAPIRealTimeNearStopUDP(params *CityBusAPIRealTimeNearStopUDPParams) (*CityBusAPIRealTimeNearStopUDPOK, *CityBusAPIRealTimeNearStopUDPStatus299, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCityBusAPIRealTimeNearStopUDPParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "CityBusApi_RealTimeNearStop_UDP", + Method: "GET", + PathPattern: "/v2/Bus/RealTimeNearStop/Streaming/City/{City}", + ProducesMediaTypes: []string{"application/json", "text/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"https"}, + Params: params, + Reader: &CityBusAPIRealTimeNearStopUDPReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, nil, err + } + switch value := result.(type) { + case *CityBusAPIRealTimeNearStopUDPOK: + return value, nil, nil + case *CityBusAPIRealTimeNearStopUDPStatus299: + return nil, value, nil + } + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for city_bus: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +CityBusAPIRealTimeNearStopUDP1 取得指定s 縣市 路線名稱 的公車動態定點資料 a2 逐筆更新 + +### 市區公車之定點資料(A2) ### +- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html)) +*/ +func (a *Client) CityBusAPIRealTimeNearStopUDP1(params *CityBusAPIRealTimeNearStopUDP1Params) (*CityBusAPIRealTimeNearStopUdp1OK, *CityBusAPIRealTimeNearStopUdp1Status299, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCityBusAPIRealTimeNearStopUDP1Params() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "CityBusApi_RealTimeNearStop_UDP_1", + Method: "GET", + PathPattern: "/v2/Bus/RealTimeNearStop/Streaming/City/{City}/{RouteName}", + ProducesMediaTypes: []string{"application/json", "text/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"https"}, + Params: params, + Reader: &CityBusAPIRealTimeNearStopUDP1Reader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, nil, err + } + switch value := result.(type) { + case *CityBusAPIRealTimeNearStopUdp1OK: + return value, nil, nil + case *CityBusAPIRealTimeNearStopUdp1Status299: + return nil, value, nil + } + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for city_bus: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + /* CityBusAPIRoute 取得指定s 縣市 的市區公車路線資料 @@ -770,6 +1006,43 @@ func (a *Client) CityBusAPIStation(params *CityBusAPIStationParams) (*CityBusAPI panic(msg) } +/* +CityBusAPIStationGroup 取得指定s 縣市 的市區公車組站位資料 + +市區公車之各站牌所屬的組站位資料 +*/ +func (a *Client) CityBusAPIStationGroup(params *CityBusAPIStationGroupParams) (*CityBusAPIStationGroupOK, *CityBusAPIStationGroupStatus299, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCityBusAPIStationGroupParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "CityBusApi_StationGroup", + Method: "GET", + PathPattern: "/v2/Bus/StationGroup/City/{City}", + ProducesMediaTypes: []string{"application/json", "text/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"https"}, + Params: params, + Reader: &CityBusAPIStationGroupReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, nil, err + } + switch value := result.(type) { + case *CityBusAPIStationGroupOK: + return value, nil, nil + case *CityBusAPIStationGroupStatus299: + return nil, value, nil + } + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for city_bus: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + /* CityBusAPIStationName 取得指定s 縣市 的市區公車站名碼資料 diff --git a/bus/v2/client/inter_city_bus/inter_city_bus_api_estimated_time_of_arrival_udp_1_parameters.go b/bus/v2/client/inter_city_bus/inter_city_bus_api_estimated_time_of_arrival_udp_1_parameters.go new file mode 100644 index 00000000..71105b69 --- /dev/null +++ b/bus/v2/client/inter_city_bus/inter_city_bus_api_estimated_time_of_arrival_udp_1_parameters.go @@ -0,0 +1,366 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package inter_city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/swag" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewInterCityBusAPIEstimatedTimeOfArrivalUDP1Params creates a new InterCityBusAPIEstimatedTimeOfArrivalUDP1Params object +// with the default values initialized. +func NewInterCityBusAPIEstimatedTimeOfArrivalUDP1Params() *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIEstimatedTimeOfArrivalUDP1Params{ + DollarTop: &dollarTopDefault, + + timeout: cr.DefaultTimeout, + } +} + +// NewInterCityBusAPIEstimatedTimeOfArrivalUDP1ParamsWithTimeout creates a new InterCityBusAPIEstimatedTimeOfArrivalUDP1Params object +// with the default values initialized, and the ability to set a timeout on a request +func NewInterCityBusAPIEstimatedTimeOfArrivalUDP1ParamsWithTimeout(timeout time.Duration) *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIEstimatedTimeOfArrivalUDP1Params{ + DollarTop: &dollarTopDefault, + + timeout: timeout, + } +} + +// NewInterCityBusAPIEstimatedTimeOfArrivalUDP1ParamsWithContext creates a new InterCityBusAPIEstimatedTimeOfArrivalUDP1Params object +// with the default values initialized, and the ability to set a context for a request +func NewInterCityBusAPIEstimatedTimeOfArrivalUDP1ParamsWithContext(ctx context.Context) *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIEstimatedTimeOfArrivalUDP1Params{ + DollarTop: &dollarTopDefault, + + Context: ctx, + } +} + +// NewInterCityBusAPIEstimatedTimeOfArrivalUDP1ParamsWithHTTPClient creates a new InterCityBusAPIEstimatedTimeOfArrivalUDP1Params object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewInterCityBusAPIEstimatedTimeOfArrivalUDP1ParamsWithHTTPClient(client *http.Client) *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIEstimatedTimeOfArrivalUDP1Params{ + DollarTop: &dollarTopDefault, + HTTPClient: client, + } +} + +/*InterCityBusAPIEstimatedTimeOfArrivalUDP1Params contains all the parameters to send to the API endpoint +for the inter city bus Api estimated time of arrival UDP 1 operation typically these are written to a http.Request +*/ +type InterCityBusAPIEstimatedTimeOfArrivalUDP1Params struct { + + /*DollarFilter + 過濾 + + */ + DollarFilter *string + /*DollarFormat + 指定來源格式 + + */ + DollarFormat string + /*DollarOrderby + 排序 + + */ + DollarOrderby *string + /*DollarSelect + 挑選 + + */ + DollarSelect *string + /*DollarSkip + 跳過前幾筆 + + */ + DollarSkip *string + /*DollarTop + 取前幾筆 + + */ + DollarTop *int64 + /*RouteName + 繁體中文路線名稱,如'9102' + + */ + RouteName string + /*Health + 加入參數'?health=true'即可查詢此API服務的健康狀態 + + */ + Health *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the inter city bus Api estimated time of arrival UDP 1 params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params) WithTimeout(timeout time.Duration) *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the inter city bus Api estimated time of arrival UDP 1 params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the inter city bus Api estimated time of arrival UDP 1 params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params) WithContext(ctx context.Context) *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the inter city bus Api estimated time of arrival UDP 1 params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the inter city bus Api estimated time of arrival UDP 1 params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params) WithHTTPClient(client *http.Client) *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the inter city bus Api estimated time of arrival UDP 1 params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDollarFilter adds the dollarFilter to the inter city bus Api estimated time of arrival UDP 1 params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params) WithDollarFilter(dollarFilter *string) *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params { + o.SetDollarFilter(dollarFilter) + return o +} + +// SetDollarFilter adds the dollarFilter to the inter city bus Api estimated time of arrival UDP 1 params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params) SetDollarFilter(dollarFilter *string) { + o.DollarFilter = dollarFilter +} + +// WithDollarFormat adds the dollarFormat to the inter city bus Api estimated time of arrival UDP 1 params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params) WithDollarFormat(dollarFormat string) *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params { + o.SetDollarFormat(dollarFormat) + return o +} + +// SetDollarFormat adds the dollarFormat to the inter city bus Api estimated time of arrival UDP 1 params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params) SetDollarFormat(dollarFormat string) { + o.DollarFormat = dollarFormat +} + +// WithDollarOrderby adds the dollarOrderby to the inter city bus Api estimated time of arrival UDP 1 params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params) WithDollarOrderby(dollarOrderby *string) *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params { + o.SetDollarOrderby(dollarOrderby) + return o +} + +// SetDollarOrderby adds the dollarOrderby to the inter city bus Api estimated time of arrival UDP 1 params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params) SetDollarOrderby(dollarOrderby *string) { + o.DollarOrderby = dollarOrderby +} + +// WithDollarSelect adds the dollarSelect to the inter city bus Api estimated time of arrival UDP 1 params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params) WithDollarSelect(dollarSelect *string) *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params { + o.SetDollarSelect(dollarSelect) + return o +} + +// SetDollarSelect adds the dollarSelect to the inter city bus Api estimated time of arrival UDP 1 params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params) SetDollarSelect(dollarSelect *string) { + o.DollarSelect = dollarSelect +} + +// WithDollarSkip adds the dollarSkip to the inter city bus Api estimated time of arrival UDP 1 params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params) WithDollarSkip(dollarSkip *string) *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params { + o.SetDollarSkip(dollarSkip) + return o +} + +// SetDollarSkip adds the dollarSkip to the inter city bus Api estimated time of arrival UDP 1 params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params) SetDollarSkip(dollarSkip *string) { + o.DollarSkip = dollarSkip +} + +// WithDollarTop adds the dollarTop to the inter city bus Api estimated time of arrival UDP 1 params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params) WithDollarTop(dollarTop *int64) *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params { + o.SetDollarTop(dollarTop) + return o +} + +// SetDollarTop adds the dollarTop to the inter city bus Api estimated time of arrival UDP 1 params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params) SetDollarTop(dollarTop *int64) { + o.DollarTop = dollarTop +} + +// WithRouteName adds the routeName to the inter city bus Api estimated time of arrival UDP 1 params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params) WithRouteName(routeName string) *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params { + o.SetRouteName(routeName) + return o +} + +// SetRouteName adds the routeName to the inter city bus Api estimated time of arrival UDP 1 params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params) SetRouteName(routeName string) { + o.RouteName = routeName +} + +// WithHealth adds the health to the inter city bus Api estimated time of arrival UDP 1 params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params) WithHealth(health *string) *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params { + o.SetHealth(health) + return o +} + +// SetHealth adds the health to the inter city bus Api estimated time of arrival UDP 1 params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params) SetHealth(health *string) { + o.Health = health +} + +// WriteToRequest writes these params to a swagger request +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.DollarFilter != nil { + + // query param $filter + var qrDollarFilter string + if o.DollarFilter != nil { + qrDollarFilter = *o.DollarFilter + } + qDollarFilter := qrDollarFilter + if qDollarFilter != "" { + if err := r.SetQueryParam("$filter", qDollarFilter); err != nil { + return err + } + } + + } + + // query param $format + qrDollarFormat := o.DollarFormat + qDollarFormat := qrDollarFormat + if qDollarFormat != "" { + if err := r.SetQueryParam("$format", qDollarFormat); err != nil { + return err + } + } + + if o.DollarOrderby != nil { + + // query param $orderby + var qrDollarOrderby string + if o.DollarOrderby != nil { + qrDollarOrderby = *o.DollarOrderby + } + qDollarOrderby := qrDollarOrderby + if qDollarOrderby != "" { + if err := r.SetQueryParam("$orderby", qDollarOrderby); err != nil { + return err + } + } + + } + + if o.DollarSelect != nil { + + // query param $select + var qrDollarSelect string + if o.DollarSelect != nil { + qrDollarSelect = *o.DollarSelect + } + qDollarSelect := qrDollarSelect + if qDollarSelect != "" { + if err := r.SetQueryParam("$select", qDollarSelect); err != nil { + return err + } + } + + } + + if o.DollarSkip != nil { + + // query param $skip + var qrDollarSkip string + if o.DollarSkip != nil { + qrDollarSkip = *o.DollarSkip + } + qDollarSkip := qrDollarSkip + if qDollarSkip != "" { + if err := r.SetQueryParam("$skip", qDollarSkip); err != nil { + return err + } + } + + } + + if o.DollarTop != nil { + + // query param $top + var qrDollarTop int64 + if o.DollarTop != nil { + qrDollarTop = *o.DollarTop + } + qDollarTop := swag.FormatInt64(qrDollarTop) + if qDollarTop != "" { + if err := r.SetQueryParam("$top", qDollarTop); err != nil { + return err + } + } + + } + + // path param RouteName + if err := r.SetPathParam("RouteName", o.RouteName); err != nil { + return err + } + + if o.Health != nil { + + // query param health + var qrHealth string + if o.Health != nil { + qrHealth = *o.Health + } + qHealth := qrHealth + if qHealth != "" { + if err := r.SetQueryParam("health", qHealth); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/bus/v2/client/inter_city_bus/inter_city_bus_api_estimated_time_of_arrival_udp_1_responses.go b/bus/v2/client/inter_city_bus/inter_city_bus_api_estimated_time_of_arrival_udp_1_responses.go new file mode 100644 index 00000000..a8d1b9ff --- /dev/null +++ b/bus/v2/client/inter_city_bus/inter_city_bus_api_estimated_time_of_arrival_udp_1_responses.go @@ -0,0 +1,107 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package inter_city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/minchao/go-ptx/bus/v2/models" +) + +// InterCityBusAPIEstimatedTimeOfArrivalUDP1Reader is a Reader for the InterCityBusAPIEstimatedTimeOfArrivalUDP1 structure. +type InterCityBusAPIEstimatedTimeOfArrivalUDP1Reader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDP1Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewInterCityBusAPIEstimatedTimeOfArrivalUdp1OK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 299: + result := NewInterCityBusAPIEstimatedTimeOfArrivalUdp1Status299() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewInterCityBusAPIEstimatedTimeOfArrivalUdp1OK creates a InterCityBusAPIEstimatedTimeOfArrivalUdp1OK with default headers values +func NewInterCityBusAPIEstimatedTimeOfArrivalUdp1OK() *InterCityBusAPIEstimatedTimeOfArrivalUdp1OK { + return &InterCityBusAPIEstimatedTimeOfArrivalUdp1OK{} +} + +/*InterCityBusAPIEstimatedTimeOfArrivalUdp1OK handles this case with default header values. + +OK +*/ +type InterCityBusAPIEstimatedTimeOfArrivalUdp1OK struct { + Payload []*models.ServiceDTOVersion2BusBusN1EstimateTime +} + +func (o *InterCityBusAPIEstimatedTimeOfArrivalUdp1OK) Error() string { + return fmt.Sprintf("[GET /v2/Bus/EstimatedTimeOfArrival/Streaming/InterCity/{RouteName}][%d] interCityBusApiEstimatedTimeOfArrivalUdp1OK %+v", 200, o.Payload) +} + +func (o *InterCityBusAPIEstimatedTimeOfArrivalUdp1OK) GetPayload() []*models.ServiceDTOVersion2BusBusN1EstimateTime { + return o.Payload +} + +func (o *InterCityBusAPIEstimatedTimeOfArrivalUdp1OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewInterCityBusAPIEstimatedTimeOfArrivalUdp1Status299 creates a InterCityBusAPIEstimatedTimeOfArrivalUdp1Status299 with default headers values +func NewInterCityBusAPIEstimatedTimeOfArrivalUdp1Status299() *InterCityBusAPIEstimatedTimeOfArrivalUdp1Status299 { + return &InterCityBusAPIEstimatedTimeOfArrivalUdp1Status299{} +} + +/*InterCityBusAPIEstimatedTimeOfArrivalUdp1Status299 handles this case with default header values. + +加入參數'?health=true'即可查詢此API服務的健康狀態 +*/ +type InterCityBusAPIEstimatedTimeOfArrivalUdp1Status299 struct { + Payload *models.ServiceDTOVersion3BaseHealth +} + +func (o *InterCityBusAPIEstimatedTimeOfArrivalUdp1Status299) Error() string { + return fmt.Sprintf("[GET /v2/Bus/EstimatedTimeOfArrival/Streaming/InterCity/{RouteName}][%d] interCityBusApiEstimatedTimeOfArrivalUdp1Status299 %+v", 299, o.Payload) +} + +func (o *InterCityBusAPIEstimatedTimeOfArrivalUdp1Status299) GetPayload() *models.ServiceDTOVersion3BaseHealth { + return o.Payload +} + +func (o *InterCityBusAPIEstimatedTimeOfArrivalUdp1Status299) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceDTOVersion3BaseHealth) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/bus/v2/client/inter_city_bus/inter_city_bus_api_estimated_time_of_arrival_udp_parameters.go b/bus/v2/client/inter_city_bus/inter_city_bus_api_estimated_time_of_arrival_udp_parameters.go new file mode 100644 index 00000000..9758bc4b --- /dev/null +++ b/bus/v2/client/inter_city_bus/inter_city_bus_api_estimated_time_of_arrival_udp_parameters.go @@ -0,0 +1,345 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package inter_city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/swag" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewInterCityBusAPIEstimatedTimeOfArrivalUDPParams creates a new InterCityBusAPIEstimatedTimeOfArrivalUDPParams object +// with the default values initialized. +func NewInterCityBusAPIEstimatedTimeOfArrivalUDPParams() *InterCityBusAPIEstimatedTimeOfArrivalUDPParams { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIEstimatedTimeOfArrivalUDPParams{ + DollarTop: &dollarTopDefault, + + timeout: cr.DefaultTimeout, + } +} + +// NewInterCityBusAPIEstimatedTimeOfArrivalUDPParamsWithTimeout creates a new InterCityBusAPIEstimatedTimeOfArrivalUDPParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewInterCityBusAPIEstimatedTimeOfArrivalUDPParamsWithTimeout(timeout time.Duration) *InterCityBusAPIEstimatedTimeOfArrivalUDPParams { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIEstimatedTimeOfArrivalUDPParams{ + DollarTop: &dollarTopDefault, + + timeout: timeout, + } +} + +// NewInterCityBusAPIEstimatedTimeOfArrivalUDPParamsWithContext creates a new InterCityBusAPIEstimatedTimeOfArrivalUDPParams object +// with the default values initialized, and the ability to set a context for a request +func NewInterCityBusAPIEstimatedTimeOfArrivalUDPParamsWithContext(ctx context.Context) *InterCityBusAPIEstimatedTimeOfArrivalUDPParams { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIEstimatedTimeOfArrivalUDPParams{ + DollarTop: &dollarTopDefault, + + Context: ctx, + } +} + +// NewInterCityBusAPIEstimatedTimeOfArrivalUDPParamsWithHTTPClient creates a new InterCityBusAPIEstimatedTimeOfArrivalUDPParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewInterCityBusAPIEstimatedTimeOfArrivalUDPParamsWithHTTPClient(client *http.Client) *InterCityBusAPIEstimatedTimeOfArrivalUDPParams { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIEstimatedTimeOfArrivalUDPParams{ + DollarTop: &dollarTopDefault, + HTTPClient: client, + } +} + +/*InterCityBusAPIEstimatedTimeOfArrivalUDPParams contains all the parameters to send to the API endpoint +for the inter city bus Api estimated time of arrival UDP operation typically these are written to a http.Request +*/ +type InterCityBusAPIEstimatedTimeOfArrivalUDPParams struct { + + /*DollarFilter + 過濾 + + */ + DollarFilter *string + /*DollarFormat + 指定來源格式 + + */ + DollarFormat string + /*DollarOrderby + 排序 + + */ + DollarOrderby *string + /*DollarSelect + 挑選 + + */ + DollarSelect *string + /*DollarSkip + 跳過前幾筆 + + */ + DollarSkip *string + /*DollarTop + 取前幾筆 + + */ + DollarTop *int64 + /*Health + 加入參數'?health=true'即可查詢此API服務的健康狀態 + + */ + Health *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the inter city bus Api estimated time of arrival UDP params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPParams) WithTimeout(timeout time.Duration) *InterCityBusAPIEstimatedTimeOfArrivalUDPParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the inter city bus Api estimated time of arrival UDP params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the inter city bus Api estimated time of arrival UDP params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPParams) WithContext(ctx context.Context) *InterCityBusAPIEstimatedTimeOfArrivalUDPParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the inter city bus Api estimated time of arrival UDP params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the inter city bus Api estimated time of arrival UDP params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPParams) WithHTTPClient(client *http.Client) *InterCityBusAPIEstimatedTimeOfArrivalUDPParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the inter city bus Api estimated time of arrival UDP params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDollarFilter adds the dollarFilter to the inter city bus Api estimated time of arrival UDP params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPParams) WithDollarFilter(dollarFilter *string) *InterCityBusAPIEstimatedTimeOfArrivalUDPParams { + o.SetDollarFilter(dollarFilter) + return o +} + +// SetDollarFilter adds the dollarFilter to the inter city bus Api estimated time of arrival UDP params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPParams) SetDollarFilter(dollarFilter *string) { + o.DollarFilter = dollarFilter +} + +// WithDollarFormat adds the dollarFormat to the inter city bus Api estimated time of arrival UDP params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPParams) WithDollarFormat(dollarFormat string) *InterCityBusAPIEstimatedTimeOfArrivalUDPParams { + o.SetDollarFormat(dollarFormat) + return o +} + +// SetDollarFormat adds the dollarFormat to the inter city bus Api estimated time of arrival UDP params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPParams) SetDollarFormat(dollarFormat string) { + o.DollarFormat = dollarFormat +} + +// WithDollarOrderby adds the dollarOrderby to the inter city bus Api estimated time of arrival UDP params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPParams) WithDollarOrderby(dollarOrderby *string) *InterCityBusAPIEstimatedTimeOfArrivalUDPParams { + o.SetDollarOrderby(dollarOrderby) + return o +} + +// SetDollarOrderby adds the dollarOrderby to the inter city bus Api estimated time of arrival UDP params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPParams) SetDollarOrderby(dollarOrderby *string) { + o.DollarOrderby = dollarOrderby +} + +// WithDollarSelect adds the dollarSelect to the inter city bus Api estimated time of arrival UDP params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPParams) WithDollarSelect(dollarSelect *string) *InterCityBusAPIEstimatedTimeOfArrivalUDPParams { + o.SetDollarSelect(dollarSelect) + return o +} + +// SetDollarSelect adds the dollarSelect to the inter city bus Api estimated time of arrival UDP params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPParams) SetDollarSelect(dollarSelect *string) { + o.DollarSelect = dollarSelect +} + +// WithDollarSkip adds the dollarSkip to the inter city bus Api estimated time of arrival UDP params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPParams) WithDollarSkip(dollarSkip *string) *InterCityBusAPIEstimatedTimeOfArrivalUDPParams { + o.SetDollarSkip(dollarSkip) + return o +} + +// SetDollarSkip adds the dollarSkip to the inter city bus Api estimated time of arrival UDP params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPParams) SetDollarSkip(dollarSkip *string) { + o.DollarSkip = dollarSkip +} + +// WithDollarTop adds the dollarTop to the inter city bus Api estimated time of arrival UDP params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPParams) WithDollarTop(dollarTop *int64) *InterCityBusAPIEstimatedTimeOfArrivalUDPParams { + o.SetDollarTop(dollarTop) + return o +} + +// SetDollarTop adds the dollarTop to the inter city bus Api estimated time of arrival UDP params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPParams) SetDollarTop(dollarTop *int64) { + o.DollarTop = dollarTop +} + +// WithHealth adds the health to the inter city bus Api estimated time of arrival UDP params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPParams) WithHealth(health *string) *InterCityBusAPIEstimatedTimeOfArrivalUDPParams { + o.SetHealth(health) + return o +} + +// SetHealth adds the health to the inter city bus Api estimated time of arrival UDP params +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPParams) SetHealth(health *string) { + o.Health = health +} + +// WriteToRequest writes these params to a swagger request +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.DollarFilter != nil { + + // query param $filter + var qrDollarFilter string + if o.DollarFilter != nil { + qrDollarFilter = *o.DollarFilter + } + qDollarFilter := qrDollarFilter + if qDollarFilter != "" { + if err := r.SetQueryParam("$filter", qDollarFilter); err != nil { + return err + } + } + + } + + // query param $format + qrDollarFormat := o.DollarFormat + qDollarFormat := qrDollarFormat + if qDollarFormat != "" { + if err := r.SetQueryParam("$format", qDollarFormat); err != nil { + return err + } + } + + if o.DollarOrderby != nil { + + // query param $orderby + var qrDollarOrderby string + if o.DollarOrderby != nil { + qrDollarOrderby = *o.DollarOrderby + } + qDollarOrderby := qrDollarOrderby + if qDollarOrderby != "" { + if err := r.SetQueryParam("$orderby", qDollarOrderby); err != nil { + return err + } + } + + } + + if o.DollarSelect != nil { + + // query param $select + var qrDollarSelect string + if o.DollarSelect != nil { + qrDollarSelect = *o.DollarSelect + } + qDollarSelect := qrDollarSelect + if qDollarSelect != "" { + if err := r.SetQueryParam("$select", qDollarSelect); err != nil { + return err + } + } + + } + + if o.DollarSkip != nil { + + // query param $skip + var qrDollarSkip string + if o.DollarSkip != nil { + qrDollarSkip = *o.DollarSkip + } + qDollarSkip := qrDollarSkip + if qDollarSkip != "" { + if err := r.SetQueryParam("$skip", qDollarSkip); err != nil { + return err + } + } + + } + + if o.DollarTop != nil { + + // query param $top + var qrDollarTop int64 + if o.DollarTop != nil { + qrDollarTop = *o.DollarTop + } + qDollarTop := swag.FormatInt64(qrDollarTop) + if qDollarTop != "" { + if err := r.SetQueryParam("$top", qDollarTop); err != nil { + return err + } + } + + } + + if o.Health != nil { + + // query param health + var qrHealth string + if o.Health != nil { + qrHealth = *o.Health + } + qHealth := qrHealth + if qHealth != "" { + if err := r.SetQueryParam("health", qHealth); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/bus/v2/client/inter_city_bus/inter_city_bus_api_estimated_time_of_arrival_udp_responses.go b/bus/v2/client/inter_city_bus/inter_city_bus_api_estimated_time_of_arrival_udp_responses.go new file mode 100644 index 00000000..4d39124f --- /dev/null +++ b/bus/v2/client/inter_city_bus/inter_city_bus_api_estimated_time_of_arrival_udp_responses.go @@ -0,0 +1,107 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package inter_city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/minchao/go-ptx/bus/v2/models" +) + +// InterCityBusAPIEstimatedTimeOfArrivalUDPReader is a Reader for the InterCityBusAPIEstimatedTimeOfArrivalUDP structure. +type InterCityBusAPIEstimatedTimeOfArrivalUDPReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewInterCityBusAPIEstimatedTimeOfArrivalUDPOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 299: + result := NewInterCityBusAPIEstimatedTimeOfArrivalUDPStatus299() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewInterCityBusAPIEstimatedTimeOfArrivalUDPOK creates a InterCityBusAPIEstimatedTimeOfArrivalUDPOK with default headers values +func NewInterCityBusAPIEstimatedTimeOfArrivalUDPOK() *InterCityBusAPIEstimatedTimeOfArrivalUDPOK { + return &InterCityBusAPIEstimatedTimeOfArrivalUDPOK{} +} + +/*InterCityBusAPIEstimatedTimeOfArrivalUDPOK handles this case with default header values. + +OK +*/ +type InterCityBusAPIEstimatedTimeOfArrivalUDPOK struct { + Payload []*models.ServiceDTOVersion2BusBusN1EstimateTime +} + +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPOK) Error() string { + return fmt.Sprintf("[GET /v2/Bus/EstimatedTimeOfArrival/Streaming/InterCity][%d] interCityBusApiEstimatedTimeOfArrivalUdpOK %+v", 200, o.Payload) +} + +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPOK) GetPayload() []*models.ServiceDTOVersion2BusBusN1EstimateTime { + return o.Payload +} + +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewInterCityBusAPIEstimatedTimeOfArrivalUDPStatus299 creates a InterCityBusAPIEstimatedTimeOfArrivalUDPStatus299 with default headers values +func NewInterCityBusAPIEstimatedTimeOfArrivalUDPStatus299() *InterCityBusAPIEstimatedTimeOfArrivalUDPStatus299 { + return &InterCityBusAPIEstimatedTimeOfArrivalUDPStatus299{} +} + +/*InterCityBusAPIEstimatedTimeOfArrivalUDPStatus299 handles this case with default header values. + +加入參數'?health=true'即可查詢此API服務的健康狀態 +*/ +type InterCityBusAPIEstimatedTimeOfArrivalUDPStatus299 struct { + Payload *models.ServiceDTOVersion3BaseHealth +} + +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPStatus299) Error() string { + return fmt.Sprintf("[GET /v2/Bus/EstimatedTimeOfArrival/Streaming/InterCity][%d] interCityBusApiEstimatedTimeOfArrivalUdpStatus299 %+v", 299, o.Payload) +} + +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPStatus299) GetPayload() *models.ServiceDTOVersion3BaseHealth { + return o.Payload +} + +func (o *InterCityBusAPIEstimatedTimeOfArrivalUDPStatus299) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceDTOVersion3BaseHealth) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_by_frequency_udp_1_parameters.go b/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_by_frequency_udp_1_parameters.go new file mode 100644 index 00000000..3f304a77 --- /dev/null +++ b/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_by_frequency_udp_1_parameters.go @@ -0,0 +1,398 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package inter_city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/swag" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewInterCityBusAPIRealTimeByFrequencyUDP1Params creates a new InterCityBusAPIRealTimeByFrequencyUDP1Params object +// with the default values initialized. +func NewInterCityBusAPIRealTimeByFrequencyUDP1Params() *InterCityBusAPIRealTimeByFrequencyUDP1Params { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIRealTimeByFrequencyUDP1Params{ + DollarTop: &dollarTopDefault, + + timeout: cr.DefaultTimeout, + } +} + +// NewInterCityBusAPIRealTimeByFrequencyUDP1ParamsWithTimeout creates a new InterCityBusAPIRealTimeByFrequencyUDP1Params object +// with the default values initialized, and the ability to set a timeout on a request +func NewInterCityBusAPIRealTimeByFrequencyUDP1ParamsWithTimeout(timeout time.Duration) *InterCityBusAPIRealTimeByFrequencyUDP1Params { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIRealTimeByFrequencyUDP1Params{ + DollarTop: &dollarTopDefault, + + timeout: timeout, + } +} + +// NewInterCityBusAPIRealTimeByFrequencyUDP1ParamsWithContext creates a new InterCityBusAPIRealTimeByFrequencyUDP1Params object +// with the default values initialized, and the ability to set a context for a request +func NewInterCityBusAPIRealTimeByFrequencyUDP1ParamsWithContext(ctx context.Context) *InterCityBusAPIRealTimeByFrequencyUDP1Params { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIRealTimeByFrequencyUDP1Params{ + DollarTop: &dollarTopDefault, + + Context: ctx, + } +} + +// NewInterCityBusAPIRealTimeByFrequencyUDP1ParamsWithHTTPClient creates a new InterCityBusAPIRealTimeByFrequencyUDP1Params object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewInterCityBusAPIRealTimeByFrequencyUDP1ParamsWithHTTPClient(client *http.Client) *InterCityBusAPIRealTimeByFrequencyUDP1Params { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIRealTimeByFrequencyUDP1Params{ + DollarTop: &dollarTopDefault, + HTTPClient: client, + } +} + +/*InterCityBusAPIRealTimeByFrequencyUDP1Params contains all the parameters to send to the API endpoint +for the inter city bus Api real time by frequency UDP 1 operation typically these are written to a http.Request +*/ +type InterCityBusAPIRealTimeByFrequencyUDP1Params struct { + + /*DollarFilter + 過濾 + + */ + DollarFilter *string + /*DollarFormat + 指定來源格式 + + */ + DollarFormat string + /*DollarOrderby + 排序 + + */ + DollarOrderby *string + /*DollarSelect + 挑選 + + */ + DollarSelect *string + /*DollarSkip + 跳過前幾筆 + + */ + DollarSkip *string + /*DollarSpatialFilter + 空間過濾 + + */ + DollarSpatialFilter *string + /*DollarTop + 取前幾筆 + + */ + DollarTop *int64 + /*RouteName + 繁體中文路線名稱,如'9102' + + */ + RouteName string + /*Health + 加入參數'?health=true'即可查詢此API服務的健康狀態 + + */ + Health *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the inter city bus Api real time by frequency UDP 1 params +func (o *InterCityBusAPIRealTimeByFrequencyUDP1Params) WithTimeout(timeout time.Duration) *InterCityBusAPIRealTimeByFrequencyUDP1Params { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the inter city bus Api real time by frequency UDP 1 params +func (o *InterCityBusAPIRealTimeByFrequencyUDP1Params) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the inter city bus Api real time by frequency UDP 1 params +func (o *InterCityBusAPIRealTimeByFrequencyUDP1Params) WithContext(ctx context.Context) *InterCityBusAPIRealTimeByFrequencyUDP1Params { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the inter city bus Api real time by frequency UDP 1 params +func (o *InterCityBusAPIRealTimeByFrequencyUDP1Params) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the inter city bus Api real time by frequency UDP 1 params +func (o *InterCityBusAPIRealTimeByFrequencyUDP1Params) WithHTTPClient(client *http.Client) *InterCityBusAPIRealTimeByFrequencyUDP1Params { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the inter city bus Api real time by frequency UDP 1 params +func (o *InterCityBusAPIRealTimeByFrequencyUDP1Params) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDollarFilter adds the dollarFilter to the inter city bus Api real time by frequency UDP 1 params +func (o *InterCityBusAPIRealTimeByFrequencyUDP1Params) WithDollarFilter(dollarFilter *string) *InterCityBusAPIRealTimeByFrequencyUDP1Params { + o.SetDollarFilter(dollarFilter) + return o +} + +// SetDollarFilter adds the dollarFilter to the inter city bus Api real time by frequency UDP 1 params +func (o *InterCityBusAPIRealTimeByFrequencyUDP1Params) SetDollarFilter(dollarFilter *string) { + o.DollarFilter = dollarFilter +} + +// WithDollarFormat adds the dollarFormat to the inter city bus Api real time by frequency UDP 1 params +func (o *InterCityBusAPIRealTimeByFrequencyUDP1Params) WithDollarFormat(dollarFormat string) *InterCityBusAPIRealTimeByFrequencyUDP1Params { + o.SetDollarFormat(dollarFormat) + return o +} + +// SetDollarFormat adds the dollarFormat to the inter city bus Api real time by frequency UDP 1 params +func (o *InterCityBusAPIRealTimeByFrequencyUDP1Params) SetDollarFormat(dollarFormat string) { + o.DollarFormat = dollarFormat +} + +// WithDollarOrderby adds the dollarOrderby to the inter city bus Api real time by frequency UDP 1 params +func (o *InterCityBusAPIRealTimeByFrequencyUDP1Params) WithDollarOrderby(dollarOrderby *string) *InterCityBusAPIRealTimeByFrequencyUDP1Params { + o.SetDollarOrderby(dollarOrderby) + return o +} + +// SetDollarOrderby adds the dollarOrderby to the inter city bus Api real time by frequency UDP 1 params +func (o *InterCityBusAPIRealTimeByFrequencyUDP1Params) SetDollarOrderby(dollarOrderby *string) { + o.DollarOrderby = dollarOrderby +} + +// WithDollarSelect adds the dollarSelect to the inter city bus Api real time by frequency UDP 1 params +func (o *InterCityBusAPIRealTimeByFrequencyUDP1Params) WithDollarSelect(dollarSelect *string) *InterCityBusAPIRealTimeByFrequencyUDP1Params { + o.SetDollarSelect(dollarSelect) + return o +} + +// SetDollarSelect adds the dollarSelect to the inter city bus Api real time by frequency UDP 1 params +func (o *InterCityBusAPIRealTimeByFrequencyUDP1Params) SetDollarSelect(dollarSelect *string) { + o.DollarSelect = dollarSelect +} + +// WithDollarSkip adds the dollarSkip to the inter city bus Api real time by frequency UDP 1 params +func (o *InterCityBusAPIRealTimeByFrequencyUDP1Params) WithDollarSkip(dollarSkip *string) *InterCityBusAPIRealTimeByFrequencyUDP1Params { + o.SetDollarSkip(dollarSkip) + return o +} + +// SetDollarSkip adds the dollarSkip to the inter city bus Api real time by frequency UDP 1 params +func (o *InterCityBusAPIRealTimeByFrequencyUDP1Params) SetDollarSkip(dollarSkip *string) { + o.DollarSkip = dollarSkip +} + +// WithDollarSpatialFilter adds the dollarSpatialFilter to the inter city bus Api real time by frequency UDP 1 params +func (o *InterCityBusAPIRealTimeByFrequencyUDP1Params) WithDollarSpatialFilter(dollarSpatialFilter *string) *InterCityBusAPIRealTimeByFrequencyUDP1Params { + o.SetDollarSpatialFilter(dollarSpatialFilter) + return o +} + +// SetDollarSpatialFilter adds the dollarSpatialFilter to the inter city bus Api real time by frequency UDP 1 params +func (o *InterCityBusAPIRealTimeByFrequencyUDP1Params) SetDollarSpatialFilter(dollarSpatialFilter *string) { + o.DollarSpatialFilter = dollarSpatialFilter +} + +// WithDollarTop adds the dollarTop to the inter city bus Api real time by frequency UDP 1 params +func (o *InterCityBusAPIRealTimeByFrequencyUDP1Params) WithDollarTop(dollarTop *int64) *InterCityBusAPIRealTimeByFrequencyUDP1Params { + o.SetDollarTop(dollarTop) + return o +} + +// SetDollarTop adds the dollarTop to the inter city bus Api real time by frequency UDP 1 params +func (o *InterCityBusAPIRealTimeByFrequencyUDP1Params) SetDollarTop(dollarTop *int64) { + o.DollarTop = dollarTop +} + +// WithRouteName adds the routeName to the inter city bus Api real time by frequency UDP 1 params +func (o *InterCityBusAPIRealTimeByFrequencyUDP1Params) WithRouteName(routeName string) *InterCityBusAPIRealTimeByFrequencyUDP1Params { + o.SetRouteName(routeName) + return o +} + +// SetRouteName adds the routeName to the inter city bus Api real time by frequency UDP 1 params +func (o *InterCityBusAPIRealTimeByFrequencyUDP1Params) SetRouteName(routeName string) { + o.RouteName = routeName +} + +// WithHealth adds the health to the inter city bus Api real time by frequency UDP 1 params +func (o *InterCityBusAPIRealTimeByFrequencyUDP1Params) WithHealth(health *string) *InterCityBusAPIRealTimeByFrequencyUDP1Params { + o.SetHealth(health) + return o +} + +// SetHealth adds the health to the inter city bus Api real time by frequency UDP 1 params +func (o *InterCityBusAPIRealTimeByFrequencyUDP1Params) SetHealth(health *string) { + o.Health = health +} + +// WriteToRequest writes these params to a swagger request +func (o *InterCityBusAPIRealTimeByFrequencyUDP1Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.DollarFilter != nil { + + // query param $filter + var qrDollarFilter string + if o.DollarFilter != nil { + qrDollarFilter = *o.DollarFilter + } + qDollarFilter := qrDollarFilter + if qDollarFilter != "" { + if err := r.SetQueryParam("$filter", qDollarFilter); err != nil { + return err + } + } + + } + + // query param $format + qrDollarFormat := o.DollarFormat + qDollarFormat := qrDollarFormat + if qDollarFormat != "" { + if err := r.SetQueryParam("$format", qDollarFormat); err != nil { + return err + } + } + + if o.DollarOrderby != nil { + + // query param $orderby + var qrDollarOrderby string + if o.DollarOrderby != nil { + qrDollarOrderby = *o.DollarOrderby + } + qDollarOrderby := qrDollarOrderby + if qDollarOrderby != "" { + if err := r.SetQueryParam("$orderby", qDollarOrderby); err != nil { + return err + } + } + + } + + if o.DollarSelect != nil { + + // query param $select + var qrDollarSelect string + if o.DollarSelect != nil { + qrDollarSelect = *o.DollarSelect + } + qDollarSelect := qrDollarSelect + if qDollarSelect != "" { + if err := r.SetQueryParam("$select", qDollarSelect); err != nil { + return err + } + } + + } + + if o.DollarSkip != nil { + + // query param $skip + var qrDollarSkip string + if o.DollarSkip != nil { + qrDollarSkip = *o.DollarSkip + } + qDollarSkip := qrDollarSkip + if qDollarSkip != "" { + if err := r.SetQueryParam("$skip", qDollarSkip); err != nil { + return err + } + } + + } + + if o.DollarSpatialFilter != nil { + + // query param $spatialFilter + var qrDollarSpatialFilter string + if o.DollarSpatialFilter != nil { + qrDollarSpatialFilter = *o.DollarSpatialFilter + } + qDollarSpatialFilter := qrDollarSpatialFilter + if qDollarSpatialFilter != "" { + if err := r.SetQueryParam("$spatialFilter", qDollarSpatialFilter); err != nil { + return err + } + } + + } + + if o.DollarTop != nil { + + // query param $top + var qrDollarTop int64 + if o.DollarTop != nil { + qrDollarTop = *o.DollarTop + } + qDollarTop := swag.FormatInt64(qrDollarTop) + if qDollarTop != "" { + if err := r.SetQueryParam("$top", qDollarTop); err != nil { + return err + } + } + + } + + // path param RouteName + if err := r.SetPathParam("RouteName", o.RouteName); err != nil { + return err + } + + if o.Health != nil { + + // query param health + var qrHealth string + if o.Health != nil { + qrHealth = *o.Health + } + qHealth := qrHealth + if qHealth != "" { + if err := r.SetQueryParam("health", qHealth); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_by_frequency_udp_1_responses.go b/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_by_frequency_udp_1_responses.go new file mode 100644 index 00000000..997266b3 --- /dev/null +++ b/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_by_frequency_udp_1_responses.go @@ -0,0 +1,107 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package inter_city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/minchao/go-ptx/bus/v2/models" +) + +// InterCityBusAPIRealTimeByFrequencyUDP1Reader is a Reader for the InterCityBusAPIRealTimeByFrequencyUDP1 structure. +type InterCityBusAPIRealTimeByFrequencyUDP1Reader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *InterCityBusAPIRealTimeByFrequencyUDP1Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewInterCityBusAPIRealTimeByFrequencyUdp1OK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 299: + result := NewInterCityBusAPIRealTimeByFrequencyUdp1Status299() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewInterCityBusAPIRealTimeByFrequencyUdp1OK creates a InterCityBusAPIRealTimeByFrequencyUdp1OK with default headers values +func NewInterCityBusAPIRealTimeByFrequencyUdp1OK() *InterCityBusAPIRealTimeByFrequencyUdp1OK { + return &InterCityBusAPIRealTimeByFrequencyUdp1OK{} +} + +/*InterCityBusAPIRealTimeByFrequencyUdp1OK handles this case with default header values. + +OK +*/ +type InterCityBusAPIRealTimeByFrequencyUdp1OK struct { + Payload []*models.ServiceDTOVersion2BusBusA1Data +} + +func (o *InterCityBusAPIRealTimeByFrequencyUdp1OK) Error() string { + return fmt.Sprintf("[GET /v2/Bus/RealTimeByFrequency/Streaming/InterCity/{RouteName}][%d] interCityBusApiRealTimeByFrequencyUdp1OK %+v", 200, o.Payload) +} + +func (o *InterCityBusAPIRealTimeByFrequencyUdp1OK) GetPayload() []*models.ServiceDTOVersion2BusBusA1Data { + return o.Payload +} + +func (o *InterCityBusAPIRealTimeByFrequencyUdp1OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewInterCityBusAPIRealTimeByFrequencyUdp1Status299 creates a InterCityBusAPIRealTimeByFrequencyUdp1Status299 with default headers values +func NewInterCityBusAPIRealTimeByFrequencyUdp1Status299() *InterCityBusAPIRealTimeByFrequencyUdp1Status299 { + return &InterCityBusAPIRealTimeByFrequencyUdp1Status299{} +} + +/*InterCityBusAPIRealTimeByFrequencyUdp1Status299 handles this case with default header values. + +加入參數'?health=true'即可查詢此API服務的健康狀態 +*/ +type InterCityBusAPIRealTimeByFrequencyUdp1Status299 struct { + Payload *models.ServiceDTOVersion3BaseHealth +} + +func (o *InterCityBusAPIRealTimeByFrequencyUdp1Status299) Error() string { + return fmt.Sprintf("[GET /v2/Bus/RealTimeByFrequency/Streaming/InterCity/{RouteName}][%d] interCityBusApiRealTimeByFrequencyUdp1Status299 %+v", 299, o.Payload) +} + +func (o *InterCityBusAPIRealTimeByFrequencyUdp1Status299) GetPayload() *models.ServiceDTOVersion3BaseHealth { + return o.Payload +} + +func (o *InterCityBusAPIRealTimeByFrequencyUdp1Status299) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceDTOVersion3BaseHealth) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_by_frequency_udp_parameters.go b/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_by_frequency_udp_parameters.go new file mode 100644 index 00000000..01eef738 --- /dev/null +++ b/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_by_frequency_udp_parameters.go @@ -0,0 +1,377 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package inter_city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/swag" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewInterCityBusAPIRealTimeByFrequencyUDPParams creates a new InterCityBusAPIRealTimeByFrequencyUDPParams object +// with the default values initialized. +func NewInterCityBusAPIRealTimeByFrequencyUDPParams() *InterCityBusAPIRealTimeByFrequencyUDPParams { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIRealTimeByFrequencyUDPParams{ + DollarTop: &dollarTopDefault, + + timeout: cr.DefaultTimeout, + } +} + +// NewInterCityBusAPIRealTimeByFrequencyUDPParamsWithTimeout creates a new InterCityBusAPIRealTimeByFrequencyUDPParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewInterCityBusAPIRealTimeByFrequencyUDPParamsWithTimeout(timeout time.Duration) *InterCityBusAPIRealTimeByFrequencyUDPParams { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIRealTimeByFrequencyUDPParams{ + DollarTop: &dollarTopDefault, + + timeout: timeout, + } +} + +// NewInterCityBusAPIRealTimeByFrequencyUDPParamsWithContext creates a new InterCityBusAPIRealTimeByFrequencyUDPParams object +// with the default values initialized, and the ability to set a context for a request +func NewInterCityBusAPIRealTimeByFrequencyUDPParamsWithContext(ctx context.Context) *InterCityBusAPIRealTimeByFrequencyUDPParams { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIRealTimeByFrequencyUDPParams{ + DollarTop: &dollarTopDefault, + + Context: ctx, + } +} + +// NewInterCityBusAPIRealTimeByFrequencyUDPParamsWithHTTPClient creates a new InterCityBusAPIRealTimeByFrequencyUDPParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewInterCityBusAPIRealTimeByFrequencyUDPParamsWithHTTPClient(client *http.Client) *InterCityBusAPIRealTimeByFrequencyUDPParams { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIRealTimeByFrequencyUDPParams{ + DollarTop: &dollarTopDefault, + HTTPClient: client, + } +} + +/*InterCityBusAPIRealTimeByFrequencyUDPParams contains all the parameters to send to the API endpoint +for the inter city bus Api real time by frequency UDP operation typically these are written to a http.Request +*/ +type InterCityBusAPIRealTimeByFrequencyUDPParams struct { + + /*DollarFilter + 過濾 + + */ + DollarFilter *string + /*DollarFormat + 指定來源格式 + + */ + DollarFormat string + /*DollarOrderby + 排序 + + */ + DollarOrderby *string + /*DollarSelect + 挑選 + + */ + DollarSelect *string + /*DollarSkip + 跳過前幾筆 + + */ + DollarSkip *string + /*DollarSpatialFilter + 空間過濾 + + */ + DollarSpatialFilter *string + /*DollarTop + 取前幾筆 + + */ + DollarTop *int64 + /*Health + 加入參數'?health=true'即可查詢此API服務的健康狀態 + + */ + Health *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the inter city bus Api real time by frequency UDP params +func (o *InterCityBusAPIRealTimeByFrequencyUDPParams) WithTimeout(timeout time.Duration) *InterCityBusAPIRealTimeByFrequencyUDPParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the inter city bus Api real time by frequency UDP params +func (o *InterCityBusAPIRealTimeByFrequencyUDPParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the inter city bus Api real time by frequency UDP params +func (o *InterCityBusAPIRealTimeByFrequencyUDPParams) WithContext(ctx context.Context) *InterCityBusAPIRealTimeByFrequencyUDPParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the inter city bus Api real time by frequency UDP params +func (o *InterCityBusAPIRealTimeByFrequencyUDPParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the inter city bus Api real time by frequency UDP params +func (o *InterCityBusAPIRealTimeByFrequencyUDPParams) WithHTTPClient(client *http.Client) *InterCityBusAPIRealTimeByFrequencyUDPParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the inter city bus Api real time by frequency UDP params +func (o *InterCityBusAPIRealTimeByFrequencyUDPParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDollarFilter adds the dollarFilter to the inter city bus Api real time by frequency UDP params +func (o *InterCityBusAPIRealTimeByFrequencyUDPParams) WithDollarFilter(dollarFilter *string) *InterCityBusAPIRealTimeByFrequencyUDPParams { + o.SetDollarFilter(dollarFilter) + return o +} + +// SetDollarFilter adds the dollarFilter to the inter city bus Api real time by frequency UDP params +func (o *InterCityBusAPIRealTimeByFrequencyUDPParams) SetDollarFilter(dollarFilter *string) { + o.DollarFilter = dollarFilter +} + +// WithDollarFormat adds the dollarFormat to the inter city bus Api real time by frequency UDP params +func (o *InterCityBusAPIRealTimeByFrequencyUDPParams) WithDollarFormat(dollarFormat string) *InterCityBusAPIRealTimeByFrequencyUDPParams { + o.SetDollarFormat(dollarFormat) + return o +} + +// SetDollarFormat adds the dollarFormat to the inter city bus Api real time by frequency UDP params +func (o *InterCityBusAPIRealTimeByFrequencyUDPParams) SetDollarFormat(dollarFormat string) { + o.DollarFormat = dollarFormat +} + +// WithDollarOrderby adds the dollarOrderby to the inter city bus Api real time by frequency UDP params +func (o *InterCityBusAPIRealTimeByFrequencyUDPParams) WithDollarOrderby(dollarOrderby *string) *InterCityBusAPIRealTimeByFrequencyUDPParams { + o.SetDollarOrderby(dollarOrderby) + return o +} + +// SetDollarOrderby adds the dollarOrderby to the inter city bus Api real time by frequency UDP params +func (o *InterCityBusAPIRealTimeByFrequencyUDPParams) SetDollarOrderby(dollarOrderby *string) { + o.DollarOrderby = dollarOrderby +} + +// WithDollarSelect adds the dollarSelect to the inter city bus Api real time by frequency UDP params +func (o *InterCityBusAPIRealTimeByFrequencyUDPParams) WithDollarSelect(dollarSelect *string) *InterCityBusAPIRealTimeByFrequencyUDPParams { + o.SetDollarSelect(dollarSelect) + return o +} + +// SetDollarSelect adds the dollarSelect to the inter city bus Api real time by frequency UDP params +func (o *InterCityBusAPIRealTimeByFrequencyUDPParams) SetDollarSelect(dollarSelect *string) { + o.DollarSelect = dollarSelect +} + +// WithDollarSkip adds the dollarSkip to the inter city bus Api real time by frequency UDP params +func (o *InterCityBusAPIRealTimeByFrequencyUDPParams) WithDollarSkip(dollarSkip *string) *InterCityBusAPIRealTimeByFrequencyUDPParams { + o.SetDollarSkip(dollarSkip) + return o +} + +// SetDollarSkip adds the dollarSkip to the inter city bus Api real time by frequency UDP params +func (o *InterCityBusAPIRealTimeByFrequencyUDPParams) SetDollarSkip(dollarSkip *string) { + o.DollarSkip = dollarSkip +} + +// WithDollarSpatialFilter adds the dollarSpatialFilter to the inter city bus Api real time by frequency UDP params +func (o *InterCityBusAPIRealTimeByFrequencyUDPParams) WithDollarSpatialFilter(dollarSpatialFilter *string) *InterCityBusAPIRealTimeByFrequencyUDPParams { + o.SetDollarSpatialFilter(dollarSpatialFilter) + return o +} + +// SetDollarSpatialFilter adds the dollarSpatialFilter to the inter city bus Api real time by frequency UDP params +func (o *InterCityBusAPIRealTimeByFrequencyUDPParams) SetDollarSpatialFilter(dollarSpatialFilter *string) { + o.DollarSpatialFilter = dollarSpatialFilter +} + +// WithDollarTop adds the dollarTop to the inter city bus Api real time by frequency UDP params +func (o *InterCityBusAPIRealTimeByFrequencyUDPParams) WithDollarTop(dollarTop *int64) *InterCityBusAPIRealTimeByFrequencyUDPParams { + o.SetDollarTop(dollarTop) + return o +} + +// SetDollarTop adds the dollarTop to the inter city bus Api real time by frequency UDP params +func (o *InterCityBusAPIRealTimeByFrequencyUDPParams) SetDollarTop(dollarTop *int64) { + o.DollarTop = dollarTop +} + +// WithHealth adds the health to the inter city bus Api real time by frequency UDP params +func (o *InterCityBusAPIRealTimeByFrequencyUDPParams) WithHealth(health *string) *InterCityBusAPIRealTimeByFrequencyUDPParams { + o.SetHealth(health) + return o +} + +// SetHealth adds the health to the inter city bus Api real time by frequency UDP params +func (o *InterCityBusAPIRealTimeByFrequencyUDPParams) SetHealth(health *string) { + o.Health = health +} + +// WriteToRequest writes these params to a swagger request +func (o *InterCityBusAPIRealTimeByFrequencyUDPParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.DollarFilter != nil { + + // query param $filter + var qrDollarFilter string + if o.DollarFilter != nil { + qrDollarFilter = *o.DollarFilter + } + qDollarFilter := qrDollarFilter + if qDollarFilter != "" { + if err := r.SetQueryParam("$filter", qDollarFilter); err != nil { + return err + } + } + + } + + // query param $format + qrDollarFormat := o.DollarFormat + qDollarFormat := qrDollarFormat + if qDollarFormat != "" { + if err := r.SetQueryParam("$format", qDollarFormat); err != nil { + return err + } + } + + if o.DollarOrderby != nil { + + // query param $orderby + var qrDollarOrderby string + if o.DollarOrderby != nil { + qrDollarOrderby = *o.DollarOrderby + } + qDollarOrderby := qrDollarOrderby + if qDollarOrderby != "" { + if err := r.SetQueryParam("$orderby", qDollarOrderby); err != nil { + return err + } + } + + } + + if o.DollarSelect != nil { + + // query param $select + var qrDollarSelect string + if o.DollarSelect != nil { + qrDollarSelect = *o.DollarSelect + } + qDollarSelect := qrDollarSelect + if qDollarSelect != "" { + if err := r.SetQueryParam("$select", qDollarSelect); err != nil { + return err + } + } + + } + + if o.DollarSkip != nil { + + // query param $skip + var qrDollarSkip string + if o.DollarSkip != nil { + qrDollarSkip = *o.DollarSkip + } + qDollarSkip := qrDollarSkip + if qDollarSkip != "" { + if err := r.SetQueryParam("$skip", qDollarSkip); err != nil { + return err + } + } + + } + + if o.DollarSpatialFilter != nil { + + // query param $spatialFilter + var qrDollarSpatialFilter string + if o.DollarSpatialFilter != nil { + qrDollarSpatialFilter = *o.DollarSpatialFilter + } + qDollarSpatialFilter := qrDollarSpatialFilter + if qDollarSpatialFilter != "" { + if err := r.SetQueryParam("$spatialFilter", qDollarSpatialFilter); err != nil { + return err + } + } + + } + + if o.DollarTop != nil { + + // query param $top + var qrDollarTop int64 + if o.DollarTop != nil { + qrDollarTop = *o.DollarTop + } + qDollarTop := swag.FormatInt64(qrDollarTop) + if qDollarTop != "" { + if err := r.SetQueryParam("$top", qDollarTop); err != nil { + return err + } + } + + } + + if o.Health != nil { + + // query param health + var qrHealth string + if o.Health != nil { + qrHealth = *o.Health + } + qHealth := qrHealth + if qHealth != "" { + if err := r.SetQueryParam("health", qHealth); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_by_frequency_udp_responses.go b/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_by_frequency_udp_responses.go new file mode 100644 index 00000000..337c423a --- /dev/null +++ b/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_by_frequency_udp_responses.go @@ -0,0 +1,107 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package inter_city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/minchao/go-ptx/bus/v2/models" +) + +// InterCityBusAPIRealTimeByFrequencyUDPReader is a Reader for the InterCityBusAPIRealTimeByFrequencyUDP structure. +type InterCityBusAPIRealTimeByFrequencyUDPReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *InterCityBusAPIRealTimeByFrequencyUDPReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewInterCityBusAPIRealTimeByFrequencyUDPOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 299: + result := NewInterCityBusAPIRealTimeByFrequencyUDPStatus299() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewInterCityBusAPIRealTimeByFrequencyUDPOK creates a InterCityBusAPIRealTimeByFrequencyUDPOK with default headers values +func NewInterCityBusAPIRealTimeByFrequencyUDPOK() *InterCityBusAPIRealTimeByFrequencyUDPOK { + return &InterCityBusAPIRealTimeByFrequencyUDPOK{} +} + +/*InterCityBusAPIRealTimeByFrequencyUDPOK handles this case with default header values. + +OK +*/ +type InterCityBusAPIRealTimeByFrequencyUDPOK struct { + Payload []*models.ServiceDTOVersion2BusBusA1Data +} + +func (o *InterCityBusAPIRealTimeByFrequencyUDPOK) Error() string { + return fmt.Sprintf("[GET /v2/Bus/RealTimeByFrequency/Streaming/InterCity][%d] interCityBusApiRealTimeByFrequencyUdpOK %+v", 200, o.Payload) +} + +func (o *InterCityBusAPIRealTimeByFrequencyUDPOK) GetPayload() []*models.ServiceDTOVersion2BusBusA1Data { + return o.Payload +} + +func (o *InterCityBusAPIRealTimeByFrequencyUDPOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewInterCityBusAPIRealTimeByFrequencyUDPStatus299 creates a InterCityBusAPIRealTimeByFrequencyUDPStatus299 with default headers values +func NewInterCityBusAPIRealTimeByFrequencyUDPStatus299() *InterCityBusAPIRealTimeByFrequencyUDPStatus299 { + return &InterCityBusAPIRealTimeByFrequencyUDPStatus299{} +} + +/*InterCityBusAPIRealTimeByFrequencyUDPStatus299 handles this case with default header values. + +加入參數'?health=true'即可查詢此API服務的健康狀態 +*/ +type InterCityBusAPIRealTimeByFrequencyUDPStatus299 struct { + Payload *models.ServiceDTOVersion3BaseHealth +} + +func (o *InterCityBusAPIRealTimeByFrequencyUDPStatus299) Error() string { + return fmt.Sprintf("[GET /v2/Bus/RealTimeByFrequency/Streaming/InterCity][%d] interCityBusApiRealTimeByFrequencyUdpStatus299 %+v", 299, o.Payload) +} + +func (o *InterCityBusAPIRealTimeByFrequencyUDPStatus299) GetPayload() *models.ServiceDTOVersion3BaseHealth { + return o.Payload +} + +func (o *InterCityBusAPIRealTimeByFrequencyUDPStatus299) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceDTOVersion3BaseHealth) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop1_parameters.go b/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop1_parameters.go index 1355c1e5..6c0ee543 100644 --- a/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop1_parameters.go +++ b/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop1_parameters.go @@ -104,6 +104,11 @@ type InterCityBusAPIRealTimeNearStop1Params struct { */ DollarTop *int64 + /*RouteName + 繁體中文路線名稱,如'9102' + + */ + RouteName string /*Health 加入參數'?health=true'即可查詢此API服務的健康狀態 @@ -214,6 +219,17 @@ func (o *InterCityBusAPIRealTimeNearStop1Params) SetDollarTop(dollarTop *int64) o.DollarTop = dollarTop } +// WithRouteName adds the routeName to the inter city bus Api real time near stop 1 params +func (o *InterCityBusAPIRealTimeNearStop1Params) WithRouteName(routeName string) *InterCityBusAPIRealTimeNearStop1Params { + o.SetRouteName(routeName) + return o +} + +// SetRouteName adds the routeName to the inter city bus Api real time near stop 1 params +func (o *InterCityBusAPIRealTimeNearStop1Params) SetRouteName(routeName string) { + o.RouteName = routeName +} + // WithHealth adds the health to the inter city bus Api real time near stop 1 params func (o *InterCityBusAPIRealTimeNearStop1Params) WithHealth(health *string) *InterCityBusAPIRealTimeNearStop1Params { o.SetHealth(health) @@ -322,6 +338,11 @@ func (o *InterCityBusAPIRealTimeNearStop1Params) WriteToRequest(r runtime.Client } + // path param RouteName + if err := r.SetPathParam("RouteName", o.RouteName); err != nil { + return err + } + if o.Health != nil { // query param health diff --git a/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop1_responses.go b/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop1_responses.go index 0605553a..3cafe23c 100644 --- a/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop1_responses.go +++ b/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop1_responses.go @@ -56,7 +56,7 @@ type InterCityBusAPIRealTimeNearStop1OK struct { } func (o *InterCityBusAPIRealTimeNearStop1OK) Error() string { - return fmt.Sprintf("[GET /v2/Bus/RealTimeNearStop/InterCity][%d] interCityBusApiRealTimeNearStop1OK %+v", 200, o.Payload) + return fmt.Sprintf("[GET /v2/Bus/RealTimeNearStop/InterCity/{RouteName}][%d] interCityBusApiRealTimeNearStop1OK %+v", 200, o.Payload) } func (o *InterCityBusAPIRealTimeNearStop1OK) GetPayload() []*models.ServiceDTOVersion2BusBusA2Data { @@ -87,7 +87,7 @@ type InterCityBusAPIRealTimeNearStop1Status299 struct { } func (o *InterCityBusAPIRealTimeNearStop1Status299) Error() string { - return fmt.Sprintf("[GET /v2/Bus/RealTimeNearStop/InterCity][%d] interCityBusApiRealTimeNearStop1Status299 %+v", 299, o.Payload) + return fmt.Sprintf("[GET /v2/Bus/RealTimeNearStop/InterCity/{RouteName}][%d] interCityBusApiRealTimeNearStop1Status299 %+v", 299, o.Payload) } func (o *InterCityBusAPIRealTimeNearStop1Status299) GetPayload() *models.ServiceDTOVersion3BaseHealth { diff --git a/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop2_responses.go b/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop2_responses.go deleted file mode 100644 index c1fced3a..00000000 --- a/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop2_responses.go +++ /dev/null @@ -1,107 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package inter_city_bus - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - - strfmt "github.com/go-openapi/strfmt" - - models "github.com/minchao/go-ptx/bus/v2/models" -) - -// InterCityBusAPIRealTimeNearStop2Reader is a Reader for the InterCityBusAPIRealTimeNearStop2 structure. -type InterCityBusAPIRealTimeNearStop2Reader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *InterCityBusAPIRealTimeNearStop2Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewInterCityBusAPIRealTimeNearStop2OK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 299: - result := NewInterCityBusAPIRealTimeNearStop2Status299() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) - } -} - -// NewInterCityBusAPIRealTimeNearStop2OK creates a InterCityBusAPIRealTimeNearStop2OK with default headers values -func NewInterCityBusAPIRealTimeNearStop2OK() *InterCityBusAPIRealTimeNearStop2OK { - return &InterCityBusAPIRealTimeNearStop2OK{} -} - -/*InterCityBusAPIRealTimeNearStop2OK handles this case with default header values. - -OK -*/ -type InterCityBusAPIRealTimeNearStop2OK struct { - Payload []*models.ServiceDTOVersion2BusBusA2Data -} - -func (o *InterCityBusAPIRealTimeNearStop2OK) Error() string { - return fmt.Sprintf("[GET /v2/Bus/RealTimeNearStop/InterCity/{RouteName}][%d] interCityBusApiRealTimeNearStop2OK %+v", 200, o.Payload) -} - -func (o *InterCityBusAPIRealTimeNearStop2OK) GetPayload() []*models.ServiceDTOVersion2BusBusA2Data { - return o.Payload -} - -func (o *InterCityBusAPIRealTimeNearStop2OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewInterCityBusAPIRealTimeNearStop2Status299 creates a InterCityBusAPIRealTimeNearStop2Status299 with default headers values -func NewInterCityBusAPIRealTimeNearStop2Status299() *InterCityBusAPIRealTimeNearStop2Status299 { - return &InterCityBusAPIRealTimeNearStop2Status299{} -} - -/*InterCityBusAPIRealTimeNearStop2Status299 handles this case with default header values. - -加入參數'?health=true'即可查詢此API服務的健康狀態 -*/ -type InterCityBusAPIRealTimeNearStop2Status299 struct { - Payload *models.ServiceDTOVersion3BaseHealth -} - -func (o *InterCityBusAPIRealTimeNearStop2Status299) Error() string { - return fmt.Sprintf("[GET /v2/Bus/RealTimeNearStop/InterCity/{RouteName}][%d] interCityBusApiRealTimeNearStop2Status299 %+v", 299, o.Payload) -} - -func (o *InterCityBusAPIRealTimeNearStop2Status299) GetPayload() *models.ServiceDTOVersion3BaseHealth { - return o.Payload -} - -func (o *InterCityBusAPIRealTimeNearStop2Status299) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.ServiceDTOVersion3BaseHealth) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop_parameters.go b/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop_parameters.go new file mode 100644 index 00000000..c8e8567b --- /dev/null +++ b/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop_parameters.go @@ -0,0 +1,345 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package inter_city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/swag" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewInterCityBusAPIRealTimeNearStopParams creates a new InterCityBusAPIRealTimeNearStopParams object +// with the default values initialized. +func NewInterCityBusAPIRealTimeNearStopParams() *InterCityBusAPIRealTimeNearStopParams { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIRealTimeNearStopParams{ + DollarTop: &dollarTopDefault, + + timeout: cr.DefaultTimeout, + } +} + +// NewInterCityBusAPIRealTimeNearStopParamsWithTimeout creates a new InterCityBusAPIRealTimeNearStopParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewInterCityBusAPIRealTimeNearStopParamsWithTimeout(timeout time.Duration) *InterCityBusAPIRealTimeNearStopParams { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIRealTimeNearStopParams{ + DollarTop: &dollarTopDefault, + + timeout: timeout, + } +} + +// NewInterCityBusAPIRealTimeNearStopParamsWithContext creates a new InterCityBusAPIRealTimeNearStopParams object +// with the default values initialized, and the ability to set a context for a request +func NewInterCityBusAPIRealTimeNearStopParamsWithContext(ctx context.Context) *InterCityBusAPIRealTimeNearStopParams { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIRealTimeNearStopParams{ + DollarTop: &dollarTopDefault, + + Context: ctx, + } +} + +// NewInterCityBusAPIRealTimeNearStopParamsWithHTTPClient creates a new InterCityBusAPIRealTimeNearStopParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewInterCityBusAPIRealTimeNearStopParamsWithHTTPClient(client *http.Client) *InterCityBusAPIRealTimeNearStopParams { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIRealTimeNearStopParams{ + DollarTop: &dollarTopDefault, + HTTPClient: client, + } +} + +/*InterCityBusAPIRealTimeNearStopParams contains all the parameters to send to the API endpoint +for the inter city bus Api real time near stop operation typically these are written to a http.Request +*/ +type InterCityBusAPIRealTimeNearStopParams struct { + + /*DollarFilter + 過濾 + + */ + DollarFilter *string + /*DollarFormat + 指定來源格式 + + */ + DollarFormat string + /*DollarOrderby + 排序 + + */ + DollarOrderby *string + /*DollarSelect + 挑選 + + */ + DollarSelect *string + /*DollarSkip + 跳過前幾筆 + + */ + DollarSkip *string + /*DollarTop + 取前幾筆 + + */ + DollarTop *int64 + /*Health + 加入參數'?health=true'即可查詢此API服務的健康狀態 + + */ + Health *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the inter city bus Api real time near stop params +func (o *InterCityBusAPIRealTimeNearStopParams) WithTimeout(timeout time.Duration) *InterCityBusAPIRealTimeNearStopParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the inter city bus Api real time near stop params +func (o *InterCityBusAPIRealTimeNearStopParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the inter city bus Api real time near stop params +func (o *InterCityBusAPIRealTimeNearStopParams) WithContext(ctx context.Context) *InterCityBusAPIRealTimeNearStopParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the inter city bus Api real time near stop params +func (o *InterCityBusAPIRealTimeNearStopParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the inter city bus Api real time near stop params +func (o *InterCityBusAPIRealTimeNearStopParams) WithHTTPClient(client *http.Client) *InterCityBusAPIRealTimeNearStopParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the inter city bus Api real time near stop params +func (o *InterCityBusAPIRealTimeNearStopParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDollarFilter adds the dollarFilter to the inter city bus Api real time near stop params +func (o *InterCityBusAPIRealTimeNearStopParams) WithDollarFilter(dollarFilter *string) *InterCityBusAPIRealTimeNearStopParams { + o.SetDollarFilter(dollarFilter) + return o +} + +// SetDollarFilter adds the dollarFilter to the inter city bus Api real time near stop params +func (o *InterCityBusAPIRealTimeNearStopParams) SetDollarFilter(dollarFilter *string) { + o.DollarFilter = dollarFilter +} + +// WithDollarFormat adds the dollarFormat to the inter city bus Api real time near stop params +func (o *InterCityBusAPIRealTimeNearStopParams) WithDollarFormat(dollarFormat string) *InterCityBusAPIRealTimeNearStopParams { + o.SetDollarFormat(dollarFormat) + return o +} + +// SetDollarFormat adds the dollarFormat to the inter city bus Api real time near stop params +func (o *InterCityBusAPIRealTimeNearStopParams) SetDollarFormat(dollarFormat string) { + o.DollarFormat = dollarFormat +} + +// WithDollarOrderby adds the dollarOrderby to the inter city bus Api real time near stop params +func (o *InterCityBusAPIRealTimeNearStopParams) WithDollarOrderby(dollarOrderby *string) *InterCityBusAPIRealTimeNearStopParams { + o.SetDollarOrderby(dollarOrderby) + return o +} + +// SetDollarOrderby adds the dollarOrderby to the inter city bus Api real time near stop params +func (o *InterCityBusAPIRealTimeNearStopParams) SetDollarOrderby(dollarOrderby *string) { + o.DollarOrderby = dollarOrderby +} + +// WithDollarSelect adds the dollarSelect to the inter city bus Api real time near stop params +func (o *InterCityBusAPIRealTimeNearStopParams) WithDollarSelect(dollarSelect *string) *InterCityBusAPIRealTimeNearStopParams { + o.SetDollarSelect(dollarSelect) + return o +} + +// SetDollarSelect adds the dollarSelect to the inter city bus Api real time near stop params +func (o *InterCityBusAPIRealTimeNearStopParams) SetDollarSelect(dollarSelect *string) { + o.DollarSelect = dollarSelect +} + +// WithDollarSkip adds the dollarSkip to the inter city bus Api real time near stop params +func (o *InterCityBusAPIRealTimeNearStopParams) WithDollarSkip(dollarSkip *string) *InterCityBusAPIRealTimeNearStopParams { + o.SetDollarSkip(dollarSkip) + return o +} + +// SetDollarSkip adds the dollarSkip to the inter city bus Api real time near stop params +func (o *InterCityBusAPIRealTimeNearStopParams) SetDollarSkip(dollarSkip *string) { + o.DollarSkip = dollarSkip +} + +// WithDollarTop adds the dollarTop to the inter city bus Api real time near stop params +func (o *InterCityBusAPIRealTimeNearStopParams) WithDollarTop(dollarTop *int64) *InterCityBusAPIRealTimeNearStopParams { + o.SetDollarTop(dollarTop) + return o +} + +// SetDollarTop adds the dollarTop to the inter city bus Api real time near stop params +func (o *InterCityBusAPIRealTimeNearStopParams) SetDollarTop(dollarTop *int64) { + o.DollarTop = dollarTop +} + +// WithHealth adds the health to the inter city bus Api real time near stop params +func (o *InterCityBusAPIRealTimeNearStopParams) WithHealth(health *string) *InterCityBusAPIRealTimeNearStopParams { + o.SetHealth(health) + return o +} + +// SetHealth adds the health to the inter city bus Api real time near stop params +func (o *InterCityBusAPIRealTimeNearStopParams) SetHealth(health *string) { + o.Health = health +} + +// WriteToRequest writes these params to a swagger request +func (o *InterCityBusAPIRealTimeNearStopParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.DollarFilter != nil { + + // query param $filter + var qrDollarFilter string + if o.DollarFilter != nil { + qrDollarFilter = *o.DollarFilter + } + qDollarFilter := qrDollarFilter + if qDollarFilter != "" { + if err := r.SetQueryParam("$filter", qDollarFilter); err != nil { + return err + } + } + + } + + // query param $format + qrDollarFormat := o.DollarFormat + qDollarFormat := qrDollarFormat + if qDollarFormat != "" { + if err := r.SetQueryParam("$format", qDollarFormat); err != nil { + return err + } + } + + if o.DollarOrderby != nil { + + // query param $orderby + var qrDollarOrderby string + if o.DollarOrderby != nil { + qrDollarOrderby = *o.DollarOrderby + } + qDollarOrderby := qrDollarOrderby + if qDollarOrderby != "" { + if err := r.SetQueryParam("$orderby", qDollarOrderby); err != nil { + return err + } + } + + } + + if o.DollarSelect != nil { + + // query param $select + var qrDollarSelect string + if o.DollarSelect != nil { + qrDollarSelect = *o.DollarSelect + } + qDollarSelect := qrDollarSelect + if qDollarSelect != "" { + if err := r.SetQueryParam("$select", qDollarSelect); err != nil { + return err + } + } + + } + + if o.DollarSkip != nil { + + // query param $skip + var qrDollarSkip string + if o.DollarSkip != nil { + qrDollarSkip = *o.DollarSkip + } + qDollarSkip := qrDollarSkip + if qDollarSkip != "" { + if err := r.SetQueryParam("$skip", qDollarSkip); err != nil { + return err + } + } + + } + + if o.DollarTop != nil { + + // query param $top + var qrDollarTop int64 + if o.DollarTop != nil { + qrDollarTop = *o.DollarTop + } + qDollarTop := swag.FormatInt64(qrDollarTop) + if qDollarTop != "" { + if err := r.SetQueryParam("$top", qDollarTop); err != nil { + return err + } + } + + } + + if o.Health != nil { + + // query param health + var qrHealth string + if o.Health != nil { + qrHealth = *o.Health + } + qHealth := qrHealth + if qHealth != "" { + if err := r.SetQueryParam("health", qHealth); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop_responses.go b/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop_responses.go new file mode 100644 index 00000000..3ec52785 --- /dev/null +++ b/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop_responses.go @@ -0,0 +1,107 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package inter_city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/minchao/go-ptx/bus/v2/models" +) + +// InterCityBusAPIRealTimeNearStopReader is a Reader for the InterCityBusAPIRealTimeNearStop structure. +type InterCityBusAPIRealTimeNearStopReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *InterCityBusAPIRealTimeNearStopReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewInterCityBusAPIRealTimeNearStopOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 299: + result := NewInterCityBusAPIRealTimeNearStopStatus299() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewInterCityBusAPIRealTimeNearStopOK creates a InterCityBusAPIRealTimeNearStopOK with default headers values +func NewInterCityBusAPIRealTimeNearStopOK() *InterCityBusAPIRealTimeNearStopOK { + return &InterCityBusAPIRealTimeNearStopOK{} +} + +/*InterCityBusAPIRealTimeNearStopOK handles this case with default header values. + +OK +*/ +type InterCityBusAPIRealTimeNearStopOK struct { + Payload []*models.ServiceDTOVersion2BusBusA2Data +} + +func (o *InterCityBusAPIRealTimeNearStopOK) Error() string { + return fmt.Sprintf("[GET /v2/Bus/RealTimeNearStop/InterCity][%d] interCityBusApiRealTimeNearStopOK %+v", 200, o.Payload) +} + +func (o *InterCityBusAPIRealTimeNearStopOK) GetPayload() []*models.ServiceDTOVersion2BusBusA2Data { + return o.Payload +} + +func (o *InterCityBusAPIRealTimeNearStopOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewInterCityBusAPIRealTimeNearStopStatus299 creates a InterCityBusAPIRealTimeNearStopStatus299 with default headers values +func NewInterCityBusAPIRealTimeNearStopStatus299() *InterCityBusAPIRealTimeNearStopStatus299 { + return &InterCityBusAPIRealTimeNearStopStatus299{} +} + +/*InterCityBusAPIRealTimeNearStopStatus299 handles this case with default header values. + +加入參數'?health=true'即可查詢此API服務的健康狀態 +*/ +type InterCityBusAPIRealTimeNearStopStatus299 struct { + Payload *models.ServiceDTOVersion3BaseHealth +} + +func (o *InterCityBusAPIRealTimeNearStopStatus299) Error() string { + return fmt.Sprintf("[GET /v2/Bus/RealTimeNearStop/InterCity][%d] interCityBusApiRealTimeNearStopStatus299 %+v", 299, o.Payload) +} + +func (o *InterCityBusAPIRealTimeNearStopStatus299) GetPayload() *models.ServiceDTOVersion3BaseHealth { + return o.Payload +} + +func (o *InterCityBusAPIRealTimeNearStopStatus299) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceDTOVersion3BaseHealth) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop2_parameters.go b/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop_udp_1_parameters.go similarity index 57% rename from bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop2_parameters.go rename to bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop_udp_1_parameters.go index 358dc8cd..df317bfb 100644 --- a/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop2_parameters.go +++ b/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop_udp_1_parameters.go @@ -18,61 +18,61 @@ import ( strfmt "github.com/go-openapi/strfmt" ) -// NewInterCityBusAPIRealTimeNearStop2Params creates a new InterCityBusAPIRealTimeNearStop2Params object +// NewInterCityBusAPIRealTimeNearStopUDP1Params creates a new InterCityBusAPIRealTimeNearStopUDP1Params object // with the default values initialized. -func NewInterCityBusAPIRealTimeNearStop2Params() *InterCityBusAPIRealTimeNearStop2Params { +func NewInterCityBusAPIRealTimeNearStopUDP1Params() *InterCityBusAPIRealTimeNearStopUDP1Params { var ( dollarTopDefault = int64(30) ) - return &InterCityBusAPIRealTimeNearStop2Params{ + return &InterCityBusAPIRealTimeNearStopUDP1Params{ DollarTop: &dollarTopDefault, timeout: cr.DefaultTimeout, } } -// NewInterCityBusAPIRealTimeNearStop2ParamsWithTimeout creates a new InterCityBusAPIRealTimeNearStop2Params object +// NewInterCityBusAPIRealTimeNearStopUDP1ParamsWithTimeout creates a new InterCityBusAPIRealTimeNearStopUDP1Params object // with the default values initialized, and the ability to set a timeout on a request -func NewInterCityBusAPIRealTimeNearStop2ParamsWithTimeout(timeout time.Duration) *InterCityBusAPIRealTimeNearStop2Params { +func NewInterCityBusAPIRealTimeNearStopUDP1ParamsWithTimeout(timeout time.Duration) *InterCityBusAPIRealTimeNearStopUDP1Params { var ( dollarTopDefault = int64(30) ) - return &InterCityBusAPIRealTimeNearStop2Params{ + return &InterCityBusAPIRealTimeNearStopUDP1Params{ DollarTop: &dollarTopDefault, timeout: timeout, } } -// NewInterCityBusAPIRealTimeNearStop2ParamsWithContext creates a new InterCityBusAPIRealTimeNearStop2Params object +// NewInterCityBusAPIRealTimeNearStopUDP1ParamsWithContext creates a new InterCityBusAPIRealTimeNearStopUDP1Params object // with the default values initialized, and the ability to set a context for a request -func NewInterCityBusAPIRealTimeNearStop2ParamsWithContext(ctx context.Context) *InterCityBusAPIRealTimeNearStop2Params { +func NewInterCityBusAPIRealTimeNearStopUDP1ParamsWithContext(ctx context.Context) *InterCityBusAPIRealTimeNearStopUDP1Params { var ( dollarTopDefault = int64(30) ) - return &InterCityBusAPIRealTimeNearStop2Params{ + return &InterCityBusAPIRealTimeNearStopUDP1Params{ DollarTop: &dollarTopDefault, Context: ctx, } } -// NewInterCityBusAPIRealTimeNearStop2ParamsWithHTTPClient creates a new InterCityBusAPIRealTimeNearStop2Params object +// NewInterCityBusAPIRealTimeNearStopUDP1ParamsWithHTTPClient creates a new InterCityBusAPIRealTimeNearStopUDP1Params object // with the default values initialized, and the ability to set a custom HTTPClient for a request -func NewInterCityBusAPIRealTimeNearStop2ParamsWithHTTPClient(client *http.Client) *InterCityBusAPIRealTimeNearStop2Params { +func NewInterCityBusAPIRealTimeNearStopUDP1ParamsWithHTTPClient(client *http.Client) *InterCityBusAPIRealTimeNearStopUDP1Params { var ( dollarTopDefault = int64(30) ) - return &InterCityBusAPIRealTimeNearStop2Params{ + return &InterCityBusAPIRealTimeNearStopUDP1Params{ DollarTop: &dollarTopDefault, HTTPClient: client, } } -/*InterCityBusAPIRealTimeNearStop2Params contains all the parameters to send to the API endpoint -for the inter city bus Api real time near stop 2 operation typically these are written to a http.Request +/*InterCityBusAPIRealTimeNearStopUDP1Params contains all the parameters to send to the API endpoint +for the inter city bus Api real time near stop UDP 1 operation typically these are written to a http.Request */ -type InterCityBusAPIRealTimeNearStop2Params struct { +type InterCityBusAPIRealTimeNearStopUDP1Params struct { /*DollarFilter 過濾 @@ -120,129 +120,129 @@ type InterCityBusAPIRealTimeNearStop2Params struct { HTTPClient *http.Client } -// WithTimeout adds the timeout to the inter city bus Api real time near stop 2 params -func (o *InterCityBusAPIRealTimeNearStop2Params) WithTimeout(timeout time.Duration) *InterCityBusAPIRealTimeNearStop2Params { +// WithTimeout adds the timeout to the inter city bus Api real time near stop UDP 1 params +func (o *InterCityBusAPIRealTimeNearStopUDP1Params) WithTimeout(timeout time.Duration) *InterCityBusAPIRealTimeNearStopUDP1Params { o.SetTimeout(timeout) return o } -// SetTimeout adds the timeout to the inter city bus Api real time near stop 2 params -func (o *InterCityBusAPIRealTimeNearStop2Params) SetTimeout(timeout time.Duration) { +// SetTimeout adds the timeout to the inter city bus Api real time near stop UDP 1 params +func (o *InterCityBusAPIRealTimeNearStopUDP1Params) SetTimeout(timeout time.Duration) { o.timeout = timeout } -// WithContext adds the context to the inter city bus Api real time near stop 2 params -func (o *InterCityBusAPIRealTimeNearStop2Params) WithContext(ctx context.Context) *InterCityBusAPIRealTimeNearStop2Params { +// WithContext adds the context to the inter city bus Api real time near stop UDP 1 params +func (o *InterCityBusAPIRealTimeNearStopUDP1Params) WithContext(ctx context.Context) *InterCityBusAPIRealTimeNearStopUDP1Params { o.SetContext(ctx) return o } -// SetContext adds the context to the inter city bus Api real time near stop 2 params -func (o *InterCityBusAPIRealTimeNearStop2Params) SetContext(ctx context.Context) { +// SetContext adds the context to the inter city bus Api real time near stop UDP 1 params +func (o *InterCityBusAPIRealTimeNearStopUDP1Params) SetContext(ctx context.Context) { o.Context = ctx } -// WithHTTPClient adds the HTTPClient to the inter city bus Api real time near stop 2 params -func (o *InterCityBusAPIRealTimeNearStop2Params) WithHTTPClient(client *http.Client) *InterCityBusAPIRealTimeNearStop2Params { +// WithHTTPClient adds the HTTPClient to the inter city bus Api real time near stop UDP 1 params +func (o *InterCityBusAPIRealTimeNearStopUDP1Params) WithHTTPClient(client *http.Client) *InterCityBusAPIRealTimeNearStopUDP1Params { o.SetHTTPClient(client) return o } -// SetHTTPClient adds the HTTPClient to the inter city bus Api real time near stop 2 params -func (o *InterCityBusAPIRealTimeNearStop2Params) SetHTTPClient(client *http.Client) { +// SetHTTPClient adds the HTTPClient to the inter city bus Api real time near stop UDP 1 params +func (o *InterCityBusAPIRealTimeNearStopUDP1Params) SetHTTPClient(client *http.Client) { o.HTTPClient = client } -// WithDollarFilter adds the dollarFilter to the inter city bus Api real time near stop 2 params -func (o *InterCityBusAPIRealTimeNearStop2Params) WithDollarFilter(dollarFilter *string) *InterCityBusAPIRealTimeNearStop2Params { +// WithDollarFilter adds the dollarFilter to the inter city bus Api real time near stop UDP 1 params +func (o *InterCityBusAPIRealTimeNearStopUDP1Params) WithDollarFilter(dollarFilter *string) *InterCityBusAPIRealTimeNearStopUDP1Params { o.SetDollarFilter(dollarFilter) return o } -// SetDollarFilter adds the dollarFilter to the inter city bus Api real time near stop 2 params -func (o *InterCityBusAPIRealTimeNearStop2Params) SetDollarFilter(dollarFilter *string) { +// SetDollarFilter adds the dollarFilter to the inter city bus Api real time near stop UDP 1 params +func (o *InterCityBusAPIRealTimeNearStopUDP1Params) SetDollarFilter(dollarFilter *string) { o.DollarFilter = dollarFilter } -// WithDollarFormat adds the dollarFormat to the inter city bus Api real time near stop 2 params -func (o *InterCityBusAPIRealTimeNearStop2Params) WithDollarFormat(dollarFormat string) *InterCityBusAPIRealTimeNearStop2Params { +// WithDollarFormat adds the dollarFormat to the inter city bus Api real time near stop UDP 1 params +func (o *InterCityBusAPIRealTimeNearStopUDP1Params) WithDollarFormat(dollarFormat string) *InterCityBusAPIRealTimeNearStopUDP1Params { o.SetDollarFormat(dollarFormat) return o } -// SetDollarFormat adds the dollarFormat to the inter city bus Api real time near stop 2 params -func (o *InterCityBusAPIRealTimeNearStop2Params) SetDollarFormat(dollarFormat string) { +// SetDollarFormat adds the dollarFormat to the inter city bus Api real time near stop UDP 1 params +func (o *InterCityBusAPIRealTimeNearStopUDP1Params) SetDollarFormat(dollarFormat string) { o.DollarFormat = dollarFormat } -// WithDollarOrderby adds the dollarOrderby to the inter city bus Api real time near stop 2 params -func (o *InterCityBusAPIRealTimeNearStop2Params) WithDollarOrderby(dollarOrderby *string) *InterCityBusAPIRealTimeNearStop2Params { +// WithDollarOrderby adds the dollarOrderby to the inter city bus Api real time near stop UDP 1 params +func (o *InterCityBusAPIRealTimeNearStopUDP1Params) WithDollarOrderby(dollarOrderby *string) *InterCityBusAPIRealTimeNearStopUDP1Params { o.SetDollarOrderby(dollarOrderby) return o } -// SetDollarOrderby adds the dollarOrderby to the inter city bus Api real time near stop 2 params -func (o *InterCityBusAPIRealTimeNearStop2Params) SetDollarOrderby(dollarOrderby *string) { +// SetDollarOrderby adds the dollarOrderby to the inter city bus Api real time near stop UDP 1 params +func (o *InterCityBusAPIRealTimeNearStopUDP1Params) SetDollarOrderby(dollarOrderby *string) { o.DollarOrderby = dollarOrderby } -// WithDollarSelect adds the dollarSelect to the inter city bus Api real time near stop 2 params -func (o *InterCityBusAPIRealTimeNearStop2Params) WithDollarSelect(dollarSelect *string) *InterCityBusAPIRealTimeNearStop2Params { +// WithDollarSelect adds the dollarSelect to the inter city bus Api real time near stop UDP 1 params +func (o *InterCityBusAPIRealTimeNearStopUDP1Params) WithDollarSelect(dollarSelect *string) *InterCityBusAPIRealTimeNearStopUDP1Params { o.SetDollarSelect(dollarSelect) return o } -// SetDollarSelect adds the dollarSelect to the inter city bus Api real time near stop 2 params -func (o *InterCityBusAPIRealTimeNearStop2Params) SetDollarSelect(dollarSelect *string) { +// SetDollarSelect adds the dollarSelect to the inter city bus Api real time near stop UDP 1 params +func (o *InterCityBusAPIRealTimeNearStopUDP1Params) SetDollarSelect(dollarSelect *string) { o.DollarSelect = dollarSelect } -// WithDollarSkip adds the dollarSkip to the inter city bus Api real time near stop 2 params -func (o *InterCityBusAPIRealTimeNearStop2Params) WithDollarSkip(dollarSkip *string) *InterCityBusAPIRealTimeNearStop2Params { +// WithDollarSkip adds the dollarSkip to the inter city bus Api real time near stop UDP 1 params +func (o *InterCityBusAPIRealTimeNearStopUDP1Params) WithDollarSkip(dollarSkip *string) *InterCityBusAPIRealTimeNearStopUDP1Params { o.SetDollarSkip(dollarSkip) return o } -// SetDollarSkip adds the dollarSkip to the inter city bus Api real time near stop 2 params -func (o *InterCityBusAPIRealTimeNearStop2Params) SetDollarSkip(dollarSkip *string) { +// SetDollarSkip adds the dollarSkip to the inter city bus Api real time near stop UDP 1 params +func (o *InterCityBusAPIRealTimeNearStopUDP1Params) SetDollarSkip(dollarSkip *string) { o.DollarSkip = dollarSkip } -// WithDollarTop adds the dollarTop to the inter city bus Api real time near stop 2 params -func (o *InterCityBusAPIRealTimeNearStop2Params) WithDollarTop(dollarTop *int64) *InterCityBusAPIRealTimeNearStop2Params { +// WithDollarTop adds the dollarTop to the inter city bus Api real time near stop UDP 1 params +func (o *InterCityBusAPIRealTimeNearStopUDP1Params) WithDollarTop(dollarTop *int64) *InterCityBusAPIRealTimeNearStopUDP1Params { o.SetDollarTop(dollarTop) return o } -// SetDollarTop adds the dollarTop to the inter city bus Api real time near stop 2 params -func (o *InterCityBusAPIRealTimeNearStop2Params) SetDollarTop(dollarTop *int64) { +// SetDollarTop adds the dollarTop to the inter city bus Api real time near stop UDP 1 params +func (o *InterCityBusAPIRealTimeNearStopUDP1Params) SetDollarTop(dollarTop *int64) { o.DollarTop = dollarTop } -// WithRouteName adds the routeName to the inter city bus Api real time near stop 2 params -func (o *InterCityBusAPIRealTimeNearStop2Params) WithRouteName(routeName string) *InterCityBusAPIRealTimeNearStop2Params { +// WithRouteName adds the routeName to the inter city bus Api real time near stop UDP 1 params +func (o *InterCityBusAPIRealTimeNearStopUDP1Params) WithRouteName(routeName string) *InterCityBusAPIRealTimeNearStopUDP1Params { o.SetRouteName(routeName) return o } -// SetRouteName adds the routeName to the inter city bus Api real time near stop 2 params -func (o *InterCityBusAPIRealTimeNearStop2Params) SetRouteName(routeName string) { +// SetRouteName adds the routeName to the inter city bus Api real time near stop UDP 1 params +func (o *InterCityBusAPIRealTimeNearStopUDP1Params) SetRouteName(routeName string) { o.RouteName = routeName } -// WithHealth adds the health to the inter city bus Api real time near stop 2 params -func (o *InterCityBusAPIRealTimeNearStop2Params) WithHealth(health *string) *InterCityBusAPIRealTimeNearStop2Params { +// WithHealth adds the health to the inter city bus Api real time near stop UDP 1 params +func (o *InterCityBusAPIRealTimeNearStopUDP1Params) WithHealth(health *string) *InterCityBusAPIRealTimeNearStopUDP1Params { o.SetHealth(health) return o } -// SetHealth adds the health to the inter city bus Api real time near stop 2 params -func (o *InterCityBusAPIRealTimeNearStop2Params) SetHealth(health *string) { +// SetHealth adds the health to the inter city bus Api real time near stop UDP 1 params +func (o *InterCityBusAPIRealTimeNearStopUDP1Params) SetHealth(health *string) { o.Health = health } // WriteToRequest writes these params to a swagger request -func (o *InterCityBusAPIRealTimeNearStop2Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { +func (o *InterCityBusAPIRealTimeNearStopUDP1Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { if err := r.SetTimeout(o.timeout); err != nil { return err diff --git a/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop_udp_1_responses.go b/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop_udp_1_responses.go new file mode 100644 index 00000000..503756b7 --- /dev/null +++ b/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop_udp_1_responses.go @@ -0,0 +1,107 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package inter_city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/minchao/go-ptx/bus/v2/models" +) + +// InterCityBusAPIRealTimeNearStopUDP1Reader is a Reader for the InterCityBusAPIRealTimeNearStopUDP1 structure. +type InterCityBusAPIRealTimeNearStopUDP1Reader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *InterCityBusAPIRealTimeNearStopUDP1Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewInterCityBusAPIRealTimeNearStopUdp1OK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 299: + result := NewInterCityBusAPIRealTimeNearStopUdp1Status299() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewInterCityBusAPIRealTimeNearStopUdp1OK creates a InterCityBusAPIRealTimeNearStopUdp1OK with default headers values +func NewInterCityBusAPIRealTimeNearStopUdp1OK() *InterCityBusAPIRealTimeNearStopUdp1OK { + return &InterCityBusAPIRealTimeNearStopUdp1OK{} +} + +/*InterCityBusAPIRealTimeNearStopUdp1OK handles this case with default header values. + +OK +*/ +type InterCityBusAPIRealTimeNearStopUdp1OK struct { + Payload []*models.ServiceDTOVersion2BusBusA2Data +} + +func (o *InterCityBusAPIRealTimeNearStopUdp1OK) Error() string { + return fmt.Sprintf("[GET /v2/Bus/RealTimeNearStop/Streaming/InterCity/{RouteName}][%d] interCityBusApiRealTimeNearStopUdp1OK %+v", 200, o.Payload) +} + +func (o *InterCityBusAPIRealTimeNearStopUdp1OK) GetPayload() []*models.ServiceDTOVersion2BusBusA2Data { + return o.Payload +} + +func (o *InterCityBusAPIRealTimeNearStopUdp1OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewInterCityBusAPIRealTimeNearStopUdp1Status299 creates a InterCityBusAPIRealTimeNearStopUdp1Status299 with default headers values +func NewInterCityBusAPIRealTimeNearStopUdp1Status299() *InterCityBusAPIRealTimeNearStopUdp1Status299 { + return &InterCityBusAPIRealTimeNearStopUdp1Status299{} +} + +/*InterCityBusAPIRealTimeNearStopUdp1Status299 handles this case with default header values. + +加入參數'?health=true'即可查詢此API服務的健康狀態 +*/ +type InterCityBusAPIRealTimeNearStopUdp1Status299 struct { + Payload *models.ServiceDTOVersion3BaseHealth +} + +func (o *InterCityBusAPIRealTimeNearStopUdp1Status299) Error() string { + return fmt.Sprintf("[GET /v2/Bus/RealTimeNearStop/Streaming/InterCity/{RouteName}][%d] interCityBusApiRealTimeNearStopUdp1Status299 %+v", 299, o.Payload) +} + +func (o *InterCityBusAPIRealTimeNearStopUdp1Status299) GetPayload() *models.ServiceDTOVersion3BaseHealth { + return o.Payload +} + +func (o *InterCityBusAPIRealTimeNearStopUdp1Status299) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceDTOVersion3BaseHealth) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop_udp_parameters.go b/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop_udp_parameters.go new file mode 100644 index 00000000..a730e231 --- /dev/null +++ b/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop_udp_parameters.go @@ -0,0 +1,345 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package inter_city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/swag" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewInterCityBusAPIRealTimeNearStopUDPParams creates a new InterCityBusAPIRealTimeNearStopUDPParams object +// with the default values initialized. +func NewInterCityBusAPIRealTimeNearStopUDPParams() *InterCityBusAPIRealTimeNearStopUDPParams { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIRealTimeNearStopUDPParams{ + DollarTop: &dollarTopDefault, + + timeout: cr.DefaultTimeout, + } +} + +// NewInterCityBusAPIRealTimeNearStopUDPParamsWithTimeout creates a new InterCityBusAPIRealTimeNearStopUDPParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewInterCityBusAPIRealTimeNearStopUDPParamsWithTimeout(timeout time.Duration) *InterCityBusAPIRealTimeNearStopUDPParams { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIRealTimeNearStopUDPParams{ + DollarTop: &dollarTopDefault, + + timeout: timeout, + } +} + +// NewInterCityBusAPIRealTimeNearStopUDPParamsWithContext creates a new InterCityBusAPIRealTimeNearStopUDPParams object +// with the default values initialized, and the ability to set a context for a request +func NewInterCityBusAPIRealTimeNearStopUDPParamsWithContext(ctx context.Context) *InterCityBusAPIRealTimeNearStopUDPParams { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIRealTimeNearStopUDPParams{ + DollarTop: &dollarTopDefault, + + Context: ctx, + } +} + +// NewInterCityBusAPIRealTimeNearStopUDPParamsWithHTTPClient creates a new InterCityBusAPIRealTimeNearStopUDPParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewInterCityBusAPIRealTimeNearStopUDPParamsWithHTTPClient(client *http.Client) *InterCityBusAPIRealTimeNearStopUDPParams { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIRealTimeNearStopUDPParams{ + DollarTop: &dollarTopDefault, + HTTPClient: client, + } +} + +/*InterCityBusAPIRealTimeNearStopUDPParams contains all the parameters to send to the API endpoint +for the inter city bus Api real time near stop UDP operation typically these are written to a http.Request +*/ +type InterCityBusAPIRealTimeNearStopUDPParams struct { + + /*DollarFilter + 過濾 + + */ + DollarFilter *string + /*DollarFormat + 指定來源格式 + + */ + DollarFormat string + /*DollarOrderby + 排序 + + */ + DollarOrderby *string + /*DollarSelect + 挑選 + + */ + DollarSelect *string + /*DollarSkip + 跳過前幾筆 + + */ + DollarSkip *string + /*DollarTop + 取前幾筆 + + */ + DollarTop *int64 + /*Health + 加入參數'?health=true'即可查詢此API服務的健康狀態 + + */ + Health *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the inter city bus Api real time near stop UDP params +func (o *InterCityBusAPIRealTimeNearStopUDPParams) WithTimeout(timeout time.Duration) *InterCityBusAPIRealTimeNearStopUDPParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the inter city bus Api real time near stop UDP params +func (o *InterCityBusAPIRealTimeNearStopUDPParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the inter city bus Api real time near stop UDP params +func (o *InterCityBusAPIRealTimeNearStopUDPParams) WithContext(ctx context.Context) *InterCityBusAPIRealTimeNearStopUDPParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the inter city bus Api real time near stop UDP params +func (o *InterCityBusAPIRealTimeNearStopUDPParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the inter city bus Api real time near stop UDP params +func (o *InterCityBusAPIRealTimeNearStopUDPParams) WithHTTPClient(client *http.Client) *InterCityBusAPIRealTimeNearStopUDPParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the inter city bus Api real time near stop UDP params +func (o *InterCityBusAPIRealTimeNearStopUDPParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDollarFilter adds the dollarFilter to the inter city bus Api real time near stop UDP params +func (o *InterCityBusAPIRealTimeNearStopUDPParams) WithDollarFilter(dollarFilter *string) *InterCityBusAPIRealTimeNearStopUDPParams { + o.SetDollarFilter(dollarFilter) + return o +} + +// SetDollarFilter adds the dollarFilter to the inter city bus Api real time near stop UDP params +func (o *InterCityBusAPIRealTimeNearStopUDPParams) SetDollarFilter(dollarFilter *string) { + o.DollarFilter = dollarFilter +} + +// WithDollarFormat adds the dollarFormat to the inter city bus Api real time near stop UDP params +func (o *InterCityBusAPIRealTimeNearStopUDPParams) WithDollarFormat(dollarFormat string) *InterCityBusAPIRealTimeNearStopUDPParams { + o.SetDollarFormat(dollarFormat) + return o +} + +// SetDollarFormat adds the dollarFormat to the inter city bus Api real time near stop UDP params +func (o *InterCityBusAPIRealTimeNearStopUDPParams) SetDollarFormat(dollarFormat string) { + o.DollarFormat = dollarFormat +} + +// WithDollarOrderby adds the dollarOrderby to the inter city bus Api real time near stop UDP params +func (o *InterCityBusAPIRealTimeNearStopUDPParams) WithDollarOrderby(dollarOrderby *string) *InterCityBusAPIRealTimeNearStopUDPParams { + o.SetDollarOrderby(dollarOrderby) + return o +} + +// SetDollarOrderby adds the dollarOrderby to the inter city bus Api real time near stop UDP params +func (o *InterCityBusAPIRealTimeNearStopUDPParams) SetDollarOrderby(dollarOrderby *string) { + o.DollarOrderby = dollarOrderby +} + +// WithDollarSelect adds the dollarSelect to the inter city bus Api real time near stop UDP params +func (o *InterCityBusAPIRealTimeNearStopUDPParams) WithDollarSelect(dollarSelect *string) *InterCityBusAPIRealTimeNearStopUDPParams { + o.SetDollarSelect(dollarSelect) + return o +} + +// SetDollarSelect adds the dollarSelect to the inter city bus Api real time near stop UDP params +func (o *InterCityBusAPIRealTimeNearStopUDPParams) SetDollarSelect(dollarSelect *string) { + o.DollarSelect = dollarSelect +} + +// WithDollarSkip adds the dollarSkip to the inter city bus Api real time near stop UDP params +func (o *InterCityBusAPIRealTimeNearStopUDPParams) WithDollarSkip(dollarSkip *string) *InterCityBusAPIRealTimeNearStopUDPParams { + o.SetDollarSkip(dollarSkip) + return o +} + +// SetDollarSkip adds the dollarSkip to the inter city bus Api real time near stop UDP params +func (o *InterCityBusAPIRealTimeNearStopUDPParams) SetDollarSkip(dollarSkip *string) { + o.DollarSkip = dollarSkip +} + +// WithDollarTop adds the dollarTop to the inter city bus Api real time near stop UDP params +func (o *InterCityBusAPIRealTimeNearStopUDPParams) WithDollarTop(dollarTop *int64) *InterCityBusAPIRealTimeNearStopUDPParams { + o.SetDollarTop(dollarTop) + return o +} + +// SetDollarTop adds the dollarTop to the inter city bus Api real time near stop UDP params +func (o *InterCityBusAPIRealTimeNearStopUDPParams) SetDollarTop(dollarTop *int64) { + o.DollarTop = dollarTop +} + +// WithHealth adds the health to the inter city bus Api real time near stop UDP params +func (o *InterCityBusAPIRealTimeNearStopUDPParams) WithHealth(health *string) *InterCityBusAPIRealTimeNearStopUDPParams { + o.SetHealth(health) + return o +} + +// SetHealth adds the health to the inter city bus Api real time near stop UDP params +func (o *InterCityBusAPIRealTimeNearStopUDPParams) SetHealth(health *string) { + o.Health = health +} + +// WriteToRequest writes these params to a swagger request +func (o *InterCityBusAPIRealTimeNearStopUDPParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.DollarFilter != nil { + + // query param $filter + var qrDollarFilter string + if o.DollarFilter != nil { + qrDollarFilter = *o.DollarFilter + } + qDollarFilter := qrDollarFilter + if qDollarFilter != "" { + if err := r.SetQueryParam("$filter", qDollarFilter); err != nil { + return err + } + } + + } + + // query param $format + qrDollarFormat := o.DollarFormat + qDollarFormat := qrDollarFormat + if qDollarFormat != "" { + if err := r.SetQueryParam("$format", qDollarFormat); err != nil { + return err + } + } + + if o.DollarOrderby != nil { + + // query param $orderby + var qrDollarOrderby string + if o.DollarOrderby != nil { + qrDollarOrderby = *o.DollarOrderby + } + qDollarOrderby := qrDollarOrderby + if qDollarOrderby != "" { + if err := r.SetQueryParam("$orderby", qDollarOrderby); err != nil { + return err + } + } + + } + + if o.DollarSelect != nil { + + // query param $select + var qrDollarSelect string + if o.DollarSelect != nil { + qrDollarSelect = *o.DollarSelect + } + qDollarSelect := qrDollarSelect + if qDollarSelect != "" { + if err := r.SetQueryParam("$select", qDollarSelect); err != nil { + return err + } + } + + } + + if o.DollarSkip != nil { + + // query param $skip + var qrDollarSkip string + if o.DollarSkip != nil { + qrDollarSkip = *o.DollarSkip + } + qDollarSkip := qrDollarSkip + if qDollarSkip != "" { + if err := r.SetQueryParam("$skip", qDollarSkip); err != nil { + return err + } + } + + } + + if o.DollarTop != nil { + + // query param $top + var qrDollarTop int64 + if o.DollarTop != nil { + qrDollarTop = *o.DollarTop + } + qDollarTop := swag.FormatInt64(qrDollarTop) + if qDollarTop != "" { + if err := r.SetQueryParam("$top", qDollarTop); err != nil { + return err + } + } + + } + + if o.Health != nil { + + // query param health + var qrHealth string + if o.Health != nil { + qrHealth = *o.Health + } + qHealth := qrHealth + if qHealth != "" { + if err := r.SetQueryParam("health", qHealth); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop_udp_responses.go b/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop_udp_responses.go new file mode 100644 index 00000000..fcf6a3eb --- /dev/null +++ b/bus/v2/client/inter_city_bus/inter_city_bus_api_real_time_near_stop_udp_responses.go @@ -0,0 +1,107 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package inter_city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/minchao/go-ptx/bus/v2/models" +) + +// InterCityBusAPIRealTimeNearStopUDPReader is a Reader for the InterCityBusAPIRealTimeNearStopUDP structure. +type InterCityBusAPIRealTimeNearStopUDPReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *InterCityBusAPIRealTimeNearStopUDPReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewInterCityBusAPIRealTimeNearStopUDPOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 299: + result := NewInterCityBusAPIRealTimeNearStopUDPStatus299() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewInterCityBusAPIRealTimeNearStopUDPOK creates a InterCityBusAPIRealTimeNearStopUDPOK with default headers values +func NewInterCityBusAPIRealTimeNearStopUDPOK() *InterCityBusAPIRealTimeNearStopUDPOK { + return &InterCityBusAPIRealTimeNearStopUDPOK{} +} + +/*InterCityBusAPIRealTimeNearStopUDPOK handles this case with default header values. + +OK +*/ +type InterCityBusAPIRealTimeNearStopUDPOK struct { + Payload []*models.ServiceDTOVersion2BusBusA2Data +} + +func (o *InterCityBusAPIRealTimeNearStopUDPOK) Error() string { + return fmt.Sprintf("[GET /v2/Bus/RealTimeNearStop/Streaming/InterCity][%d] interCityBusApiRealTimeNearStopUdpOK %+v", 200, o.Payload) +} + +func (o *InterCityBusAPIRealTimeNearStopUDPOK) GetPayload() []*models.ServiceDTOVersion2BusBusA2Data { + return o.Payload +} + +func (o *InterCityBusAPIRealTimeNearStopUDPOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewInterCityBusAPIRealTimeNearStopUDPStatus299 creates a InterCityBusAPIRealTimeNearStopUDPStatus299 with default headers values +func NewInterCityBusAPIRealTimeNearStopUDPStatus299() *InterCityBusAPIRealTimeNearStopUDPStatus299 { + return &InterCityBusAPIRealTimeNearStopUDPStatus299{} +} + +/*InterCityBusAPIRealTimeNearStopUDPStatus299 handles this case with default header values. + +加入參數'?health=true'即可查詢此API服務的健康狀態 +*/ +type InterCityBusAPIRealTimeNearStopUDPStatus299 struct { + Payload *models.ServiceDTOVersion3BaseHealth +} + +func (o *InterCityBusAPIRealTimeNearStopUDPStatus299) Error() string { + return fmt.Sprintf("[GET /v2/Bus/RealTimeNearStop/Streaming/InterCity][%d] interCityBusApiRealTimeNearStopUdpStatus299 %+v", 299, o.Payload) +} + +func (o *InterCityBusAPIRealTimeNearStopUDPStatus299) GetPayload() *models.ServiceDTOVersion3BaseHealth { + return o.Payload +} + +func (o *InterCityBusAPIRealTimeNearStopUDPStatus299) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceDTOVersion3BaseHealth) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/bus/v2/client/inter_city_bus/inter_city_bus_api_station_group_parameters.go b/bus/v2/client/inter_city_bus/inter_city_bus_api_station_group_parameters.go new file mode 100644 index 00000000..85d91c6a --- /dev/null +++ b/bus/v2/client/inter_city_bus/inter_city_bus_api_station_group_parameters.go @@ -0,0 +1,377 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package inter_city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/swag" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewInterCityBusAPIStationGroupParams creates a new InterCityBusAPIStationGroupParams object +// with the default values initialized. +func NewInterCityBusAPIStationGroupParams() *InterCityBusAPIStationGroupParams { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIStationGroupParams{ + DollarTop: &dollarTopDefault, + + timeout: cr.DefaultTimeout, + } +} + +// NewInterCityBusAPIStationGroupParamsWithTimeout creates a new InterCityBusAPIStationGroupParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewInterCityBusAPIStationGroupParamsWithTimeout(timeout time.Duration) *InterCityBusAPIStationGroupParams { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIStationGroupParams{ + DollarTop: &dollarTopDefault, + + timeout: timeout, + } +} + +// NewInterCityBusAPIStationGroupParamsWithContext creates a new InterCityBusAPIStationGroupParams object +// with the default values initialized, and the ability to set a context for a request +func NewInterCityBusAPIStationGroupParamsWithContext(ctx context.Context) *InterCityBusAPIStationGroupParams { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIStationGroupParams{ + DollarTop: &dollarTopDefault, + + Context: ctx, + } +} + +// NewInterCityBusAPIStationGroupParamsWithHTTPClient creates a new InterCityBusAPIStationGroupParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewInterCityBusAPIStationGroupParamsWithHTTPClient(client *http.Client) *InterCityBusAPIStationGroupParams { + var ( + dollarTopDefault = int64(30) + ) + return &InterCityBusAPIStationGroupParams{ + DollarTop: &dollarTopDefault, + HTTPClient: client, + } +} + +/*InterCityBusAPIStationGroupParams contains all the parameters to send to the API endpoint +for the inter city bus Api station group operation typically these are written to a http.Request +*/ +type InterCityBusAPIStationGroupParams struct { + + /*DollarFilter + 過濾 + + */ + DollarFilter *string + /*DollarFormat + 指定來源格式 + + */ + DollarFormat string + /*DollarOrderby + 排序 + + */ + DollarOrderby *string + /*DollarSelect + 挑選 + + */ + DollarSelect *string + /*DollarSkip + 跳過前幾筆 + + */ + DollarSkip *string + /*DollarSpatialFilter + 空間過濾 + + */ + DollarSpatialFilter *string + /*DollarTop + 取前幾筆 + + */ + DollarTop *int64 + /*Health + 加入參數'?health=true'即可查詢此API服務的健康狀態 + + */ + Health *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the inter city bus Api station group params +func (o *InterCityBusAPIStationGroupParams) WithTimeout(timeout time.Duration) *InterCityBusAPIStationGroupParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the inter city bus Api station group params +func (o *InterCityBusAPIStationGroupParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the inter city bus Api station group params +func (o *InterCityBusAPIStationGroupParams) WithContext(ctx context.Context) *InterCityBusAPIStationGroupParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the inter city bus Api station group params +func (o *InterCityBusAPIStationGroupParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the inter city bus Api station group params +func (o *InterCityBusAPIStationGroupParams) WithHTTPClient(client *http.Client) *InterCityBusAPIStationGroupParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the inter city bus Api station group params +func (o *InterCityBusAPIStationGroupParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDollarFilter adds the dollarFilter to the inter city bus Api station group params +func (o *InterCityBusAPIStationGroupParams) WithDollarFilter(dollarFilter *string) *InterCityBusAPIStationGroupParams { + o.SetDollarFilter(dollarFilter) + return o +} + +// SetDollarFilter adds the dollarFilter to the inter city bus Api station group params +func (o *InterCityBusAPIStationGroupParams) SetDollarFilter(dollarFilter *string) { + o.DollarFilter = dollarFilter +} + +// WithDollarFormat adds the dollarFormat to the inter city bus Api station group params +func (o *InterCityBusAPIStationGroupParams) WithDollarFormat(dollarFormat string) *InterCityBusAPIStationGroupParams { + o.SetDollarFormat(dollarFormat) + return o +} + +// SetDollarFormat adds the dollarFormat to the inter city bus Api station group params +func (o *InterCityBusAPIStationGroupParams) SetDollarFormat(dollarFormat string) { + o.DollarFormat = dollarFormat +} + +// WithDollarOrderby adds the dollarOrderby to the inter city bus Api station group params +func (o *InterCityBusAPIStationGroupParams) WithDollarOrderby(dollarOrderby *string) *InterCityBusAPIStationGroupParams { + o.SetDollarOrderby(dollarOrderby) + return o +} + +// SetDollarOrderby adds the dollarOrderby to the inter city bus Api station group params +func (o *InterCityBusAPIStationGroupParams) SetDollarOrderby(dollarOrderby *string) { + o.DollarOrderby = dollarOrderby +} + +// WithDollarSelect adds the dollarSelect to the inter city bus Api station group params +func (o *InterCityBusAPIStationGroupParams) WithDollarSelect(dollarSelect *string) *InterCityBusAPIStationGroupParams { + o.SetDollarSelect(dollarSelect) + return o +} + +// SetDollarSelect adds the dollarSelect to the inter city bus Api station group params +func (o *InterCityBusAPIStationGroupParams) SetDollarSelect(dollarSelect *string) { + o.DollarSelect = dollarSelect +} + +// WithDollarSkip adds the dollarSkip to the inter city bus Api station group params +func (o *InterCityBusAPIStationGroupParams) WithDollarSkip(dollarSkip *string) *InterCityBusAPIStationGroupParams { + o.SetDollarSkip(dollarSkip) + return o +} + +// SetDollarSkip adds the dollarSkip to the inter city bus Api station group params +func (o *InterCityBusAPIStationGroupParams) SetDollarSkip(dollarSkip *string) { + o.DollarSkip = dollarSkip +} + +// WithDollarSpatialFilter adds the dollarSpatialFilter to the inter city bus Api station group params +func (o *InterCityBusAPIStationGroupParams) WithDollarSpatialFilter(dollarSpatialFilter *string) *InterCityBusAPIStationGroupParams { + o.SetDollarSpatialFilter(dollarSpatialFilter) + return o +} + +// SetDollarSpatialFilter adds the dollarSpatialFilter to the inter city bus Api station group params +func (o *InterCityBusAPIStationGroupParams) SetDollarSpatialFilter(dollarSpatialFilter *string) { + o.DollarSpatialFilter = dollarSpatialFilter +} + +// WithDollarTop adds the dollarTop to the inter city bus Api station group params +func (o *InterCityBusAPIStationGroupParams) WithDollarTop(dollarTop *int64) *InterCityBusAPIStationGroupParams { + o.SetDollarTop(dollarTop) + return o +} + +// SetDollarTop adds the dollarTop to the inter city bus Api station group params +func (o *InterCityBusAPIStationGroupParams) SetDollarTop(dollarTop *int64) { + o.DollarTop = dollarTop +} + +// WithHealth adds the health to the inter city bus Api station group params +func (o *InterCityBusAPIStationGroupParams) WithHealth(health *string) *InterCityBusAPIStationGroupParams { + o.SetHealth(health) + return o +} + +// SetHealth adds the health to the inter city bus Api station group params +func (o *InterCityBusAPIStationGroupParams) SetHealth(health *string) { + o.Health = health +} + +// WriteToRequest writes these params to a swagger request +func (o *InterCityBusAPIStationGroupParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.DollarFilter != nil { + + // query param $filter + var qrDollarFilter string + if o.DollarFilter != nil { + qrDollarFilter = *o.DollarFilter + } + qDollarFilter := qrDollarFilter + if qDollarFilter != "" { + if err := r.SetQueryParam("$filter", qDollarFilter); err != nil { + return err + } + } + + } + + // query param $format + qrDollarFormat := o.DollarFormat + qDollarFormat := qrDollarFormat + if qDollarFormat != "" { + if err := r.SetQueryParam("$format", qDollarFormat); err != nil { + return err + } + } + + if o.DollarOrderby != nil { + + // query param $orderby + var qrDollarOrderby string + if o.DollarOrderby != nil { + qrDollarOrderby = *o.DollarOrderby + } + qDollarOrderby := qrDollarOrderby + if qDollarOrderby != "" { + if err := r.SetQueryParam("$orderby", qDollarOrderby); err != nil { + return err + } + } + + } + + if o.DollarSelect != nil { + + // query param $select + var qrDollarSelect string + if o.DollarSelect != nil { + qrDollarSelect = *o.DollarSelect + } + qDollarSelect := qrDollarSelect + if qDollarSelect != "" { + if err := r.SetQueryParam("$select", qDollarSelect); err != nil { + return err + } + } + + } + + if o.DollarSkip != nil { + + // query param $skip + var qrDollarSkip string + if o.DollarSkip != nil { + qrDollarSkip = *o.DollarSkip + } + qDollarSkip := qrDollarSkip + if qDollarSkip != "" { + if err := r.SetQueryParam("$skip", qDollarSkip); err != nil { + return err + } + } + + } + + if o.DollarSpatialFilter != nil { + + // query param $spatialFilter + var qrDollarSpatialFilter string + if o.DollarSpatialFilter != nil { + qrDollarSpatialFilter = *o.DollarSpatialFilter + } + qDollarSpatialFilter := qrDollarSpatialFilter + if qDollarSpatialFilter != "" { + if err := r.SetQueryParam("$spatialFilter", qDollarSpatialFilter); err != nil { + return err + } + } + + } + + if o.DollarTop != nil { + + // query param $top + var qrDollarTop int64 + if o.DollarTop != nil { + qrDollarTop = *o.DollarTop + } + qDollarTop := swag.FormatInt64(qrDollarTop) + if qDollarTop != "" { + if err := r.SetQueryParam("$top", qDollarTop); err != nil { + return err + } + } + + } + + if o.Health != nil { + + // query param health + var qrHealth string + if o.Health != nil { + qrHealth = *o.Health + } + qHealth := qrHealth + if qHealth != "" { + if err := r.SetQueryParam("health", qHealth); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/bus/v2/client/inter_city_bus/inter_city_bus_api_station_group_responses.go b/bus/v2/client/inter_city_bus/inter_city_bus_api_station_group_responses.go new file mode 100644 index 00000000..8f2665cd --- /dev/null +++ b/bus/v2/client/inter_city_bus/inter_city_bus_api_station_group_responses.go @@ -0,0 +1,107 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package inter_city_bus + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/minchao/go-ptx/bus/v2/models" +) + +// InterCityBusAPIStationGroupReader is a Reader for the InterCityBusAPIStationGroup structure. +type InterCityBusAPIStationGroupReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *InterCityBusAPIStationGroupReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewInterCityBusAPIStationGroupOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 299: + result := NewInterCityBusAPIStationGroupStatus299() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewInterCityBusAPIStationGroupOK creates a InterCityBusAPIStationGroupOK with default headers values +func NewInterCityBusAPIStationGroupOK() *InterCityBusAPIStationGroupOK { + return &InterCityBusAPIStationGroupOK{} +} + +/*InterCityBusAPIStationGroupOK handles this case with default header values. + +OK +*/ +type InterCityBusAPIStationGroupOK struct { + Payload []*models.ServiceDTOVersion2BusBusStationGroup +} + +func (o *InterCityBusAPIStationGroupOK) Error() string { + return fmt.Sprintf("[GET /v2/Bus/StationGroup/InterCity][%d] interCityBusApiStationGroupOK %+v", 200, o.Payload) +} + +func (o *InterCityBusAPIStationGroupOK) GetPayload() []*models.ServiceDTOVersion2BusBusStationGroup { + return o.Payload +} + +func (o *InterCityBusAPIStationGroupOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewInterCityBusAPIStationGroupStatus299 creates a InterCityBusAPIStationGroupStatus299 with default headers values +func NewInterCityBusAPIStationGroupStatus299() *InterCityBusAPIStationGroupStatus299 { + return &InterCityBusAPIStationGroupStatus299{} +} + +/*InterCityBusAPIStationGroupStatus299 handles this case with default header values. + +加入參數'?health=true'即可查詢此API服務的健康狀態 +*/ +type InterCityBusAPIStationGroupStatus299 struct { + Payload *models.ServiceDTOVersion3BaseHealth +} + +func (o *InterCityBusAPIStationGroupStatus299) Error() string { + return fmt.Sprintf("[GET /v2/Bus/StationGroup/InterCity][%d] interCityBusApiStationGroupStatus299 %+v", 299, o.Payload) +} + +func (o *InterCityBusAPIStationGroupStatus299) GetPayload() *models.ServiceDTOVersion3BaseHealth { + return o.Payload +} + +func (o *InterCityBusAPIStationGroupStatus299) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceDTOVersion3BaseHealth) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/bus/v2/client/inter_city_bus/inter_city_bus_client.go b/bus/v2/client/inter_city_bus/inter_city_bus_client.go index 32ae85a8..3fcfeb96 100644 --- a/bus/v2/client/inter_city_bus/inter_city_bus_client.go +++ b/bus/v2/client/inter_city_bus/inter_city_bus_client.go @@ -67,7 +67,8 @@ func (a *Client) InterCityBusAPIDataVersion(params *InterCityBusAPIDataVersionPa InterCityBusAPIEstimatedTimeOfArrival 取得公路客運的預估到站資料s n1 批次更新 ###公路客運之預估到站資料(N1)### -不保留[現在時間]超過[本平台資料更新時間]兩分鐘的資料 +- 不保留[現在時間]超過[本平台資料更新時間]兩分鐘的資料 +- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html)) */ func (a *Client) InterCityBusAPIEstimatedTimeOfArrival(params *InterCityBusAPIEstimatedTimeOfArrivalParams) (*InterCityBusAPIEstimatedTimeOfArrivalOK, *InterCityBusAPIEstimatedTimeOfArrivalStatus299, error) { // TODO: Validate the params before sending @@ -105,7 +106,8 @@ func (a *Client) InterCityBusAPIEstimatedTimeOfArrival(params *InterCityBusAPIEs InterCityBusAPIEstimatedTimeOfArrival1 取得指定s 路線名稱 的公路客運預估到站資料 n1 批次更新 ### 公路客運之預估到站資料(N1) ### -不保留[現在時間]超過[本平台資料更新時間]兩分鐘的資料 +- 不保留[現在時間]超過[本平台資料更新時間]兩分鐘的資料 +- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html)) */ func (a *Client) InterCityBusAPIEstimatedTimeOfArrival1(params *InterCityBusAPIEstimatedTimeOfArrival1Params) (*InterCityBusAPIEstimatedTimeOfArrival1OK, *InterCityBusAPIEstimatedTimeOfArrival1Status299, error) { // TODO: Validate the params before sending @@ -139,6 +141,86 @@ func (a *Client) InterCityBusAPIEstimatedTimeOfArrival1(params *InterCityBusAPIE panic(msg) } +/* +InterCityBusAPIEstimatedTimeOfArrivalUDP 取得公路客運的預估到站資料s n1 逐筆更新 + +### 公路客運之預估到站資料(N1) ### +- 不保留[現在時間]超過[本平台資料更新時間]兩分鐘的資料 +- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html)) +- N1僅於該路線上有任一車輛離站時,來源端才會重新計算並發佈,因此使用者需自行處理時間遞減機制,或以EstimateTime-(收到資料時間-SrcTrasTime)(秒)作為實際預估抵達時間。 +*/ +func (a *Client) InterCityBusAPIEstimatedTimeOfArrivalUDP(params *InterCityBusAPIEstimatedTimeOfArrivalUDPParams) (*InterCityBusAPIEstimatedTimeOfArrivalUDPOK, *InterCityBusAPIEstimatedTimeOfArrivalUDPStatus299, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewInterCityBusAPIEstimatedTimeOfArrivalUDPParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "InterCityBusApi_EstimatedTimeOfArrival_UDP", + Method: "GET", + PathPattern: "/v2/Bus/EstimatedTimeOfArrival/Streaming/InterCity", + ProducesMediaTypes: []string{"application/json", "text/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"https"}, + Params: params, + Reader: &InterCityBusAPIEstimatedTimeOfArrivalUDPReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, nil, err + } + switch value := result.(type) { + case *InterCityBusAPIEstimatedTimeOfArrivalUDPOK: + return value, nil, nil + case *InterCityBusAPIEstimatedTimeOfArrivalUDPStatus299: + return nil, value, nil + } + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for inter_city_bus: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +InterCityBusAPIEstimatedTimeOfArrivalUDP1 取得指定s 路線名稱 的公路客運預估到站資料 n1 逐筆更新 + +### 公路客運之預估到站資料(N1) ### +- 不保留[現在時間]超過[本平台資料更新時間]兩分鐘的資料 +- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html)) +- N1僅於該路線上有任一車輛離站時,來源端才會重新計算並發佈,因此使用者需自行處理時間遞減機制,或以EstimateTime-(收到資料時間-SrcTrasTime)(秒)作為實際預估抵達時間。 +*/ +func (a *Client) InterCityBusAPIEstimatedTimeOfArrivalUDP1(params *InterCityBusAPIEstimatedTimeOfArrivalUDP1Params) (*InterCityBusAPIEstimatedTimeOfArrivalUdp1OK, *InterCityBusAPIEstimatedTimeOfArrivalUdp1Status299, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewInterCityBusAPIEstimatedTimeOfArrivalUDP1Params() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "InterCityBusApi_EstimatedTimeOfArrival_UDP_1", + Method: "GET", + PathPattern: "/v2/Bus/EstimatedTimeOfArrival/Streaming/InterCity/{RouteName}", + ProducesMediaTypes: []string{"application/json", "text/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"https"}, + Params: params, + Reader: &InterCityBusAPIEstimatedTimeOfArrivalUDP1Reader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, nil, err + } + switch value := result.(type) { + case *InterCityBusAPIEstimatedTimeOfArrivalUdp1OK: + return value, nil, nil + case *InterCityBusAPIEstimatedTimeOfArrivalUdp1Status299: + return nil, value, nil + } + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for inter_city_bus: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + /* InterCityBusAPINews 取得公路客運之最新消息s @@ -217,6 +299,7 @@ func (a *Client) InterCityBusAPIOperator(params *InterCityBusAPIOperatorParams) InterCityBusAPIRealTimeByFrequency 取得公路客運的動態定時資料s a1 批次更新 ### 公路客運之定時資料(A1) ### +- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html)) */ func (a *Client) InterCityBusAPIRealTimeByFrequency(params *InterCityBusAPIRealTimeByFrequencyParams) (*InterCityBusAPIRealTimeByFrequencyOK, *InterCityBusAPIRealTimeByFrequencyStatus299, error) { // TODO: Validate the params before sending @@ -254,6 +337,7 @@ func (a *Client) InterCityBusAPIRealTimeByFrequency(params *InterCityBusAPIRealT InterCityBusAPIRealTimeByFrequency1 取得指定s 路線名稱 的公路客運動態定時資料 a1 批次更新 ### 公路客運之定時資料(A1) ### +- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html)) */ func (a *Client) InterCityBusAPIRealTimeByFrequency1(params *InterCityBusAPIRealTimeByFrequency1Params) (*InterCityBusAPIRealTimeByFrequency1OK, *InterCityBusAPIRealTimeByFrequency1Status299, error) { // TODO: Validate the params before sending @@ -288,11 +372,124 @@ func (a *Client) InterCityBusAPIRealTimeByFrequency1(params *InterCityBusAPIReal } /* -InterCityBusAPIRealTimeNearStop1 取得公路客運的動態定點資料s a2 批次更新 +InterCityBusAPIRealTimeByFrequencyUDP 取得公路客運的動態定時資料s a1 逐筆更新 + +### 公路客運之定時資料(A1) ### +- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html)) +*/ +func (a *Client) InterCityBusAPIRealTimeByFrequencyUDP(params *InterCityBusAPIRealTimeByFrequencyUDPParams) (*InterCityBusAPIRealTimeByFrequencyUDPOK, *InterCityBusAPIRealTimeByFrequencyUDPStatus299, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewInterCityBusAPIRealTimeByFrequencyUDPParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "InterCityBusApi_RealTimeByFrequency_UDP", + Method: "GET", + PathPattern: "/v2/Bus/RealTimeByFrequency/Streaming/InterCity", + ProducesMediaTypes: []string{"application/json", "text/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"https"}, + Params: params, + Reader: &InterCityBusAPIRealTimeByFrequencyUDPReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, nil, err + } + switch value := result.(type) { + case *InterCityBusAPIRealTimeByFrequencyUDPOK: + return value, nil, nil + case *InterCityBusAPIRealTimeByFrequencyUDPStatus299: + return nil, value, nil + } + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for inter_city_bus: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +InterCityBusAPIRealTimeByFrequencyUDP1 取得指定s 路線名稱 的公路客運動態定時資料 a1 逐筆更新 + +### 公路客運之定時資料(A1) ### +- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html)) +*/ +func (a *Client) InterCityBusAPIRealTimeByFrequencyUDP1(params *InterCityBusAPIRealTimeByFrequencyUDP1Params) (*InterCityBusAPIRealTimeByFrequencyUdp1OK, *InterCityBusAPIRealTimeByFrequencyUdp1Status299, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewInterCityBusAPIRealTimeByFrequencyUDP1Params() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "InterCityBusApi_RealTimeByFrequency_UDP_1", + Method: "GET", + PathPattern: "/v2/Bus/RealTimeByFrequency/Streaming/InterCity/{RouteName}", + ProducesMediaTypes: []string{"application/json", "text/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"https"}, + Params: params, + Reader: &InterCityBusAPIRealTimeByFrequencyUDP1Reader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, nil, err + } + switch value := result.(type) { + case *InterCityBusAPIRealTimeByFrequencyUdp1OK: + return value, nil, nil + case *InterCityBusAPIRealTimeByFrequencyUdp1Status299: + return nil, value, nil + } + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for inter_city_bus: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +InterCityBusAPIRealTimeNearStop 取得公路客運的動態定點資料s a2 批次更新 + +### 公路客運之定點資料(A2) ### +- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html)) +*/ +func (a *Client) InterCityBusAPIRealTimeNearStop(params *InterCityBusAPIRealTimeNearStopParams) (*InterCityBusAPIRealTimeNearStopOK, *InterCityBusAPIRealTimeNearStopStatus299, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewInterCityBusAPIRealTimeNearStopParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "InterCityBusApi_RealTimeNearStop", + Method: "GET", + PathPattern: "/v2/Bus/RealTimeNearStop/InterCity", + ProducesMediaTypes: []string{"application/json", "text/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"https"}, + Params: params, + Reader: &InterCityBusAPIRealTimeNearStopReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, nil, err + } + switch value := result.(type) { + case *InterCityBusAPIRealTimeNearStopOK: + return value, nil, nil + case *InterCityBusAPIRealTimeNearStopStatus299: + return nil, value, nil + } + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for inter_city_bus: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +InterCityBusAPIRealTimeNearStop1 取得指定s 路線名稱 的公路客運動態定點資料 a2 批次更新 ### 公路客運之定點資料(A2) ### -公路客運動態定點資料(A2) -- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/bus.html)) +- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html)) */ func (a *Client) InterCityBusAPIRealTimeNearStop1(params *InterCityBusAPIRealTimeNearStop1Params) (*InterCityBusAPIRealTimeNearStop1OK, *InterCityBusAPIRealTimeNearStop1Status299, error) { // TODO: Validate the params before sending @@ -303,7 +500,7 @@ func (a *Client) InterCityBusAPIRealTimeNearStop1(params *InterCityBusAPIRealTim result, err := a.transport.Submit(&runtime.ClientOperation{ ID: "InterCityBusApi_RealTimeNearStop_1", Method: "GET", - PathPattern: "/v2/Bus/RealTimeNearStop/InterCity", + PathPattern: "/v2/Bus/RealTimeNearStop/InterCity/{RouteName}", ProducesMediaTypes: []string{"application/json", "text/json"}, ConsumesMediaTypes: []string{""}, Schemes: []string{"https"}, @@ -327,25 +524,26 @@ func (a *Client) InterCityBusAPIRealTimeNearStop1(params *InterCityBusAPIRealTim } /* -InterCityBusAPIRealTimeNearStop2 取得指定s 路線名稱 的公路客運動態定點資料 a2 批次更新 +InterCityBusAPIRealTimeNearStopUDP 取得公路客運的動態定點資料s a2 逐筆更新 ### 公路客運之定點資料(A2) ### +- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html)) */ -func (a *Client) InterCityBusAPIRealTimeNearStop2(params *InterCityBusAPIRealTimeNearStop2Params) (*InterCityBusAPIRealTimeNearStop2OK, *InterCityBusAPIRealTimeNearStop2Status299, error) { +func (a *Client) InterCityBusAPIRealTimeNearStopUDP(params *InterCityBusAPIRealTimeNearStopUDPParams) (*InterCityBusAPIRealTimeNearStopUDPOK, *InterCityBusAPIRealTimeNearStopUDPStatus299, error) { // TODO: Validate the params before sending if params == nil { - params = NewInterCityBusAPIRealTimeNearStop2Params() + params = NewInterCityBusAPIRealTimeNearStopUDPParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "InterCityBusApi_RealTimeNearStop_2", + ID: "InterCityBusApi_RealTimeNearStop_UDP", Method: "GET", - PathPattern: "/v2/Bus/RealTimeNearStop/InterCity/{RouteName}", + PathPattern: "/v2/Bus/RealTimeNearStop/Streaming/InterCity", ProducesMediaTypes: []string{"application/json", "text/json"}, ConsumesMediaTypes: []string{""}, Schemes: []string{"https"}, Params: params, - Reader: &InterCityBusAPIRealTimeNearStop2Reader{formats: a.formats}, + Reader: &InterCityBusAPIRealTimeNearStopUDPReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, }) @@ -353,9 +551,47 @@ func (a *Client) InterCityBusAPIRealTimeNearStop2(params *InterCityBusAPIRealTim return nil, nil, err } switch value := result.(type) { - case *InterCityBusAPIRealTimeNearStop2OK: + case *InterCityBusAPIRealTimeNearStopUDPOK: return value, nil, nil - case *InterCityBusAPIRealTimeNearStop2Status299: + case *InterCityBusAPIRealTimeNearStopUDPStatus299: + return nil, value, nil + } + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for inter_city_bus: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +InterCityBusAPIRealTimeNearStopUDP1 取得指定s 路線名稱 的公路客運動態定點資料 a2 逐筆更新 + +### 公路客運之定點資料(A2) ### +- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html)) +*/ +func (a *Client) InterCityBusAPIRealTimeNearStopUDP1(params *InterCityBusAPIRealTimeNearStopUDP1Params) (*InterCityBusAPIRealTimeNearStopUdp1OK, *InterCityBusAPIRealTimeNearStopUdp1Status299, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewInterCityBusAPIRealTimeNearStopUDP1Params() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "InterCityBusApi_RealTimeNearStop_UDP_1", + Method: "GET", + PathPattern: "/v2/Bus/RealTimeNearStop/Streaming/InterCity/{RouteName}", + ProducesMediaTypes: []string{"application/json", "text/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"https"}, + Params: params, + Reader: &InterCityBusAPIRealTimeNearStopUDP1Reader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, nil, err + } + switch value := result.(type) { + case *InterCityBusAPIRealTimeNearStopUdp1OK: + return value, nil, nil + case *InterCityBusAPIRealTimeNearStopUdp1Status299: return nil, value, nil } // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue @@ -622,6 +858,43 @@ func (a *Client) InterCityBusAPIStation(params *InterCityBusAPIStationParams) (* panic(msg) } +/* +InterCityBusAPIStationGroup 取得公路客運組站位資料s + +公路客運之各站牌所屬的組站位資料 +*/ +func (a *Client) InterCityBusAPIStationGroup(params *InterCityBusAPIStationGroupParams) (*InterCityBusAPIStationGroupOK, *InterCityBusAPIStationGroupStatus299, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewInterCityBusAPIStationGroupParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "InterCityBusApi_StationGroup", + Method: "GET", + PathPattern: "/v2/Bus/StationGroup/InterCity", + ProducesMediaTypes: []string{"application/json", "text/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"https"}, + Params: params, + Reader: &InterCityBusAPIStationGroupReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, nil, err + } + switch value := result.(type) { + case *InterCityBusAPIStationGroupOK: + return value, nil, nil + case *InterCityBusAPIStationGroupStatus299: + return nil, value, nil + } + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for inter_city_bus: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + /* InterCityBusAPIStationName 取得公路客運站名碼資料s diff --git a/bus/v2/models/service_d_t_o_version2_bus_bus_station.go b/bus/v2/models/service_d_t_o_version2_bus_bus_station.go index 61dd862e..7345ebb8 100644 --- a/bus/v2/models/service_d_t_o_version2_bus_bus_station.go +++ b/bus/v2/models/service_d_t_o_version2_bus_bus_station.go @@ -24,6 +24,10 @@ type ServiceDTOVersion2BusBusStation struct { // 站位地址 StationAddress string `json:"StationAddress,omitempty"` + // 站牌所屬的組站位ID + // Required: true + StationGroupID *string `json:"StationGroupID"` + // 站位代碼 // Required: true StationID *string `json:"StationID"` @@ -66,6 +70,10 @@ type ServiceDTOVersion2BusBusStation struct { func (m *ServiceDTOVersion2BusBusStation) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateStationGroupID(formats); err != nil { + res = append(res, err) + } + if err := m.validateStationID(formats); err != nil { res = append(res, err) } @@ -104,6 +112,15 @@ func (m *ServiceDTOVersion2BusBusStation) Validate(formats strfmt.Registry) erro return nil } +func (m *ServiceDTOVersion2BusBusStation) validateStationGroupID(formats strfmt.Registry) error { + + if err := validate.Required("StationGroupID", "body", m.StationGroupID); err != nil { + return err + } + + return nil +} + func (m *ServiceDTOVersion2BusBusStation) validateStationID(formats strfmt.Registry) error { if err := validate.Required("StationID", "body", m.StationID); err != nil { diff --git a/bus/v2/models/service_d_t_o_version2_bus_bus_station_group.go b/bus/v2/models/service_d_t_o_version2_bus_bus_station_group.go new file mode 100644 index 00000000..25549dd3 --- /dev/null +++ b/bus/v2/models/service_d_t_o_version2_bus_bus_station_group.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ServiceDTOVersion2BusBusStationGroup BusStationGroup +// +// 組站位資料型別 +// swagger:model Service.DTO.Version2.Bus.BusStationGroup +type ServiceDTOVersion2BusBusStationGroup struct { + + // 組站位代碼 + // Required: true + StationGroupID *string `json:"StationGroupID"` + + // NameType + // + // 組站位名稱 + // Required: true + StationGroupName *ServiceDTOVersion2BaseNameType `json:"StationGroupName"` + + // PointType + // + // 組站位位置 + // Required: true + StationGroupPosition *ServiceDTOVersion2BasePointType `json:"StationGroupPosition"` + + // 組站位唯一識別代碼,規則為 {業管機關簡碼} + {StationGroupID},其中 {業管機關簡碼} 可於Authority API中的AuthorityCode欄位查詢 + // Required: true + StationGroupUID *string `json:"StationGroupUID"` + + // DateTime + // + // 資料更新日期時間(ISO8601格式:yyyy-MM-ddTHH:mm:sszzz) + // Required: true + UpdateTime *string `json:"UpdateTime"` + + // 資料版本編號 + // Required: true + VersionID *int32 `json:"VersionID"` +} + +// Validate validates this service d t o version2 bus bus station group +func (m *ServiceDTOVersion2BusBusStationGroup) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateStationGroupID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStationGroupName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStationGroupPosition(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStationGroupUID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdateTime(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVersionID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceDTOVersion2BusBusStationGroup) validateStationGroupID(formats strfmt.Registry) error { + + if err := validate.Required("StationGroupID", "body", m.StationGroupID); err != nil { + return err + } + + return nil +} + +func (m *ServiceDTOVersion2BusBusStationGroup) validateStationGroupName(formats strfmt.Registry) error { + + if err := validate.Required("StationGroupName", "body", m.StationGroupName); err != nil { + return err + } + + if m.StationGroupName != nil { + if err := m.StationGroupName.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("StationGroupName") + } + return err + } + } + + return nil +} + +func (m *ServiceDTOVersion2BusBusStationGroup) validateStationGroupPosition(formats strfmt.Registry) error { + + if err := validate.Required("StationGroupPosition", "body", m.StationGroupPosition); err != nil { + return err + } + + if m.StationGroupPosition != nil { + if err := m.StationGroupPosition.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("StationGroupPosition") + } + return err + } + } + + return nil +} + +func (m *ServiceDTOVersion2BusBusStationGroup) validateStationGroupUID(formats strfmt.Registry) error { + + if err := validate.Required("StationGroupUID", "body", m.StationGroupUID); err != nil { + return err + } + + return nil +} + +func (m *ServiceDTOVersion2BusBusStationGroup) validateUpdateTime(formats strfmt.Registry) error { + + if err := validate.Required("UpdateTime", "body", m.UpdateTime); err != nil { + return err + } + + return nil +} + +func (m *ServiceDTOVersion2BusBusStationGroup) validateVersionID(formats strfmt.Registry) error { + + if err := validate.Required("VersionID", "body", m.VersionID); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceDTOVersion2BusBusStationGroup) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceDTOVersion2BusBusStationGroup) UnmarshalBinary(b []byte) error { + var res ServiceDTOVersion2BusBusStationGroup + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/bus/v2/models/service_d_t_o_version2_bus_bus_stop.go b/bus/v2/models/service_d_t_o_version2_bus_bus_stop.go index e97f6bbc..20322dd7 100644 --- a/bus/v2/models/service_d_t_o_version2_bus_bus_stop.go +++ b/bus/v2/models/service_d_t_o_version2_bus_bus_stop.go @@ -35,6 +35,10 @@ type ServiceDTOVersion2BusBusStop struct { // 站牌位置縣市之代碼(國際ISO 3166-2 三碼城市代碼)[若為公路/國道客運路線則為空值] LocationCityCode string `json:"LocationCityCode,omitempty"` + // 站牌所屬的組站位ID + // Required: true + StationGroupID *string `json:"StationGroupID"` + // 站牌所屬的站位ID StationID string `json:"StationID,omitempty"` @@ -87,6 +91,10 @@ func (m *ServiceDTOVersion2BusBusStop) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateStationGroupID(formats); err != nil { + res = append(res, err) + } + if err := m.validateStationNameID(formats); err != nil { res = append(res, err) } @@ -130,6 +138,15 @@ func (m *ServiceDTOVersion2BusBusStop) validateAuthorityID(formats strfmt.Regist return nil } +func (m *ServiceDTOVersion2BusBusStop) validateStationGroupID(formats strfmt.Registry) error { + + if err := validate.Required("StationGroupID", "body", m.StationGroupID); err != nil { + return err + } + + return nil +} + func (m *ServiceDTOVersion2BusBusStop) validateStationNameID(formats strfmt.Registry) error { if err := validate.Required("StationNameID", "body", m.StationNameID); err != nil { diff --git a/bus/v2/models/service_d_t_o_version2_bus_stop.go b/bus/v2/models/service_d_t_o_version2_bus_stop.go index 4bd0422a..997e7d57 100644 --- a/bus/v2/models/service_d_t_o_version2_bus_stop.go +++ b/bus/v2/models/service_d_t_o_version2_bus_stop.go @@ -22,6 +22,10 @@ type ServiceDTOVersion2BusStop struct { // 站牌位置縣市之代碼(國際ISO 3166-2 三碼城市代碼)[若為公路/國道客運路線則為空值] LocationCityCode string `json:"LocationCityCode,omitempty"` + // 站牌所屬的組站位ID + // Required: true + StationGroupID *string `json:"StationGroupID"` + // 站牌所屬的站位ID StationID string `json:"StationID,omitempty"` @@ -63,6 +67,10 @@ type ServiceDTOVersion2BusStop struct { func (m *ServiceDTOVersion2BusStop) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateStationGroupID(formats); err != nil { + res = append(res, err) + } + if err := m.validateStationNameID(formats); err != nil { res = append(res, err) } @@ -93,6 +101,15 @@ func (m *ServiceDTOVersion2BusStop) Validate(formats strfmt.Registry) error { return nil } +func (m *ServiceDTOVersion2BusStop) validateStationGroupID(formats strfmt.Registry) error { + + if err := validate.Required("StationGroupID", "body", m.StationGroupID); err != nil { + return err + } + + return nil +} + func (m *ServiceDTOVersion2BusStop) validateStationNameID(formats strfmt.Registry) error { if err := validate.Required("StationNameID", "body", m.StationNameID); err != nil { diff --git a/oas.bus.v2.json b/oas.bus.v2.json index 1ea2f38a..762d9c59 100644 --- a/oas.bus.v2.json +++ b/oas.bus.v2.json @@ -3,7 +3,7 @@ "info": { "version": "v2", "title": "MOTC Transport API V2", - "description": "本平臺提供涵蓋全國尺度之公車、臺鐵、高鐵、捷運、航空、自行車等公共運輸旅運資料服務API,歡迎各產政學單位介接使用。\r\n
利用本平臺開放資料進行各項應用服務開發時,請考量不同特性使用者(如:性別/身心障礙/老幼等)的需求,並歡迎回饋寶貴意見。\r\n

資料使用葵花寶典:[請點我](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/)\r\n
資料服務開發實作參考手冊:[請點我](https://docs.google.com/viewer?url=https://github.com/ptxmotc/PTX_Web/blob/master/Swagger%E6%9C%8D%E5%8B%99%E8%AA%AA%E6%98%8E%E4%B8%8A%E5%82%B3%E5%8F%83%E8%80%83%E6%AA%94%E6%A1%88/%E5%85%AC%E5%85%B1%E9%81%8B%E8%BC%B8%E6%95%B4%E5%90%88%E8%B3%87%E8%A8%8A%E5%B9%B3%E5%8F%B0%E8%B3%87%E6%96%99%E6%9C%8D%E5%8B%99%E9%96%8B%E7%99%BC%E5%AF%A6%E4%BD%9C.pdf?raw=true)\r\n
API URI Convention文件說明:[請點我](https://docs.google.com/viewer?url=https://github.com/ptxmotc/PTX_Web/blob/master/Swagger%E6%9C%8D%E5%8B%99%E8%AA%AA%E6%98%8E%E4%B8%8A%E5%82%B3%E5%8F%83%E8%80%83%E6%AA%94%E6%A1%88/API_URI_Convention%E6%96%87%E4%BB%B6_v1.pdf?raw=true)
資料文本OAS描述:[請點我](http://ptx.transportdata.tw/MOTC/v2/Bus/api-docs/oas)" + "description": "本平臺提供涵蓋全國尺度之公車、臺鐵、高鐵、捷運、航空、自行車等公共運輸旅運資料服務API,歡迎各產政學單位介接使用。\r\n
利用本平臺開放資料進行各項應用服務開發時,請考量不同特性使用者(如:性別/身心障礙/老幼等)的需求,並歡迎回饋寶貴意見。\r\n

資料使用葵花寶典:[請點我](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/)\r\n
資料服務開發實作參考手冊:[請點我](https://docs.google.com/viewer?url=https://github.com/ptxmotc/PTX_Web/blob/master/Swagger%E6%9C%8D%E5%8B%99%E8%AA%AA%E6%98%8E%E4%B8%8A%E5%82%B3%E5%8F%83%E8%80%83%E6%AA%94%E6%A1%88/%E5%85%AC%E5%85%B1%E9%81%8B%E8%BC%B8%E6%95%B4%E5%90%88%E8%B3%87%E8%A8%8A%E5%B9%B3%E5%8F%B0%E8%B3%87%E6%96%99%E6%9C%8D%E5%8B%99%E9%96%8B%E7%99%BC%E5%AF%A6%E4%BD%9C.pdf?raw=true)\r\n
API URI Convention文件說明:[請點我](https://docs.google.com/viewer?url=https://github.com/ptxmotc/PTX_Web/blob/master/Swagger%E6%9C%8D%E5%8B%99%E8%AA%AA%E6%98%8E%E4%B8%8A%E5%82%B3%E5%8F%83%E8%80%83%E6%AA%94%E6%A1%88/API_URI_Convention%E6%96%87%E4%BB%B6_v1.pdf?raw=true)
資料文本OAS描述:[請點我](https://ptx.transportdata.tw/MOTC/v2/Bus/api-docs/oas)" }, "host": "ptx.transportdata.tw", "basePath": "/MOTC/", @@ -11,14 +11,14 @@ "https" ], "paths": { - "/v2/Bus/RealTimeByFrequency/City/{City}": { + "/v2/Bus/RealTimeByFrequency/Streaming/City/{City}": { "get": { "tags": [ "CityBus" ], - "summary": "取得指定[縣市]的公車動態定時資料(A1)[批次更新]", - "description": "### 市區公車之定時資料(A1) ###", - "operationId": "CityBusApi_RealTimeByFrequency", + "summary": "取得指定[縣市]的公車動態定時資料(A1)[逐筆更新]", + "description": "### 市區公車之定時資料(A1) ###\r\n- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html))", + "operationId": "CityBusApi_RealTimeByFrequency_UDP", "consumes": [], "produces": [ "application/json", @@ -32,13 +32,6 @@ "required": true, "type": "string", "enum": [ - "Taipei", - "NewTaipei", - "Taoyuan", - "Taichung", - "Tainan", - "Kaohsiung", - "Keelung", "Hsinchu", "HsinchuCounty", "MiaoliCounty", @@ -51,33 +44,22 @@ "YilanCounty", "HualienCounty", "TaitungCounty", - "KinmenCounty", - "PenghuCounty", - "LienchiangCounty" + "PenghuCounty" ], "x-enum": { - "Hsinchu": "新竹市", - "TaitungCounty": "臺東縣", - "NewTaipei": "新北市", - "ChanghuaCounty": "彰化縣", - "Taoyuan": "桃園市", - "Kaohsiung": "高雄市", - "PenghuCounty": "澎湖縣", - "Taipei": "臺北市", + "ChiayiCounty": "嘉義縣", + "YilanCounty": "宜蘭縣", "HualienCounty": "花蓮縣", - "Tainan": "臺南市", "NantouCounty": "南投縣", - "Taichung": "臺中市", + "MiaoliCounty": "苗栗縣", + "TaitungCounty": "臺東縣", + "ChanghuaCounty": "彰化縣", + "YunlinCounty": "雲林縣", "PingtungCounty": "屏東縣", - "LienchiangCounty": "連江縣", - "HsinchuCounty": "新竹縣", "Chiayi": "嘉義市", - "YunlinCounty": "雲林縣", - "ChiayiCounty": "嘉義縣", - "YilanCounty": "宜蘭縣", - "MiaoliCounty": "苗栗縣", - "KinmenCounty": "金門縣", - "Keelung": "基隆市" + "PenghuCounty": "澎湖縣", + "Hsinchu": "新竹市", + "HsinchuCounty": "新竹縣" } }, { @@ -159,14 +141,14 @@ } } }, - "/v2/Bus/RealTimeByFrequency/City/{City}/{RouteName}": { + "/v2/Bus/RealTimeByFrequency/Streaming/City/{City}/{RouteName}": { "get": { "tags": [ "CityBus" ], - "summary": "取得指定[縣市],[路線名稱]的公車動態定時資料(A1)[批次更新]", - "description": "### 市區公車之定時資料(A1) ###", - "operationId": "CityBusApi_RealTimeByFrequency_1", + "summary": "取得指定[縣市],[路線名稱]的公車動態定時資料(A1)[逐筆更新]", + "description": "### 市區公車之定時資料(A1) ###\r\n- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html))", + "operationId": "CityBusApi_RealTimeByFrequency_UDP_1", "consumes": [], "produces": [ "application/json", @@ -180,13 +162,6 @@ "required": true, "type": "string", "enum": [ - "Taipei", - "NewTaipei", - "Taoyuan", - "Taichung", - "Tainan", - "Kaohsiung", - "Keelung", "Hsinchu", "HsinchuCounty", "MiaoliCounty", @@ -199,33 +174,22 @@ "YilanCounty", "HualienCounty", "TaitungCounty", - "KinmenCounty", - "PenghuCounty", - "LienchiangCounty" + "PenghuCounty" ], "x-enum": { - "Hsinchu": "新竹市", - "TaitungCounty": "臺東縣", - "NewTaipei": "新北市", - "ChanghuaCounty": "彰化縣", - "Taoyuan": "桃園市", - "Kaohsiung": "高雄市", - "PenghuCounty": "澎湖縣", - "Taipei": "臺北市", + "ChiayiCounty": "嘉義縣", + "YilanCounty": "宜蘭縣", "HualienCounty": "花蓮縣", - "Tainan": "臺南市", "NantouCounty": "南投縣", - "Taichung": "臺中市", + "MiaoliCounty": "苗栗縣", + "TaitungCounty": "臺東縣", + "ChanghuaCounty": "彰化縣", + "YunlinCounty": "雲林縣", "PingtungCounty": "屏東縣", - "LienchiangCounty": "連江縣", - "HsinchuCounty": "新竹縣", "Chiayi": "嘉義市", - "YunlinCounty": "雲林縣", - "ChiayiCounty": "嘉義縣", - "YilanCounty": "宜蘭縣", - "MiaoliCounty": "苗栗縣", - "KinmenCounty": "金門縣", - "Keelung": "基隆市" + "PenghuCounty": "澎湖縣", + "Hsinchu": "新竹市", + "HsinchuCounty": "新竹縣" } }, { @@ -314,14 +278,14 @@ } } }, - "/v2/Bus/RealTimeNearStop/City/{City}": { + "/v2/Bus/RealTimeNearStop/Streaming/City/{City}": { "get": { "tags": [ "CityBus" ], - "summary": "取得指定[縣市]的公車動態定點資料(A2)[批次更新]", - "description": "### 市區公車之定點資料(A2) ###\r\n欲查詢縣市公車動態定點資料(A2)\r\n- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/bus.html))", - "operationId": "CityBusApi_RealTimeNearStop", + "summary": "取得指定[縣市]的公車動態定點資料(A2)[逐筆更新]", + "description": "### 市區公車之定點資料(A2) ###\r\n- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html))", + "operationId": "CityBusApi_RealTimeNearStop_UDP", "consumes": [], "produces": [ "application/json", @@ -331,16 +295,10 @@ { "name": "City", "in": "path", + "description": "欲查詢縣市", "required": true, "type": "string", "enum": [ - "Taipei", - "NewTaipei", - "Taoyuan", - "Taichung", - "Tainan", - "Kaohsiung", - "Keelung", "Hsinchu", "HsinchuCounty", "MiaoliCounty", @@ -353,33 +311,22 @@ "YilanCounty", "HualienCounty", "TaitungCounty", - "KinmenCounty", - "PenghuCounty", - "LienchiangCounty" + "PenghuCounty" ], "x-enum": { - "KinmenCounty": "金門縣", - "Taichung": "臺中市", - "TaitungCounty": "臺東縣", - "ChiayiCounty": "嘉義縣", - "Taoyuan": "桃園市", - "Chiayi": "嘉義市", - "PingtungCounty": "屏東縣", "Hsinchu": "新竹市", - "Tainan": "臺南市", - "Kaohsiung": "高雄市", - "NewTaipei": "新北市", - "Keelung": "基隆市", - "PenghuCounty": "澎湖縣", + "HualienCounty": "花蓮縣", + "NantouCounty": "南投縣", "MiaoliCounty": "苗栗縣", - "Taipei": "臺北市", - "YunlinCounty": "雲林縣", - "ChanghuaCounty": "彰化縣", + "Chiayi": "嘉義市", "YilanCounty": "宜蘭縣", + "PenghuCounty": "澎湖縣", "HsinchuCounty": "新竹縣", - "HualienCounty": "花蓮縣", - "LienchiangCounty": "連江縣", - "NantouCounty": "南投縣" + "PingtungCounty": "屏東縣", + "TaitungCounty": "臺東縣", + "ChanghuaCounty": "彰化縣", + "YunlinCounty": "雲林縣", + "ChiayiCounty": "嘉義縣" } }, { @@ -455,14 +402,14 @@ } } }, - "/v2/Bus/RealTimeNearStop/City/{City}/{RouteName}": { + "/v2/Bus/RealTimeNearStop/Streaming/City/{City}/{RouteName}": { "get": { "tags": [ "CityBus" ], - "summary": "取得指定[縣市],[路線名稱]的公車動態定點資料(A2)[批次更新]", - "description": "### 市區公車之定點資料(A2) ###", - "operationId": "CityBusApi_RealTimeNearStop_1", + "summary": "取得指定[縣市],[路線名稱]的公車動態定點資料(A2)[逐筆更新]", + "description": "### 市區公車之定點資料(A2) ###\r\n- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html))", + "operationId": "CityBusApi_RealTimeNearStop_UDP_1", "consumes": [], "produces": [ "application/json", @@ -476,13 +423,6 @@ "required": true, "type": "string", "enum": [ - "Taipei", - "NewTaipei", - "Taoyuan", - "Taichung", - "Tainan", - "Kaohsiung", - "Keelung", "Hsinchu", "HsinchuCounty", "MiaoliCounty", @@ -495,33 +435,22 @@ "YilanCounty", "HualienCounty", "TaitungCounty", - "KinmenCounty", - "PenghuCounty", - "LienchiangCounty" + "PenghuCounty" ], "x-enum": { - "KinmenCounty": "金門縣", - "Taichung": "臺中市", - "TaitungCounty": "臺東縣", - "ChiayiCounty": "嘉義縣", - "Taoyuan": "桃園市", - "Chiayi": "嘉義市", - "PingtungCounty": "屏東縣", "Hsinchu": "新竹市", - "Tainan": "臺南市", - "Kaohsiung": "高雄市", - "NewTaipei": "新北市", - "Keelung": "基隆市", - "PenghuCounty": "澎湖縣", + "HualienCounty": "花蓮縣", + "NantouCounty": "南投縣", "MiaoliCounty": "苗栗縣", - "Taipei": "臺北市", - "YunlinCounty": "雲林縣", - "ChanghuaCounty": "彰化縣", + "Chiayi": "嘉義市", "YilanCounty": "宜蘭縣", + "PenghuCounty": "澎湖縣", "HsinchuCounty": "新竹縣", - "HualienCounty": "花蓮縣", - "LienchiangCounty": "連江縣", - "NantouCounty": "南投縣" + "PingtungCounty": "屏東縣", + "TaitungCounty": "臺東縣", + "ChanghuaCounty": "彰化縣", + "YunlinCounty": "雲林縣", + "ChiayiCounty": "嘉義縣" } }, { @@ -604,14 +533,14 @@ } } }, - "/v2/Bus/EstimatedTimeOfArrival/City/{City}": { + "/v2/Bus/EstimatedTimeOfArrival/Streaming/City/{City}": { "get": { "tags": [ "CityBus" ], - "summary": "取得指定[縣市]的公車預估到站資料(N1)[批次更新]", - "description": " ### 市區公車之預估到站資料(N1) ###\r\n[部分縣市] 當 StopStatus = 1(尚未發車) 且 EstimateTime > 0 (有值) 的情形, 屬正常情形, 雖目前尚未發車, 但提供EstimateTime值為預計多久後開始發車之時間。", - "operationId": "CityBusApi_EstimatedTimeOfArrival", + "summary": "取得指定[縣市]的公車預估到站資料(N1)[逐筆更新]", + "description": "### 市區公車之預估到站資料(N1) ###\r\n- [部分縣市] 當 StopStatus = 1(尚未發車) 且 EstimateTime > 0 (有值) 的情形, 屬正常情形, 雖目前尚未發車, 但提供EstimateTime值為預計多久後開始發車之時間。\r\n- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html))\r\n- N1僅於該路線上有任一車輛離站時,來源端才會重新計算並發佈,因此使用者需自行處理時間遞減機制,或以EstimateTime-(收到資料時間-SrcTrasTime)(秒)作為實際預估抵達時間。", + "operationId": "CityBusApi_EstimatedTimeOfArrival_UDP", "consumes": [], "produces": [ "application/json", @@ -625,13 +554,6 @@ "required": true, "type": "string", "enum": [ - "Taipei", - "NewTaipei", - "Taoyuan", - "Taichung", - "Tainan", - "Kaohsiung", - "Keelung", "Hsinchu", "HsinchuCounty", "MiaoliCounty", @@ -644,33 +566,22 @@ "YilanCounty", "HualienCounty", "TaitungCounty", - "KinmenCounty", - "PenghuCounty", - "LienchiangCounty" + "PenghuCounty" ], "x-enum": { - "Keelung": "基隆市", - "HualienCounty": "花蓮縣", - "Kaohsiung": "高雄市", - "NantouCounty": "南投縣", - "KinmenCounty": "金門縣", - "ChiayiCounty": "嘉義縣", - "ChanghuaCounty": "彰化縣", - "Taichung": "臺中市", + "MiaoliCounty": "苗栗縣", "Chiayi": "嘉義市", - "PingtungCounty": "屏東縣", - "Tainan": "臺南市", "YunlinCounty": "雲林縣", - "NewTaipei": "新北市", - "Taoyuan": "桃園市", - "Taipei": "臺北市", - "Hsinchu": "新竹市", - "LienchiangCounty": "連江縣", "HsinchuCounty": "新竹縣", - "MiaoliCounty": "苗栗縣", + "YilanCounty": "宜蘭縣", + "PingtungCounty": "屏東縣", "PenghuCounty": "澎湖縣", - "TaitungCounty": "臺東縣", - "YilanCounty": "宜蘭縣" + "ChanghuaCounty": "彰化縣", + "HualienCounty": "花蓮縣", + "ChiayiCounty": "嘉義縣", + "NantouCounty": "南投縣", + "Hsinchu": "新竹市", + "TaitungCounty": "臺東縣" } }, { @@ -746,14 +657,14 @@ } } }, - "/v2/Bus/EstimatedTimeOfArrival/City/{City}/{RouteName}": { + "/v2/Bus/EstimatedTimeOfArrival/Streaming/City/{City}/{RouteName}": { "get": { "tags": [ "CityBus" ], - "summary": "取得指定[縣市],[路線名稱]的公車預估到站資料(N1)[批次更新]", - "description": " ### 市區公車之預估到站資料(N1) ###\r\n[部分縣市] 當 StopStatus = 1(尚未發車) 且 EstimateTime > 0 (有值) 的情形, 屬正常情形, 雖目前尚未發車, 但提供EstimateTime值為預計多久後開始發車之時間。", - "operationId": "CityBusApi_EstimatedTimeOfArrival_1", + "summary": "取得指定[縣市],[路線名稱]的公車預估到站資料(N1)[逐筆更新]", + "description": "### 市區公車之預估到站資料(N1) ###\r\n- [部分縣市] 當 StopStatus = 1(尚未發車) 且 EstimateTime > 0 (有值) 的情形, 屬正常情形, 雖目前尚未發車, 但提供EstimateTime值為預計多久後開始發車之時間。\r\n- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html))\r\n- N1僅於該路線上有任一車輛離站時,來源端才會重新計算並發佈,因此使用者需自行處理時間遞減機制,或以EstimateTime-(收到資料時間-SrcTrasTime)(秒)作為實際預估抵達時間。", + "operationId": "CityBusApi_EstimatedTimeOfArrival_UDP_1", "consumes": [], "produces": [ "application/json", @@ -767,13 +678,6 @@ "required": true, "type": "string", "enum": [ - "Taipei", - "NewTaipei", - "Taoyuan", - "Taichung", - "Tainan", - "Kaohsiung", - "Keelung", "Hsinchu", "HsinchuCounty", "MiaoliCounty", @@ -786,33 +690,22 @@ "YilanCounty", "HualienCounty", "TaitungCounty", - "KinmenCounty", - "PenghuCounty", - "LienchiangCounty" + "PenghuCounty" ], "x-enum": { - "Keelung": "基隆市", - "HualienCounty": "花蓮縣", - "Kaohsiung": "高雄市", - "NantouCounty": "南投縣", - "KinmenCounty": "金門縣", - "ChiayiCounty": "嘉義縣", - "ChanghuaCounty": "彰化縣", - "Taichung": "臺中市", + "MiaoliCounty": "苗栗縣", "Chiayi": "嘉義市", - "PingtungCounty": "屏東縣", - "Tainan": "臺南市", "YunlinCounty": "雲林縣", - "NewTaipei": "新北市", - "Taoyuan": "桃園市", - "Taipei": "臺北市", - "Hsinchu": "新竹市", - "LienchiangCounty": "連江縣", "HsinchuCounty": "新竹縣", - "MiaoliCounty": "苗栗縣", + "YilanCounty": "宜蘭縣", + "PingtungCounty": "屏東縣", "PenghuCounty": "澎湖縣", - "TaitungCounty": "臺東縣", - "YilanCounty": "宜蘭縣" + "ChanghuaCounty": "彰化縣", + "HualienCounty": "花蓮縣", + "ChiayiCounty": "嘉義縣", + "NantouCounty": "南投縣", + "Hsinchu": "新竹市", + "TaitungCounty": "臺東縣" } }, { @@ -895,20 +788,18 @@ } } }, - "/v2/Bus/DataVersion/City/{City}": { + "/v2/Bus/RealTimeByFrequency/City/{City}": { "get": { "tags": [ "CityBus" ], - "summary": "取得指定[縣市]目前資料的最新版本資訊", - "description": "版本詳細資訊", - "operationId": "CityBusApi_DataVersion", + "summary": "取得指定[縣市]的公車動態定時資料(A1)[批次更新]", + "description": "### 市區公車之定時資料(A1) ###\r\n- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html))", + "operationId": "CityBusApi_RealTimeByFrequency", "consumes": [], "produces": [ "application/json", - "text/json", - "application/xml", - "text/xml" + "text/json" ], "parameters": [ { @@ -942,30 +833,67 @@ "LienchiangCounty" ], "x-enum": { - "Chiayi": "嘉義市", - "NantouCounty": "南投縣", - "MiaoliCounty": "苗栗縣", "YunlinCounty": "雲林縣", - "ChiayiCounty": "嘉義縣", - "PingtungCounty": "屏東縣", "TaitungCounty": "臺東縣", - "PenghuCounty": "澎湖縣", - "Taoyuan": "桃園市", - "HsinchuCounty": "新竹縣", - "Keelung": "基隆市", - "Tainan": "臺南市", "Kaohsiung": "高雄市", + "MiaoliCounty": "苗栗縣", "Hsinchu": "新竹市", - "KinmenCounty": "金門縣", - "Taipei": "臺北市", + "PenghuCounty": "澎湖縣", + "ChiayiCounty": "嘉義縣", "HualienCounty": "花蓮縣", + "KinmenCounty": "金門縣", + "NantouCounty": "南投縣", + "Taichung": "臺中市", + "PingtungCounty": "屏東縣", + "Tainan": "臺南市", "NewTaipei": "新北市", - "YilanCounty": "宜蘭縣", + "Taoyuan": "桃園市", + "Chiayi": "嘉義市", "LienchiangCounty": "連江縣", - "Taichung": "臺中市", - "ChanghuaCounty": "彰化縣" + "Taipei": "臺北市", + "HsinchuCounty": "新竹縣", + "ChanghuaCounty": "彰化縣", + "YilanCounty": "宜蘭縣", + "Keelung": "基隆市" } }, + { + "name": "$select", + "in": "query", + "description": "挑選", + "type": "string" + }, + { + "name": "$filter", + "in": "query", + "description": "過濾", + "type": "string" + }, + { + "name": "$orderby", + "in": "query", + "description": "排序", + "type": "string" + }, + { + "name": "$top", + "in": "query", + "description": "取前幾筆", + "type": "integer", + "default": 30 + }, + { + "name": "$skip", + "in": "query", + "description": "跳過前幾筆", + "type": "string" + }, + { + "name": "$spatialFilter", + "in": "query", + "description": "空間過濾", + "type": "string" + }, { "name": "$format", "in": "query", @@ -993,7 +921,10 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/Service.DTO.Version2.Bus.BusVersion" + "type": "array", + "items": { + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusA1Data" + } } }, "299": { @@ -1005,14 +936,14 @@ } } }, - "/v2/Bus/Operator/City/{City}": { + "/v2/Bus/RealTimeByFrequency/City/{City}/{RouteName}": { "get": { "tags": [ "CityBus" ], - "summary": "取得指定[縣市]的市區公車營運業者資料", - "description": "市區公車之營運業者資料", - "operationId": "CityBusApi_Operator", + "summary": "取得指定[縣市],[路線名稱]的公車動態定時資料(A1)[批次更新]", + "description": "### 市區公車之定時資料(A1) ###\r\n- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html))", + "operationId": "CityBusApi_RealTimeByFrequency_1", "consumes": [], "produces": [ "application/json", @@ -1050,30 +981,37 @@ "LienchiangCounty" ], "x-enum": { - "ChanghuaCounty": "彰化縣", - "PingtungCounty": "屏東縣", - "Hsinchu": "新竹市", - "YilanCounty": "宜蘭縣", - "PenghuCounty": "澎湖縣", - "NewTaipei": "新北市", - "LienchiangCounty": "連江縣", - "Tainan": "臺南市", - "NantouCounty": "南投縣", + "YunlinCounty": "雲林縣", "TaitungCounty": "臺東縣", + "Kaohsiung": "高雄市", "MiaoliCounty": "苗栗縣", - "Taichung": "臺中市", + "Hsinchu": "新竹市", + "PenghuCounty": "澎湖縣", + "ChiayiCounty": "嘉義縣", "HualienCounty": "花蓮縣", "KinmenCounty": "金門縣", - "Kaohsiung": "高雄市", + "NantouCounty": "南投縣", + "Taichung": "臺中市", + "PingtungCounty": "屏東縣", + "Tainan": "臺南市", + "NewTaipei": "新北市", "Taoyuan": "桃園市", - "HsinchuCounty": "新竹縣", + "Chiayi": "嘉義市", + "LienchiangCounty": "連江縣", "Taipei": "臺北市", - "YunlinCounty": "雲林縣", - "ChiayiCounty": "嘉義縣", - "Keelung": "基隆市", - "Chiayi": "嘉義市" + "HsinchuCounty": "新竹縣", + "ChanghuaCounty": "彰化縣", + "YilanCounty": "宜蘭縣", + "Keelung": "基隆市" } }, + { + "name": "RouteName", + "in": "path", + "description": "繁體中文路線名稱,如'307'", + "required": true, + "type": "string" + }, { "name": "$select", "in": "query", @@ -1105,6 +1043,12 @@ "description": "跳過前幾筆", "type": "string" }, + { + "name": "$spatialFilter", + "in": "query", + "description": "空間過濾", + "type": "string" + }, { "name": "$format", "in": "query", @@ -1134,7 +1078,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/Service.DTO.Version2.Base.Operator" + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusA1Data" } } }, @@ -1147,14 +1091,14 @@ } } }, - "/v2/Bus/Route/City/{City}": { + "/v2/Bus/RealTimeNearStop/City/{City}": { "get": { "tags": [ "CityBus" ], - "summary": "取得指定[縣市]的市區公車路線資料", - "description": "市區公車之路線資料", - "operationId": "CityBusApi_Route", + "summary": "取得指定[縣市]的公車動態定點資料(A2)[批次更新]", + "description": "### 市區公車之定點資料(A2) ###\r\n- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html))", + "operationId": "CityBusApi_RealTimeNearStop", "consumes": [], "produces": [ "application/json", @@ -1192,28 +1136,28 @@ "LienchiangCounty" ], "x-enum": { - "ChanghuaCounty": "彰化縣", - "KinmenCounty": "金門縣", - "TaitungCounty": "臺東縣", - "LienchiangCounty": "連江縣", - "MiaoliCounty": "苗栗縣", - "HsinchuCounty": "新竹縣", - "PingtungCounty": "屏東縣", + "Taichung": "臺中市", "Chiayi": "嘉義市", "HualienCounty": "花蓮縣", - "Taoyuan": "桃園市", - "ChiayiCounty": "嘉義縣", "NantouCounty": "南投縣", - "Kaohsiung": "高雄市", + "ChanghuaCounty": "彰化縣", "Hsinchu": "新竹市", + "PenghuCounty": "澎湖縣", + "MiaoliCounty": "苗栗縣", "Taipei": "臺北市", - "YunlinCounty": "雲林縣", + "LienchiangCounty": "連江縣", + "Taoyuan": "桃園市", + "HsinchuCounty": "新竹縣", "NewTaipei": "新北市", - "YilanCounty": "宜蘭縣", - "PenghuCounty": "澎湖縣", "Keelung": "基隆市", - "Tainan": "臺南市", - "Taichung": "臺中市" + "PingtungCounty": "屏東縣", + "ChiayiCounty": "嘉義縣", + "Kaohsiung": "高雄市", + "YilanCounty": "宜蘭縣", + "KinmenCounty": "金門縣", + "YunlinCounty": "雲林縣", + "TaitungCounty": "臺東縣", + "Tainan": "臺南市" } }, { @@ -1276,7 +1220,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/Service.DTO.Version2.Bus.BusRoute" + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusA2Data" } } }, @@ -1289,14 +1233,14 @@ } } }, - "/v2/Bus/Route/City/{City}/{RouteName}": { + "/v2/Bus/RealTimeNearStop/City/{City}/{RouteName}": { "get": { "tags": [ "CityBus" ], - "summary": "取得指定[縣市],[路線名稱]的路線資料", - "description": "市區公車之路線資料", - "operationId": "CityBusApi_Route_1", + "summary": "取得指定[縣市],[路線名稱]的公車動態定點資料(A2)[批次更新]", + "description": "### 市區公車之定點資料(A2) ###\r\n- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html))", + "operationId": "CityBusApi_RealTimeNearStop_1", "consumes": [], "produces": [ "application/json", @@ -1334,28 +1278,28 @@ "LienchiangCounty" ], "x-enum": { - "ChanghuaCounty": "彰化縣", - "KinmenCounty": "金門縣", - "TaitungCounty": "臺東縣", - "LienchiangCounty": "連江縣", - "MiaoliCounty": "苗栗縣", - "HsinchuCounty": "新竹縣", - "PingtungCounty": "屏東縣", + "Taichung": "臺中市", "Chiayi": "嘉義市", "HualienCounty": "花蓮縣", - "Taoyuan": "桃園市", - "ChiayiCounty": "嘉義縣", "NantouCounty": "南投縣", - "Kaohsiung": "高雄市", + "ChanghuaCounty": "彰化縣", "Hsinchu": "新竹市", + "PenghuCounty": "澎湖縣", + "MiaoliCounty": "苗栗縣", "Taipei": "臺北市", - "YunlinCounty": "雲林縣", + "LienchiangCounty": "連江縣", + "Taoyuan": "桃園市", + "HsinchuCounty": "新竹縣", "NewTaipei": "新北市", - "YilanCounty": "宜蘭縣", - "PenghuCounty": "澎湖縣", "Keelung": "基隆市", - "Tainan": "臺南市", - "Taichung": "臺中市" + "PingtungCounty": "屏東縣", + "ChiayiCounty": "嘉義縣", + "Kaohsiung": "高雄市", + "YilanCounty": "宜蘭縣", + "KinmenCounty": "金門縣", + "YunlinCounty": "雲林縣", + "TaitungCounty": "臺東縣", + "Tainan": "臺南市" } }, { @@ -1425,7 +1369,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/Service.DTO.Version2.Bus.BusRoute" + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusA2Data" } } }, @@ -1438,14 +1382,14 @@ } } }, - "/v2/Bus/Stop/City/{City}": { + "/v2/Bus/EstimatedTimeOfArrival/City/{City}": { "get": { "tags": [ "CityBus" ], - "summary": "取得指定[縣市]的市區公車站牌資料", - "description": "市區公車之站牌資料", - "operationId": "CityBusApi_Stop", + "summary": "取得指定[縣市]的公車預估到站資料(N1)[批次更新]", + "description": " ### 市區公車之預估到站資料(N1) ###\r\n- [部分縣市] 當 StopStatus = 1(尚未發車) 且 EstimateTime > 0 (有值) 的情形, 屬正常情形, 雖目前尚未發車, 但提供EstimateTime值為預計多久後開始發車之時間。\r\n- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html))", + "operationId": "CityBusApi_EstimatedTimeOfArrival", "consumes": [], "produces": [ "application/json", @@ -1459,6 +1403,7 @@ "required": true, "type": "string", "enum": [ + "Taipei", "NewTaipei", "Taoyuan", "Taichung", @@ -1479,32 +1424,31 @@ "TaitungCounty", "KinmenCounty", "PenghuCounty", - "LienchiangCounty", - "Taipei" + "LienchiangCounty" ], "x-enum": { - "Hsinchu": "新竹市", - "HsinchuCounty": "新竹縣", - "Keelung": "基隆市", - "NewTaipei": "新北市", - "MiaoliCounty": "苗栗縣", - "YunlinCounty": "雲林縣", + "ChiayiCounty": "嘉義縣", "Taichung": "臺中市", - "YilanCounty": "宜蘭縣", - "LienchiangCounty": "連江縣", - "PenghuCounty": "澎湖縣", - "PingtungCounty": "屏東縣", + "HsinchuCounty": "新竹縣", "KinmenCounty": "金門縣", "Chiayi": "嘉義市", "NantouCounty": "南投縣", + "Kaohsiung": "高雄市", + "Taoyuan": "桃園市", + "LienchiangCounty": "連江縣", + "Hsinchu": "新竹市", + "MiaoliCounty": "苗栗縣", + "Keelung": "基隆市", + "ChanghuaCounty": "彰化縣", "HualienCounty": "花蓮縣", - "Tainan": "臺南市", "TaitungCounty": "臺東縣", - "ChiayiCounty": "嘉義縣", - "Taoyuan": "桃園市", + "YilanCounty": "宜蘭縣", "Taipei": "臺北市", - "Kaohsiung": "高雄市", - "ChanghuaCounty": "彰化縣" + "NewTaipei": "新北市", + "PingtungCounty": "屏東縣", + "PenghuCounty": "澎湖縣", + "YunlinCounty": "雲林縣", + "Tainan": "臺南市" } }, { @@ -1538,12 +1482,6 @@ "description": "跳過前幾筆", "type": "string" }, - { - "name": "$spatialFilter", - "in": "query", - "description": "空間過濾", - "type": "string" - }, { "name": "$format", "in": "query", @@ -1573,7 +1511,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/Service.DTO.Version2.Bus.BusStop" + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusN1EstimateTime" } } }, @@ -1586,14 +1524,14 @@ } } }, - "/v2/Bus/Station/City/{City}": { + "/v2/Bus/EstimatedTimeOfArrival/City/{City}/{RouteName}": { "get": { "tags": [ "CityBus" ], - "summary": "取得指定[縣市]的市區公車站位資料", - "description": "市區公車之各站牌所屬的站位資料", - "operationId": "CityBusApi_Station", + "summary": "取得指定[縣市],[路線名稱]的公車預估到站資料(N1)[批次更新]", + "description": " ### 市區公車之預估到站資料(N1) ###\r\n- [部分縣市] 當 StopStatus = 1(尚未發車) 且 EstimateTime > 0 (有值) 的情形, 屬正常情形, 雖目前尚未發車, 但提供EstimateTime值為預計多久後開始發車之時間。\r\n- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html))", + "operationId": "CityBusApi_EstimatedTimeOfArrival_1", "consumes": [], "produces": [ "application/json", @@ -1609,7 +1547,11 @@ "enum": [ "Taipei", "NewTaipei", + "Taoyuan", + "Taichung", + "Tainan", "Kaohsiung", + "Keelung", "Hsinchu", "HsinchuCounty", "MiaoliCounty", @@ -1622,29 +1564,1784 @@ "YilanCounty", "HualienCounty", "TaitungCounty", + "KinmenCounty", + "PenghuCounty", + "LienchiangCounty" + ], + "x-enum": { + "ChiayiCounty": "嘉義縣", + "Taichung": "臺中市", + "HsinchuCounty": "新竹縣", + "KinmenCounty": "金門縣", + "Chiayi": "嘉義市", + "NantouCounty": "南投縣", + "Kaohsiung": "高雄市", + "Taoyuan": "桃園市", + "LienchiangCounty": "連江縣", + "Hsinchu": "新竹市", + "MiaoliCounty": "苗栗縣", + "Keelung": "基隆市", + "ChanghuaCounty": "彰化縣", + "HualienCounty": "花蓮縣", + "TaitungCounty": "臺東縣", + "YilanCounty": "宜蘭縣", + "Taipei": "臺北市", + "NewTaipei": "新北市", + "PingtungCounty": "屏東縣", + "PenghuCounty": "澎湖縣", + "YunlinCounty": "雲林縣", + "Tainan": "臺南市" + } + }, + { + "name": "RouteName", + "in": "path", + "description": "繁體中文路線名稱,如'307'", + "required": true, + "type": "string" + }, + { + "name": "$select", + "in": "query", + "description": "挑選", + "type": "string" + }, + { + "name": "$filter", + "in": "query", + "description": "過濾", + "type": "string" + }, + { + "name": "$orderby", + "in": "query", + "description": "排序", + "type": "string" + }, + { + "name": "$top", + "in": "query", + "description": "取前幾筆", + "type": "integer", + "default": 30 + }, + { + "name": "$skip", + "in": "query", + "description": "跳過前幾筆", + "type": "string" + }, + { + "name": "$format", + "in": "query", + "description": "指定來源格式", + "required": true, + "type": "string", + "enum": [ + "JSON", + "XML" + ] + }, + { + "name": "health", + "in": "query", + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "required": false, + "type": "string", + "enum": [ + "true", + "false" + ] + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusN1EstimateTime" + } + } + }, + "299": { + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "schema": { + "$ref": "#/definitions/Service.DTO.Version3.Base.Health" + } + } + } + } + }, + "/v2/Bus/DataVersion/City/{City}": { + "get": { + "tags": [ + "CityBus" + ], + "summary": "取得指定[縣市]目前資料的最新版本資訊", + "description": "版本詳細資訊", + "operationId": "CityBusApi_DataVersion", + "consumes": [], + "produces": [ + "application/json", + "text/json", + "application/xml", + "text/xml" + ], + "parameters": [ + { + "name": "City", + "in": "path", + "description": "欲查詢縣市", + "required": true, + "type": "string", + "enum": [ + "Taipei", + "NewTaipei", + "Taoyuan", + "Taichung", + "Tainan", + "Kaohsiung", + "Keelung", + "Hsinchu", + "HsinchuCounty", + "MiaoliCounty", + "ChanghuaCounty", + "NantouCounty", + "YunlinCounty", + "ChiayiCounty", + "Chiayi", + "PingtungCounty", + "YilanCounty", + "HualienCounty", + "TaitungCounty", + "KinmenCounty", "PenghuCounty", - "Tainan" + "LienchiangCounty" + ], + "x-enum": { + "Chiayi": "嘉義市", + "MiaoliCounty": "苗栗縣", + "TaitungCounty": "臺東縣", + "PenghuCounty": "澎湖縣", + "Keelung": "基隆市", + "YilanCounty": "宜蘭縣", + "Kaohsiung": "高雄市", + "ChiayiCounty": "嘉義縣", + "LienchiangCounty": "連江縣", + "NewTaipei": "新北市", + "YunlinCounty": "雲林縣", + "Tainan": "臺南市", + "NantouCounty": "南投縣", + "Taichung": "臺中市", + "PingtungCounty": "屏東縣", + "Taoyuan": "桃園市", + "ChanghuaCounty": "彰化縣", + "HualienCounty": "花蓮縣", + "KinmenCounty": "金門縣", + "Taipei": "臺北市", + "Hsinchu": "新竹市", + "HsinchuCounty": "新竹縣" + } + }, + { + "name": "$format", + "in": "query", + "description": "指定來源格式", + "required": true, + "type": "string", + "enum": [ + "JSON", + "XML" + ] + }, + { + "name": "health", + "in": "query", + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "required": false, + "type": "string", + "enum": [ + "true", + "false" + ] + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusVersion" + } + }, + "299": { + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "schema": { + "$ref": "#/definitions/Service.DTO.Version3.Base.Health" + } + } + } + } + }, + "/v2/Bus/Operator/City/{City}": { + "get": { + "tags": [ + "CityBus" + ], + "summary": "取得指定[縣市]的市區公車營運業者資料", + "description": "市區公車之營運業者資料", + "operationId": "CityBusApi_Operator", + "consumes": [], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "name": "City", + "in": "path", + "description": "欲查詢縣市", + "required": true, + "type": "string", + "enum": [ + "Taipei", + "NewTaipei", + "Taoyuan", + "Taichung", + "Tainan", + "Kaohsiung", + "Keelung", + "Hsinchu", + "HsinchuCounty", + "MiaoliCounty", + "ChanghuaCounty", + "NantouCounty", + "YunlinCounty", + "ChiayiCounty", + "Chiayi", + "PingtungCounty", + "YilanCounty", + "HualienCounty", + "TaitungCounty", + "KinmenCounty", + "PenghuCounty", + "LienchiangCounty" + ], + "x-enum": { + "KinmenCounty": "金門縣", + "HsinchuCounty": "新竹縣", + "ChiayiCounty": "嘉義縣", + "Kaohsiung": "高雄市", + "ChanghuaCounty": "彰化縣", + "Hsinchu": "新竹市", + "LienchiangCounty": "連江縣", + "Taichung": "臺中市", + "Taoyuan": "桃園市", + "Chiayi": "嘉義市", + "Tainan": "臺南市", + "NewTaipei": "新北市", + "PingtungCounty": "屏東縣", + "TaitungCounty": "臺東縣", + "YilanCounty": "宜蘭縣", + "PenghuCounty": "澎湖縣", + "NantouCounty": "南投縣", + "YunlinCounty": "雲林縣", + "Taipei": "臺北市", + "Keelung": "基隆市", + "HualienCounty": "花蓮縣", + "MiaoliCounty": "苗栗縣" + } + }, + { + "name": "$select", + "in": "query", + "description": "挑選", + "type": "string" + }, + { + "name": "$filter", + "in": "query", + "description": "過濾", + "type": "string" + }, + { + "name": "$orderby", + "in": "query", + "description": "排序", + "type": "string" + }, + { + "name": "$top", + "in": "query", + "description": "取前幾筆", + "type": "integer", + "default": 30 + }, + { + "name": "$skip", + "in": "query", + "description": "跳過前幾筆", + "type": "string" + }, + { + "name": "$format", + "in": "query", + "description": "指定來源格式", + "required": true, + "type": "string", + "enum": [ + "JSON", + "XML" + ] + }, + { + "name": "health", + "in": "query", + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "required": false, + "type": "string", + "enum": [ + "true", + "false" + ] + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Service.DTO.Version2.Base.Operator" + } + } + }, + "299": { + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "schema": { + "$ref": "#/definitions/Service.DTO.Version3.Base.Health" + } + } + } + } + }, + "/v2/Bus/Route/City/{City}": { + "get": { + "tags": [ + "CityBus" + ], + "summary": "取得指定[縣市]的市區公車路線資料", + "description": "市區公車之路線資料", + "operationId": "CityBusApi_Route", + "consumes": [], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "name": "City", + "in": "path", + "description": "欲查詢縣市", + "required": true, + "type": "string", + "enum": [ + "Taipei", + "NewTaipei", + "Taoyuan", + "Taichung", + "Tainan", + "Kaohsiung", + "Keelung", + "Hsinchu", + "HsinchuCounty", + "MiaoliCounty", + "ChanghuaCounty", + "NantouCounty", + "YunlinCounty", + "ChiayiCounty", + "Chiayi", + "PingtungCounty", + "YilanCounty", + "HualienCounty", + "TaitungCounty", + "KinmenCounty", + "PenghuCounty", + "LienchiangCounty" + ], + "x-enum": { + "Taipei": "臺北市", + "ChiayiCounty": "嘉義縣", + "YunlinCounty": "雲林縣", + "NewTaipei": "新北市", + "YilanCounty": "宜蘭縣", + "KinmenCounty": "金門縣", + "NantouCounty": "南投縣", + "PenghuCounty": "澎湖縣", + "Chiayi": "嘉義市", + "MiaoliCounty": "苗栗縣", + "Taoyuan": "桃園市", + "PingtungCounty": "屏東縣", + "Taichung": "臺中市", + "TaitungCounty": "臺東縣", + "HualienCounty": "花蓮縣", + "Keelung": "基隆市", + "Hsinchu": "新竹市", + "Kaohsiung": "高雄市", + "HsinchuCounty": "新竹縣", + "LienchiangCounty": "連江縣", + "ChanghuaCounty": "彰化縣", + "Tainan": "臺南市" + } + }, + { + "name": "$select", + "in": "query", + "description": "挑選", + "type": "string" + }, + { + "name": "$filter", + "in": "query", + "description": "過濾", + "type": "string" + }, + { + "name": "$orderby", + "in": "query", + "description": "排序", + "type": "string" + }, + { + "name": "$top", + "in": "query", + "description": "取前幾筆", + "type": "integer", + "default": 30 + }, + { + "name": "$skip", + "in": "query", + "description": "跳過前幾筆", + "type": "string" + }, + { + "name": "$format", + "in": "query", + "description": "指定來源格式", + "required": true, + "type": "string", + "enum": [ + "JSON", + "XML" + ] + }, + { + "name": "health", + "in": "query", + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "required": false, + "type": "string", + "enum": [ + "true", + "false" + ] + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusRoute" + } + } + }, + "299": { + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "schema": { + "$ref": "#/definitions/Service.DTO.Version3.Base.Health" + } + } + } + } + }, + "/v2/Bus/Route/City/{City}/{RouteName}": { + "get": { + "tags": [ + "CityBus" + ], + "summary": "取得指定[縣市],[路線名稱]的路線資料", + "description": "市區公車之路線資料", + "operationId": "CityBusApi_Route_1", + "consumes": [], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "name": "City", + "in": "path", + "description": "欲查詢縣市", + "required": true, + "type": "string", + "enum": [ + "Taipei", + "NewTaipei", + "Taoyuan", + "Taichung", + "Tainan", + "Kaohsiung", + "Keelung", + "Hsinchu", + "HsinchuCounty", + "MiaoliCounty", + "ChanghuaCounty", + "NantouCounty", + "YunlinCounty", + "ChiayiCounty", + "Chiayi", + "PingtungCounty", + "YilanCounty", + "HualienCounty", + "TaitungCounty", + "KinmenCounty", + "PenghuCounty", + "LienchiangCounty" + ], + "x-enum": { + "Taipei": "臺北市", + "ChiayiCounty": "嘉義縣", + "YunlinCounty": "雲林縣", + "NewTaipei": "新北市", + "YilanCounty": "宜蘭縣", + "KinmenCounty": "金門縣", + "NantouCounty": "南投縣", + "PenghuCounty": "澎湖縣", + "Chiayi": "嘉義市", + "MiaoliCounty": "苗栗縣", + "Taoyuan": "桃園市", + "PingtungCounty": "屏東縣", + "Taichung": "臺中市", + "TaitungCounty": "臺東縣", + "HualienCounty": "花蓮縣", + "Keelung": "基隆市", + "Hsinchu": "新竹市", + "Kaohsiung": "高雄市", + "HsinchuCounty": "新竹縣", + "LienchiangCounty": "連江縣", + "ChanghuaCounty": "彰化縣", + "Tainan": "臺南市" + } + }, + { + "name": "RouteName", + "in": "path", + "description": "繁體中文路線名稱,如'307'", + "required": true, + "type": "string" + }, + { + "name": "$select", + "in": "query", + "description": "挑選", + "type": "string" + }, + { + "name": "$filter", + "in": "query", + "description": "過濾", + "type": "string" + }, + { + "name": "$orderby", + "in": "query", + "description": "排序", + "type": "string" + }, + { + "name": "$top", + "in": "query", + "description": "取前幾筆", + "type": "integer", + "default": 30 + }, + { + "name": "$skip", + "in": "query", + "description": "跳過前幾筆", + "type": "string" + }, + { + "name": "$format", + "in": "query", + "description": "指定來源格式", + "required": true, + "type": "string", + "enum": [ + "JSON", + "XML" + ] + }, + { + "name": "health", + "in": "query", + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "required": false, + "type": "string", + "enum": [ + "true", + "false" + ] + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusRoute" + } + } + }, + "299": { + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "schema": { + "$ref": "#/definitions/Service.DTO.Version3.Base.Health" + } + } + } + } + }, + "/v2/Bus/Stop/City/{City}": { + "get": { + "tags": [ + "CityBus" + ], + "summary": "取得指定[縣市]的市區公車站牌資料", + "description": "市區公車之站牌資料", + "operationId": "CityBusApi_Stop", + "consumes": [], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "name": "City", + "in": "path", + "description": "欲查詢縣市", + "required": true, + "type": "string", + "enum": [ + "NewTaipei", + "Taoyuan", + "Taichung", + "Tainan", + "Kaohsiung", + "Keelung", + "Hsinchu", + "HsinchuCounty", + "MiaoliCounty", + "ChanghuaCounty", + "NantouCounty", + "YunlinCounty", + "ChiayiCounty", + "Chiayi", + "PingtungCounty", + "YilanCounty", + "HualienCounty", + "TaitungCounty", + "KinmenCounty", + "PenghuCounty", + "LienchiangCounty", + "Taipei" + ], + "x-enum": { + "Chiayi": "嘉義市", + "NewTaipei": "新北市", + "PenghuCounty": "澎湖縣", + "NantouCounty": "南投縣", + "LienchiangCounty": "連江縣", + "Tainan": "臺南市", + "Kaohsiung": "高雄市", + "KinmenCounty": "金門縣", + "PingtungCounty": "屏東縣", + "HualienCounty": "花蓮縣", + "Keelung": "基隆市", + "YilanCounty": "宜蘭縣", + "HsinchuCounty": "新竹縣", + "Taoyuan": "桃園市", + "YunlinCounty": "雲林縣", + "ChiayiCounty": "嘉義縣", + "Hsinchu": "新竹市", + "Taipei": "臺北市", + "MiaoliCounty": "苗栗縣", + "Taichung": "臺中市", + "ChanghuaCounty": "彰化縣", + "TaitungCounty": "臺東縣" + } + }, + { + "name": "$select", + "in": "query", + "description": "挑選", + "type": "string" + }, + { + "name": "$filter", + "in": "query", + "description": "過濾", + "type": "string" + }, + { + "name": "$orderby", + "in": "query", + "description": "排序", + "type": "string" + }, + { + "name": "$top", + "in": "query", + "description": "取前幾筆", + "type": "integer", + "default": 30 + }, + { + "name": "$skip", + "in": "query", + "description": "跳過前幾筆", + "type": "string" + }, + { + "name": "$spatialFilter", + "in": "query", + "description": "空間過濾", + "type": "string" + }, + { + "name": "$format", + "in": "query", + "description": "指定來源格式", + "required": true, + "type": "string", + "enum": [ + "JSON", + "XML" + ] + }, + { + "name": "health", + "in": "query", + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "required": false, + "type": "string", + "enum": [ + "true", + "false" + ] + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusStop" + } + } + }, + "299": { + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "schema": { + "$ref": "#/definitions/Service.DTO.Version3.Base.Health" + } + } + } + } + }, + "/v2/Bus/Station/City/{City}": { + "get": { + "tags": [ + "CityBus" + ], + "summary": "取得指定[縣市]的市區公車站位資料", + "description": "市區公車之各站牌所屬的站位資料", + "operationId": "CityBusApi_Station", + "consumes": [], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "name": "City", + "in": "path", + "description": "欲查詢縣市", + "required": true, + "type": "string", + "enum": [ + "Taipei", + "NewTaipei", + "Kaohsiung", + "Hsinchu", + "HsinchuCounty", + "MiaoliCounty", + "ChanghuaCounty", + "NantouCounty", + "YunlinCounty", + "ChiayiCounty", + "Chiayi", + "PingtungCounty", + "YilanCounty", + "HualienCounty", + "TaitungCounty", + "PenghuCounty", + "Tainan", + "KinmenCounty" + ], + "x-enum": { + "YilanCounty": "宜蘭縣", + "PingtungCounty": "屏東縣", + "TaitungCounty": "臺東縣", + "Taipei": "臺北市", + "MiaoliCounty": "苗栗縣", + "YunlinCounty": "雲林縣", + "Tainan": "臺南市", + "HsinchuCounty": "新竹縣", + "NantouCounty": "南投縣", + "Hsinchu": "新竹市", + "PenghuCounty": "澎湖縣", + "Chiayi": "嘉義市", + "KinmenCounty": "金門縣", + "Kaohsiung": "高雄市", + "ChiayiCounty": "嘉義縣", + "NewTaipei": "新北市", + "ChanghuaCounty": "彰化縣", + "HualienCounty": "花蓮縣" + } + }, + { + "name": "$select", + "in": "query", + "description": "挑選", + "type": "string" + }, + { + "name": "$filter", + "in": "query", + "description": "過濾", + "type": "string" + }, + { + "name": "$orderby", + "in": "query", + "description": "排序", + "type": "string" + }, + { + "name": "$top", + "in": "query", + "description": "取前幾筆", + "type": "integer", + "default": 30 + }, + { + "name": "$skip", + "in": "query", + "description": "跳過前幾筆", + "type": "string" + }, + { + "name": "$spatialFilter", + "in": "query", + "description": "空間過濾", + "type": "string" + }, + { + "name": "$format", + "in": "query", + "description": "指定來源格式", + "required": true, + "type": "string", + "enum": [ + "JSON", + "XML" + ] + }, + { + "name": "health", + "in": "query", + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "required": false, + "type": "string", + "enum": [ + "true", + "false" + ] + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusStation" + } + } + }, + "299": { + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "schema": { + "$ref": "#/definitions/Service.DTO.Version3.Base.Health" + } + } + } + } + }, + "/v2/Bus/StationName/City/{City}": { + "get": { + "tags": [ + "CityBus" + ], + "summary": "取得指定[縣市]的市區公車站名碼資料", + "description": "市區公車之各站牌所屬的站名碼資料", + "operationId": "CityBusApi_StationName", + "consumes": [], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "name": "City", + "in": "path", + "description": "欲查詢縣市", + "required": true, + "type": "string", + "enum": [ + "Hsinchu", + "HsinchuCounty", + "MiaoliCounty", + "ChanghuaCounty", + "NantouCounty", + "YunlinCounty", + "ChiayiCounty", + "Chiayi", + "PingtungCounty", + "YilanCounty", + "HualienCounty", + "TaitungCounty", + "PenghuCounty" + ], + "x-enum": { + "HsinchuCounty": "新竹縣", + "YilanCounty": "宜蘭縣", + "ChiayiCounty": "嘉義縣", + "NantouCounty": "南投縣", + "TaitungCounty": "臺東縣", + "YunlinCounty": "雲林縣", + "PenghuCounty": "澎湖縣", + "MiaoliCounty": "苗栗縣", + "ChanghuaCounty": "彰化縣", + "Hsinchu": "新竹市", + "HualienCounty": "花蓮縣", + "PingtungCounty": "屏東縣", + "Chiayi": "嘉義市" + } + }, + { + "name": "$select", + "in": "query", + "description": "挑選", + "type": "string" + }, + { + "name": "$filter", + "in": "query", + "description": "過濾", + "type": "string" + }, + { + "name": "$orderby", + "in": "query", + "description": "排序", + "type": "string" + }, + { + "name": "$top", + "in": "query", + "description": "取前幾筆", + "type": "integer", + "default": 30 + }, + { + "name": "$skip", + "in": "query", + "description": "跳過前幾筆", + "type": "string" + }, + { + "name": "$spatialFilter", + "in": "query", + "description": "空間過濾", + "type": "string" + }, + { + "name": "$format", + "in": "query", + "description": "指定來源格式", + "required": true, + "type": "string", + "enum": [ + "JSON", + "XML" + ] + }, + { + "name": "health", + "in": "query", + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "required": false, + "type": "string", + "enum": [ + "true", + "false" + ] + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusStationName" + } + } + }, + "299": { + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "schema": { + "$ref": "#/definitions/Service.DTO.Version3.Base.Health" + } + } + } + } + }, + "/v2/Bus/DisplayStopOfRoute/City/{City}": { + "get": { + "tags": [ + "CityBus" + ], + "summary": "取得指定[縣市]的市區公車顯示用路線站序資料", + "description": "市區公車之顯示用路線站序資料,僅台北市與新北市可查詢", + "operationId": "CityBusApi_DisplayStopOfRoute", + "consumes": [], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "name": "City", + "in": "path", + "description": "欲查詢縣市", + "required": true, + "type": "string", + "enum": [ + "Taipei", + "Tainan", + "NewTaipei" + ], + "x-enum": { + "Taipei": "臺北市", + "Tainan": "臺南市", + "NewTaipei": "新北市" + } + }, + { + "name": "$select", + "in": "query", + "description": "挑選", + "type": "string" + }, + { + "name": "$filter", + "in": "query", + "description": "過濾", + "type": "string" + }, + { + "name": "$orderby", + "in": "query", + "description": "排序", + "type": "string" + }, + { + "name": "$top", + "in": "query", + "description": "取前幾筆", + "type": "integer", + "default": 30 + }, + { + "name": "$skip", + "in": "query", + "description": "跳過前幾筆", + "type": "string" + }, + { + "name": "$format", + "in": "query", + "description": "指定來源格式", + "required": true, + "type": "string", + "enum": [ + "JSON", + "XML" + ] + }, + { + "name": "health", + "in": "query", + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "required": false, + "type": "string", + "enum": [ + "true", + "false" + ] + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusDisplayStopOfRoute" + } + } + }, + "299": { + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "schema": { + "$ref": "#/definitions/Service.DTO.Version3.Base.Health" + } + } + } + } + }, + "/v2/Bus/DisplayStopOfRoute/City/{City}/{RouteName}": { + "get": { + "tags": [ + "CityBus" + ], + "summary": "取得指定[縣市],[路線名稱]的市區公車顯示用路線站序資料", + "description": "市區公車之顯示用路線站序資料,僅台北市與新北市可查詢", + "operationId": "CityBusApi_DisplayStopOfRoute_1", + "consumes": [], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "name": "City", + "in": "path", + "description": "欲查詢縣市", + "required": true, + "type": "string", + "enum": [ + "Taipei", + "Tainan", + "NewTaipei" + ], + "x-enum": { + "Taipei": "臺北市", + "Tainan": "臺南市", + "NewTaipei": "新北市" + } + }, + { + "name": "RouteName", + "in": "path", + "description": "繁體中文路線名稱,如'307'", + "required": true, + "type": "string" + }, + { + "name": "$select", + "in": "query", + "description": "挑選", + "type": "string" + }, + { + "name": "$filter", + "in": "query", + "description": "過濾", + "type": "string" + }, + { + "name": "$orderby", + "in": "query", + "description": "排序", + "type": "string" + }, + { + "name": "$top", + "in": "query", + "description": "取前幾筆", + "type": "integer", + "default": 30 + }, + { + "name": "$skip", + "in": "query", + "description": "跳過前幾筆", + "type": "string" + }, + { + "name": "$format", + "in": "query", + "description": "指定來源格式", + "required": true, + "type": "string", + "enum": [ + "JSON", + "XML" + ] + }, + { + "name": "health", + "in": "query", + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "required": false, + "type": "string", + "enum": [ + "true", + "false" + ] + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusDisplayStopOfRoute" + } + } + }, + "299": { + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "schema": { + "$ref": "#/definitions/Service.DTO.Version3.Base.Health" + } + } + } + } + }, + "/v2/Bus/StopOfRoute/City/{City}": { + "get": { + "tags": [ + "CityBus" + ], + "summary": "取得指定[縣市]的市區公車路線站序資料", + "description": "市區公車之路線站序資料", + "operationId": "CityBusApi_StopOfRoute", + "consumes": [], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "name": "City", + "in": "path", + "description": "欲查詢縣市", + "required": true, + "type": "string", + "enum": [ + "Taipei", + "NewTaipei", + "Taoyuan", + "Taichung", + "Tainan", + "Kaohsiung", + "Keelung", + "Hsinchu", + "HsinchuCounty", + "MiaoliCounty", + "ChanghuaCounty", + "NantouCounty", + "YunlinCounty", + "ChiayiCounty", + "Chiayi", + "PingtungCounty", + "YilanCounty", + "HualienCounty", + "TaitungCounty", + "KinmenCounty", + "PenghuCounty", + "LienchiangCounty" + ], + "x-enum": { + "Taichung": "臺中市", + "KinmenCounty": "金門縣", + "MiaoliCounty": "苗栗縣", + "ChiayiCounty": "嘉義縣", + "HsinchuCounty": "新竹縣", + "NewTaipei": "新北市", + "Chiayi": "嘉義市", + "Hsinchu": "新竹市", + "PingtungCounty": "屏東縣", + "Taoyuan": "桃園市", + "TaitungCounty": "臺東縣", + "YilanCounty": "宜蘭縣", + "YunlinCounty": "雲林縣", + "HualienCounty": "花蓮縣", + "Keelung": "基隆市", + "LienchiangCounty": "連江縣", + "ChanghuaCounty": "彰化縣", + "Kaohsiung": "高雄市", + "Taipei": "臺北市", + "NantouCounty": "南投縣", + "PenghuCounty": "澎湖縣", + "Tainan": "臺南市" + } + }, + { + "name": "$select", + "in": "query", + "description": "挑選", + "type": "string" + }, + { + "name": "$filter", + "in": "query", + "description": "過濾", + "type": "string" + }, + { + "name": "$orderby", + "in": "query", + "description": "排序", + "type": "string" + }, + { + "name": "$top", + "in": "query", + "description": "取前幾筆", + "type": "integer", + "default": 30 + }, + { + "name": "$skip", + "in": "query", + "description": "跳過前幾筆", + "type": "string" + }, + { + "name": "$format", + "in": "query", + "description": "指定來源格式", + "required": true, + "type": "string", + "enum": [ + "JSON", + "XML" + ] + }, + { + "name": "health", + "in": "query", + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "required": false, + "type": "string", + "enum": [ + "true", + "false" + ] + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusStopOfRoute" + } + } + }, + "299": { + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "schema": { + "$ref": "#/definitions/Service.DTO.Version3.Base.Health" + } + } + } + } + }, + "/v2/Bus/StopOfRoute/City/{City}/{RouteName}": { + "get": { + "tags": [ + "CityBus" + ], + "summary": "取得指定[縣市],[路線名稱]的市區公車路線站序資料", + "description": "市區公車之路線站序資料", + "operationId": "CityBusApi_StopOfRoute_1", + "consumes": [], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "name": "City", + "in": "path", + "description": "欲查詢縣市", + "required": true, + "type": "string", + "enum": [ + "Taipei", + "NewTaipei", + "Taoyuan", + "Taichung", + "Tainan", + "Kaohsiung", + "Keelung", + "Hsinchu", + "HsinchuCounty", + "MiaoliCounty", + "ChanghuaCounty", + "NantouCounty", + "YunlinCounty", + "ChiayiCounty", + "Chiayi", + "PingtungCounty", + "YilanCounty", + "HualienCounty", + "TaitungCounty", + "KinmenCounty", + "PenghuCounty", + "LienchiangCounty" + ], + "x-enum": { + "Taichung": "臺中市", + "KinmenCounty": "金門縣", + "MiaoliCounty": "苗栗縣", + "ChiayiCounty": "嘉義縣", + "HsinchuCounty": "新竹縣", + "NewTaipei": "新北市", + "Chiayi": "嘉義市", + "Hsinchu": "新竹市", + "PingtungCounty": "屏東縣", + "Taoyuan": "桃園市", + "TaitungCounty": "臺東縣", + "YilanCounty": "宜蘭縣", + "YunlinCounty": "雲林縣", + "HualienCounty": "花蓮縣", + "Keelung": "基隆市", + "LienchiangCounty": "連江縣", + "ChanghuaCounty": "彰化縣", + "Kaohsiung": "高雄市", + "Taipei": "臺北市", + "NantouCounty": "南投縣", + "PenghuCounty": "澎湖縣", + "Tainan": "臺南市" + } + }, + { + "name": "RouteName", + "in": "path", + "description": "繁體中文路線名稱,如'307'", + "required": true, + "type": "string" + }, + { + "name": "$select", + "in": "query", + "description": "挑選", + "type": "string" + }, + { + "name": "$filter", + "in": "query", + "description": "過濾", + "type": "string" + }, + { + "name": "$orderby", + "in": "query", + "description": "排序", + "type": "string" + }, + { + "name": "$top", + "in": "query", + "description": "取前幾筆", + "type": "integer", + "default": 30 + }, + { + "name": "$skip", + "in": "query", + "description": "跳過前幾筆", + "type": "string" + }, + { + "name": "$format", + "in": "query", + "description": "指定來源格式", + "required": true, + "type": "string", + "enum": [ + "JSON", + "XML" + ] + }, + { + "name": "health", + "in": "query", + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "required": false, + "type": "string", + "enum": [ + "true", + "false" + ] + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusStopOfRoute" + } + } + }, + "299": { + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "schema": { + "$ref": "#/definitions/Service.DTO.Version3.Base.Health" + } + } + } + } + }, + "/v2/Bus/Schedule/City/{City}": { + "get": { + "tags": [ + "CityBus" + ], + "summary": "取得指定[縣市]的市區公車路線班表資料", + "description": "市區公車之班表及班距資料。一般市區公車班次較多時會採用【班距】式時刻表;班次較少時會採用【班表】式時刻表", + "operationId": "CityBusApi_Schedule", + "consumes": [], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "name": "City", + "in": "path", + "description": "欲查詢縣市", + "required": true, + "type": "string", + "enum": [ + "Taipei", + "NewTaipei", + "Tainan", + "Keelung", + "Hsinchu", + "HsinchuCounty", + "MiaoliCounty", + "ChanghuaCounty", + "NantouCounty", + "YunlinCounty", + "ChiayiCounty", + "Chiayi", + "PingtungCounty", + "YilanCounty", + "HualienCounty", + "TaitungCounty", + "KinmenCounty", + "PenghuCounty" + ], + "x-enum": { + "KinmenCounty": "金門縣", + "MiaoliCounty": "苗栗縣", + "HsinchuCounty": "新竹縣", + "YunlinCounty": "雲林縣", + "ChanghuaCounty": "彰化縣", + "HualienCounty": "花蓮縣", + "Taipei": "臺北市", + "Hsinchu": "新竹市", + "ChiayiCounty": "嘉義縣", + "TaitungCounty": "臺東縣", + "NantouCounty": "南投縣", + "YilanCounty": "宜蘭縣", + "NewTaipei": "新北市", + "Chiayi": "嘉義市", + "Keelung": "基隆市", + "Tainan": "臺南市", + "PingtungCounty": "屏東縣", + "PenghuCounty": "澎湖縣" + } + }, + { + "name": "$select", + "in": "query", + "description": "挑選", + "type": "string" + }, + { + "name": "$filter", + "in": "query", + "description": "過濾", + "type": "string" + }, + { + "name": "$orderby", + "in": "query", + "description": "排序", + "type": "string" + }, + { + "name": "$top", + "in": "query", + "description": "取前幾筆", + "type": "integer", + "default": 30 + }, + { + "name": "$skip", + "in": "query", + "description": "跳過前幾筆", + "type": "string" + }, + { + "name": "$format", + "in": "query", + "description": "指定來源格式", + "required": true, + "type": "string", + "enum": [ + "JSON", + "XML" + ] + }, + { + "name": "health", + "in": "query", + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "required": false, + "type": "string", + "enum": [ + "true", + "false" + ] + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusSchedule" + } + } + }, + "299": { + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "schema": { + "$ref": "#/definitions/Service.DTO.Version3.Base.Health" + } + } + } + } + }, + "/v2/Bus/Schedule/City/{City}/{RouteName}": { + "get": { + "tags": [ + "CityBus" + ], + "summary": "取得指定[縣市],[路線名稱]的市區公車路線班表資料", + "description": "市區公車之預定班表及班距資料。一般市區公車班次較多時會採用【班距】式時刻表;班次較少時會採用【班表】式時刻表", + "operationId": "CityBusApi_Schedule_1", + "consumes": [], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "name": "City", + "in": "path", + "description": "欲查詢縣市", + "required": true, + "type": "string", + "enum": [ + "Taipei", + "NewTaipei", + "Tainan", + "Keelung", + "Hsinchu", + "HsinchuCounty", + "MiaoliCounty", + "ChanghuaCounty", + "NantouCounty", + "YunlinCounty", + "ChiayiCounty", + "Chiayi", + "PingtungCounty", + "YilanCounty", + "HualienCounty", + "TaitungCounty", + "KinmenCounty", + "PenghuCounty" ], "x-enum": { - "Chiayi": "嘉義市", - "HsinchuCounty": "新竹縣", - "Kaohsiung": "高雄市", - "PingtungCounty": "屏東縣", - "TaitungCounty": "臺東縣", - "HualienCounty": "花蓮縣", - "NantouCounty": "南投縣", + "KinmenCounty": "金門縣", "MiaoliCounty": "苗栗縣", + "HsinchuCounty": "新竹縣", "YunlinCounty": "雲林縣", - "PenghuCounty": "澎湖縣", - "YilanCounty": "宜蘭縣", "ChanghuaCounty": "彰化縣", + "HualienCounty": "花蓮縣", "Taipei": "臺北市", + "Hsinchu": "新竹市", + "ChiayiCounty": "嘉義縣", + "TaitungCounty": "臺東縣", + "NantouCounty": "南投縣", + "YilanCounty": "宜蘭縣", "NewTaipei": "新北市", + "Chiayi": "嘉義市", + "Keelung": "基隆市", "Tainan": "臺南市", - "Hsinchu": "新竹市", - "ChiayiCounty": "嘉義縣" + "PingtungCounty": "屏東縣", + "PenghuCounty": "澎湖縣" } }, + { + "name": "RouteName", + "in": "path", + "description": "繁體中文路線名稱,如'307'", + "required": true, + "type": "string" + }, { "name": "$select", "in": "query", @@ -1676,12 +3373,6 @@ "description": "跳過前幾筆", "type": "string" }, - { - "name": "$spatialFilter", - "in": "query", - "description": "空間過濾", - "type": "string" - }, { "name": "$format", "in": "query", @@ -1711,7 +3402,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/Service.DTO.Version2.Bus.BusStation" + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusSchedule" } } }, @@ -1724,14 +3415,14 @@ } } }, - "/v2/Bus/StationName/City/{City}": { + "/v2/Bus/Vehicle/City/{City}": { "get": { "tags": [ "CityBus" ], - "summary": "取得指定[縣市]的市區公車站名碼資料", - "description": "市區公車之各站牌所屬的站名碼資料", - "operationId": "CityBusApi_StationName", + "summary": "取得指定[縣市]的市區公車車輛資料", + "description": "市區公車之車輛資料", + "operationId": "CityBusApi_Vehicle", "consumes": [], "produces": [ "application/json", @@ -1745,6 +3436,13 @@ "required": true, "type": "string", "enum": [ + "Taipei", + "NewTaipei", + "Taoyuan", + "Taichung", + "Tainan", + "Kaohsiung", + "Keelung", "Hsinchu", "HsinchuCounty", "MiaoliCounty", @@ -1752,27 +3450,37 @@ "NantouCounty", "YunlinCounty", "ChiayiCounty", - "Chiayi", "PingtungCounty", "YilanCounty", "HualienCounty", "TaitungCounty", - "PenghuCounty" + "KinmenCounty", + "PenghuCounty", + "LienchiangCounty" ], "x-enum": { - "NantouCounty": "南投縣", - "HsinchuCounty": "新竹縣", - "PenghuCounty": "澎湖縣", - "Chiayi": "嘉義市", - "ChanghuaCounty": "彰化縣", - "YilanCounty": "宜蘭縣", + "Hsinchu": "新竹市", + "MiaoliCounty": "苗栗縣", "HualienCounty": "花蓮縣", + "Taipei": "臺北市", "ChiayiCounty": "嘉義縣", - "MiaoliCounty": "苗栗縣", - "Hsinchu": "新竹市", + "Taoyuan": "桃園市", + "HsinchuCounty": "新竹縣", + "Tainan": "臺南市", "TaitungCounty": "臺東縣", + "NantouCounty": "南投縣", + "PingtungCounty": "屏東縣", + "Keelung": "基隆市", + "ChanghuaCounty": "彰化縣", + "NewTaipei": "新北市", + "KinmenCounty": "金門縣", + "Kaohsiung": "高雄市", "YunlinCounty": "雲林縣", - "PingtungCounty": "屏東縣" + "LienchiangCounty": "連江縣", + "YilanCounty": "宜蘭縣", + "Chiayi": "嘉義市", + "PenghuCounty": "澎湖縣", + "Taichung": "臺中市" } }, { @@ -1806,12 +3514,6 @@ "description": "跳過前幾筆", "type": "string" }, - { - "name": "$spatialFilter", - "in": "query", - "description": "空間過濾", - "type": "string" - }, { "name": "$format", "in": "query", @@ -1841,7 +3543,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/Service.DTO.Version2.Bus.BusStationName" + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusVehicleInfo" } } }, @@ -1854,14 +3556,14 @@ } } }, - "/v2/Bus/DisplayStopOfRoute/City/{City}": { + "/v2/Bus/Shape/City/{City}": { "get": { "tags": [ "CityBus" ], - "summary": "取得指定[縣市]的市區公車顯示用路線站序資料", - "description": "市區公車之顯示用路線站序資料,僅台北市與新北市可查詢", - "operationId": "CityBusApi_DisplayStopOfRoute", + "summary": "取得指定[縣市]的市區公車線型資料", + "description": "市區公車之線型資料", + "operationId": "CityBusApi_Shape", "consumes": [], "produces": [ "application/json", @@ -1876,13 +3578,23 @@ "type": "string", "enum": [ "Taipei", + "NewTaipei", + "Taoyuan", + "Taichung", "Tainan", - "NewTaipei" + "Kaohsiung", + "Keelung", + "KinmenCounty" ], "x-enum": { + "Taoyuan": "桃園市", "NewTaipei": "新北市", - "Taipei": "臺北市", - "Tainan": "臺南市" + "Taichung": "臺中市", + "Tainan": "臺南市", + "KinmenCounty": "金門縣", + "Keelung": "基隆市", + "Kaohsiung": "高雄市", + "Taipei": "臺北市" } }, { @@ -1945,7 +3657,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/Service.DTO.Version2.Bus.BusDisplayStopOfRoute" + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusShape" } } }, @@ -1958,14 +3670,14 @@ } } }, - "/v2/Bus/DisplayStopOfRoute/City/{City}/{RouteName}": { + "/v2/Bus/Shape/City/{City}/{RouteName}": { "get": { "tags": [ "CityBus" ], - "summary": "取得指定[縣市],[路線名稱]的市區公車顯示用路線站序資料", - "description": "市區公車之顯示用路線站序資料,僅台北市與新北市可查詢", - "operationId": "CityBusApi_DisplayStopOfRoute_1", + "summary": "取得指定[縣市],[路線名稱]的市區公車線型資料", + "description": "市區公車之線型資料", + "operationId": "CityBusApi_Shape_1", "consumes": [], "produces": [ "application/json", @@ -1980,13 +3692,23 @@ "type": "string", "enum": [ "Taipei", + "NewTaipei", + "Taoyuan", + "Taichung", "Tainan", - "NewTaipei" + "Kaohsiung", + "Keelung", + "KinmenCounty" ], "x-enum": { + "Taoyuan": "桃園市", "NewTaipei": "新北市", - "Taipei": "臺北市", - "Tainan": "臺南市" + "Taichung": "臺中市", + "Tainan": "臺南市", + "KinmenCounty": "金門縣", + "Keelung": "基隆市", + "Kaohsiung": "高雄市", + "Taipei": "臺北市" } }, { @@ -2056,7 +3778,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/Service.DTO.Version2.Bus.BusDisplayStopOfRoute" + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusShape" } } }, @@ -2069,14 +3791,14 @@ } } }, - "/v2/Bus/StopOfRoute/City/{City}": { + "/v2/Bus/RouteFare/City/{City}": { "get": { "tags": [ "CityBus" ], - "summary": "取得指定[縣市]的市區公車路線站序資料", - "description": "市區公車之路線站序資料", - "operationId": "CityBusApi_StopOfRoute", + "summary": "取得指定[縣市]的市區公車路線票價資料", + "description": "市區公車路線票價資料", + "operationId": "CityBusApi_RouteFare", "consumes": [], "produces": [ "application/json", @@ -2090,13 +3812,6 @@ "required": true, "type": "string", "enum": [ - "Taipei", - "NewTaipei", - "Taoyuan", - "Taichung", - "Tainan", - "Kaohsiung", - "Keelung", "Hsinchu", "HsinchuCounty", "MiaoliCounty", @@ -2108,34 +3823,31 @@ "PingtungCounty", "YilanCounty", "HualienCounty", - "TaitungCounty", - "KinmenCounty", - "PenghuCounty", - "LienchiangCounty" + "TaitungCounty" ], "x-enum": { + "MiaoliCounty": "苗栗縣", + "KinmenCounty": "金門縣", + "HsinchuCounty": "新竹縣", + "Taoyuan": "桃園市", + "Kaohsiung": "高雄市", + "NewTaipei": "新北市", + "PenghuCounty": "澎湖縣", "PingtungCounty": "屏東縣", - "Tainan": "臺南市", - "Keelung": "基隆市", - "Chiayi": "嘉義市", + "ChanghuaCounty": "彰化縣", "ChiayiCounty": "嘉義縣", - "LienchiangCounty": "連江縣", + "Taichung": "臺中市", "Taipei": "臺北市", - "TaitungCounty": "臺東縣", - "YilanCounty": "宜蘭縣", - "ChanghuaCounty": "彰化縣", - "PenghuCounty": "澎湖縣", - "Taoyuan": "桃園市", "YunlinCounty": "雲林縣", - "Kaohsiung": "高雄市", - "MiaoliCounty": "苗栗縣", + "YilanCounty": "宜蘭縣", + "LienchiangCounty": "連江縣", + "Tainan": "臺南市", + "Keelung": "基隆市", + "TaitungCounty": "臺東縣", + "Chiayi": "嘉義市", "HualienCounty": "花蓮縣", - "Hsinchu": "新竹市", - "KinmenCounty": "金門縣", "NantouCounty": "南投縣", - "HsinchuCounty": "新竹縣", - "NewTaipei": "新北市", - "Taichung": "臺中市" + "Hsinchu": "新竹市" } }, { @@ -2198,7 +3910,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/Service.DTO.Version2.Bus.BusStopOfRoute" + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusRouteFare" } } }, @@ -2211,14 +3923,14 @@ } } }, - "/v2/Bus/StopOfRoute/City/{City}/{RouteName}": { + "/v2/Bus/RouteFare/City/{City}/{RouteName}": { "get": { "tags": [ "CityBus" ], - "summary": "取得指定[縣市],[路線名稱]的市區公車路線站序資料", - "description": "市區公車之路線站序資料", - "operationId": "CityBusApi_StopOfRoute_1", + "summary": "取得指定[縣市],[路線名稱]的的市區公車路線票價資料", + "description": "市區公車路線票價資料", + "operationId": "CityBusApi_RouteFare_1", "consumes": [], "produces": [ "application/json", @@ -2232,13 +3944,6 @@ "required": true, "type": "string", "enum": [ - "Taipei", - "NewTaipei", - "Taoyuan", - "Taichung", - "Tainan", - "Kaohsiung", - "Keelung", "Hsinchu", "HsinchuCounty", "MiaoliCounty", @@ -2250,34 +3955,31 @@ "PingtungCounty", "YilanCounty", "HualienCounty", - "TaitungCounty", - "KinmenCounty", - "PenghuCounty", - "LienchiangCounty" + "TaitungCounty" ], "x-enum": { + "MiaoliCounty": "苗栗縣", + "KinmenCounty": "金門縣", + "HsinchuCounty": "新竹縣", + "Taoyuan": "桃園市", + "Kaohsiung": "高雄市", + "NewTaipei": "新北市", + "PenghuCounty": "澎湖縣", "PingtungCounty": "屏東縣", - "Tainan": "臺南市", - "Keelung": "基隆市", - "Chiayi": "嘉義市", + "ChanghuaCounty": "彰化縣", "ChiayiCounty": "嘉義縣", - "LienchiangCounty": "連江縣", + "Taichung": "臺中市", "Taipei": "臺北市", - "TaitungCounty": "臺東縣", - "YilanCounty": "宜蘭縣", - "ChanghuaCounty": "彰化縣", - "PenghuCounty": "澎湖縣", - "Taoyuan": "桃園市", "YunlinCounty": "雲林縣", - "Kaohsiung": "高雄市", - "MiaoliCounty": "苗栗縣", + "YilanCounty": "宜蘭縣", + "LienchiangCounty": "連江縣", + "Tainan": "臺南市", + "Keelung": "基隆市", + "TaitungCounty": "臺東縣", + "Chiayi": "嘉義市", "HualienCounty": "花蓮縣", - "Hsinchu": "新竹市", - "KinmenCounty": "金門縣", "NantouCounty": "南投縣", - "HsinchuCounty": "新竹縣", - "NewTaipei": "新北市", - "Taichung": "臺中市" + "Hsinchu": "新竹市" } }, { @@ -2347,7 +4049,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/Service.DTO.Version2.Bus.BusStopOfRoute" + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusRouteFare" } } }, @@ -2360,14 +4062,14 @@ } } }, - "/v2/Bus/Schedule/City/{City}": { + "/v2/Bus/News/City/{City}": { "get": { "tags": [ "CityBus" ], - "summary": "取得指定[縣市]的市區公車路線班表資料", - "description": "市區公車之班表及班距資料。一般市區公車班次較多時會採用【班距】式時刻表;班次較少時會採用【班表】式時刻表", - "operationId": "CityBusApi_Schedule", + "summary": "取得指定[縣市]的市區公車最新消息資料", + "description": "市區公車最新消息資料", + "operationId": "CityBusApi_News", "consumes": [], "produces": [ "application/json", @@ -2381,44 +4083,14 @@ "required": true, "type": "string", "enum": [ - "Taipei", - "NewTaipei", - "Tainan", "Keelung", - "Hsinchu", - "HsinchuCounty", - "MiaoliCounty", - "ChanghuaCounty", - "NantouCounty", - "YunlinCounty", - "ChiayiCounty", - "Chiayi", - "PingtungCounty", - "YilanCounty", - "HualienCounty", - "TaitungCounty", - "KinmenCounty", - "PenghuCounty" + "Tainan", + "KinmenCounty" ], "x-enum": { - "NantouCounty": "南投縣", - "YilanCounty": "宜蘭縣", - "Chiayi": "嘉義市", - "HsinchuCounty": "新竹縣", - "ChanghuaCounty": "彰化縣", - "NewTaipei": "新北市", - "KinmenCounty": "金門縣", - "TaitungCounty": "臺東縣", - "HualienCounty": "花蓮縣", "Tainan": "臺南市", - "Taipei": "臺北市", - "Keelung": "基隆市", - "MiaoliCounty": "苗栗縣", - "PingtungCounty": "屏東縣", - "Hsinchu": "新竹市", - "PenghuCounty": "澎湖縣", - "YunlinCounty": "雲林縣", - "ChiayiCounty": "嘉義縣" + "KinmenCounty": "金門縣", + "Keelung": "基隆市" } }, { @@ -2481,7 +4153,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/Service.DTO.Version2.Bus.BusSchedule" + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusNews" } } }, @@ -2494,14 +4166,14 @@ } } }, - "/v2/Bus/Schedule/City/{City}/{RouteName}": { + "/v2/Bus/StationGroup/City/{City}": { "get": { "tags": [ "CityBus" ], - "summary": "取得指定[縣市],[路線名稱]的市區公車路線班表資料", - "description": "市區公車之預定班表及班距資料。一般市區公車班次較多時會採用【班距】式時刻表;班次較少時會採用【班表】式時刻表", - "operationId": "CityBusApi_Schedule_1", + "summary": "取得指定[縣市]的市區公車組站位資料", + "description": "市區公車之各站牌所屬的組站位資料", + "operationId": "CityBusApi_StationGroup", "consumes": [], "produces": [ "application/json", @@ -2515,10 +4187,6 @@ "required": true, "type": "string", "enum": [ - "Taipei", - "NewTaipei", - "Tainan", - "Keelung", "Hsinchu", "HsinchuCounty", "MiaoliCounty", @@ -2531,37 +4199,24 @@ "YilanCounty", "HualienCounty", "TaitungCounty", - "KinmenCounty", "PenghuCounty" ], "x-enum": { + "PenghuCounty": "澎湖縣", + "TaitungCounty": "臺東縣", "NantouCounty": "南投縣", + "PingtungCounty": "屏東縣", + "MiaoliCounty": "苗栗縣", + "HualienCounty": "花蓮縣", + "YunlinCounty": "雲林縣", + "HsinchuCounty": "新竹縣", + "Hsinchu": "新竹市", "YilanCounty": "宜蘭縣", "Chiayi": "嘉義市", - "HsinchuCounty": "新竹縣", "ChanghuaCounty": "彰化縣", - "NewTaipei": "新北市", - "KinmenCounty": "金門縣", - "TaitungCounty": "臺東縣", - "HualienCounty": "花蓮縣", - "Tainan": "臺南市", - "Taipei": "臺北市", - "Keelung": "基隆市", - "MiaoliCounty": "苗栗縣", - "PingtungCounty": "屏東縣", - "Hsinchu": "新竹市", - "PenghuCounty": "澎湖縣", - "YunlinCounty": "雲林縣", "ChiayiCounty": "嘉義縣" } }, - { - "name": "RouteName", - "in": "path", - "description": "繁體中文路線名稱,如'307'", - "required": true, - "type": "string" - }, { "name": "$select", "in": "query", @@ -2593,6 +4248,12 @@ "description": "跳過前幾筆", "type": "string" }, + { + "name": "$spatialFilter", + "in": "query", + "description": "空間過濾", + "type": "string" + }, { "name": "$format", "in": "query", @@ -2622,7 +4283,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/Service.DTO.Version2.Bus.BusSchedule" + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusStationGroup" } } }, @@ -2635,74 +4296,20 @@ } } }, - "/v2/Bus/Vehicle/City/{City}": { + "/v2/Bus/RealTimeByFrequency/Streaming/InterCity": { "get": { "tags": [ - "CityBus" + "InterCityBus" ], - "summary": "取得指定[縣市]的市區公車車輛資料", - "description": "市區公車之車輛資料", - "operationId": "CityBusApi_Vehicle", + "summary": "取得公路客運的動態定時資料(A1)[逐筆更新]", + "description": "### 公路客運之定時資料(A1) ###\r\n- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html))", + "operationId": "InterCityBusApi_RealTimeByFrequency_UDP", "consumes": [], "produces": [ "application/json", "text/json" ], "parameters": [ - { - "name": "City", - "in": "path", - "description": "欲查詢縣市", - "required": true, - "type": "string", - "enum": [ - "Taipei", - "NewTaipei", - "Taoyuan", - "Taichung", - "Tainan", - "Kaohsiung", - "Keelung", - "Hsinchu", - "HsinchuCounty", - "MiaoliCounty", - "ChanghuaCounty", - "NantouCounty", - "YunlinCounty", - "ChiayiCounty", - "PingtungCounty", - "YilanCounty", - "HualienCounty", - "TaitungCounty", - "KinmenCounty", - "PenghuCounty", - "LienchiangCounty" - ], - "x-enum": { - "Chiayi": "嘉義市", - "Taipei": "臺北市", - "ChiayiCounty": "嘉義縣", - "Tainan": "臺南市", - "Kaohsiung": "高雄市", - "LienchiangCounty": "連江縣", - "Taichung": "臺中市", - "HsinchuCounty": "新竹縣", - "Keelung": "基隆市", - "Hsinchu": "新竹市", - "NantouCounty": "南投縣", - "PenghuCounty": "澎湖縣", - "NewTaipei": "新北市", - "KinmenCounty": "金門縣", - "Taoyuan": "桃園市", - "YilanCounty": "宜蘭縣", - "HualienCounty": "花蓮縣", - "YunlinCounty": "雲林縣", - "MiaoliCounty": "苗栗縣", - "TaitungCounty": "臺東縣", - "PingtungCounty": "屏東縣", - "ChanghuaCounty": "彰化縣" - } - }, { "name": "$select", "in": "query", @@ -2734,6 +4341,12 @@ "description": "跳過前幾筆", "type": "string" }, + { + "name": "$spatialFilter", + "in": "query", + "description": "空間過濾", + "type": "string" + }, { "name": "$format", "in": "query", @@ -2763,7 +4376,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/Service.DTO.Version2.Bus.BusVehicleInfo" + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusA1Data" } } }, @@ -2776,14 +4389,14 @@ } } }, - "/v2/Bus/Shape/City/{City}": { + "/v2/Bus/RealTimeByFrequency/Streaming/InterCity/{RouteName}": { "get": { "tags": [ - "CityBus" + "InterCityBus" ], - "summary": "取得指定[縣市]的市區公車線型資料", - "description": "市區公車之線型資料", - "operationId": "CityBusApi_Shape", + "summary": "取得指定[路線名稱]的公路客運動態定時資料(A1)[逐筆更新]", + "description": "### 公路客運之定時資料(A1) ###\r\n- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html))", + "operationId": "InterCityBusApi_RealTimeByFrequency_UDP_1", "consumes": [], "produces": [ "application/json", @@ -2791,31 +4404,11 @@ ], "parameters": [ { - "name": "City", + "name": "RouteName", "in": "path", - "description": "欲查詢縣市", + "description": "繁體中文路線名稱,如'9102'", "required": true, - "type": "string", - "enum": [ - "Taipei", - "NewTaipei", - "Taoyuan", - "Taichung", - "Tainan", - "Kaohsiung", - "Keelung", - "KinmenCounty" - ], - "x-enum": { - "Kaohsiung": "高雄市", - "NewTaipei": "新北市", - "Taichung": "臺中市", - "Taoyuan": "桃園市", - "Taipei": "臺北市", - "Keelung": "基隆市", - "KinmenCounty": "金門縣", - "Tainan": "臺南市" - } + "type": "string" }, { "name": "$select", @@ -2848,6 +4441,12 @@ "description": "跳過前幾筆", "type": "string" }, + { + "name": "$spatialFilter", + "in": "query", + "description": "空間過濾", + "type": "string" + }, { "name": "$format", "in": "query", @@ -2877,7 +4476,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/Service.DTO.Version2.Bus.BusShape" + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusA1Data" } } }, @@ -2890,54 +4489,20 @@ } } }, - "/v2/Bus/Shape/City/{City}/{RouteName}": { + "/v2/Bus/RealTimeNearStop/Streaming/InterCity": { "get": { "tags": [ - "CityBus" + "InterCityBus" ], - "summary": "取得指定[縣市],[路線名稱]的市區公車線型資料", - "description": "市區公車之線型資料", - "operationId": "CityBusApi_Shape_1", + "summary": "取得公路客運的動態定點資料(A2)[逐筆更新]", + "description": "### 公路客運之定點資料(A2) ###\r\n- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html))", + "operationId": "InterCityBusApi_RealTimeNearStop_UDP", "consumes": [], "produces": [ "application/json", "text/json" ], "parameters": [ - { - "name": "City", - "in": "path", - "description": "欲查詢縣市", - "required": true, - "type": "string", - "enum": [ - "Taipei", - "NewTaipei", - "Taoyuan", - "Taichung", - "Tainan", - "Kaohsiung", - "Keelung", - "KinmenCounty" - ], - "x-enum": { - "Kaohsiung": "高雄市", - "NewTaipei": "新北市", - "Taichung": "臺中市", - "Taoyuan": "桃園市", - "Taipei": "臺北市", - "Keelung": "基隆市", - "KinmenCounty": "金門縣", - "Tainan": "臺南市" - } - }, - { - "name": "RouteName", - "in": "path", - "description": "繁體中文路線名稱,如'307'", - "required": true, - "type": "string" - }, { "name": "$select", "in": "query", @@ -2998,7 +4563,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/Service.DTO.Version2.Bus.BusShape" + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusA2Data" } } }, @@ -3011,14 +4576,14 @@ } } }, - "/v2/Bus/RouteFare/City/{City}": { + "/v2/Bus/RealTimeNearStop/Streaming/InterCity/{RouteName}": { "get": { "tags": [ - "CityBus" + "InterCityBus" ], - "summary": "取得指定[縣市]的市區公車路線票價資料", - "description": "市區公車路線票價資料", - "operationId": "CityBusApi_RouteFare", + "summary": "取得指定[路線名稱]的公路客運動態定點資料(A2)[逐筆更新]", + "description": "### 公路客運之定點資料(A2) ###\r\n- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html))", + "operationId": "InterCityBusApi_RealTimeNearStop_UDP_1", "consumes": [], "produces": [ "application/json", @@ -3026,49 +4591,11 @@ ], "parameters": [ { - "name": "City", + "name": "RouteName", "in": "path", - "description": "欲查詢縣市", + "description": "繁體中文路線名稱,如'9102'", "required": true, - "type": "string", - "enum": [ - "Hsinchu", - "HsinchuCounty", - "MiaoliCounty", - "ChanghuaCounty", - "NantouCounty", - "YunlinCounty", - "ChiayiCounty", - "Chiayi", - "PingtungCounty", - "YilanCounty", - "HualienCounty", - "TaitungCounty" - ], - "x-enum": { - "PingtungCounty": "屏東縣", - "Tainan": "臺南市", - "NantouCounty": "南投縣", - "PenghuCounty": "澎湖縣", - "ChiayiCounty": "嘉義縣", - "YunlinCounty": "雲林縣", - "Chiayi": "嘉義市", - "Taipei": "臺北市", - "NewTaipei": "新北市", - "KinmenCounty": "金門縣", - "TaitungCounty": "臺東縣", - "LienchiangCounty": "連江縣", - "HualienCounty": "花蓮縣", - "YilanCounty": "宜蘭縣", - "HsinchuCounty": "新竹縣", - "Taichung": "臺中市", - "ChanghuaCounty": "彰化縣", - "Hsinchu": "新竹市", - "Kaohsiung": "高雄市", - "Keelung": "基隆市", - "Taoyuan": "桃園市", - "MiaoliCounty": "苗栗縣" - } + "type": "string" }, { "name": "$select", @@ -3130,7 +4657,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/Service.DTO.Version2.Bus.BusRouteFare" + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusA2Data" } } }, @@ -3143,72 +4670,20 @@ } } }, - "/v2/Bus/RouteFare/City/{City}/{RouteName}": { + "/v2/Bus/EstimatedTimeOfArrival/Streaming/InterCity": { "get": { "tags": [ - "CityBus" + "InterCityBus" ], - "summary": "取得指定[縣市],[路線名稱]的的市區公車路線票價資料", - "description": "市區公車路線票價資料", - "operationId": "CityBusApi_RouteFare_1", + "summary": "取得公路客運的預估到站資料(N1)[逐筆更新]", + "description": "### 公路客運之預估到站資料(N1) ###\r\n- 不保留[現在時間]超過[本平台資料更新時間]兩分鐘的資料\r\n- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html))\r\n- N1僅於該路線上有任一車輛離站時,來源端才會重新計算並發佈,因此使用者需自行處理時間遞減機制,或以EstimateTime-(收到資料時間-SrcTrasTime)(秒)作為實際預估抵達時間。", + "operationId": "InterCityBusApi_EstimatedTimeOfArrival_UDP", "consumes": [], "produces": [ "application/json", "text/json" ], "parameters": [ - { - "name": "City", - "in": "path", - "description": "欲查詢縣市", - "required": true, - "type": "string", - "enum": [ - "Hsinchu", - "HsinchuCounty", - "MiaoliCounty", - "ChanghuaCounty", - "NantouCounty", - "YunlinCounty", - "ChiayiCounty", - "Chiayi", - "PingtungCounty", - "YilanCounty", - "HualienCounty", - "TaitungCounty" - ], - "x-enum": { - "PingtungCounty": "屏東縣", - "Tainan": "臺南市", - "NantouCounty": "南投縣", - "PenghuCounty": "澎湖縣", - "ChiayiCounty": "嘉義縣", - "YunlinCounty": "雲林縣", - "Chiayi": "嘉義市", - "Taipei": "臺北市", - "NewTaipei": "新北市", - "KinmenCounty": "金門縣", - "TaitungCounty": "臺東縣", - "LienchiangCounty": "連江縣", - "HualienCounty": "花蓮縣", - "YilanCounty": "宜蘭縣", - "HsinchuCounty": "新竹縣", - "Taichung": "臺中市", - "ChanghuaCounty": "彰化縣", - "Hsinchu": "新竹市", - "Kaohsiung": "高雄市", - "Keelung": "基隆市", - "Taoyuan": "桃園市", - "MiaoliCounty": "苗栗縣" - } - }, - { - "name": "RouteName", - "in": "path", - "description": "繁體中文路線名稱,如'307'", - "required": true, - "type": "string" - }, { "name": "$select", "in": "query", @@ -3269,7 +4744,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/Service.DTO.Version2.Bus.BusRouteFare" + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusN1EstimateTime" } } }, @@ -3282,14 +4757,14 @@ } } }, - "/v2/Bus/News/City/{City}": { + "/v2/Bus/EstimatedTimeOfArrival/Streaming/InterCity/{RouteName}": { "get": { "tags": [ - "CityBus" + "InterCityBus" ], - "summary": "取得指定[縣市]的市區公車最新消息資料", - "description": "市區公車最新消息資料", - "operationId": "CityBusApi_News", + "summary": "取得指定[路線名稱]的公路客運預估到站資料(N1)[逐筆更新]", + "description": "### 公路客運之預估到站資料(N1) ###\r\n- 不保留[現在時間]超過[本平台資料更新時間]兩分鐘的資料\r\n- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html))\r\n- N1僅於該路線上有任一車輛離站時,來源端才會重新計算並發佈,因此使用者需自行處理時間遞減機制,或以EstimateTime-(收到資料時間-SrcTrasTime)(秒)作為實際預估抵達時間。", + "operationId": "InterCityBusApi_EstimatedTimeOfArrival_UDP_1", "consumes": [], "produces": [ "application/json", @@ -3297,19 +4772,11 @@ ], "parameters": [ { - "name": "City", + "name": "RouteName", "in": "path", - "description": "欲查詢縣市", + "description": "繁體中文路線名稱,如'9102'", "required": true, - "type": "string", - "enum": [ - "Keelung", - "Tainan" - ], - "x-enum": { - "Keelung": "基隆市", - "Tainan": "臺南市" - } + "type": "string" }, { "name": "$select", @@ -3371,7 +4838,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/Service.DTO.Version2.Bus.BusNews" + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusN1EstimateTime" } } }, @@ -3390,7 +4857,7 @@ "InterCityBus" ], "summary": "取得公路客運的動態定時資料(A1)[批次更新]", - "description": "### 公路客運之定時資料(A1) ###", + "description": "### 公路客運之定時資料(A1) ###\r\n- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html))", "operationId": "InterCityBusApi_RealTimeByFrequency", "consumes": [], "produces": [ @@ -3483,7 +4950,7 @@ "InterCityBus" ], "summary": "取得指定[路線名稱]的公路客運動態定時資料(A1)[批次更新]", - "description": "### 公路客運之定時資料(A1) ###", + "description": "### 公路客運之定時資料(A1) ###\r\n- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html))", "operationId": "InterCityBusApi_RealTimeByFrequency_1", "consumes": [], "produces": [ @@ -3583,8 +5050,8 @@ "InterCityBus" ], "summary": "取得公路客運的動態定點資料(A2)[批次更新]", - "description": "### 公路客運之定點資料(A2) ###\r\n公路客運動態定點資料(A2)\r\n- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/bus.html))", - "operationId": "InterCityBusApi_RealTimeNearStop_1", + "description": "### 公路客運之定點資料(A2) ###\r\n- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html))", + "operationId": "InterCityBusApi_RealTimeNearStop", "consumes": [], "produces": [ "application/json", @@ -3670,8 +5137,8 @@ "InterCityBus" ], "summary": "取得指定[路線名稱]的公路客運動態定點資料(A2)[批次更新]", - "description": "### 公路客運之定點資料(A2) ###", - "operationId": "InterCityBusApi_RealTimeNearStop_2", + "description": "### 公路客運之定點資料(A2) ###\r\n- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html))", + "operationId": "InterCityBusApi_RealTimeNearStop_1", "consumes": [], "produces": [ "application/json", @@ -3764,7 +5231,7 @@ "InterCityBus" ], "summary": "取得公路客運的預估到站資料(N1)[批次更新]", - "description": "###公路客運之預估到站資料(N1)###\r\n不保留[現在時間]超過[本平台資料更新時間]兩分鐘的資料", + "description": "###公路客運之預估到站資料(N1)###\r\n- 不保留[現在時間]超過[本平台資料更新時間]兩分鐘的資料\r\n- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html))", "operationId": "InterCityBusApi_EstimatedTimeOfArrival", "consumes": [], "produces": [ @@ -3851,7 +5318,7 @@ "InterCityBus" ], "summary": "取得指定[路線名稱]的公路客運預估到站資料(N1)[批次更新]", - "description": "### 公路客運之預估到站資料(N1) ###\r\n不保留[現在時間]超過[本平台資料更新時間]兩分鐘的資料", + "description": "### 公路客運之預估到站資料(N1) ###\r\n- 不保留[現在時間]超過[本平台資料更新時間]兩分鐘的資料\r\n- [逐筆更新]與[批次更新]之差異請詳見資料使用葵花寶典([連結](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/api-zi-liao-shi-yong-zhu-yi-shi-xiang/buslive.html))", "operationId": "InterCityBusApi_EstimatedTimeOfArrival_1", "consumes": [], "produces": [ @@ -5257,6 +6724,99 @@ } } } + }, + "/v2/Bus/StationGroup/InterCity": { + "get": { + "tags": [ + "InterCityBus" + ], + "summary": "取得公路客運組站位資料", + "description": "公路客運之各站牌所屬的組站位資料", + "operationId": "InterCityBusApi_StationGroup", + "consumes": [], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "name": "$select", + "in": "query", + "description": "挑選", + "type": "string" + }, + { + "name": "$filter", + "in": "query", + "description": "過濾", + "type": "string" + }, + { + "name": "$orderby", + "in": "query", + "description": "排序", + "type": "string" + }, + { + "name": "$top", + "in": "query", + "description": "取前幾筆", + "type": "integer", + "default": 30 + }, + { + "name": "$skip", + "in": "query", + "description": "跳過前幾筆", + "type": "string" + }, + { + "name": "$spatialFilter", + "in": "query", + "description": "空間過濾", + "type": "string" + }, + { + "name": "$format", + "in": "query", + "description": "指定來源格式", + "required": true, + "type": "string", + "enum": [ + "JSON", + "XML" + ] + }, + { + "name": "health", + "in": "query", + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "required": false, + "type": "string", + "enum": [ + "true", + "false" + ] + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Service.DTO.Version2.Bus.BusStationGroup" + } + } + }, + "299": { + "description": "加入參數'?health=true'即可查詢此API服務的健康狀態", + "schema": { + "$ref": "#/definitions/Service.DTO.Version3.Base.Health" + } + } + } + } } }, "definitions": { @@ -5673,7 +7233,8 @@ "StopName", "StopSequence", "StopPosition", - "StationNameID" + "StationNameID", + "StationGroupID" ], "type": "object", "properties": { @@ -5714,6 +7275,10 @@ "description": "站牌所屬的站名碼ID", "type": "string" }, + "StationGroupID": { + "description": "站牌所屬的組站位ID", + "type": "string" + }, "LocationCityCode": { "description": "站牌位置縣市之代碼(國際ISO 3166-2 三碼城市代碼)[若為公路/國道客運路線則為空值]", "type": "string" @@ -6773,6 +8338,7 @@ "StationName", "StationPosition", "StationNameID", + "StationGroupID", "UpdateTime", "VersionID" ], @@ -6804,6 +8370,10 @@ "description": "站牌所屬的站名碼ID", "type": "string" }, + "StationGroupID": { + "description": "站牌所屬的組站位ID", + "type": "string" + }, "Stops": { "description": "站牌與所行經此站牌之路線列表(資料會對路線展開,因此可能會有重複的站牌資料)", "type": "array", @@ -6860,6 +8430,49 @@ } } }, + "Service.DTO.Version2.Bus.BusStationGroup": { + "title": "BusStationGroup", + "description": "組站位資料型別", + "required": [ + "StationGroupUID", + "StationGroupID", + "StationGroupName", + "StationGroupPosition", + "UpdateTime", + "VersionID" + ], + "type": "object", + "properties": { + "StationGroupUID": { + "description": "組站位唯一識別代碼,規則為 {業管機關簡碼} + {StationGroupID},其中 {業管機關簡碼} 可於Authority API中的AuthorityCode欄位查詢", + "type": "string" + }, + "StationGroupID": { + "description": "組站位代碼", + "type": "string" + }, + "StationGroupName": { + "$ref": "#/definitions/Service.DTO.Version2.Base.NameType", + "title": "NameType", + "description": "組站位名稱" + }, + "StationGroupPosition": { + "$ref": "#/definitions/Service.DTO.Version2.Base.PointType", + "title": "PointType", + "description": "組站位位置" + }, + "UpdateTime": { + "title": "DateTime", + "description": "資料更新日期時間(ISO8601格式:yyyy-MM-ddTHH:mm:sszzz)", + "type": "string" + }, + "VersionID": { + "format": "int32", + "description": "資料版本編號", + "type": "integer" + } + } + }, "Service.DTO.Version2.Bus.BusStationName": { "title": "BusStationName", "description": "站名碼資料型別", @@ -6913,6 +8526,7 @@ "StopName", "StopPosition", "StationNameID", + "StationGroupID", "UpdateTime", "VersionID" ], @@ -6956,6 +8570,10 @@ "description": "站牌所屬的站名碼ID", "type": "string" }, + "StationGroupID": { + "description": "站牌所屬的組站位ID", + "type": "string" + }, "StopDescription": { "description": "站牌詳細說明描述", "type": "string" diff --git a/oas.bus.v3.json b/oas.bus.v3.json index fdcd0db4..09b4d817 100644 --- a/oas.bus.v3.json +++ b/oas.bus.v3.json @@ -3,7 +3,7 @@ "info": { "version": "v3", "title": "MOTC Transport API V3", - "description": "本平臺提供涵蓋全國尺度之公車、臺鐵、高鐵、捷運、航空、自行車等公共運輸旅運資料服務API,歡迎各產政學單位介接使用。\r\n
利用本平臺開放資料進行各項應用服務開發時,請考量不同特性使用者(如:性別/身心障礙/老幼等)的需求,並歡迎回饋寶貴意見。\r\n

資料使用葵花寶典:[請點我](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/)\r\n
資料服務開發實作參考手冊:[請點我](https://docs.google.com/viewer?url=https://github.com/ptxmotc/PTX_Web/blob/master/Swagger%E6%9C%8D%E5%8B%99%E8%AA%AA%E6%98%8E%E4%B8%8A%E5%82%B3%E5%8F%83%E8%80%83%E6%AA%94%E6%A1%88/%E5%85%AC%E5%85%B1%E9%81%8B%E8%BC%B8%E6%95%B4%E5%90%88%E8%B3%87%E8%A8%8A%E5%B9%B3%E5%8F%B0%E8%B3%87%E6%96%99%E6%9C%8D%E5%8B%99%E9%96%8B%E7%99%BC%E5%AF%A6%E4%BD%9C.pdf?raw=true)\r\n
API URI Convention文件說明:[請點我](https://docs.google.com/viewer?url=https://github.com/ptxmotc/PTX_Web/blob/master/Swagger%E6%9C%8D%E5%8B%99%E8%AA%AA%E6%98%8E%E4%B8%8A%E5%82%B3%E5%8F%83%E8%80%83%E6%AA%94%E6%A1%88/API_URI_Convention%E6%96%87%E4%BB%B6_v1.pdf?raw=true)
資料文本OAS描述:[請點我](http://ptx.transportdata.tw/MOTC/v3/Bus/api-docs/oas)" + "description": "本平臺提供涵蓋全國尺度之公車、臺鐵、高鐵、捷運、航空、自行車等公共運輸旅運資料服務API,歡迎各產政學單位介接使用。\r\n
利用本平臺開放資料進行各項應用服務開發時,請考量不同特性使用者(如:性別/身心障礙/老幼等)的需求,並歡迎回饋寶貴意見。\r\n

資料使用葵花寶典:[請點我](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/)\r\n
資料服務開發實作參考手冊:[請點我](https://docs.google.com/viewer?url=https://github.com/ptxmotc/PTX_Web/blob/master/Swagger%E6%9C%8D%E5%8B%99%E8%AA%AA%E6%98%8E%E4%B8%8A%E5%82%B3%E5%8F%83%E8%80%83%E6%AA%94%E6%A1%88/%E5%85%AC%E5%85%B1%E9%81%8B%E8%BC%B8%E6%95%B4%E5%90%88%E8%B3%87%E8%A8%8A%E5%B9%B3%E5%8F%B0%E8%B3%87%E6%96%99%E6%9C%8D%E5%8B%99%E9%96%8B%E7%99%BC%E5%AF%A6%E4%BD%9C.pdf?raw=true)\r\n
API URI Convention文件說明:[請點我](https://docs.google.com/viewer?url=https://github.com/ptxmotc/PTX_Web/blob/master/Swagger%E6%9C%8D%E5%8B%99%E8%AA%AA%E6%98%8E%E4%B8%8A%E5%82%B3%E5%8F%83%E8%80%83%E6%AA%94%E6%A1%88/API_URI_Convention%E6%96%87%E4%BB%B6_v1.pdf?raw=true)
資料文本OAS描述:[請點我](https://ptx.transportdata.tw/MOTC/v3/Bus/api-docs/oas)" }, "host": "ptx.transportdata.tw", "basePath": "/MOTC/", diff --git a/oas.rail.v2.json b/oas.rail.v2.json index ec439bbe..0b0568e4 100644 --- a/oas.rail.v2.json +++ b/oas.rail.v2.json @@ -3,7 +3,7 @@ "info": { "version": "v2", "title": "MOTC Transport API V2", - "description": "本平臺提供涵蓋全國尺度之公車、臺鐵、高鐵、捷運、航空、自行車等公共運輸旅運資料服務API,歡迎各產政學單位介接使用。\r\n
利用本平臺開放資料進行各項應用服務開發時,請考量不同特性使用者(如:性別/身心障礙/老幼等)的需求,並歡迎回饋寶貴意見。\r\n

資料使用葵花寶典:[請點我](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/)\r\n
資料服務開發實作參考手冊:[請點我](https://docs.google.com/viewer?url=https://github.com/ptxmotc/PTX_Web/blob/master/Swagger%E6%9C%8D%E5%8B%99%E8%AA%AA%E6%98%8E%E4%B8%8A%E5%82%B3%E5%8F%83%E8%80%83%E6%AA%94%E6%A1%88/%E5%85%AC%E5%85%B1%E9%81%8B%E8%BC%B8%E6%95%B4%E5%90%88%E8%B3%87%E8%A8%8A%E5%B9%B3%E5%8F%B0%E8%B3%87%E6%96%99%E6%9C%8D%E5%8B%99%E9%96%8B%E7%99%BC%E5%AF%A6%E4%BD%9C.pdf?raw=true)\r\n
API URI Convention文件說明:[請點我](https://docs.google.com/viewer?url=https://github.com/ptxmotc/PTX_Web/blob/master/Swagger%E6%9C%8D%E5%8B%99%E8%AA%AA%E6%98%8E%E4%B8%8A%E5%82%B3%E5%8F%83%E8%80%83%E6%AA%94%E6%A1%88/API_URI_Convention%E6%96%87%E4%BB%B6_v1.pdf?raw=true)
資料文本OAS描述:[請點我](http://ptx.transportdata.tw/MOTC/v2/Rail/api-docs/oas)" + "description": "本平臺提供涵蓋全國尺度之公車、臺鐵、高鐵、捷運、航空、自行車等公共運輸旅運資料服務API,歡迎各產政學單位介接使用。\r\n
利用本平臺開放資料進行各項應用服務開發時,請考量不同特性使用者(如:性別/身心障礙/老幼等)的需求,並歡迎回饋寶貴意見。\r\n

資料使用葵花寶典:[請點我](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/)\r\n
資料服務開發實作參考手冊:[請點我](https://docs.google.com/viewer?url=https://github.com/ptxmotc/PTX_Web/blob/master/Swagger%E6%9C%8D%E5%8B%99%E8%AA%AA%E6%98%8E%E4%B8%8A%E5%82%B3%E5%8F%83%E8%80%83%E6%AA%94%E6%A1%88/%E5%85%AC%E5%85%B1%E9%81%8B%E8%BC%B8%E6%95%B4%E5%90%88%E8%B3%87%E8%A8%8A%E5%B9%B3%E5%8F%B0%E8%B3%87%E6%96%99%E6%9C%8D%E5%8B%99%E9%96%8B%E7%99%BC%E5%AF%A6%E4%BD%9C.pdf?raw=true)\r\n
API URI Convention文件說明:[請點我](https://docs.google.com/viewer?url=https://github.com/ptxmotc/PTX_Web/blob/master/Swagger%E6%9C%8D%E5%8B%99%E8%AA%AA%E6%98%8E%E4%B8%8A%E5%82%B3%E5%8F%83%E8%80%83%E6%AA%94%E6%A1%88/API_URI_Convention%E6%96%87%E4%BB%B6_v1.pdf?raw=true)
資料文本OAS描述:[請點我](https://ptx.transportdata.tw/MOTC/v2/Rail/api-docs/oas)" }, "host": "ptx.transportdata.tw", "basePath": "/MOTC/", @@ -37,9 +37,9 @@ "TYMC" ], "x-enum": { - "KRTC": "高雄捷運", "TRTC": "臺北捷運", - "TYMC": "桃園捷運" + "TYMC": "桃園捷運", + "KRTC": "高雄捷運" } }, { @@ -125,10 +125,10 @@ "KLRT" ], "x-enum": { - "TRTC": "臺北捷運", "KRTC": "高雄捷運", "KLRT": "高雄輕軌", - "TYMC": "桃園捷運" + "TYMC": "桃園捷運", + "TRTC": "臺北捷運" } }, { @@ -215,9 +215,9 @@ ], "x-enum": { "KLRT": "高雄輕軌", - "KRTC": "高雄捷運", "TRTC": "臺北捷運", - "TYMC": "桃園捷運" + "TYMC": "桃園捷運", + "KRTC": "高雄捷運" } }, { @@ -310,9 +310,9 @@ ], "x-enum": { "TYMC": "桃園捷運", - "KRTC": "高雄捷運", + "TRTC": "臺北捷運", "KLRT": "高雄輕軌", - "TRTC": "臺北捷運" + "KRTC": "高雄捷運" } }, { @@ -397,8 +397,8 @@ ], "x-enum": { "TYMC": "桃園捷運", - "KRTC": "高雄捷運", - "TRTC": "臺北捷運" + "TRTC": "臺北捷運", + "KRTC": "高雄捷運" } }, { @@ -568,10 +568,10 @@ "TYMC" ], "x-enum": { - "TRTC": "臺北捷運", - "KRTC": "高雄捷運", + "KLRT": "高雄輕軌", "TYMC": "桃園捷運", - "KLRT": "高雄輕軌" + "TRTC": "臺北捷運", + "KRTC": "高雄捷運" } }, { @@ -662,9 +662,9 @@ "TYMC" ], "x-enum": { - "KRTC": "高雄捷運", + "TYMC": "桃園捷運", "TRTC": "臺北捷運", - "TYMC": "桃園捷運" + "KRTC": "高雄捷運" } }, { @@ -837,10 +837,10 @@ "KLRT" ], "x-enum": { - "KRTC": "高雄捷運", "TYMC": "桃園捷運", "TRTC": "臺北捷運", - "KLRT": "高雄輕軌" + "KLRT": "高雄輕軌", + "KRTC": "高雄捷運" } }, { @@ -924,9 +924,9 @@ "TYMC" ], "x-enum": { - "KRTC": "高雄捷運", "TRTC": "臺北捷運", - "TYMC": "桃園捷運" + "TYMC": "桃園捷運", + "KRTC": "高雄捷運" } }, { @@ -1012,8 +1012,8 @@ ], "x-enum": { "TRTC": "臺北捷運", - "TYMC": "桃園捷運", - "KRTC": "高雄捷運" + "KRTC": "高雄捷運", + "TYMC": "桃園捷運" } }, { @@ -1100,9 +1100,9 @@ ], "x-enum": { "KRTC": "高雄捷運", + "KLRT": "高雄輕軌", "TRTC": "臺北捷運", - "TYMC": "桃園捷運", - "KLRT": "高雄輕軌" + "TYMC": "桃園捷運" } }, { @@ -1185,9 +1185,9 @@ "KRTC" ], "x-enum": { + "TYMC": "桃園捷運", "KRTC": "高雄捷運", - "TRTC": "臺北捷運", - "TYMC": "桃園捷運" + "TRTC": "臺北捷運" } }, { @@ -1252,7 +1252,7 @@ "Metro" ], "summary": "取得捷運站別時刻表資料", - "description": "取得捷運站別時刻表資料", + "description": "取得捷運站別時刻表資料\r\n\r\n## 使用注意事項\r\n臺北捷運目前無提供文湖線站別時刻表,建議您可使用[取得捷運路線發車班距頻率資料]取得文湖線列車相關資訊。", "operationId": "MetroApi_StationTimeTable", "consumes": [], "produces": [ @@ -1273,8 +1273,8 @@ ], "x-enum": { "TRTC": "臺北捷運", - "TYMC": "桃園捷運", - "KRTC": "高雄捷運" + "KRTC": "高雄捷運", + "TYMC": "桃園捷運" } }, { @@ -1358,9 +1358,9 @@ "TYMC" ], "x-enum": { + "KRTC": "高雄捷運", "TRTC": "臺北捷運", - "TYMC": "桃園捷運", - "KRTC": "高雄捷運" + "TYMC": "桃園捷運" } }, { @@ -1419,6 +1419,184 @@ } } }, + "/v2/Rail/Metro/News/{Operator}": { + "get": { + "tags": [ + "Metro" + ], + "summary": "取得最新消息", + "description": "取得最新消息", + "operationId": "MetroApi_News", + "consumes": [], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "name": "Operator", + "in": "path", + "required": true, + "type": "string", + "enum": [ + "TYMC" + ], + "x-enum": { + "TYMC": "桃園捷運" + } + }, + { + "name": "$select", + "in": "query", + "description": "挑選", + "type": "string" + }, + { + "name": "$filter", + "in": "query", + "description": "過濾", + "type": "string" + }, + { + "name": "$orderby", + "in": "query", + "description": "排序", + "type": "string" + }, + { + "name": "$top", + "in": "query", + "description": "取前幾筆", + "type": "integer", + "default": 30 + }, + { + "name": "$skip", + "in": "query", + "description": "跳過前幾筆", + "type": "string" + }, + { + "name": "$count", + "in": "query", + "description": "查詢數量", + "type": "string", + "enum": [ + "true", + "false" + ] + }, + { + "name": "$format", + "in": "query", + "description": "指定來源格式", + "required": true, + "type": "string", + "enum": [ + "JSON", + "XML" + ] + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/MOTC.API.Rail.Models.MRTRealTimeWrapper[Service.DTO.Version2.Rail.Metro.MRTNewsList.News]" + } + } + } + } + }, + "/v2/Rail/Metro/Alert/{Operator}": { + "get": { + "tags": [ + "Metro" + ], + "summary": "取得營運通阻資料", + "description": "取得營運通阻資料", + "operationId": "MetroApi_Alert", + "consumes": [], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "name": "Operator", + "in": "path", + "required": true, + "type": "string", + "enum": [ + "TYMC" + ], + "x-enum": { + "TYMC": "桃園捷運" + } + }, + { + "name": "$select", + "in": "query", + "description": "挑選", + "type": "string" + }, + { + "name": "$filter", + "in": "query", + "description": "過濾", + "type": "string" + }, + { + "name": "$orderby", + "in": "query", + "description": "排序", + "type": "string" + }, + { + "name": "$top", + "in": "query", + "description": "取前幾筆", + "type": "integer", + "default": 30 + }, + { + "name": "$skip", + "in": "query", + "description": "跳過前幾筆", + "type": "string" + }, + { + "name": "$count", + "in": "query", + "description": "查詢數量", + "type": "string", + "enum": [ + "true", + "false" + ] + }, + { + "name": "$format", + "in": "query", + "description": "指定來源格式", + "required": true, + "type": "string", + "enum": [ + "JSON", + "XML" + ] + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/MOTC.API.Rail.Models.MRTRealTimeWrapper[Service.DTO.Version2.Rail.Metro.MRTAlertList.Alert]" + } + } + } + } + }, "/v2/Rail/THSR/Station": { "get": { "tags": [ @@ -4829,47 +5007,390 @@ } } } - } - }, - "definitions": { - "Service.DTO.Version2.Rail.THSR.AlertInfo": { - "title": "AlertInfo", - "description": "高鐵即時通阻事件資料", - "required": [ - "Level", - "Status", - "Title", - "Description", - "Effects", - "Direction", - "EffectedSection", - "SrcUpdateTime", - "UpdateTime" - ], - "type": "object", - "properties": { - "Level": { - "format": "int32", - "title": "integer", - "description": "動態事件影響等級(本資料僅作參考,實際資料請參考高鐵http://www.thsrc.com.tw/tw/Operation) : [1:'全線正常運行',2:'有異常狀況']", - "type": "integer" - }, - "Status": { - "description": "營運狀態 = ['空白: 正常' or '▲: 其他的異常狀態' or 'X: 全線停止運行']", - "type": "string" - }, - "Title": { - "description": "標題", - "type": "string" - }, - "Description": { - "description": "事件簡易描述", - "type": "string" - }, - "Effects": { - "description": "影響狀態", - "type": "string" - }, + }, + "/v2/Rail/Operator": { + "get": { + "tags": [ + "RailBasic" + ], + "operationId": "RailApi_Operator", + "consumes": [], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "name": "$select", + "in": "query", + "description": "挑選", + "type": "string" + }, + { + "name": "$filter", + "in": "query", + "description": "過濾", + "type": "string" + }, + { + "name": "$orderby", + "in": "query", + "description": "排序", + "type": "string" + }, + { + "name": "$top", + "in": "query", + "description": "取前幾筆", + "type": "integer", + "default": 30 + }, + { + "name": "$skip", + "in": "query", + "description": "跳過前幾筆", + "type": "string" + }, + { + "name": "$format", + "in": "query", + "description": "指定來源格式", + "required": true, + "type": "string", + "enum": [ + "JSON", + "XML" + ] + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Service.DTO.Version2.Base.Operator" + } + } + } + } + } + } + }, + "definitions": { + "MOTC.API.Rail.Models.MRTRealTimeWrapper[Service.DTO.Version2.Rail.Metro.MRTAlertList.Alert]": { + "title": "MRTAlertList", + "required": [ + "UpdateInterval", + "SrcUpdateTime", + "SrcUpdateInterval", + "AuthorityCode", + "Alerts" + ], + "type": "object", + "properties": { + "UpdateTime": { + "title": "DateTime", + "description": "本平台資料更新時間(ISO8601格式:yyyy-MM-ddTHH:mm:sszzz)", + "type": "string" + }, + "UpdateInterval": { + "format": "int32", + "description": "本平台資料更新週期(秒)", + "type": "integer" + }, + "SrcUpdateTime": { + "title": "DateTime", + "description": "來源端平台資料更新時間(ISO8601格式:yyyy-MM-ddTHH:mm:sszzz)", + "type": "string" + }, + "SrcUpdateInterval": { + "format": "int32", + "description": "來源端平台資料更新週期(秒)", + "type": "integer" + }, + "AuthorityCode": { + "description": "業管機關簡碼", + "type": "string" + }, + "Alerts": { + "description": "資料(陣列)", + "type": "array", + "items": { + "$ref": "#/definitions/Service.DTO.Version2.Rail.Metro.MRTAlertList.Alert" + } + }, + "Count": { + "format": "int64", + "description": "資料總筆數", + "type": "integer" + } + } + }, + "Service.DTO.Version2.Rail.Metro.MRTAlertList.Alert": { + "title": "Alert", + "required": [ + "AlertID", + "Title", + "Description", + "Status", + "Scope", + "UpdateTime" + ], + "type": "object", + "properties": { + "AlertID": { + "description": "通阻訊息代碼", + "type": "string" + }, + "Title": { + "description": "通阻訊息標題", + "type": "string" + }, + "Description": { + "description": "通阻訊息說明", + "type": "string" + }, + "Status": { + "format": "int32", + "title": "integer", + "description": "營運狀況 : [0:'全線營運停止',1:'全線營運正常',2:'有異常狀況']", + "type": "integer" + }, + "Scope": { + "$ref": "#/definitions/Service.DTO.Version2.Rail.Metro.MRTAlertList.AlertScope", + "title": "AlertScope", + "description": "影響範圍" + }, + "Direction": { + "format": "int32", + "title": "integer", + "description": "影響方向 : [0:'去程',1:'返程']", + "type": "integer" + }, + "Level": { + "format": "int32", + "title": "integer", + "description": "影響等級程度 : [1:'重度',2:'中度',3:'輕度']", + "type": "integer" + }, + "Effect": { + "description": "影響說明", + "type": "string" + }, + "Reason": { + "description": "影響原因", + "type": "string" + }, + "AlertURL": { + "description": "通阻訊息網址連結", + "type": "string" + }, + "StartTime": { + "title": "DateTime", + "description": "訊息起始日期時間", + "type": "string" + }, + "EndTime": { + "title": "DateTime", + "description": "訊息結束日期時間", + "type": "string" + }, + "PublishTime": { + "title": "DateTime", + "description": "消息發佈日期時間", + "type": "string" + }, + "UpdateTime": { + "title": "DateTime", + "description": "消息更新日期時間", + "type": "string" + } + } + }, + "Service.DTO.Version2.Rail.Metro.MRTAlertList.AlertScope": { + "title": "AlertScope", + "required": [ + "Stations", + "Lines", + "Routes", + "Trains", + "LineSections" + ], + "type": "object", + "properties": { + "Network": { + "$ref": "#/definitions/Service.DTO.Version2.Rail.Metro.MRTAlertList.AlertScopeNetwork", + "title": "AlertScopeNetwork", + "description": "受影響的路網" + }, + "Stations": { + "description": "受影響的車站", + "type": "array", + "items": { + "$ref": "#/definitions/Service.DTO.Version2.Rail.Metro.MRTAlertList.AlertScopeStation" + } + }, + "Lines": { + "description": "受影響的實體路線", + "type": "array", + "items": { + "$ref": "#/definitions/Service.DTO.Version2.Rail.Metro.MRTAlertList.AlertScopeLine" + } + }, + "Routes": { + "description": "受影響的營運路線", + "type": "array", + "items": { + "$ref": "#/definitions/Service.DTO.Version2.Rail.Metro.MRTAlertList.AlertScopeRoute" + } + }, + "Trains": { + "description": "受影響的車次", + "type": "array", + "items": { + "$ref": "#/definitions/Service.DTO.Version2.Rail.Metro.MRTAlertList.AlertScopeTrain" + } + }, + "LineSections": { + "description": "受影響的路線區間", + "type": "array", + "items": { + "$ref": "#/definitions/Service.DTO.Version2.Rail.Metro.MRTAlertList.AlertScopeLineSection" + } + } + } + }, + "Service.DTO.Version2.Rail.Metro.MRTAlertList.AlertScopeNetwork": { + "title": "AlertScopeNetwork", + "type": "object", + "properties": { + "NetworkID": { + "description": "路網代碼", + "type": "string" + } + } + }, + "Service.DTO.Version2.Rail.Metro.MRTAlertList.AlertScopeStation": { + "title": "AlertScopeStation", + "type": "object", + "properties": { + "StationID": { + "description": "車站代碼", + "type": "string" + }, + "StationName": { + "description": "車站名稱", + "type": "string" + } + } + }, + "Service.DTO.Version2.Rail.Metro.MRTAlertList.AlertScopeLine": { + "title": "AlertScopeLine", + "type": "object", + "properties": { + "LineID": { + "description": "實體路線代碼", + "type": "string" + }, + "LineName": { + "description": "實體路線名稱", + "type": "string" + } + } + }, + "Service.DTO.Version2.Rail.Metro.MRTAlertList.AlertScopeRoute": { + "title": "AlertScopeRoute", + "type": "object", + "properties": { + "RouteID": { + "description": "營運路線代碼", + "type": "string" + }, + "RouteName": { + "description": "營運路線名稱", + "type": "string" + } + } + }, + "Service.DTO.Version2.Rail.Metro.MRTAlertList.AlertScopeTrain": { + "title": "AlertScopeTrain", + "type": "object", + "properties": { + "TrainNo": { + "description": "受影響的車次", + "type": "string" + } + } + }, + "Service.DTO.Version2.Rail.Metro.MRTAlertList.AlertScopeLineSection": { + "title": "AlertScopeLineSection", + "type": "object", + "properties": { + "LineID": { + "description": "路線區間所在路線代碼", + "type": "string" + }, + "StartingStationID": { + "description": "區間起站車站代碼", + "type": "string" + }, + "StartingStationName": { + "description": "區間起站車站名稱", + "type": "string" + }, + "EndingStationID": { + "description": "區間迄站車站代碼", + "type": "string" + }, + "EndingStationName": { + "description": "區間迄站車站名稱", + "type": "string" + }, + "Description": { + "description": "影響區間輔助描述", + "type": "string" + } + } + }, + "Service.DTO.Version2.Rail.THSR.AlertInfo": { + "title": "AlertInfo", + "description": "高鐵即時通阻事件資料", + "required": [ + "Level", + "Status", + "Title", + "Description", + "Effects", + "Direction", + "EffectedSection", + "SrcUpdateTime", + "UpdateTime" + ], + "type": "object", + "properties": { + "Level": { + "format": "int32", + "title": "integer", + "description": "動態事件影響等級(本資料僅作參考,實際資料請參考高鐵http://www.thsrc.com.tw/tw/Operation) : [1:'全線正常運行',2:'有異常狀況']", + "type": "integer" + }, + "Status": { + "description": "營運狀態 = ['空白: 正常' or '▲: 其他的異常狀態' or 'X: 全線停止運行']", + "type": "string" + }, + "Title": { + "description": "標題", + "type": "string" + }, + "Description": { + "description": "事件簡易描述", + "type": "string" + }, + "Effects": { + "description": "影響狀態", + "type": "string" + }, "Direction": { "description": "運行方向", "type": "string" @@ -6953,6 +7474,125 @@ } } }, + "MOTC.API.Rail.Models.MRTRealTimeWrapper[Service.DTO.Version2.Rail.Metro.MRTNewsList.News]": { + "title": "MRTNewsList", + "required": [ + "UpdateInterval", + "SrcUpdateTime", + "SrcUpdateInterval", + "AuthorityCode", + "Newses" + ], + "type": "object", + "properties": { + "UpdateTime": { + "title": "DateTime", + "description": "本平台資料更新時間(ISO8601格式:yyyy-MM-ddTHH:mm:sszzz)", + "type": "string" + }, + "UpdateInterval": { + "format": "int32", + "description": "本平台資料更新週期(秒)", + "type": "integer" + }, + "SrcUpdateTime": { + "title": "DateTime", + "description": "來源端平台資料更新時間(ISO8601格式:yyyy-MM-ddTHH:mm:sszzz)", + "type": "string" + }, + "SrcUpdateInterval": { + "format": "int32", + "description": "來源端平台資料更新週期(秒)", + "type": "integer" + }, + "AuthorityCode": { + "description": "業管機關簡碼", + "type": "string" + }, + "Newses": { + "description": "資料(陣列)", + "type": "array", + "items": { + "$ref": "#/definitions/Service.DTO.Version2.Rail.Metro.MRTNewsList.News" + } + }, + "Count": { + "format": "int64", + "description": "資料總筆數", + "type": "integer" + } + } + }, + "Service.DTO.Version2.Rail.Metro.MRTNewsList.News": { + "title": "News", + "required": [ + "NewsID", + "Title", + "NewsCategory", + "Description", + "PublishTime", + "UpdateTime" + ], + "type": "object", + "properties": { + "NewsID": { + "description": "消息代碼", + "type": "string" + }, + "Language": { + "format": "int32", + "title": "integer", + "description": "語系 : [1:'Zh_tw',2:'En_us',3:'Zh_cn',4:'Ja',5:'Ko',99:'Other']", + "type": "integer" + }, + "Department": { + "description": "發布單位", + "type": "string" + }, + "Title": { + "description": "消息標題", + "type": "string" + }, + "NewsCategory": { + "format": "int32", + "title": "integer", + "description": "消息類別 : [1:'最新消息',2:'新聞稿',3:'營運資訊',4:'轉乘資訊',5:'活動訊息',6:'系統公告',7:'新服務上架',8:'API修正',9:'來源異常',99:'其他']", + "type": "integer" + }, + "Description": { + "description": "內容描述", + "type": "string" + }, + "NewsURL": { + "description": "消息網址連結", + "type": "string" + }, + "AttachmentURL": { + "description": "附件網址連結", + "type": "string" + }, + "StartTime": { + "title": "DateTime", + "description": "消息起始日期時間", + "type": "string" + }, + "EndTime": { + "title": "DateTime", + "description": "消息結束日期時間", + "type": "string" + }, + "PublishTime": { + "title": "DateTime", + "description": "消息發佈日期時間", + "type": "string" + }, + "UpdateTime": { + "title": "DateTime", + "description": "本筆資料之更新日期時間", + "type": "string" + } + } + }, "Service.DTO.Version2.Rail.TRA.RailODDailyTimetable": { "title": "RailODDailyTimetable", "description": "台鐵起訖站間到離站時刻資料型別", @@ -7278,6 +7918,76 @@ } } }, + "Service.DTO.Version2.Base.Operator": { + "title": "Operator", + "description": "營運業者資料型別", + "required": [ + "ProviderID", + "OperatorID", + "OperatorName", + "OperatorCode", + "AuthorityCode", + "OperatorNo", + "UpdateTime" + ], + "type": "object", + "properties": { + "ProviderID": { + "description": "資料提供平台代碼", + "type": "string" + }, + "OperatorID": { + "description": "營運業者代碼", + "type": "string" + }, + "OperatorName": { + "$ref": "#/definitions/Service.DTO.Version2.Base.NameType", + "title": "NameType", + "description": "營運業者名稱" + }, + "OperatorPhone": { + "description": "營運業者連絡電話", + "type": "string" + }, + "OperatorEmail": { + "description": "營運業者電子信箱", + "type": "string" + }, + "OperatorUrl": { + "description": "營運業者網址鏈結", + "type": "string" + }, + "ReservationUrl": { + "description": "訂票網址鏈結", + "type": "string" + }, + "ReservationPhone": { + "description": "訂票連絡電話", + "type": "string" + }, + "OperatorCode": { + "description": "營運業者簡碼", + "type": "string" + }, + "AuthorityCode": { + "description": "營運業者業管機關簡碼(對於於公路客運/國道客運而言為THB)", + "type": "string" + }, + "SubAuthorityCode": { + "description": "營運業者所屬業管子機關簡碼(對於公路客運/國道客運路線而言為區監理所如THB-VO10-1..等)", + "type": "string" + }, + "OperatorNo": { + "description": "營運業者編號[交通部票證資料系統定義]", + "type": "string" + }, + "UpdateTime": { + "title": "DateTime", + "description": "資料更新日期時間(ISO8601格式:yyyy-MM-ddTHH:mm:sszzz)", + "type": "string" + } + } + }, "Service.DTO.Version2.Rail.Metro.Route": { "title": "Route", "description": "營運路線基本資料", @@ -8624,6 +9334,9 @@ } }, "tags": [ + { + "name": "RailBasic" + }, { "name": "TRA" }, diff --git a/oas.rail.v3.json b/oas.rail.v3.json index fa905d4e..b9577f49 100644 --- a/oas.rail.v3.json +++ b/oas.rail.v3.json @@ -3,7 +3,7 @@ "info": { "version": "v3", "title": "MOTC Transport API V3", - "description": "本平臺提供涵蓋全國尺度之公車、臺鐵、高鐵、捷運、航空、自行車等公共運輸旅運資料服務API,歡迎各產政學單位介接使用。\r\n
利用本平臺開放資料進行各項應用服務開發時,請考量不同特性使用者(如:性別/身心障礙/老幼等)的需求,並歡迎回饋寶貴意見。\r\n

資料使用葵花寶典:[請點我](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/)\r\n
資料服務開發實作參考手冊:[請點我](https://docs.google.com/viewer?url=https://github.com/ptxmotc/PTX_Web/blob/master/Swagger%E6%9C%8D%E5%8B%99%E8%AA%AA%E6%98%8E%E4%B8%8A%E5%82%B3%E5%8F%83%E8%80%83%E6%AA%94%E6%A1%88/%E5%85%AC%E5%85%B1%E9%81%8B%E8%BC%B8%E6%95%B4%E5%90%88%E8%B3%87%E8%A8%8A%E5%B9%B3%E5%8F%B0%E8%B3%87%E6%96%99%E6%9C%8D%E5%8B%99%E9%96%8B%E7%99%BC%E5%AF%A6%E4%BD%9C.pdf?raw=true)\r\n
API URI Convention文件說明:[請點我](https://docs.google.com/viewer?url=https://github.com/ptxmotc/PTX_Web/blob/master/Swagger%E6%9C%8D%E5%8B%99%E8%AA%AA%E6%98%8E%E4%B8%8A%E5%82%B3%E5%8F%83%E8%80%83%E6%AA%94%E6%A1%88/API_URI_Convention%E6%96%87%E4%BB%B6_v1.pdf?raw=true)
資料文本OAS描述:[請點我](http://ptx.transportdata.tw/MOTC/v3/Rail/api-docs/oas)" + "description": "本平臺提供涵蓋全國尺度之公車、臺鐵、高鐵、捷運、航空、自行車等公共運輸旅運資料服務API,歡迎各產政學單位介接使用。\r\n
利用本平臺開放資料進行各項應用服務開發時,請考量不同特性使用者(如:性別/身心障礙/老幼等)的需求,並歡迎回饋寶貴意見。\r\n

資料使用葵花寶典:[請點我](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/)\r\n
資料服務開發實作參考手冊:[請點我](https://docs.google.com/viewer?url=https://github.com/ptxmotc/PTX_Web/blob/master/Swagger%E6%9C%8D%E5%8B%99%E8%AA%AA%E6%98%8E%E4%B8%8A%E5%82%B3%E5%8F%83%E8%80%83%E6%AA%94%E6%A1%88/%E5%85%AC%E5%85%B1%E9%81%8B%E8%BC%B8%E6%95%B4%E5%90%88%E8%B3%87%E8%A8%8A%E5%B9%B3%E5%8F%B0%E8%B3%87%E6%96%99%E6%9C%8D%E5%8B%99%E9%96%8B%E7%99%BC%E5%AF%A6%E4%BD%9C.pdf?raw=true)\r\n
API URI Convention文件說明:[請點我](https://docs.google.com/viewer?url=https://github.com/ptxmotc/PTX_Web/blob/master/Swagger%E6%9C%8D%E5%8B%99%E8%AA%AA%E6%98%8E%E4%B8%8A%E5%82%B3%E5%8F%83%E8%80%83%E6%AA%94%E6%A1%88/API_URI_Convention%E6%96%87%E4%BB%B6_v1.pdf?raw=true)
資料文本OAS描述:[請點我](https://ptx.transportdata.tw/MOTC/v3/Rail/api-docs/oas)" }, "host": "ptx.transportdata.tw", "basePath": "/MOTC/", @@ -5042,12 +5042,17 @@ "title": "Station", "description": "台鐵車站資料", "required": [ + "StationUID", "StationID", "StationName", "StationPosition" ], "type": "object", "properties": { + "StationUID": { + "description": "臺鐵車站唯一識別代碼", + "type": "string" + }, "StationID": { "description": "臺鐵車站代碼", "type": "string" @@ -6397,6 +6402,9 @@ } }, "tags": [ + { + "name": "RailBasic" + }, { "name": "TRA" }, diff --git a/oas.tourism.v2.json b/oas.tourism.v2.json index bcddd7e0..8dddc500 100644 --- a/oas.tourism.v2.json +++ b/oas.tourism.v2.json @@ -3,7 +3,7 @@ "info": { "version": "v2", "title": "MOTC Transport API V2", - "description": "本平臺提供涵蓋全國尺度之公車、臺鐵、高鐵、捷運、航空、自行車等公共運輸旅運資料服務API,歡迎各產政學單位介接使用。\r\n
利用本平臺開放資料進行各項應用服務開發時,請考量不同特性使用者(如:性別/身心障礙/老幼等)的需求,並歡迎回饋寶貴意見。\r\n

資料使用葵花寶典:[請點我](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/)\r\n
資料服務開發實作參考手冊:[請點我](https://docs.google.com/viewer?url=https://github.com/ptxmotc/PTX_Web/blob/master/Swagger%E6%9C%8D%E5%8B%99%E8%AA%AA%E6%98%8E%E4%B8%8A%E5%82%B3%E5%8F%83%E8%80%83%E6%AA%94%E6%A1%88/%E5%85%AC%E5%85%B1%E9%81%8B%E8%BC%B8%E6%95%B4%E5%90%88%E8%B3%87%E8%A8%8A%E5%B9%B3%E5%8F%B0%E8%B3%87%E6%96%99%E6%9C%8D%E5%8B%99%E9%96%8B%E7%99%BC%E5%AF%A6%E4%BD%9C.pdf?raw=true)\r\n
API URI Convention文件說明:[請點我](https://docs.google.com/viewer?url=https://github.com/ptxmotc/PTX_Web/blob/master/Swagger%E6%9C%8D%E5%8B%99%E8%AA%AA%E6%98%8E%E4%B8%8A%E5%82%B3%E5%8F%83%E8%80%83%E6%AA%94%E6%A1%88/API_URI_Convention%E6%96%87%E4%BB%B6_v1.pdf?raw=true)
資料文本OAS描述:[請點我](http://ptx.transportdata.tw/MOTC/v2/Tourism/api-docs/oas)" + "description": "本平臺提供涵蓋全國尺度之公車、臺鐵、高鐵、捷運、航空、自行車等公共運輸旅運資料服務API,歡迎各產政學單位介接使用。\r\n
利用本平臺開放資料進行各項應用服務開發時,請考量不同特性使用者(如:性別/身心障礙/老幼等)的需求,並歡迎回饋寶貴意見。\r\n

資料使用葵花寶典:[請點我](https://ptxmotc.gitbooks.io/ptx-api-documentation/content/)\r\n
資料服務開發實作參考手冊:[請點我](https://docs.google.com/viewer?url=https://github.com/ptxmotc/PTX_Web/blob/master/Swagger%E6%9C%8D%E5%8B%99%E8%AA%AA%E6%98%8E%E4%B8%8A%E5%82%B3%E5%8F%83%E8%80%83%E6%AA%94%E6%A1%88/%E5%85%AC%E5%85%B1%E9%81%8B%E8%BC%B8%E6%95%B4%E5%90%88%E8%B3%87%E8%A8%8A%E5%B9%B3%E5%8F%B0%E8%B3%87%E6%96%99%E6%9C%8D%E5%8B%99%E9%96%8B%E7%99%BC%E5%AF%A6%E4%BD%9C.pdf?raw=true)\r\n
API URI Convention文件說明:[請點我](https://docs.google.com/viewer?url=https://github.com/ptxmotc/PTX_Web/blob/master/Swagger%E6%9C%8D%E5%8B%99%E8%AA%AA%E6%98%8E%E4%B8%8A%E5%82%B3%E5%8F%83%E8%80%83%E6%AA%94%E6%A1%88/API_URI_Convention%E6%96%87%E4%BB%B6_v1.pdf?raw=true)
資料文本OAS描述:[請點我](https://ptx.transportdata.tw/MOTC/v2/Tourism/api-docs/oas)" }, "host": "ptx.transportdata.tw", "basePath": "/MOTC/", @@ -133,27 +133,27 @@ ], "x-enum": { "Taipei": "臺北市", - "MiaoliCounty": "苗栗縣", - "YunlinCounty": "雲林縣", - "TaitungCounty": "臺東縣", "PingtungCounty": "屏東縣", - "HualienCounty": "花蓮縣", - "LienchiangCounty": "連江縣", + "Keelung": "基隆市", "Taoyuan": "桃園市", - "Kaohsiung": "高雄市", - "KinmenCounty": "金門縣", + "PenghuCounty": "澎湖縣", "Hsinchu": "新竹市", - "Taichung": "臺中市", - "NantouCounty": "南投縣", "Chiayi": "嘉義市", - "Keelung": "基隆市", - "HsinchuCounty": "新竹縣", "ChanghuaCounty": "彰化縣", - "Tainan": "臺南市", - "NewTaipei": "新北市", - "YilanCounty": "宜蘭縣", "ChiayiCounty": "嘉義縣", - "PenghuCounty": "澎湖縣" + "MiaoliCounty": "苗栗縣", + "YilanCounty": "宜蘭縣", + "HualienCounty": "花蓮縣", + "HsinchuCounty": "新竹縣", + "NewTaipei": "新北市", + "TaitungCounty": "臺東縣", + "YunlinCounty": "雲林縣", + "NantouCounty": "南投縣", + "Kaohsiung": "高雄市", + "KinmenCounty": "金門縣", + "Tainan": "臺南市", + "LienchiangCounty": "連江縣", + "Taichung": "臺中市" } }, { @@ -339,28 +339,28 @@ "LienchiangCounty" ], "x-enum": { - "LienchiangCounty": "連江縣", - "ChiayiCounty": "嘉義縣", - "YilanCounty": "宜蘭縣", - "Taipei": "臺北市", - "Taoyuan": "桃園市", - "HualienCounty": "花蓮縣", - "ChanghuaCounty": "彰化縣", - "NantouCounty": "南投縣", "Hsinchu": "新竹市", + "Keelung": "基隆市", + "LienchiangCounty": "連江縣", "Kaohsiung": "高雄市", - "KinmenCounty": "金門縣", - "TaitungCounty": "臺東縣", - "PingtungCounty": "屏東縣", - "Taichung": "臺中市", + "ChanghuaCounty": "彰化縣", + "MiaoliCounty": "苗栗縣", "PenghuCounty": "澎湖縣", - "Keelung": "基隆市", + "Taichung": "臺中市", + "KinmenCounty": "金門縣", + "NantouCounty": "南投縣", + "YunlinCounty": "雲林縣", + "ChiayiCounty": "嘉義縣", + "HsinchuCounty": "新竹縣", "Chiayi": "嘉義市", + "Taipei": "臺北市", + "PingtungCounty": "屏東縣", + "HualienCounty": "花蓮縣", + "NewTaipei": "新北市", + "YilanCounty": "宜蘭縣", "Tainan": "臺南市", - "HsinchuCounty": "新竹縣", - "MiaoliCounty": "苗栗縣", - "YunlinCounty": "雲林縣", - "NewTaipei": "新北市" + "TaitungCounty": "臺東縣", + "Taoyuan": "桃園市" } }, { @@ -546,28 +546,28 @@ "LienchiangCounty" ], "x-enum": { - "Taipei": "臺北市", - "Tainan": "臺南市", + "ChanghuaCounty": "彰化縣", "HsinchuCounty": "新竹縣", - "Kaohsiung": "高雄市", - "Taoyuan": "桃園市", - "ChiayiCounty": "嘉義縣", - "MiaoliCounty": "苗栗縣", "NantouCounty": "南投縣", + "Hsinchu": "新竹市", + "Kaohsiung": "高雄市", + "TaitungCounty": "臺東縣", + "Tainan": "臺南市", + "LienchiangCounty": "連江縣", "YunlinCounty": "雲林縣", "Taichung": "臺中市", - "Keelung": "基隆市", - "PingtungCounty": "屏東縣", - "LienchiangCounty": "連江縣", - "KinmenCounty": "金門縣", + "Taipei": "臺北市", "NewTaipei": "新北市", - "PenghuCounty": "澎湖縣", - "TaitungCounty": "臺東縣", "HualienCounty": "花蓮縣", - "ChanghuaCounty": "彰化縣", + "Chiayi": "嘉義市", + "Keelung": "基隆市", + "PenghuCounty": "澎湖縣", + "KinmenCounty": "金門縣", + "MiaoliCounty": "苗栗縣", + "PingtungCounty": "屏東縣", "YilanCounty": "宜蘭縣", - "Hsinchu": "新竹市", - "Chiayi": "嘉義市" + "Taoyuan": "桃園市", + "ChiayiCounty": "嘉義縣" } }, { @@ -753,28 +753,28 @@ "LienchiangCounty" ], "x-enum": { - "Taipei": "臺北市", - "MiaoliCounty": "苗栗縣", + "YilanCounty": "宜蘭縣", + "ChiayiCounty": "嘉義縣", + "HualienCounty": "花蓮縣", + "YunlinCounty": "雲林縣", + "Keelung": "基隆市", "KinmenCounty": "金門縣", - "PenghuCounty": "澎湖縣", + "Kaohsiung": "高雄市", "HsinchuCounty": "新竹縣", + "Chiayi": "嘉義市", "Taoyuan": "桃園市", - "ChanghuaCounty": "彰化縣", + "MiaoliCounty": "苗栗縣", + "NewTaipei": "新北市", "NantouCounty": "南投縣", - "LienchiangCounty": "連江縣", + "PenghuCounty": "澎湖縣", "TaitungCounty": "臺東縣", - "HualienCounty": "花蓮縣", - "YunlinCounty": "雲林縣", - "Kaohsiung": "高雄市", + "Taipei": "臺北市", + "LienchiangCounty": "連江縣", + "ChanghuaCounty": "彰化縣", "PingtungCounty": "屏東縣", "Taichung": "臺中市", "Hsinchu": "新竹市", - "Chiayi": "嘉義市", - "ChiayiCounty": "嘉義縣", - "YilanCounty": "宜蘭縣", - "Keelung": "基隆市", - "Tainan": "臺南市", - "NewTaipei": "新北市" + "Tainan": "臺南市" } }, { @@ -922,7 +922,7 @@ ], "summary": "取得指定[路線名稱]的台灣好行公車的動態定時資料(A1)", "description": "取得指定[路線名稱]的台灣好行公車的動態定時資料(A1)", - "operationId": "TaiwanTripBusApi_RealTimeByFrequency_2", + "operationId": "TaiwanTripBusApi_RealTimeByFrequency_1", "consumes": [], "produces": [ "application/json", @@ -1075,7 +1075,7 @@ ], "summary": "取得指定[路線名稱]的台灣好行公車的動態定點資料(A2)", "description": "取得指定[路線名稱]的台灣好行公車的動態定點資料(A2)", - "operationId": "TaiwanTripBusApi_RealTimeNearStop_2", + "operationId": "TaiwanTripBusApi_RealTimeNearStop_1", "consumes": [], "produces": [ "application/json", @@ -3608,7 +3608,8 @@ "StopName", "StopSequence", "StopPosition", - "StationNameID" + "StationNameID", + "StationGroupID" ], "type": "object", "properties": { @@ -3649,6 +3650,9 @@ "description": "站牌所屬的站名碼ID", "type": "string" }, + "StationGroupID": { + "type": "string" + }, "LocationCityCode": { "description": "站牌位置縣市之代碼(國際ISO 3166-2 三碼城市代碼)[若為公路/國道客運路線則為空值]", "type": "string" diff --git a/rail/v2/client/m_o_t_c_transport_api_v2_client.go b/rail/v2/client/m_o_t_c_transport_api_v2_client.go index 4e6178c9..b340b387 100644 --- a/rail/v2/client/m_o_t_c_transport_api_v2_client.go +++ b/rail/v2/client/m_o_t_c_transport_api_v2_client.go @@ -12,6 +12,7 @@ import ( strfmt "github.com/go-openapi/strfmt" "github.com/minchao/go-ptx/rail/v2/client/metro" + "github.com/minchao/go-ptx/rail/v2/client/rail_basic" "github.com/minchao/go-ptx/rail/v2/client/t_h_s_r" "github.com/minchao/go-ptx/rail/v2/client/t_r_a" ) @@ -61,6 +62,8 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *MOTCTransp cli.Metro = metro.New(transport, formats) + cli.RailBasic = rail_basic.New(transport, formats) + cli.Thsr = t_h_s_r.New(transport, formats) cli.Tra = t_r_a.New(transport, formats) @@ -111,6 +114,8 @@ func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig { type MOTCTransportAPIV2 struct { Metro *metro.Client + RailBasic *rail_basic.Client + Thsr *t_h_s_r.Client Tra *t_r_a.Client @@ -124,6 +129,8 @@ func (c *MOTCTransportAPIV2) SetTransport(transport runtime.ClientTransport) { c.Metro.SetTransport(transport) + c.RailBasic.SetTransport(transport) + c.Thsr.SetTransport(transport) c.Tra.SetTransport(transport) diff --git a/rail/v2/client/metro/metro_api_alert_parameters.go b/rail/v2/client/metro/metro_api_alert_parameters.go new file mode 100644 index 00000000..3830f346 --- /dev/null +++ b/rail/v2/client/metro/metro_api_alert_parameters.go @@ -0,0 +1,363 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package metro + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/swag" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewMetroAPIAlertParams creates a new MetroAPIAlertParams object +// with the default values initialized. +func NewMetroAPIAlertParams() *MetroAPIAlertParams { + var ( + dollarTopDefault = int64(30) + ) + return &MetroAPIAlertParams{ + DollarTop: &dollarTopDefault, + + timeout: cr.DefaultTimeout, + } +} + +// NewMetroAPIAlertParamsWithTimeout creates a new MetroAPIAlertParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewMetroAPIAlertParamsWithTimeout(timeout time.Duration) *MetroAPIAlertParams { + var ( + dollarTopDefault = int64(30) + ) + return &MetroAPIAlertParams{ + DollarTop: &dollarTopDefault, + + timeout: timeout, + } +} + +// NewMetroAPIAlertParamsWithContext creates a new MetroAPIAlertParams object +// with the default values initialized, and the ability to set a context for a request +func NewMetroAPIAlertParamsWithContext(ctx context.Context) *MetroAPIAlertParams { + var ( + dollarTopDefault = int64(30) + ) + return &MetroAPIAlertParams{ + DollarTop: &dollarTopDefault, + + Context: ctx, + } +} + +// NewMetroAPIAlertParamsWithHTTPClient creates a new MetroAPIAlertParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewMetroAPIAlertParamsWithHTTPClient(client *http.Client) *MetroAPIAlertParams { + var ( + dollarTopDefault = int64(30) + ) + return &MetroAPIAlertParams{ + DollarTop: &dollarTopDefault, + HTTPClient: client, + } +} + +/*MetroAPIAlertParams contains all the parameters to send to the API endpoint +for the metro Api alert operation typically these are written to a http.Request +*/ +type MetroAPIAlertParams struct { + + /*DollarCount + 查詢數量 + + */ + DollarCount *string + /*DollarFilter + 過濾 + + */ + DollarFilter *string + /*DollarFormat + 指定來源格式 + + */ + DollarFormat string + /*DollarOrderby + 排序 + + */ + DollarOrderby *string + /*DollarSelect + 挑選 + + */ + DollarSelect *string + /*DollarSkip + 跳過前幾筆 + + */ + DollarSkip *string + /*DollarTop + 取前幾筆 + + */ + DollarTop *int64 + /*Operator*/ + Operator string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the metro Api alert params +func (o *MetroAPIAlertParams) WithTimeout(timeout time.Duration) *MetroAPIAlertParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the metro Api alert params +func (o *MetroAPIAlertParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the metro Api alert params +func (o *MetroAPIAlertParams) WithContext(ctx context.Context) *MetroAPIAlertParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the metro Api alert params +func (o *MetroAPIAlertParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the metro Api alert params +func (o *MetroAPIAlertParams) WithHTTPClient(client *http.Client) *MetroAPIAlertParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the metro Api alert params +func (o *MetroAPIAlertParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDollarCount adds the dollarCount to the metro Api alert params +func (o *MetroAPIAlertParams) WithDollarCount(dollarCount *string) *MetroAPIAlertParams { + o.SetDollarCount(dollarCount) + return o +} + +// SetDollarCount adds the dollarCount to the metro Api alert params +func (o *MetroAPIAlertParams) SetDollarCount(dollarCount *string) { + o.DollarCount = dollarCount +} + +// WithDollarFilter adds the dollarFilter to the metro Api alert params +func (o *MetroAPIAlertParams) WithDollarFilter(dollarFilter *string) *MetroAPIAlertParams { + o.SetDollarFilter(dollarFilter) + return o +} + +// SetDollarFilter adds the dollarFilter to the metro Api alert params +func (o *MetroAPIAlertParams) SetDollarFilter(dollarFilter *string) { + o.DollarFilter = dollarFilter +} + +// WithDollarFormat adds the dollarFormat to the metro Api alert params +func (o *MetroAPIAlertParams) WithDollarFormat(dollarFormat string) *MetroAPIAlertParams { + o.SetDollarFormat(dollarFormat) + return o +} + +// SetDollarFormat adds the dollarFormat to the metro Api alert params +func (o *MetroAPIAlertParams) SetDollarFormat(dollarFormat string) { + o.DollarFormat = dollarFormat +} + +// WithDollarOrderby adds the dollarOrderby to the metro Api alert params +func (o *MetroAPIAlertParams) WithDollarOrderby(dollarOrderby *string) *MetroAPIAlertParams { + o.SetDollarOrderby(dollarOrderby) + return o +} + +// SetDollarOrderby adds the dollarOrderby to the metro Api alert params +func (o *MetroAPIAlertParams) SetDollarOrderby(dollarOrderby *string) { + o.DollarOrderby = dollarOrderby +} + +// WithDollarSelect adds the dollarSelect to the metro Api alert params +func (o *MetroAPIAlertParams) WithDollarSelect(dollarSelect *string) *MetroAPIAlertParams { + o.SetDollarSelect(dollarSelect) + return o +} + +// SetDollarSelect adds the dollarSelect to the metro Api alert params +func (o *MetroAPIAlertParams) SetDollarSelect(dollarSelect *string) { + o.DollarSelect = dollarSelect +} + +// WithDollarSkip adds the dollarSkip to the metro Api alert params +func (o *MetroAPIAlertParams) WithDollarSkip(dollarSkip *string) *MetroAPIAlertParams { + o.SetDollarSkip(dollarSkip) + return o +} + +// SetDollarSkip adds the dollarSkip to the metro Api alert params +func (o *MetroAPIAlertParams) SetDollarSkip(dollarSkip *string) { + o.DollarSkip = dollarSkip +} + +// WithDollarTop adds the dollarTop to the metro Api alert params +func (o *MetroAPIAlertParams) WithDollarTop(dollarTop *int64) *MetroAPIAlertParams { + o.SetDollarTop(dollarTop) + return o +} + +// SetDollarTop adds the dollarTop to the metro Api alert params +func (o *MetroAPIAlertParams) SetDollarTop(dollarTop *int64) { + o.DollarTop = dollarTop +} + +// WithOperator adds the operator to the metro Api alert params +func (o *MetroAPIAlertParams) WithOperator(operator string) *MetroAPIAlertParams { + o.SetOperator(operator) + return o +} + +// SetOperator adds the operator to the metro Api alert params +func (o *MetroAPIAlertParams) SetOperator(operator string) { + o.Operator = operator +} + +// WriteToRequest writes these params to a swagger request +func (o *MetroAPIAlertParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.DollarCount != nil { + + // query param $count + var qrDollarCount string + if o.DollarCount != nil { + qrDollarCount = *o.DollarCount + } + qDollarCount := qrDollarCount + if qDollarCount != "" { + if err := r.SetQueryParam("$count", qDollarCount); err != nil { + return err + } + } + + } + + if o.DollarFilter != nil { + + // query param $filter + var qrDollarFilter string + if o.DollarFilter != nil { + qrDollarFilter = *o.DollarFilter + } + qDollarFilter := qrDollarFilter + if qDollarFilter != "" { + if err := r.SetQueryParam("$filter", qDollarFilter); err != nil { + return err + } + } + + } + + // query param $format + qrDollarFormat := o.DollarFormat + qDollarFormat := qrDollarFormat + if qDollarFormat != "" { + if err := r.SetQueryParam("$format", qDollarFormat); err != nil { + return err + } + } + + if o.DollarOrderby != nil { + + // query param $orderby + var qrDollarOrderby string + if o.DollarOrderby != nil { + qrDollarOrderby = *o.DollarOrderby + } + qDollarOrderby := qrDollarOrderby + if qDollarOrderby != "" { + if err := r.SetQueryParam("$orderby", qDollarOrderby); err != nil { + return err + } + } + + } + + if o.DollarSelect != nil { + + // query param $select + var qrDollarSelect string + if o.DollarSelect != nil { + qrDollarSelect = *o.DollarSelect + } + qDollarSelect := qrDollarSelect + if qDollarSelect != "" { + if err := r.SetQueryParam("$select", qDollarSelect); err != nil { + return err + } + } + + } + + if o.DollarSkip != nil { + + // query param $skip + var qrDollarSkip string + if o.DollarSkip != nil { + qrDollarSkip = *o.DollarSkip + } + qDollarSkip := qrDollarSkip + if qDollarSkip != "" { + if err := r.SetQueryParam("$skip", qDollarSkip); err != nil { + return err + } + } + + } + + if o.DollarTop != nil { + + // query param $top + var qrDollarTop int64 + if o.DollarTop != nil { + qrDollarTop = *o.DollarTop + } + qDollarTop := swag.FormatInt64(qrDollarTop) + if qDollarTop != "" { + if err := r.SetQueryParam("$top", qDollarTop); err != nil { + return err + } + } + + } + + // path param Operator + if err := r.SetPathParam("Operator", o.Operator); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/rail/v2/client/metro/metro_api_alert_responses.go b/rail/v2/client/metro/metro_api_alert_responses.go new file mode 100644 index 00000000..f055cf16 --- /dev/null +++ b/rail/v2/client/metro/metro_api_alert_responses.go @@ -0,0 +1,70 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package metro + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/minchao/go-ptx/rail/v2/models" +) + +// MetroAPIAlertReader is a Reader for the MetroAPIAlert structure. +type MetroAPIAlertReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MetroAPIAlertReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMetroAPIAlertOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewMetroAPIAlertOK creates a MetroAPIAlertOK with default headers values +func NewMetroAPIAlertOK() *MetroAPIAlertOK { + return &MetroAPIAlertOK{} +} + +/*MetroAPIAlertOK handles this case with default header values. + +OK +*/ +type MetroAPIAlertOK struct { + Payload *models.MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTAlertListAlert +} + +func (o *MetroAPIAlertOK) Error() string { + return fmt.Sprintf("[GET /v2/Rail/Metro/Alert/{Operator}][%d] metroApiAlertOK %+v", 200, o.Payload) +} + +func (o *MetroAPIAlertOK) GetPayload() *models.MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTAlertListAlert { + return o.Payload +} + +func (o *MetroAPIAlertOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTAlertListAlert) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/rail/v2/client/metro/metro_api_news_parameters.go b/rail/v2/client/metro/metro_api_news_parameters.go new file mode 100644 index 00000000..b45f4bae --- /dev/null +++ b/rail/v2/client/metro/metro_api_news_parameters.go @@ -0,0 +1,363 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package metro + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/swag" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewMetroAPINewsParams creates a new MetroAPINewsParams object +// with the default values initialized. +func NewMetroAPINewsParams() *MetroAPINewsParams { + var ( + dollarTopDefault = int64(30) + ) + return &MetroAPINewsParams{ + DollarTop: &dollarTopDefault, + + timeout: cr.DefaultTimeout, + } +} + +// NewMetroAPINewsParamsWithTimeout creates a new MetroAPINewsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewMetroAPINewsParamsWithTimeout(timeout time.Duration) *MetroAPINewsParams { + var ( + dollarTopDefault = int64(30) + ) + return &MetroAPINewsParams{ + DollarTop: &dollarTopDefault, + + timeout: timeout, + } +} + +// NewMetroAPINewsParamsWithContext creates a new MetroAPINewsParams object +// with the default values initialized, and the ability to set a context for a request +func NewMetroAPINewsParamsWithContext(ctx context.Context) *MetroAPINewsParams { + var ( + dollarTopDefault = int64(30) + ) + return &MetroAPINewsParams{ + DollarTop: &dollarTopDefault, + + Context: ctx, + } +} + +// NewMetroAPINewsParamsWithHTTPClient creates a new MetroAPINewsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewMetroAPINewsParamsWithHTTPClient(client *http.Client) *MetroAPINewsParams { + var ( + dollarTopDefault = int64(30) + ) + return &MetroAPINewsParams{ + DollarTop: &dollarTopDefault, + HTTPClient: client, + } +} + +/*MetroAPINewsParams contains all the parameters to send to the API endpoint +for the metro Api news operation typically these are written to a http.Request +*/ +type MetroAPINewsParams struct { + + /*DollarCount + 查詢數量 + + */ + DollarCount *string + /*DollarFilter + 過濾 + + */ + DollarFilter *string + /*DollarFormat + 指定來源格式 + + */ + DollarFormat string + /*DollarOrderby + 排序 + + */ + DollarOrderby *string + /*DollarSelect + 挑選 + + */ + DollarSelect *string + /*DollarSkip + 跳過前幾筆 + + */ + DollarSkip *string + /*DollarTop + 取前幾筆 + + */ + DollarTop *int64 + /*Operator*/ + Operator string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the metro Api news params +func (o *MetroAPINewsParams) WithTimeout(timeout time.Duration) *MetroAPINewsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the metro Api news params +func (o *MetroAPINewsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the metro Api news params +func (o *MetroAPINewsParams) WithContext(ctx context.Context) *MetroAPINewsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the metro Api news params +func (o *MetroAPINewsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the metro Api news params +func (o *MetroAPINewsParams) WithHTTPClient(client *http.Client) *MetroAPINewsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the metro Api news params +func (o *MetroAPINewsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDollarCount adds the dollarCount to the metro Api news params +func (o *MetroAPINewsParams) WithDollarCount(dollarCount *string) *MetroAPINewsParams { + o.SetDollarCount(dollarCount) + return o +} + +// SetDollarCount adds the dollarCount to the metro Api news params +func (o *MetroAPINewsParams) SetDollarCount(dollarCount *string) { + o.DollarCount = dollarCount +} + +// WithDollarFilter adds the dollarFilter to the metro Api news params +func (o *MetroAPINewsParams) WithDollarFilter(dollarFilter *string) *MetroAPINewsParams { + o.SetDollarFilter(dollarFilter) + return o +} + +// SetDollarFilter adds the dollarFilter to the metro Api news params +func (o *MetroAPINewsParams) SetDollarFilter(dollarFilter *string) { + o.DollarFilter = dollarFilter +} + +// WithDollarFormat adds the dollarFormat to the metro Api news params +func (o *MetroAPINewsParams) WithDollarFormat(dollarFormat string) *MetroAPINewsParams { + o.SetDollarFormat(dollarFormat) + return o +} + +// SetDollarFormat adds the dollarFormat to the metro Api news params +func (o *MetroAPINewsParams) SetDollarFormat(dollarFormat string) { + o.DollarFormat = dollarFormat +} + +// WithDollarOrderby adds the dollarOrderby to the metro Api news params +func (o *MetroAPINewsParams) WithDollarOrderby(dollarOrderby *string) *MetroAPINewsParams { + o.SetDollarOrderby(dollarOrderby) + return o +} + +// SetDollarOrderby adds the dollarOrderby to the metro Api news params +func (o *MetroAPINewsParams) SetDollarOrderby(dollarOrderby *string) { + o.DollarOrderby = dollarOrderby +} + +// WithDollarSelect adds the dollarSelect to the metro Api news params +func (o *MetroAPINewsParams) WithDollarSelect(dollarSelect *string) *MetroAPINewsParams { + o.SetDollarSelect(dollarSelect) + return o +} + +// SetDollarSelect adds the dollarSelect to the metro Api news params +func (o *MetroAPINewsParams) SetDollarSelect(dollarSelect *string) { + o.DollarSelect = dollarSelect +} + +// WithDollarSkip adds the dollarSkip to the metro Api news params +func (o *MetroAPINewsParams) WithDollarSkip(dollarSkip *string) *MetroAPINewsParams { + o.SetDollarSkip(dollarSkip) + return o +} + +// SetDollarSkip adds the dollarSkip to the metro Api news params +func (o *MetroAPINewsParams) SetDollarSkip(dollarSkip *string) { + o.DollarSkip = dollarSkip +} + +// WithDollarTop adds the dollarTop to the metro Api news params +func (o *MetroAPINewsParams) WithDollarTop(dollarTop *int64) *MetroAPINewsParams { + o.SetDollarTop(dollarTop) + return o +} + +// SetDollarTop adds the dollarTop to the metro Api news params +func (o *MetroAPINewsParams) SetDollarTop(dollarTop *int64) { + o.DollarTop = dollarTop +} + +// WithOperator adds the operator to the metro Api news params +func (o *MetroAPINewsParams) WithOperator(operator string) *MetroAPINewsParams { + o.SetOperator(operator) + return o +} + +// SetOperator adds the operator to the metro Api news params +func (o *MetroAPINewsParams) SetOperator(operator string) { + o.Operator = operator +} + +// WriteToRequest writes these params to a swagger request +func (o *MetroAPINewsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.DollarCount != nil { + + // query param $count + var qrDollarCount string + if o.DollarCount != nil { + qrDollarCount = *o.DollarCount + } + qDollarCount := qrDollarCount + if qDollarCount != "" { + if err := r.SetQueryParam("$count", qDollarCount); err != nil { + return err + } + } + + } + + if o.DollarFilter != nil { + + // query param $filter + var qrDollarFilter string + if o.DollarFilter != nil { + qrDollarFilter = *o.DollarFilter + } + qDollarFilter := qrDollarFilter + if qDollarFilter != "" { + if err := r.SetQueryParam("$filter", qDollarFilter); err != nil { + return err + } + } + + } + + // query param $format + qrDollarFormat := o.DollarFormat + qDollarFormat := qrDollarFormat + if qDollarFormat != "" { + if err := r.SetQueryParam("$format", qDollarFormat); err != nil { + return err + } + } + + if o.DollarOrderby != nil { + + // query param $orderby + var qrDollarOrderby string + if o.DollarOrderby != nil { + qrDollarOrderby = *o.DollarOrderby + } + qDollarOrderby := qrDollarOrderby + if qDollarOrderby != "" { + if err := r.SetQueryParam("$orderby", qDollarOrderby); err != nil { + return err + } + } + + } + + if o.DollarSelect != nil { + + // query param $select + var qrDollarSelect string + if o.DollarSelect != nil { + qrDollarSelect = *o.DollarSelect + } + qDollarSelect := qrDollarSelect + if qDollarSelect != "" { + if err := r.SetQueryParam("$select", qDollarSelect); err != nil { + return err + } + } + + } + + if o.DollarSkip != nil { + + // query param $skip + var qrDollarSkip string + if o.DollarSkip != nil { + qrDollarSkip = *o.DollarSkip + } + qDollarSkip := qrDollarSkip + if qDollarSkip != "" { + if err := r.SetQueryParam("$skip", qDollarSkip); err != nil { + return err + } + } + + } + + if o.DollarTop != nil { + + // query param $top + var qrDollarTop int64 + if o.DollarTop != nil { + qrDollarTop = *o.DollarTop + } + qDollarTop := swag.FormatInt64(qrDollarTop) + if qDollarTop != "" { + if err := r.SetQueryParam("$top", qDollarTop); err != nil { + return err + } + } + + } + + // path param Operator + if err := r.SetPathParam("Operator", o.Operator); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/rail/v2/client/metro/metro_api_news_responses.go b/rail/v2/client/metro/metro_api_news_responses.go new file mode 100644 index 00000000..275bd985 --- /dev/null +++ b/rail/v2/client/metro/metro_api_news_responses.go @@ -0,0 +1,70 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package metro + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/minchao/go-ptx/rail/v2/models" +) + +// MetroAPINewsReader is a Reader for the MetroAPINews structure. +type MetroAPINewsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MetroAPINewsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMetroAPINewsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewMetroAPINewsOK creates a MetroAPINewsOK with default headers values +func NewMetroAPINewsOK() *MetroAPINewsOK { + return &MetroAPINewsOK{} +} + +/*MetroAPINewsOK handles this case with default header values. + +OK +*/ +type MetroAPINewsOK struct { + Payload *models.MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTNewsListNews +} + +func (o *MetroAPINewsOK) Error() string { + return fmt.Sprintf("[GET /v2/Rail/Metro/News/{Operator}][%d] metroApiNewsOK %+v", 200, o.Payload) +} + +func (o *MetroAPINewsOK) GetPayload() *models.MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTNewsListNews { + return o.Payload +} + +func (o *MetroAPINewsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTNewsListNews) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/rail/v2/client/metro/metro_client.go b/rail/v2/client/metro/metro_client.go index c051ae60..42823ee7 100644 --- a/rail/v2/client/metro/metro_client.go +++ b/rail/v2/client/metro/metro_client.go @@ -26,6 +26,42 @@ type Client struct { formats strfmt.Registry } +/* +MetroAPIAlert 取得營運通阻資料s + +取得營運通阻資料 +*/ +func (a *Client) MetroAPIAlert(params *MetroAPIAlertParams) (*MetroAPIAlertOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMetroAPIAlertParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "MetroApi_Alert", + Method: "GET", + PathPattern: "/v2/Rail/Metro/Alert/{Operator}", + ProducesMediaTypes: []string{"application/json", "text/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"https"}, + Params: params, + Reader: &MetroAPIAlertReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*MetroAPIAlertOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for MetroApi_Alert: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + /* MetroAPIFirstLastTimetable 取得捷運首末班車時刻表資料s @@ -242,6 +278,42 @@ func (a *Client) MetroAPINetwork(params *MetroAPINetworkParams) (*MetroAPINetwor panic(msg) } +/* +MetroAPINews 取得最新消息s + +取得最新消息 +*/ +func (a *Client) MetroAPINews(params *MetroAPINewsParams) (*MetroAPINewsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMetroAPINewsParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "MetroApi_News", + Method: "GET", + PathPattern: "/v2/Rail/Metro/News/{Operator}", + ProducesMediaTypes: []string{"application/json", "text/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"https"}, + Params: params, + Reader: &MetroAPINewsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*MetroAPINewsOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for MetroApi_News: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + /* MetroAPIODFare 取得捷運起迄站間票價資料s @@ -570,6 +642,9 @@ func (a *Client) MetroAPIStationOfRoute(params *MetroAPIStationOfRouteParams) (* MetroAPIStationTimeTable 取得捷運站別時刻表資料s 取得捷運站別時刻表資料 + +## 使用注意事項 +臺北捷運目前無提供文湖線站別時刻表,建議您可使用[取得捷運路線發車班距頻率資料]取得文湖線列車相關資訊。 */ func (a *Client) MetroAPIStationTimeTable(params *MetroAPIStationTimeTableParams) (*MetroAPIStationTimeTableOK, error) { // TODO: Validate the params before sending diff --git a/rail/v2/client/rail_basic/rail_api_operator_parameters.go b/rail/v2/client/rail_basic/rail_api_operator_parameters.go new file mode 100644 index 00000000..6c4829b7 --- /dev/null +++ b/rail/v2/client/rail_basic/rail_api_operator_parameters.go @@ -0,0 +1,313 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package rail_basic + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/swag" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewRailAPIOperatorParams creates a new RailAPIOperatorParams object +// with the default values initialized. +func NewRailAPIOperatorParams() *RailAPIOperatorParams { + var ( + dollarTopDefault = int64(30) + ) + return &RailAPIOperatorParams{ + DollarTop: &dollarTopDefault, + + timeout: cr.DefaultTimeout, + } +} + +// NewRailAPIOperatorParamsWithTimeout creates a new RailAPIOperatorParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewRailAPIOperatorParamsWithTimeout(timeout time.Duration) *RailAPIOperatorParams { + var ( + dollarTopDefault = int64(30) + ) + return &RailAPIOperatorParams{ + DollarTop: &dollarTopDefault, + + timeout: timeout, + } +} + +// NewRailAPIOperatorParamsWithContext creates a new RailAPIOperatorParams object +// with the default values initialized, and the ability to set a context for a request +func NewRailAPIOperatorParamsWithContext(ctx context.Context) *RailAPIOperatorParams { + var ( + dollarTopDefault = int64(30) + ) + return &RailAPIOperatorParams{ + DollarTop: &dollarTopDefault, + + Context: ctx, + } +} + +// NewRailAPIOperatorParamsWithHTTPClient creates a new RailAPIOperatorParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewRailAPIOperatorParamsWithHTTPClient(client *http.Client) *RailAPIOperatorParams { + var ( + dollarTopDefault = int64(30) + ) + return &RailAPIOperatorParams{ + DollarTop: &dollarTopDefault, + HTTPClient: client, + } +} + +/*RailAPIOperatorParams contains all the parameters to send to the API endpoint +for the rail Api operator operation typically these are written to a http.Request +*/ +type RailAPIOperatorParams struct { + + /*DollarFilter + 過濾 + + */ + DollarFilter *string + /*DollarFormat + 指定來源格式 + + */ + DollarFormat string + /*DollarOrderby + 排序 + + */ + DollarOrderby *string + /*DollarSelect + 挑選 + + */ + DollarSelect *string + /*DollarSkip + 跳過前幾筆 + + */ + DollarSkip *string + /*DollarTop + 取前幾筆 + + */ + DollarTop *int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the rail Api operator params +func (o *RailAPIOperatorParams) WithTimeout(timeout time.Duration) *RailAPIOperatorParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the rail Api operator params +func (o *RailAPIOperatorParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the rail Api operator params +func (o *RailAPIOperatorParams) WithContext(ctx context.Context) *RailAPIOperatorParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the rail Api operator params +func (o *RailAPIOperatorParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the rail Api operator params +func (o *RailAPIOperatorParams) WithHTTPClient(client *http.Client) *RailAPIOperatorParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the rail Api operator params +func (o *RailAPIOperatorParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDollarFilter adds the dollarFilter to the rail Api operator params +func (o *RailAPIOperatorParams) WithDollarFilter(dollarFilter *string) *RailAPIOperatorParams { + o.SetDollarFilter(dollarFilter) + return o +} + +// SetDollarFilter adds the dollarFilter to the rail Api operator params +func (o *RailAPIOperatorParams) SetDollarFilter(dollarFilter *string) { + o.DollarFilter = dollarFilter +} + +// WithDollarFormat adds the dollarFormat to the rail Api operator params +func (o *RailAPIOperatorParams) WithDollarFormat(dollarFormat string) *RailAPIOperatorParams { + o.SetDollarFormat(dollarFormat) + return o +} + +// SetDollarFormat adds the dollarFormat to the rail Api operator params +func (o *RailAPIOperatorParams) SetDollarFormat(dollarFormat string) { + o.DollarFormat = dollarFormat +} + +// WithDollarOrderby adds the dollarOrderby to the rail Api operator params +func (o *RailAPIOperatorParams) WithDollarOrderby(dollarOrderby *string) *RailAPIOperatorParams { + o.SetDollarOrderby(dollarOrderby) + return o +} + +// SetDollarOrderby adds the dollarOrderby to the rail Api operator params +func (o *RailAPIOperatorParams) SetDollarOrderby(dollarOrderby *string) { + o.DollarOrderby = dollarOrderby +} + +// WithDollarSelect adds the dollarSelect to the rail Api operator params +func (o *RailAPIOperatorParams) WithDollarSelect(dollarSelect *string) *RailAPIOperatorParams { + o.SetDollarSelect(dollarSelect) + return o +} + +// SetDollarSelect adds the dollarSelect to the rail Api operator params +func (o *RailAPIOperatorParams) SetDollarSelect(dollarSelect *string) { + o.DollarSelect = dollarSelect +} + +// WithDollarSkip adds the dollarSkip to the rail Api operator params +func (o *RailAPIOperatorParams) WithDollarSkip(dollarSkip *string) *RailAPIOperatorParams { + o.SetDollarSkip(dollarSkip) + return o +} + +// SetDollarSkip adds the dollarSkip to the rail Api operator params +func (o *RailAPIOperatorParams) SetDollarSkip(dollarSkip *string) { + o.DollarSkip = dollarSkip +} + +// WithDollarTop adds the dollarTop to the rail Api operator params +func (o *RailAPIOperatorParams) WithDollarTop(dollarTop *int64) *RailAPIOperatorParams { + o.SetDollarTop(dollarTop) + return o +} + +// SetDollarTop adds the dollarTop to the rail Api operator params +func (o *RailAPIOperatorParams) SetDollarTop(dollarTop *int64) { + o.DollarTop = dollarTop +} + +// WriteToRequest writes these params to a swagger request +func (o *RailAPIOperatorParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.DollarFilter != nil { + + // query param $filter + var qrDollarFilter string + if o.DollarFilter != nil { + qrDollarFilter = *o.DollarFilter + } + qDollarFilter := qrDollarFilter + if qDollarFilter != "" { + if err := r.SetQueryParam("$filter", qDollarFilter); err != nil { + return err + } + } + + } + + // query param $format + qrDollarFormat := o.DollarFormat + qDollarFormat := qrDollarFormat + if qDollarFormat != "" { + if err := r.SetQueryParam("$format", qDollarFormat); err != nil { + return err + } + } + + if o.DollarOrderby != nil { + + // query param $orderby + var qrDollarOrderby string + if o.DollarOrderby != nil { + qrDollarOrderby = *o.DollarOrderby + } + qDollarOrderby := qrDollarOrderby + if qDollarOrderby != "" { + if err := r.SetQueryParam("$orderby", qDollarOrderby); err != nil { + return err + } + } + + } + + if o.DollarSelect != nil { + + // query param $select + var qrDollarSelect string + if o.DollarSelect != nil { + qrDollarSelect = *o.DollarSelect + } + qDollarSelect := qrDollarSelect + if qDollarSelect != "" { + if err := r.SetQueryParam("$select", qDollarSelect); err != nil { + return err + } + } + + } + + if o.DollarSkip != nil { + + // query param $skip + var qrDollarSkip string + if o.DollarSkip != nil { + qrDollarSkip = *o.DollarSkip + } + qDollarSkip := qrDollarSkip + if qDollarSkip != "" { + if err := r.SetQueryParam("$skip", qDollarSkip); err != nil { + return err + } + } + + } + + if o.DollarTop != nil { + + // query param $top + var qrDollarTop int64 + if o.DollarTop != nil { + qrDollarTop = *o.DollarTop + } + qDollarTop := swag.FormatInt64(qrDollarTop) + if qDollarTop != "" { + if err := r.SetQueryParam("$top", qDollarTop); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/rail/v2/client/rail_basic/rail_api_operator_responses.go b/rail/v2/client/rail_basic/rail_api_operator_responses.go new file mode 100644 index 00000000..ab3733ca --- /dev/null +++ b/rail/v2/client/rail_basic/rail_api_operator_responses.go @@ -0,0 +1,68 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package rail_basic + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/minchao/go-ptx/rail/v2/models" +) + +// RailAPIOperatorReader is a Reader for the RailAPIOperator structure. +type RailAPIOperatorReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *RailAPIOperatorReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewRailAPIOperatorOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewRailAPIOperatorOK creates a RailAPIOperatorOK with default headers values +func NewRailAPIOperatorOK() *RailAPIOperatorOK { + return &RailAPIOperatorOK{} +} + +/*RailAPIOperatorOK handles this case with default header values. + +OK +*/ +type RailAPIOperatorOK struct { + Payload []*models.ServiceDTOVersion2BaseOperator +} + +func (o *RailAPIOperatorOK) Error() string { + return fmt.Sprintf("[GET /v2/Rail/Operator][%d] railApiOperatorOK %+v", 200, o.Payload) +} + +func (o *RailAPIOperatorOK) GetPayload() []*models.ServiceDTOVersion2BaseOperator { + return o.Payload +} + +func (o *RailAPIOperatorOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/rail/v2/client/rail_basic/rail_basic_client.go b/rail/v2/client/rail_basic/rail_basic_client.go new file mode 100644 index 00000000..58bc6b25 --- /dev/null +++ b/rail/v2/client/rail_basic/rail_basic_client.go @@ -0,0 +1,66 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package rail_basic + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// New creates a new rail basic API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { + return &Client{transport: transport, formats: formats} +} + +/* +Client for rail basic API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +/* +RailAPIOperator rail Api operator API +*/ +func (a *Client) RailAPIOperator(params *RailAPIOperatorParams) (*RailAPIOperatorOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewRailAPIOperatorParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "RailApi_Operator", + Method: "GET", + PathPattern: "/v2/Rail/Operator", + ProducesMediaTypes: []string{"application/json", "text/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"https"}, + Params: params, + Reader: &RailAPIOperatorReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*RailAPIOperatorOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for RailApi_Operator: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/rail/v2/models/m_o_t_c_api_rail_models_m_r_t_real_time_wrapper_service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert.go b/rail/v2/models/m_o_t_c_api_rail_models_m_r_t_real_time_wrapper_service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert.go new file mode 100644 index 00000000..6f403457 --- /dev/null +++ b/rail/v2/models/m_o_t_c_api_rail_models_m_r_t_real_time_wrapper_service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert.go @@ -0,0 +1,160 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTAlertListAlert MRTAlertList +// swagger:model MOTC.API.Rail.Models.MRTRealTimeWrapper[Service.DTO.Version2.Rail.Metro.MRTAlertList.Alert] +type MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTAlertListAlert struct { + + // 資料(陣列) + // Required: true + Alerts []*ServiceDTOVersion2RailMetroMRTAlertListAlert `json:"Alerts"` + + // 業管機關簡碼 + // Required: true + AuthorityCode *string `json:"AuthorityCode"` + + // 資料總筆數 + Count int64 `json:"Count,omitempty"` + + // 來源端平台資料更新週期(秒) + // Required: true + SrcUpdateInterval *int32 `json:"SrcUpdateInterval"` + + // DateTime + // + // 來源端平台資料更新時間(ISO8601格式:yyyy-MM-ddTHH:mm:sszzz) + // Required: true + SrcUpdateTime *string `json:"SrcUpdateTime"` + + // 本平台資料更新週期(秒) + // Required: true + UpdateInterval *int32 `json:"UpdateInterval"` + + // DateTime + // + // 本平台資料更新時間(ISO8601格式:yyyy-MM-ddTHH:mm:sszzz) + UpdateTime string `json:"UpdateTime,omitempty"` +} + +// Validate validates this m o t c API rail models m r t real time wrapper service d t o version2 rail metro m r t alert list alert +func (m *MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTAlertListAlert) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAlerts(formats); err != nil { + res = append(res, err) + } + + if err := m.validateAuthorityCode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSrcUpdateInterval(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSrcUpdateTime(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdateInterval(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTAlertListAlert) validateAlerts(formats strfmt.Registry) error { + + if err := validate.Required("Alerts", "body", m.Alerts); err != nil { + return err + } + + for i := 0; i < len(m.Alerts); i++ { + if swag.IsZero(m.Alerts[i]) { // not required + continue + } + + if m.Alerts[i] != nil { + if err := m.Alerts[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Alerts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTAlertListAlert) validateAuthorityCode(formats strfmt.Registry) error { + + if err := validate.Required("AuthorityCode", "body", m.AuthorityCode); err != nil { + return err + } + + return nil +} + +func (m *MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTAlertListAlert) validateSrcUpdateInterval(formats strfmt.Registry) error { + + if err := validate.Required("SrcUpdateInterval", "body", m.SrcUpdateInterval); err != nil { + return err + } + + return nil +} + +func (m *MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTAlertListAlert) validateSrcUpdateTime(formats strfmt.Registry) error { + + if err := validate.Required("SrcUpdateTime", "body", m.SrcUpdateTime); err != nil { + return err + } + + return nil +} + +func (m *MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTAlertListAlert) validateUpdateInterval(formats strfmt.Registry) error { + + if err := validate.Required("UpdateInterval", "body", m.UpdateInterval); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTAlertListAlert) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTAlertListAlert) UnmarshalBinary(b []byte) error { + var res MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTAlertListAlert + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/rail/v2/models/m_o_t_c_api_rail_models_m_r_t_real_time_wrapper_service_d_t_o_version2_rail_metro_m_r_t_news_list_news.go b/rail/v2/models/m_o_t_c_api_rail_models_m_r_t_real_time_wrapper_service_d_t_o_version2_rail_metro_m_r_t_news_list_news.go new file mode 100644 index 00000000..92ee7bae --- /dev/null +++ b/rail/v2/models/m_o_t_c_api_rail_models_m_r_t_real_time_wrapper_service_d_t_o_version2_rail_metro_m_r_t_news_list_news.go @@ -0,0 +1,160 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTNewsListNews MRTNewsList +// swagger:model MOTC.API.Rail.Models.MRTRealTimeWrapper[Service.DTO.Version2.Rail.Metro.MRTNewsList.News] +type MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTNewsListNews struct { + + // 業管機關簡碼 + // Required: true + AuthorityCode *string `json:"AuthorityCode"` + + // 資料總筆數 + Count int64 `json:"Count,omitempty"` + + // 資料(陣列) + // Required: true + Newses []*ServiceDTOVersion2RailMetroMRTNewsListNews `json:"Newses"` + + // 來源端平台資料更新週期(秒) + // Required: true + SrcUpdateInterval *int32 `json:"SrcUpdateInterval"` + + // DateTime + // + // 來源端平台資料更新時間(ISO8601格式:yyyy-MM-ddTHH:mm:sszzz) + // Required: true + SrcUpdateTime *string `json:"SrcUpdateTime"` + + // 本平台資料更新週期(秒) + // Required: true + UpdateInterval *int32 `json:"UpdateInterval"` + + // DateTime + // + // 本平台資料更新時間(ISO8601格式:yyyy-MM-ddTHH:mm:sszzz) + UpdateTime string `json:"UpdateTime,omitempty"` +} + +// Validate validates this m o t c API rail models m r t real time wrapper service d t o version2 rail metro m r t news list news +func (m *MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTNewsListNews) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAuthorityCode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNewses(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSrcUpdateInterval(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSrcUpdateTime(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdateInterval(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTNewsListNews) validateAuthorityCode(formats strfmt.Registry) error { + + if err := validate.Required("AuthorityCode", "body", m.AuthorityCode); err != nil { + return err + } + + return nil +} + +func (m *MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTNewsListNews) validateNewses(formats strfmt.Registry) error { + + if err := validate.Required("Newses", "body", m.Newses); err != nil { + return err + } + + for i := 0; i < len(m.Newses); i++ { + if swag.IsZero(m.Newses[i]) { // not required + continue + } + + if m.Newses[i] != nil { + if err := m.Newses[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Newses" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTNewsListNews) validateSrcUpdateInterval(formats strfmt.Registry) error { + + if err := validate.Required("SrcUpdateInterval", "body", m.SrcUpdateInterval); err != nil { + return err + } + + return nil +} + +func (m *MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTNewsListNews) validateSrcUpdateTime(formats strfmt.Registry) error { + + if err := validate.Required("SrcUpdateTime", "body", m.SrcUpdateTime); err != nil { + return err + } + + return nil +} + +func (m *MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTNewsListNews) validateUpdateInterval(formats strfmt.Registry) error { + + if err := validate.Required("UpdateInterval", "body", m.UpdateInterval); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTNewsListNews) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTNewsListNews) UnmarshalBinary(b []byte) error { + var res MOTCAPIRailModelsMRTRealTimeWrapperServiceDTOVersion2RailMetroMRTNewsListNews + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/rail/v2/models/service_d_t_o_version2_base_operator.go b/rail/v2/models/service_d_t_o_version2_base_operator.go new file mode 100644 index 00000000..dc5c9a1e --- /dev/null +++ b/rail/v2/models/service_d_t_o_version2_base_operator.go @@ -0,0 +1,199 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ServiceDTOVersion2BaseOperator Operator +// +// 營運業者資料型別 +// swagger:model Service.DTO.Version2.Base.Operator +type ServiceDTOVersion2BaseOperator struct { + + // 營運業者業管機關簡碼(對於於公路客運/國道客運而言為THB) + // Required: true + AuthorityCode *string `json:"AuthorityCode"` + + // 營運業者簡碼 + // Required: true + OperatorCode *string `json:"OperatorCode"` + + // 營運業者電子信箱 + OperatorEmail string `json:"OperatorEmail,omitempty"` + + // 營運業者代碼 + // Required: true + OperatorID *string `json:"OperatorID"` + + // NameType + // + // 營運業者名稱 + // Required: true + OperatorName *ServiceDTOVersion2BaseNameType `json:"OperatorName"` + + // 營運業者編號[交通部票證資料系統定義] + // Required: true + OperatorNo *string `json:"OperatorNo"` + + // 營運業者連絡電話 + OperatorPhone string `json:"OperatorPhone,omitempty"` + + // 營運業者網址鏈結 + OperatorURL string `json:"OperatorUrl,omitempty"` + + // 資料提供平台代碼 + // Required: true + ProviderID *string `json:"ProviderID"` + + // 訂票連絡電話 + ReservationPhone string `json:"ReservationPhone,omitempty"` + + // 訂票網址鏈結 + ReservationURL string `json:"ReservationUrl,omitempty"` + + // 營運業者所屬業管子機關簡碼(對於公路客運/國道客運路線而言為區監理所如THB-VO10-1..等) + SubAuthorityCode string `json:"SubAuthorityCode,omitempty"` + + // DateTime + // + // 資料更新日期時間(ISO8601格式:yyyy-MM-ddTHH:mm:sszzz) + // Required: true + UpdateTime *string `json:"UpdateTime"` +} + +// Validate validates this service d t o version2 base operator +func (m *ServiceDTOVersion2BaseOperator) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAuthorityCode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOperatorCode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOperatorID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOperatorName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOperatorNo(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProviderID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdateTime(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceDTOVersion2BaseOperator) validateAuthorityCode(formats strfmt.Registry) error { + + if err := validate.Required("AuthorityCode", "body", m.AuthorityCode); err != nil { + return err + } + + return nil +} + +func (m *ServiceDTOVersion2BaseOperator) validateOperatorCode(formats strfmt.Registry) error { + + if err := validate.Required("OperatorCode", "body", m.OperatorCode); err != nil { + return err + } + + return nil +} + +func (m *ServiceDTOVersion2BaseOperator) validateOperatorID(formats strfmt.Registry) error { + + if err := validate.Required("OperatorID", "body", m.OperatorID); err != nil { + return err + } + + return nil +} + +func (m *ServiceDTOVersion2BaseOperator) validateOperatorName(formats strfmt.Registry) error { + + if err := validate.Required("OperatorName", "body", m.OperatorName); err != nil { + return err + } + + if m.OperatorName != nil { + if err := m.OperatorName.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("OperatorName") + } + return err + } + } + + return nil +} + +func (m *ServiceDTOVersion2BaseOperator) validateOperatorNo(formats strfmt.Registry) error { + + if err := validate.Required("OperatorNo", "body", m.OperatorNo); err != nil { + return err + } + + return nil +} + +func (m *ServiceDTOVersion2BaseOperator) validateProviderID(formats strfmt.Registry) error { + + if err := validate.Required("ProviderID", "body", m.ProviderID); err != nil { + return err + } + + return nil +} + +func (m *ServiceDTOVersion2BaseOperator) validateUpdateTime(formats strfmt.Registry) error { + + if err := validate.Required("UpdateTime", "body", m.UpdateTime); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceDTOVersion2BaseOperator) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceDTOVersion2BaseOperator) UnmarshalBinary(b []byte) error { + var res ServiceDTOVersion2BaseOperator + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert.go b/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert.go new file mode 100644 index 00000000..3fbd9905 --- /dev/null +++ b/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert.go @@ -0,0 +1,198 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ServiceDTOVersion2RailMetroMRTAlertListAlert Alert +// swagger:model Service.DTO.Version2.Rail.Metro.MRTAlertList.Alert +type ServiceDTOVersion2RailMetroMRTAlertListAlert struct { + + // 通阻訊息代碼 + // Required: true + AlertID *string `json:"AlertID"` + + // 通阻訊息網址連結 + AlertURL string `json:"AlertURL,omitempty"` + + // 通阻訊息說明 + // Required: true + Description *string `json:"Description"` + + // integer + // + // 影響方向 : [0:'去程',1:'返程'] + Direction int32 `json:"Direction,omitempty"` + + // 影響說明 + Effect string `json:"Effect,omitempty"` + + // DateTime + // + // 訊息結束日期時間 + EndTime string `json:"EndTime,omitempty"` + + // integer + // + // 影響等級程度 : [1:'重度',2:'中度',3:'輕度'] + Level int32 `json:"Level,omitempty"` + + // DateTime + // + // 消息發佈日期時間 + PublishTime string `json:"PublishTime,omitempty"` + + // 影響原因 + Reason string `json:"Reason,omitempty"` + + // AlertScope + // + // 影響範圍 + // Required: true + Scope *ServiceDTOVersion2RailMetroMRTAlertListAlertScope `json:"Scope"` + + // DateTime + // + // 訊息起始日期時間 + StartTime string `json:"StartTime,omitempty"` + + // integer + // + // 營運狀況 : [0:'全線營運停止',1:'全線營運正常',2:'有異常狀況'] + // Required: true + Status *int32 `json:"Status"` + + // 通阻訊息標題 + // Required: true + Title *string `json:"Title"` + + // DateTime + // + // 消息更新日期時間 + // Required: true + UpdateTime *string `json:"UpdateTime"` +} + +// Validate validates this service d t o version2 rail metro m r t alert list alert +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlert) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAlertID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if err := m.validateScope(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTitle(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdateTime(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlert) validateAlertID(formats strfmt.Registry) error { + + if err := validate.Required("AlertID", "body", m.AlertID); err != nil { + return err + } + + return nil +} + +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlert) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("Description", "body", m.Description); err != nil { + return err + } + + return nil +} + +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlert) validateScope(formats strfmt.Registry) error { + + if err := validate.Required("Scope", "body", m.Scope); err != nil { + return err + } + + if m.Scope != nil { + if err := m.Scope.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Scope") + } + return err + } + } + + return nil +} + +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlert) validateStatus(formats strfmt.Registry) error { + + if err := validate.Required("Status", "body", m.Status); err != nil { + return err + } + + return nil +} + +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlert) validateTitle(formats strfmt.Registry) error { + + if err := validate.Required("Title", "body", m.Title); err != nil { + return err + } + + return nil +} + +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlert) validateUpdateTime(formats strfmt.Registry) error { + + if err := validate.Required("UpdateTime", "body", m.UpdateTime); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlert) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlert) UnmarshalBinary(b []byte) error { + var res ServiceDTOVersion2RailMetroMRTAlertListAlert + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope.go b/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope.go new file mode 100644 index 00000000..555604b0 --- /dev/null +++ b/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope.go @@ -0,0 +1,241 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ServiceDTOVersion2RailMetroMRTAlertListAlertScope AlertScope +// swagger:model Service.DTO.Version2.Rail.Metro.MRTAlertList.AlertScope +type ServiceDTOVersion2RailMetroMRTAlertListAlertScope struct { + + // 受影響的路線區間 + // Required: true + LineSections []*ServiceDTOVersion2RailMetroMRTAlertListAlertScopeLineSection `json:"LineSections"` + + // 受影響的實體路線 + // Required: true + Lines []*ServiceDTOVersion2RailMetroMRTAlertListAlertScopeLine `json:"Lines"` + + // AlertScopeNetwork + // + // 受影響的路網 + Network *ServiceDTOVersion2RailMetroMRTAlertListAlertScopeNetwork `json:"Network,omitempty"` + + // 受影響的營運路線 + // Required: true + Routes []*ServiceDTOVersion2RailMetroMRTAlertListAlertScopeRoute `json:"Routes"` + + // 受影響的車站 + // Required: true + Stations []*ServiceDTOVersion2RailMetroMRTAlertListAlertScopeStation `json:"Stations"` + + // 受影響的車次 + // Required: true + Trains []*ServiceDTOVersion2RailMetroMRTAlertListAlertScopeTrain `json:"Trains"` +} + +// Validate validates this service d t o version2 rail metro m r t alert list alert scope +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScope) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateLineSections(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLines(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNetwork(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRoutes(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStations(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTrains(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScope) validateLineSections(formats strfmt.Registry) error { + + if err := validate.Required("LineSections", "body", m.LineSections); err != nil { + return err + } + + for i := 0; i < len(m.LineSections); i++ { + if swag.IsZero(m.LineSections[i]) { // not required + continue + } + + if m.LineSections[i] != nil { + if err := m.LineSections[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("LineSections" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScope) validateLines(formats strfmt.Registry) error { + + if err := validate.Required("Lines", "body", m.Lines); err != nil { + return err + } + + for i := 0; i < len(m.Lines); i++ { + if swag.IsZero(m.Lines[i]) { // not required + continue + } + + if m.Lines[i] != nil { + if err := m.Lines[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Lines" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScope) validateNetwork(formats strfmt.Registry) error { + + if swag.IsZero(m.Network) { // not required + return nil + } + + if m.Network != nil { + if err := m.Network.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Network") + } + return err + } + } + + return nil +} + +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScope) validateRoutes(formats strfmt.Registry) error { + + if err := validate.Required("Routes", "body", m.Routes); err != nil { + return err + } + + for i := 0; i < len(m.Routes); i++ { + if swag.IsZero(m.Routes[i]) { // not required + continue + } + + if m.Routes[i] != nil { + if err := m.Routes[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Routes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScope) validateStations(formats strfmt.Registry) error { + + if err := validate.Required("Stations", "body", m.Stations); err != nil { + return err + } + + for i := 0; i < len(m.Stations); i++ { + if swag.IsZero(m.Stations[i]) { // not required + continue + } + + if m.Stations[i] != nil { + if err := m.Stations[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Stations" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScope) validateTrains(formats strfmt.Registry) error { + + if err := validate.Required("Trains", "body", m.Trains); err != nil { + return err + } + + for i := 0; i < len(m.Trains); i++ { + if swag.IsZero(m.Trains[i]) { // not required + continue + } + + if m.Trains[i] != nil { + if err := m.Trains[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Trains" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScope) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScope) UnmarshalBinary(b []byte) error { + var res ServiceDTOVersion2RailMetroMRTAlertListAlertScope + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope_line.go b/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope_line.go new file mode 100644 index 00000000..cfe1b165 --- /dev/null +++ b/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope_line.go @@ -0,0 +1,46 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/swag" +) + +// ServiceDTOVersion2RailMetroMRTAlertListAlertScopeLine AlertScopeLine +// swagger:model Service.DTO.Version2.Rail.Metro.MRTAlertList.AlertScopeLine +type ServiceDTOVersion2RailMetroMRTAlertListAlertScopeLine struct { + + // 實體路線代碼 + LineID string `json:"LineID,omitempty"` + + // 實體路線名稱 + LineName string `json:"LineName,omitempty"` +} + +// Validate validates this service d t o version2 rail metro m r t alert list alert scope line +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScopeLine) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScopeLine) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScopeLine) UnmarshalBinary(b []byte) error { + var res ServiceDTOVersion2RailMetroMRTAlertListAlertScopeLine + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope_line_section.go b/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope_line_section.go new file mode 100644 index 00000000..f7402c67 --- /dev/null +++ b/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope_line_section.go @@ -0,0 +1,58 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/swag" +) + +// ServiceDTOVersion2RailMetroMRTAlertListAlertScopeLineSection AlertScopeLineSection +// swagger:model Service.DTO.Version2.Rail.Metro.MRTAlertList.AlertScopeLineSection +type ServiceDTOVersion2RailMetroMRTAlertListAlertScopeLineSection struct { + + // 影響區間輔助描述 + Description string `json:"Description,omitempty"` + + // 區間迄站車站代碼 + EndingStationID string `json:"EndingStationID,omitempty"` + + // 區間迄站車站名稱 + EndingStationName string `json:"EndingStationName,omitempty"` + + // 路線區間所在路線代碼 + LineID string `json:"LineID,omitempty"` + + // 區間起站車站代碼 + StartingStationID string `json:"StartingStationID,omitempty"` + + // 區間起站車站名稱 + StartingStationName string `json:"StartingStationName,omitempty"` +} + +// Validate validates this service d t o version2 rail metro m r t alert list alert scope line section +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScopeLineSection) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScopeLineSection) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScopeLineSection) UnmarshalBinary(b []byte) error { + var res ServiceDTOVersion2RailMetroMRTAlertListAlertScopeLineSection + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope_network.go b/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope_network.go new file mode 100644 index 00000000..b9ddd7ac --- /dev/null +++ b/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope_network.go @@ -0,0 +1,43 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/swag" +) + +// ServiceDTOVersion2RailMetroMRTAlertListAlertScopeNetwork AlertScopeNetwork +// swagger:model Service.DTO.Version2.Rail.Metro.MRTAlertList.AlertScopeNetwork +type ServiceDTOVersion2RailMetroMRTAlertListAlertScopeNetwork struct { + + // 路網代碼 + NetworkID string `json:"NetworkID,omitempty"` +} + +// Validate validates this service d t o version2 rail metro m r t alert list alert scope network +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScopeNetwork) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScopeNetwork) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScopeNetwork) UnmarshalBinary(b []byte) error { + var res ServiceDTOVersion2RailMetroMRTAlertListAlertScopeNetwork + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope_route.go b/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope_route.go new file mode 100644 index 00000000..0d16f12e --- /dev/null +++ b/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope_route.go @@ -0,0 +1,46 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/swag" +) + +// ServiceDTOVersion2RailMetroMRTAlertListAlertScopeRoute AlertScopeRoute +// swagger:model Service.DTO.Version2.Rail.Metro.MRTAlertList.AlertScopeRoute +type ServiceDTOVersion2RailMetroMRTAlertListAlertScopeRoute struct { + + // 營運路線代碼 + RouteID string `json:"RouteID,omitempty"` + + // 營運路線名稱 + RouteName string `json:"RouteName,omitempty"` +} + +// Validate validates this service d t o version2 rail metro m r t alert list alert scope route +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScopeRoute) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScopeRoute) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScopeRoute) UnmarshalBinary(b []byte) error { + var res ServiceDTOVersion2RailMetroMRTAlertListAlertScopeRoute + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope_station.go b/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope_station.go new file mode 100644 index 00000000..08c5efe7 --- /dev/null +++ b/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope_station.go @@ -0,0 +1,46 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/swag" +) + +// ServiceDTOVersion2RailMetroMRTAlertListAlertScopeStation AlertScopeStation +// swagger:model Service.DTO.Version2.Rail.Metro.MRTAlertList.AlertScopeStation +type ServiceDTOVersion2RailMetroMRTAlertListAlertScopeStation struct { + + // 車站代碼 + StationID string `json:"StationID,omitempty"` + + // 車站名稱 + StationName string `json:"StationName,omitempty"` +} + +// Validate validates this service d t o version2 rail metro m r t alert list alert scope station +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScopeStation) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScopeStation) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScopeStation) UnmarshalBinary(b []byte) error { + var res ServiceDTOVersion2RailMetroMRTAlertListAlertScopeStation + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope_train.go b/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope_train.go new file mode 100644 index 00000000..3c324e02 --- /dev/null +++ b/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_alert_list_alert_scope_train.go @@ -0,0 +1,43 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/swag" +) + +// ServiceDTOVersion2RailMetroMRTAlertListAlertScopeTrain AlertScopeTrain +// swagger:model Service.DTO.Version2.Rail.Metro.MRTAlertList.AlertScopeTrain +type ServiceDTOVersion2RailMetroMRTAlertListAlertScopeTrain struct { + + // 受影響的車次 + TrainNo string `json:"TrainNo,omitempty"` +} + +// Validate validates this service d t o version2 rail metro m r t alert list alert scope train +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScopeTrain) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScopeTrain) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceDTOVersion2RailMetroMRTAlertListAlertScopeTrain) UnmarshalBinary(b []byte) error { + var res ServiceDTOVersion2RailMetroMRTAlertListAlertScopeTrain + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_news_list_news.go b/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_news_list_news.go new file mode 100644 index 00000000..99698281 --- /dev/null +++ b/rail/v2/models/service_d_t_o_version2_rail_metro_m_r_t_news_list_news.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ServiceDTOVersion2RailMetroMRTNewsListNews News +// swagger:model Service.DTO.Version2.Rail.Metro.MRTNewsList.News +type ServiceDTOVersion2RailMetroMRTNewsListNews struct { + + // 附件網址連結 + AttachmentURL string `json:"AttachmentURL,omitempty"` + + // 發布單位 + Department string `json:"Department,omitempty"` + + // 內容描述 + // Required: true + Description *string `json:"Description"` + + // DateTime + // + // 消息結束日期時間 + EndTime string `json:"EndTime,omitempty"` + + // integer + // + // 語系 : [1:'Zh_tw',2:'En_us',3:'Zh_cn',4:'Ja',5:'Ko',99:'Other'] + Language int32 `json:"Language,omitempty"` + + // integer + // + // 消息類別 : [1:'最新消息',2:'新聞稿',3:'營運資訊',4:'轉乘資訊',5:'活動訊息',6:'系統公告',7:'新服務上架',8:'API修正',9:'來源異常',99:'其他'] + // Required: true + NewsCategory *int32 `json:"NewsCategory"` + + // 消息代碼 + // Required: true + NewsID *string `json:"NewsID"` + + // 消息網址連結 + NewsURL string `json:"NewsURL,omitempty"` + + // DateTime + // + // 消息發佈日期時間 + // Required: true + PublishTime *string `json:"PublishTime"` + + // DateTime + // + // 消息起始日期時間 + StartTime string `json:"StartTime,omitempty"` + + // 消息標題 + // Required: true + Title *string `json:"Title"` + + // DateTime + // + // 本筆資料之更新日期時間 + // Required: true + UpdateTime *string `json:"UpdateTime"` +} + +// Validate validates this service d t o version2 rail metro m r t news list news +func (m *ServiceDTOVersion2RailMetroMRTNewsListNews) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNewsCategory(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNewsID(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePublishTime(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTitle(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdateTime(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceDTOVersion2RailMetroMRTNewsListNews) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("Description", "body", m.Description); err != nil { + return err + } + + return nil +} + +func (m *ServiceDTOVersion2RailMetroMRTNewsListNews) validateNewsCategory(formats strfmt.Registry) error { + + if err := validate.Required("NewsCategory", "body", m.NewsCategory); err != nil { + return err + } + + return nil +} + +func (m *ServiceDTOVersion2RailMetroMRTNewsListNews) validateNewsID(formats strfmt.Registry) error { + + if err := validate.Required("NewsID", "body", m.NewsID); err != nil { + return err + } + + return nil +} + +func (m *ServiceDTOVersion2RailMetroMRTNewsListNews) validatePublishTime(formats strfmt.Registry) error { + + if err := validate.Required("PublishTime", "body", m.PublishTime); err != nil { + return err + } + + return nil +} + +func (m *ServiceDTOVersion2RailMetroMRTNewsListNews) validateTitle(formats strfmt.Registry) error { + + if err := validate.Required("Title", "body", m.Title); err != nil { + return err + } + + return nil +} + +func (m *ServiceDTOVersion2RailMetroMRTNewsListNews) validateUpdateTime(formats strfmt.Registry) error { + + if err := validate.Required("UpdateTime", "body", m.UpdateTime); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceDTOVersion2RailMetroMRTNewsListNews) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceDTOVersion2RailMetroMRTNewsListNews) UnmarshalBinary(b []byte) error { + var res ServiceDTOVersion2RailMetroMRTNewsListNews + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/rail/v3/models/service_d_t_o_version3_rail_t_r_a_station.go b/rail/v3/models/service_d_t_o_version3_rail_t_r_a_station.go index 43cc0557..5cff491a 100644 --- a/rail/v3/models/service_d_t_o_version3_rail_t_r_a_station.go +++ b/rail/v3/models/service_d_t_o_version3_rail_t_r_a_station.go @@ -47,6 +47,10 @@ type ServiceDTOVersion3RailTRAStation struct { // Required: true StationPosition *ServiceDTOVersion3BasePointType `json:"StationPosition"` + // 臺鐵車站唯一識別代碼 + // Required: true + StationUID *string `json:"StationUID"` + // 車站資訊說明網址 StationURL string `json:"StationURL,omitempty"` } @@ -67,6 +71,10 @@ func (m *ServiceDTOVersion3RailTRAStation) Validate(formats strfmt.Registry) err res = append(res, err) } + if err := m.validateStationUID(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -118,6 +126,15 @@ func (m *ServiceDTOVersion3RailTRAStation) validateStationPosition(formats strfm return nil } +func (m *ServiceDTOVersion3RailTRAStation) validateStationUID(formats strfmt.Registry) error { + + if err := validate.Required("StationUID", "body", m.StationUID); err != nil { + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *ServiceDTOVersion3RailTRAStation) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/tourism/v2/client/tourism/taiwan_trip_bus_api_real_time_by_frequency2_parameters.go b/tourism/v2/client/tourism/taiwan_trip_bus_api_real_time_by_frequency1_parameters.go similarity index 64% rename from tourism/v2/client/tourism/taiwan_trip_bus_api_real_time_by_frequency2_parameters.go rename to tourism/v2/client/tourism/taiwan_trip_bus_api_real_time_by_frequency1_parameters.go index f7bf16d3..efc0aa2f 100644 --- a/tourism/v2/client/tourism/taiwan_trip_bus_api_real_time_by_frequency2_parameters.go +++ b/tourism/v2/client/tourism/taiwan_trip_bus_api_real_time_by_frequency1_parameters.go @@ -18,61 +18,61 @@ import ( strfmt "github.com/go-openapi/strfmt" ) -// NewTaiwanTripBusAPIRealTimeByFrequency2Params creates a new TaiwanTripBusAPIRealTimeByFrequency2Params object +// NewTaiwanTripBusAPIRealTimeByFrequency1Params creates a new TaiwanTripBusAPIRealTimeByFrequency1Params object // with the default values initialized. -func NewTaiwanTripBusAPIRealTimeByFrequency2Params() *TaiwanTripBusAPIRealTimeByFrequency2Params { +func NewTaiwanTripBusAPIRealTimeByFrequency1Params() *TaiwanTripBusAPIRealTimeByFrequency1Params { var ( dollarTopDefault = int64(30) ) - return &TaiwanTripBusAPIRealTimeByFrequency2Params{ + return &TaiwanTripBusAPIRealTimeByFrequency1Params{ DollarTop: &dollarTopDefault, timeout: cr.DefaultTimeout, } } -// NewTaiwanTripBusAPIRealTimeByFrequency2ParamsWithTimeout creates a new TaiwanTripBusAPIRealTimeByFrequency2Params object +// NewTaiwanTripBusAPIRealTimeByFrequency1ParamsWithTimeout creates a new TaiwanTripBusAPIRealTimeByFrequency1Params object // with the default values initialized, and the ability to set a timeout on a request -func NewTaiwanTripBusAPIRealTimeByFrequency2ParamsWithTimeout(timeout time.Duration) *TaiwanTripBusAPIRealTimeByFrequency2Params { +func NewTaiwanTripBusAPIRealTimeByFrequency1ParamsWithTimeout(timeout time.Duration) *TaiwanTripBusAPIRealTimeByFrequency1Params { var ( dollarTopDefault = int64(30) ) - return &TaiwanTripBusAPIRealTimeByFrequency2Params{ + return &TaiwanTripBusAPIRealTimeByFrequency1Params{ DollarTop: &dollarTopDefault, timeout: timeout, } } -// NewTaiwanTripBusAPIRealTimeByFrequency2ParamsWithContext creates a new TaiwanTripBusAPIRealTimeByFrequency2Params object +// NewTaiwanTripBusAPIRealTimeByFrequency1ParamsWithContext creates a new TaiwanTripBusAPIRealTimeByFrequency1Params object // with the default values initialized, and the ability to set a context for a request -func NewTaiwanTripBusAPIRealTimeByFrequency2ParamsWithContext(ctx context.Context) *TaiwanTripBusAPIRealTimeByFrequency2Params { +func NewTaiwanTripBusAPIRealTimeByFrequency1ParamsWithContext(ctx context.Context) *TaiwanTripBusAPIRealTimeByFrequency1Params { var ( dollarTopDefault = int64(30) ) - return &TaiwanTripBusAPIRealTimeByFrequency2Params{ + return &TaiwanTripBusAPIRealTimeByFrequency1Params{ DollarTop: &dollarTopDefault, Context: ctx, } } -// NewTaiwanTripBusAPIRealTimeByFrequency2ParamsWithHTTPClient creates a new TaiwanTripBusAPIRealTimeByFrequency2Params object +// NewTaiwanTripBusAPIRealTimeByFrequency1ParamsWithHTTPClient creates a new TaiwanTripBusAPIRealTimeByFrequency1Params object // with the default values initialized, and the ability to set a custom HTTPClient for a request -func NewTaiwanTripBusAPIRealTimeByFrequency2ParamsWithHTTPClient(client *http.Client) *TaiwanTripBusAPIRealTimeByFrequency2Params { +func NewTaiwanTripBusAPIRealTimeByFrequency1ParamsWithHTTPClient(client *http.Client) *TaiwanTripBusAPIRealTimeByFrequency1Params { var ( dollarTopDefault = int64(30) ) - return &TaiwanTripBusAPIRealTimeByFrequency2Params{ + return &TaiwanTripBusAPIRealTimeByFrequency1Params{ DollarTop: &dollarTopDefault, HTTPClient: client, } } -/*TaiwanTripBusAPIRealTimeByFrequency2Params contains all the parameters to send to the API endpoint -for the taiwan trip bus Api real time by frequency 2 operation typically these are written to a http.Request +/*TaiwanTripBusAPIRealTimeByFrequency1Params contains all the parameters to send to the API endpoint +for the taiwan trip bus Api real time by frequency 1 operation typically these are written to a http.Request */ -type TaiwanTripBusAPIRealTimeByFrequency2Params struct { +type TaiwanTripBusAPIRealTimeByFrequency1Params struct { /*DollarFilter 過濾 @@ -120,129 +120,129 @@ type TaiwanTripBusAPIRealTimeByFrequency2Params struct { HTTPClient *http.Client } -// WithTimeout adds the timeout to the taiwan trip bus Api real time by frequency 2 params -func (o *TaiwanTripBusAPIRealTimeByFrequency2Params) WithTimeout(timeout time.Duration) *TaiwanTripBusAPIRealTimeByFrequency2Params { +// WithTimeout adds the timeout to the taiwan trip bus Api real time by frequency 1 params +func (o *TaiwanTripBusAPIRealTimeByFrequency1Params) WithTimeout(timeout time.Duration) *TaiwanTripBusAPIRealTimeByFrequency1Params { o.SetTimeout(timeout) return o } -// SetTimeout adds the timeout to the taiwan trip bus Api real time by frequency 2 params -func (o *TaiwanTripBusAPIRealTimeByFrequency2Params) SetTimeout(timeout time.Duration) { +// SetTimeout adds the timeout to the taiwan trip bus Api real time by frequency 1 params +func (o *TaiwanTripBusAPIRealTimeByFrequency1Params) SetTimeout(timeout time.Duration) { o.timeout = timeout } -// WithContext adds the context to the taiwan trip bus Api real time by frequency 2 params -func (o *TaiwanTripBusAPIRealTimeByFrequency2Params) WithContext(ctx context.Context) *TaiwanTripBusAPIRealTimeByFrequency2Params { +// WithContext adds the context to the taiwan trip bus Api real time by frequency 1 params +func (o *TaiwanTripBusAPIRealTimeByFrequency1Params) WithContext(ctx context.Context) *TaiwanTripBusAPIRealTimeByFrequency1Params { o.SetContext(ctx) return o } -// SetContext adds the context to the taiwan trip bus Api real time by frequency 2 params -func (o *TaiwanTripBusAPIRealTimeByFrequency2Params) SetContext(ctx context.Context) { +// SetContext adds the context to the taiwan trip bus Api real time by frequency 1 params +func (o *TaiwanTripBusAPIRealTimeByFrequency1Params) SetContext(ctx context.Context) { o.Context = ctx } -// WithHTTPClient adds the HTTPClient to the taiwan trip bus Api real time by frequency 2 params -func (o *TaiwanTripBusAPIRealTimeByFrequency2Params) WithHTTPClient(client *http.Client) *TaiwanTripBusAPIRealTimeByFrequency2Params { +// WithHTTPClient adds the HTTPClient to the taiwan trip bus Api real time by frequency 1 params +func (o *TaiwanTripBusAPIRealTimeByFrequency1Params) WithHTTPClient(client *http.Client) *TaiwanTripBusAPIRealTimeByFrequency1Params { o.SetHTTPClient(client) return o } -// SetHTTPClient adds the HTTPClient to the taiwan trip bus Api real time by frequency 2 params -func (o *TaiwanTripBusAPIRealTimeByFrequency2Params) SetHTTPClient(client *http.Client) { +// SetHTTPClient adds the HTTPClient to the taiwan trip bus Api real time by frequency 1 params +func (o *TaiwanTripBusAPIRealTimeByFrequency1Params) SetHTTPClient(client *http.Client) { o.HTTPClient = client } -// WithDollarFilter adds the dollarFilter to the taiwan trip bus Api real time by frequency 2 params -func (o *TaiwanTripBusAPIRealTimeByFrequency2Params) WithDollarFilter(dollarFilter *string) *TaiwanTripBusAPIRealTimeByFrequency2Params { +// WithDollarFilter adds the dollarFilter to the taiwan trip bus Api real time by frequency 1 params +func (o *TaiwanTripBusAPIRealTimeByFrequency1Params) WithDollarFilter(dollarFilter *string) *TaiwanTripBusAPIRealTimeByFrequency1Params { o.SetDollarFilter(dollarFilter) return o } -// SetDollarFilter adds the dollarFilter to the taiwan trip bus Api real time by frequency 2 params -func (o *TaiwanTripBusAPIRealTimeByFrequency2Params) SetDollarFilter(dollarFilter *string) { +// SetDollarFilter adds the dollarFilter to the taiwan trip bus Api real time by frequency 1 params +func (o *TaiwanTripBusAPIRealTimeByFrequency1Params) SetDollarFilter(dollarFilter *string) { o.DollarFilter = dollarFilter } -// WithDollarFormat adds the dollarFormat to the taiwan trip bus Api real time by frequency 2 params -func (o *TaiwanTripBusAPIRealTimeByFrequency2Params) WithDollarFormat(dollarFormat string) *TaiwanTripBusAPIRealTimeByFrequency2Params { +// WithDollarFormat adds the dollarFormat to the taiwan trip bus Api real time by frequency 1 params +func (o *TaiwanTripBusAPIRealTimeByFrequency1Params) WithDollarFormat(dollarFormat string) *TaiwanTripBusAPIRealTimeByFrequency1Params { o.SetDollarFormat(dollarFormat) return o } -// SetDollarFormat adds the dollarFormat to the taiwan trip bus Api real time by frequency 2 params -func (o *TaiwanTripBusAPIRealTimeByFrequency2Params) SetDollarFormat(dollarFormat string) { +// SetDollarFormat adds the dollarFormat to the taiwan trip bus Api real time by frequency 1 params +func (o *TaiwanTripBusAPIRealTimeByFrequency1Params) SetDollarFormat(dollarFormat string) { o.DollarFormat = dollarFormat } -// WithDollarOrderby adds the dollarOrderby to the taiwan trip bus Api real time by frequency 2 params -func (o *TaiwanTripBusAPIRealTimeByFrequency2Params) WithDollarOrderby(dollarOrderby *string) *TaiwanTripBusAPIRealTimeByFrequency2Params { +// WithDollarOrderby adds the dollarOrderby to the taiwan trip bus Api real time by frequency 1 params +func (o *TaiwanTripBusAPIRealTimeByFrequency1Params) WithDollarOrderby(dollarOrderby *string) *TaiwanTripBusAPIRealTimeByFrequency1Params { o.SetDollarOrderby(dollarOrderby) return o } -// SetDollarOrderby adds the dollarOrderby to the taiwan trip bus Api real time by frequency 2 params -func (o *TaiwanTripBusAPIRealTimeByFrequency2Params) SetDollarOrderby(dollarOrderby *string) { +// SetDollarOrderby adds the dollarOrderby to the taiwan trip bus Api real time by frequency 1 params +func (o *TaiwanTripBusAPIRealTimeByFrequency1Params) SetDollarOrderby(dollarOrderby *string) { o.DollarOrderby = dollarOrderby } -// WithDollarSelect adds the dollarSelect to the taiwan trip bus Api real time by frequency 2 params -func (o *TaiwanTripBusAPIRealTimeByFrequency2Params) WithDollarSelect(dollarSelect *string) *TaiwanTripBusAPIRealTimeByFrequency2Params { +// WithDollarSelect adds the dollarSelect to the taiwan trip bus Api real time by frequency 1 params +func (o *TaiwanTripBusAPIRealTimeByFrequency1Params) WithDollarSelect(dollarSelect *string) *TaiwanTripBusAPIRealTimeByFrequency1Params { o.SetDollarSelect(dollarSelect) return o } -// SetDollarSelect adds the dollarSelect to the taiwan trip bus Api real time by frequency 2 params -func (o *TaiwanTripBusAPIRealTimeByFrequency2Params) SetDollarSelect(dollarSelect *string) { +// SetDollarSelect adds the dollarSelect to the taiwan trip bus Api real time by frequency 1 params +func (o *TaiwanTripBusAPIRealTimeByFrequency1Params) SetDollarSelect(dollarSelect *string) { o.DollarSelect = dollarSelect } -// WithDollarSkip adds the dollarSkip to the taiwan trip bus Api real time by frequency 2 params -func (o *TaiwanTripBusAPIRealTimeByFrequency2Params) WithDollarSkip(dollarSkip *string) *TaiwanTripBusAPIRealTimeByFrequency2Params { +// WithDollarSkip adds the dollarSkip to the taiwan trip bus Api real time by frequency 1 params +func (o *TaiwanTripBusAPIRealTimeByFrequency1Params) WithDollarSkip(dollarSkip *string) *TaiwanTripBusAPIRealTimeByFrequency1Params { o.SetDollarSkip(dollarSkip) return o } -// SetDollarSkip adds the dollarSkip to the taiwan trip bus Api real time by frequency 2 params -func (o *TaiwanTripBusAPIRealTimeByFrequency2Params) SetDollarSkip(dollarSkip *string) { +// SetDollarSkip adds the dollarSkip to the taiwan trip bus Api real time by frequency 1 params +func (o *TaiwanTripBusAPIRealTimeByFrequency1Params) SetDollarSkip(dollarSkip *string) { o.DollarSkip = dollarSkip } -// WithDollarSpatialFilter adds the dollarSpatialFilter to the taiwan trip bus Api real time by frequency 2 params -func (o *TaiwanTripBusAPIRealTimeByFrequency2Params) WithDollarSpatialFilter(dollarSpatialFilter *string) *TaiwanTripBusAPIRealTimeByFrequency2Params { +// WithDollarSpatialFilter adds the dollarSpatialFilter to the taiwan trip bus Api real time by frequency 1 params +func (o *TaiwanTripBusAPIRealTimeByFrequency1Params) WithDollarSpatialFilter(dollarSpatialFilter *string) *TaiwanTripBusAPIRealTimeByFrequency1Params { o.SetDollarSpatialFilter(dollarSpatialFilter) return o } -// SetDollarSpatialFilter adds the dollarSpatialFilter to the taiwan trip bus Api real time by frequency 2 params -func (o *TaiwanTripBusAPIRealTimeByFrequency2Params) SetDollarSpatialFilter(dollarSpatialFilter *string) { +// SetDollarSpatialFilter adds the dollarSpatialFilter to the taiwan trip bus Api real time by frequency 1 params +func (o *TaiwanTripBusAPIRealTimeByFrequency1Params) SetDollarSpatialFilter(dollarSpatialFilter *string) { o.DollarSpatialFilter = dollarSpatialFilter } -// WithDollarTop adds the dollarTop to the taiwan trip bus Api real time by frequency 2 params -func (o *TaiwanTripBusAPIRealTimeByFrequency2Params) WithDollarTop(dollarTop *int64) *TaiwanTripBusAPIRealTimeByFrequency2Params { +// WithDollarTop adds the dollarTop to the taiwan trip bus Api real time by frequency 1 params +func (o *TaiwanTripBusAPIRealTimeByFrequency1Params) WithDollarTop(dollarTop *int64) *TaiwanTripBusAPIRealTimeByFrequency1Params { o.SetDollarTop(dollarTop) return o } -// SetDollarTop adds the dollarTop to the taiwan trip bus Api real time by frequency 2 params -func (o *TaiwanTripBusAPIRealTimeByFrequency2Params) SetDollarTop(dollarTop *int64) { +// SetDollarTop adds the dollarTop to the taiwan trip bus Api real time by frequency 1 params +func (o *TaiwanTripBusAPIRealTimeByFrequency1Params) SetDollarTop(dollarTop *int64) { o.DollarTop = dollarTop } -// WithTaiwanTripName adds the taiwanTripName to the taiwan trip bus Api real time by frequency 2 params -func (o *TaiwanTripBusAPIRealTimeByFrequency2Params) WithTaiwanTripName(taiwanTripName string) *TaiwanTripBusAPIRealTimeByFrequency2Params { +// WithTaiwanTripName adds the taiwanTripName to the taiwan trip bus Api real time by frequency 1 params +func (o *TaiwanTripBusAPIRealTimeByFrequency1Params) WithTaiwanTripName(taiwanTripName string) *TaiwanTripBusAPIRealTimeByFrequency1Params { o.SetTaiwanTripName(taiwanTripName) return o } -// SetTaiwanTripName adds the taiwanTripName to the taiwan trip bus Api real time by frequency 2 params -func (o *TaiwanTripBusAPIRealTimeByFrequency2Params) SetTaiwanTripName(taiwanTripName string) { +// SetTaiwanTripName adds the taiwanTripName to the taiwan trip bus Api real time by frequency 1 params +func (o *TaiwanTripBusAPIRealTimeByFrequency1Params) SetTaiwanTripName(taiwanTripName string) { o.TaiwanTripName = taiwanTripName } // WriteToRequest writes these params to a swagger request -func (o *TaiwanTripBusAPIRealTimeByFrequency2Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { +func (o *TaiwanTripBusAPIRealTimeByFrequency1Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { if err := r.SetTimeout(o.timeout); err != nil { return err diff --git a/tourism/v2/client/tourism/taiwan_trip_bus_api_real_time_by_frequency2_responses.go b/tourism/v2/client/tourism/taiwan_trip_bus_api_real_time_by_frequency1_responses.go similarity index 59% rename from tourism/v2/client/tourism/taiwan_trip_bus_api_real_time_by_frequency2_responses.go rename to tourism/v2/client/tourism/taiwan_trip_bus_api_real_time_by_frequency1_responses.go index 20ffb23b..b01d3349 100644 --- a/tourism/v2/client/tourism/taiwan_trip_bus_api_real_time_by_frequency2_responses.go +++ b/tourism/v2/client/tourism/taiwan_trip_bus_api_real_time_by_frequency1_responses.go @@ -16,16 +16,16 @@ import ( models "github.com/minchao/go-ptx/tourism/v2/models" ) -// TaiwanTripBusAPIRealTimeByFrequency2Reader is a Reader for the TaiwanTripBusAPIRealTimeByFrequency2 structure. -type TaiwanTripBusAPIRealTimeByFrequency2Reader struct { +// TaiwanTripBusAPIRealTimeByFrequency1Reader is a Reader for the TaiwanTripBusAPIRealTimeByFrequency1 structure. +type TaiwanTripBusAPIRealTimeByFrequency1Reader struct { formats strfmt.Registry } // ReadResponse reads a server response into the received o. -func (o *TaiwanTripBusAPIRealTimeByFrequency2Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { +func (o *TaiwanTripBusAPIRealTimeByFrequency1Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { case 200: - result := NewTaiwanTripBusAPIRealTimeByFrequency2OK() + result := NewTaiwanTripBusAPIRealTimeByFrequency1OK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } @@ -36,28 +36,28 @@ func (o *TaiwanTripBusAPIRealTimeByFrequency2Reader) ReadResponse(response runti } } -// NewTaiwanTripBusAPIRealTimeByFrequency2OK creates a TaiwanTripBusAPIRealTimeByFrequency2OK with default headers values -func NewTaiwanTripBusAPIRealTimeByFrequency2OK() *TaiwanTripBusAPIRealTimeByFrequency2OK { - return &TaiwanTripBusAPIRealTimeByFrequency2OK{} +// NewTaiwanTripBusAPIRealTimeByFrequency1OK creates a TaiwanTripBusAPIRealTimeByFrequency1OK with default headers values +func NewTaiwanTripBusAPIRealTimeByFrequency1OK() *TaiwanTripBusAPIRealTimeByFrequency1OK { + return &TaiwanTripBusAPIRealTimeByFrequency1OK{} } -/*TaiwanTripBusAPIRealTimeByFrequency2OK handles this case with default header values. +/*TaiwanTripBusAPIRealTimeByFrequency1OK handles this case with default header values. OK */ -type TaiwanTripBusAPIRealTimeByFrequency2OK struct { +type TaiwanTripBusAPIRealTimeByFrequency1OK struct { Payload []*models.ServiceDTOVersion2TaiwanTripBusBusA1Data } -func (o *TaiwanTripBusAPIRealTimeByFrequency2OK) Error() string { - return fmt.Sprintf("[GET /v2/Tourism/Bus/RealTimeByFrequency/TaiwanTrip/{TaiwanTripName}][%d] taiwanTripBusApiRealTimeByFrequency2OK %+v", 200, o.Payload) +func (o *TaiwanTripBusAPIRealTimeByFrequency1OK) Error() string { + return fmt.Sprintf("[GET /v2/Tourism/Bus/RealTimeByFrequency/TaiwanTrip/{TaiwanTripName}][%d] taiwanTripBusApiRealTimeByFrequency1OK %+v", 200, o.Payload) } -func (o *TaiwanTripBusAPIRealTimeByFrequency2OK) GetPayload() []*models.ServiceDTOVersion2TaiwanTripBusBusA1Data { +func (o *TaiwanTripBusAPIRealTimeByFrequency1OK) GetPayload() []*models.ServiceDTOVersion2TaiwanTripBusBusA1Data { return o.Payload } -func (o *TaiwanTripBusAPIRealTimeByFrequency2OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { +func (o *TaiwanTripBusAPIRealTimeByFrequency1OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { // response payload if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { diff --git a/tourism/v2/client/tourism/taiwan_trip_bus_api_real_time_near_stop2_parameters.go b/tourism/v2/client/tourism/taiwan_trip_bus_api_real_time_near_stop1_parameters.go similarity index 61% rename from tourism/v2/client/tourism/taiwan_trip_bus_api_real_time_near_stop2_parameters.go rename to tourism/v2/client/tourism/taiwan_trip_bus_api_real_time_near_stop1_parameters.go index ad34b3e5..6e42a85d 100644 --- a/tourism/v2/client/tourism/taiwan_trip_bus_api_real_time_near_stop2_parameters.go +++ b/tourism/v2/client/tourism/taiwan_trip_bus_api_real_time_near_stop1_parameters.go @@ -18,61 +18,61 @@ import ( strfmt "github.com/go-openapi/strfmt" ) -// NewTaiwanTripBusAPIRealTimeNearStop2Params creates a new TaiwanTripBusAPIRealTimeNearStop2Params object +// NewTaiwanTripBusAPIRealTimeNearStop1Params creates a new TaiwanTripBusAPIRealTimeNearStop1Params object // with the default values initialized. -func NewTaiwanTripBusAPIRealTimeNearStop2Params() *TaiwanTripBusAPIRealTimeNearStop2Params { +func NewTaiwanTripBusAPIRealTimeNearStop1Params() *TaiwanTripBusAPIRealTimeNearStop1Params { var ( dollarTopDefault = int64(30) ) - return &TaiwanTripBusAPIRealTimeNearStop2Params{ + return &TaiwanTripBusAPIRealTimeNearStop1Params{ DollarTop: &dollarTopDefault, timeout: cr.DefaultTimeout, } } -// NewTaiwanTripBusAPIRealTimeNearStop2ParamsWithTimeout creates a new TaiwanTripBusAPIRealTimeNearStop2Params object +// NewTaiwanTripBusAPIRealTimeNearStop1ParamsWithTimeout creates a new TaiwanTripBusAPIRealTimeNearStop1Params object // with the default values initialized, and the ability to set a timeout on a request -func NewTaiwanTripBusAPIRealTimeNearStop2ParamsWithTimeout(timeout time.Duration) *TaiwanTripBusAPIRealTimeNearStop2Params { +func NewTaiwanTripBusAPIRealTimeNearStop1ParamsWithTimeout(timeout time.Duration) *TaiwanTripBusAPIRealTimeNearStop1Params { var ( dollarTopDefault = int64(30) ) - return &TaiwanTripBusAPIRealTimeNearStop2Params{ + return &TaiwanTripBusAPIRealTimeNearStop1Params{ DollarTop: &dollarTopDefault, timeout: timeout, } } -// NewTaiwanTripBusAPIRealTimeNearStop2ParamsWithContext creates a new TaiwanTripBusAPIRealTimeNearStop2Params object +// NewTaiwanTripBusAPIRealTimeNearStop1ParamsWithContext creates a new TaiwanTripBusAPIRealTimeNearStop1Params object // with the default values initialized, and the ability to set a context for a request -func NewTaiwanTripBusAPIRealTimeNearStop2ParamsWithContext(ctx context.Context) *TaiwanTripBusAPIRealTimeNearStop2Params { +func NewTaiwanTripBusAPIRealTimeNearStop1ParamsWithContext(ctx context.Context) *TaiwanTripBusAPIRealTimeNearStop1Params { var ( dollarTopDefault = int64(30) ) - return &TaiwanTripBusAPIRealTimeNearStop2Params{ + return &TaiwanTripBusAPIRealTimeNearStop1Params{ DollarTop: &dollarTopDefault, Context: ctx, } } -// NewTaiwanTripBusAPIRealTimeNearStop2ParamsWithHTTPClient creates a new TaiwanTripBusAPIRealTimeNearStop2Params object +// NewTaiwanTripBusAPIRealTimeNearStop1ParamsWithHTTPClient creates a new TaiwanTripBusAPIRealTimeNearStop1Params object // with the default values initialized, and the ability to set a custom HTTPClient for a request -func NewTaiwanTripBusAPIRealTimeNearStop2ParamsWithHTTPClient(client *http.Client) *TaiwanTripBusAPIRealTimeNearStop2Params { +func NewTaiwanTripBusAPIRealTimeNearStop1ParamsWithHTTPClient(client *http.Client) *TaiwanTripBusAPIRealTimeNearStop1Params { var ( dollarTopDefault = int64(30) ) - return &TaiwanTripBusAPIRealTimeNearStop2Params{ + return &TaiwanTripBusAPIRealTimeNearStop1Params{ DollarTop: &dollarTopDefault, HTTPClient: client, } } -/*TaiwanTripBusAPIRealTimeNearStop2Params contains all the parameters to send to the API endpoint -for the taiwan trip bus Api real time near stop 2 operation typically these are written to a http.Request +/*TaiwanTripBusAPIRealTimeNearStop1Params contains all the parameters to send to the API endpoint +for the taiwan trip bus Api real time near stop 1 operation typically these are written to a http.Request */ -type TaiwanTripBusAPIRealTimeNearStop2Params struct { +type TaiwanTripBusAPIRealTimeNearStop1Params struct { /*DollarFilter 過濾 @@ -115,118 +115,118 @@ type TaiwanTripBusAPIRealTimeNearStop2Params struct { HTTPClient *http.Client } -// WithTimeout adds the timeout to the taiwan trip bus Api real time near stop 2 params -func (o *TaiwanTripBusAPIRealTimeNearStop2Params) WithTimeout(timeout time.Duration) *TaiwanTripBusAPIRealTimeNearStop2Params { +// WithTimeout adds the timeout to the taiwan trip bus Api real time near stop 1 params +func (o *TaiwanTripBusAPIRealTimeNearStop1Params) WithTimeout(timeout time.Duration) *TaiwanTripBusAPIRealTimeNearStop1Params { o.SetTimeout(timeout) return o } -// SetTimeout adds the timeout to the taiwan trip bus Api real time near stop 2 params -func (o *TaiwanTripBusAPIRealTimeNearStop2Params) SetTimeout(timeout time.Duration) { +// SetTimeout adds the timeout to the taiwan trip bus Api real time near stop 1 params +func (o *TaiwanTripBusAPIRealTimeNearStop1Params) SetTimeout(timeout time.Duration) { o.timeout = timeout } -// WithContext adds the context to the taiwan trip bus Api real time near stop 2 params -func (o *TaiwanTripBusAPIRealTimeNearStop2Params) WithContext(ctx context.Context) *TaiwanTripBusAPIRealTimeNearStop2Params { +// WithContext adds the context to the taiwan trip bus Api real time near stop 1 params +func (o *TaiwanTripBusAPIRealTimeNearStop1Params) WithContext(ctx context.Context) *TaiwanTripBusAPIRealTimeNearStop1Params { o.SetContext(ctx) return o } -// SetContext adds the context to the taiwan trip bus Api real time near stop 2 params -func (o *TaiwanTripBusAPIRealTimeNearStop2Params) SetContext(ctx context.Context) { +// SetContext adds the context to the taiwan trip bus Api real time near stop 1 params +func (o *TaiwanTripBusAPIRealTimeNearStop1Params) SetContext(ctx context.Context) { o.Context = ctx } -// WithHTTPClient adds the HTTPClient to the taiwan trip bus Api real time near stop 2 params -func (o *TaiwanTripBusAPIRealTimeNearStop2Params) WithHTTPClient(client *http.Client) *TaiwanTripBusAPIRealTimeNearStop2Params { +// WithHTTPClient adds the HTTPClient to the taiwan trip bus Api real time near stop 1 params +func (o *TaiwanTripBusAPIRealTimeNearStop1Params) WithHTTPClient(client *http.Client) *TaiwanTripBusAPIRealTimeNearStop1Params { o.SetHTTPClient(client) return o } -// SetHTTPClient adds the HTTPClient to the taiwan trip bus Api real time near stop 2 params -func (o *TaiwanTripBusAPIRealTimeNearStop2Params) SetHTTPClient(client *http.Client) { +// SetHTTPClient adds the HTTPClient to the taiwan trip bus Api real time near stop 1 params +func (o *TaiwanTripBusAPIRealTimeNearStop1Params) SetHTTPClient(client *http.Client) { o.HTTPClient = client } -// WithDollarFilter adds the dollarFilter to the taiwan trip bus Api real time near stop 2 params -func (o *TaiwanTripBusAPIRealTimeNearStop2Params) WithDollarFilter(dollarFilter *string) *TaiwanTripBusAPIRealTimeNearStop2Params { +// WithDollarFilter adds the dollarFilter to the taiwan trip bus Api real time near stop 1 params +func (o *TaiwanTripBusAPIRealTimeNearStop1Params) WithDollarFilter(dollarFilter *string) *TaiwanTripBusAPIRealTimeNearStop1Params { o.SetDollarFilter(dollarFilter) return o } -// SetDollarFilter adds the dollarFilter to the taiwan trip bus Api real time near stop 2 params -func (o *TaiwanTripBusAPIRealTimeNearStop2Params) SetDollarFilter(dollarFilter *string) { +// SetDollarFilter adds the dollarFilter to the taiwan trip bus Api real time near stop 1 params +func (o *TaiwanTripBusAPIRealTimeNearStop1Params) SetDollarFilter(dollarFilter *string) { o.DollarFilter = dollarFilter } -// WithDollarFormat adds the dollarFormat to the taiwan trip bus Api real time near stop 2 params -func (o *TaiwanTripBusAPIRealTimeNearStop2Params) WithDollarFormat(dollarFormat string) *TaiwanTripBusAPIRealTimeNearStop2Params { +// WithDollarFormat adds the dollarFormat to the taiwan trip bus Api real time near stop 1 params +func (o *TaiwanTripBusAPIRealTimeNearStop1Params) WithDollarFormat(dollarFormat string) *TaiwanTripBusAPIRealTimeNearStop1Params { o.SetDollarFormat(dollarFormat) return o } -// SetDollarFormat adds the dollarFormat to the taiwan trip bus Api real time near stop 2 params -func (o *TaiwanTripBusAPIRealTimeNearStop2Params) SetDollarFormat(dollarFormat string) { +// SetDollarFormat adds the dollarFormat to the taiwan trip bus Api real time near stop 1 params +func (o *TaiwanTripBusAPIRealTimeNearStop1Params) SetDollarFormat(dollarFormat string) { o.DollarFormat = dollarFormat } -// WithDollarOrderby adds the dollarOrderby to the taiwan trip bus Api real time near stop 2 params -func (o *TaiwanTripBusAPIRealTimeNearStop2Params) WithDollarOrderby(dollarOrderby *string) *TaiwanTripBusAPIRealTimeNearStop2Params { +// WithDollarOrderby adds the dollarOrderby to the taiwan trip bus Api real time near stop 1 params +func (o *TaiwanTripBusAPIRealTimeNearStop1Params) WithDollarOrderby(dollarOrderby *string) *TaiwanTripBusAPIRealTimeNearStop1Params { o.SetDollarOrderby(dollarOrderby) return o } -// SetDollarOrderby adds the dollarOrderby to the taiwan trip bus Api real time near stop 2 params -func (o *TaiwanTripBusAPIRealTimeNearStop2Params) SetDollarOrderby(dollarOrderby *string) { +// SetDollarOrderby adds the dollarOrderby to the taiwan trip bus Api real time near stop 1 params +func (o *TaiwanTripBusAPIRealTimeNearStop1Params) SetDollarOrderby(dollarOrderby *string) { o.DollarOrderby = dollarOrderby } -// WithDollarSelect adds the dollarSelect to the taiwan trip bus Api real time near stop 2 params -func (o *TaiwanTripBusAPIRealTimeNearStop2Params) WithDollarSelect(dollarSelect *string) *TaiwanTripBusAPIRealTimeNearStop2Params { +// WithDollarSelect adds the dollarSelect to the taiwan trip bus Api real time near stop 1 params +func (o *TaiwanTripBusAPIRealTimeNearStop1Params) WithDollarSelect(dollarSelect *string) *TaiwanTripBusAPIRealTimeNearStop1Params { o.SetDollarSelect(dollarSelect) return o } -// SetDollarSelect adds the dollarSelect to the taiwan trip bus Api real time near stop 2 params -func (o *TaiwanTripBusAPIRealTimeNearStop2Params) SetDollarSelect(dollarSelect *string) { +// SetDollarSelect adds the dollarSelect to the taiwan trip bus Api real time near stop 1 params +func (o *TaiwanTripBusAPIRealTimeNearStop1Params) SetDollarSelect(dollarSelect *string) { o.DollarSelect = dollarSelect } -// WithDollarSkip adds the dollarSkip to the taiwan trip bus Api real time near stop 2 params -func (o *TaiwanTripBusAPIRealTimeNearStop2Params) WithDollarSkip(dollarSkip *string) *TaiwanTripBusAPIRealTimeNearStop2Params { +// WithDollarSkip adds the dollarSkip to the taiwan trip bus Api real time near stop 1 params +func (o *TaiwanTripBusAPIRealTimeNearStop1Params) WithDollarSkip(dollarSkip *string) *TaiwanTripBusAPIRealTimeNearStop1Params { o.SetDollarSkip(dollarSkip) return o } -// SetDollarSkip adds the dollarSkip to the taiwan trip bus Api real time near stop 2 params -func (o *TaiwanTripBusAPIRealTimeNearStop2Params) SetDollarSkip(dollarSkip *string) { +// SetDollarSkip adds the dollarSkip to the taiwan trip bus Api real time near stop 1 params +func (o *TaiwanTripBusAPIRealTimeNearStop1Params) SetDollarSkip(dollarSkip *string) { o.DollarSkip = dollarSkip } -// WithDollarTop adds the dollarTop to the taiwan trip bus Api real time near stop 2 params -func (o *TaiwanTripBusAPIRealTimeNearStop2Params) WithDollarTop(dollarTop *int64) *TaiwanTripBusAPIRealTimeNearStop2Params { +// WithDollarTop adds the dollarTop to the taiwan trip bus Api real time near stop 1 params +func (o *TaiwanTripBusAPIRealTimeNearStop1Params) WithDollarTop(dollarTop *int64) *TaiwanTripBusAPIRealTimeNearStop1Params { o.SetDollarTop(dollarTop) return o } -// SetDollarTop adds the dollarTop to the taiwan trip bus Api real time near stop 2 params -func (o *TaiwanTripBusAPIRealTimeNearStop2Params) SetDollarTop(dollarTop *int64) { +// SetDollarTop adds the dollarTop to the taiwan trip bus Api real time near stop 1 params +func (o *TaiwanTripBusAPIRealTimeNearStop1Params) SetDollarTop(dollarTop *int64) { o.DollarTop = dollarTop } -// WithTaiwanTripName adds the taiwanTripName to the taiwan trip bus Api real time near stop 2 params -func (o *TaiwanTripBusAPIRealTimeNearStop2Params) WithTaiwanTripName(taiwanTripName string) *TaiwanTripBusAPIRealTimeNearStop2Params { +// WithTaiwanTripName adds the taiwanTripName to the taiwan trip bus Api real time near stop 1 params +func (o *TaiwanTripBusAPIRealTimeNearStop1Params) WithTaiwanTripName(taiwanTripName string) *TaiwanTripBusAPIRealTimeNearStop1Params { o.SetTaiwanTripName(taiwanTripName) return o } -// SetTaiwanTripName adds the taiwanTripName to the taiwan trip bus Api real time near stop 2 params -func (o *TaiwanTripBusAPIRealTimeNearStop2Params) SetTaiwanTripName(taiwanTripName string) { +// SetTaiwanTripName adds the taiwanTripName to the taiwan trip bus Api real time near stop 1 params +func (o *TaiwanTripBusAPIRealTimeNearStop1Params) SetTaiwanTripName(taiwanTripName string) { o.TaiwanTripName = taiwanTripName } // WriteToRequest writes these params to a swagger request -func (o *TaiwanTripBusAPIRealTimeNearStop2Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { +func (o *TaiwanTripBusAPIRealTimeNearStop1Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { if err := r.SetTimeout(o.timeout); err != nil { return err diff --git a/tourism/v2/client/tourism/taiwan_trip_bus_api_real_time_near_stop2_responses.go b/tourism/v2/client/tourism/taiwan_trip_bus_api_real_time_near_stop1_responses.go similarity index 58% rename from tourism/v2/client/tourism/taiwan_trip_bus_api_real_time_near_stop2_responses.go rename to tourism/v2/client/tourism/taiwan_trip_bus_api_real_time_near_stop1_responses.go index 65cee225..0e148e37 100644 --- a/tourism/v2/client/tourism/taiwan_trip_bus_api_real_time_near_stop2_responses.go +++ b/tourism/v2/client/tourism/taiwan_trip_bus_api_real_time_near_stop1_responses.go @@ -16,16 +16,16 @@ import ( models "github.com/minchao/go-ptx/tourism/v2/models" ) -// TaiwanTripBusAPIRealTimeNearStop2Reader is a Reader for the TaiwanTripBusAPIRealTimeNearStop2 structure. -type TaiwanTripBusAPIRealTimeNearStop2Reader struct { +// TaiwanTripBusAPIRealTimeNearStop1Reader is a Reader for the TaiwanTripBusAPIRealTimeNearStop1 structure. +type TaiwanTripBusAPIRealTimeNearStop1Reader struct { formats strfmt.Registry } // ReadResponse reads a server response into the received o. -func (o *TaiwanTripBusAPIRealTimeNearStop2Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { +func (o *TaiwanTripBusAPIRealTimeNearStop1Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { case 200: - result := NewTaiwanTripBusAPIRealTimeNearStop2OK() + result := NewTaiwanTripBusAPIRealTimeNearStop1OK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } @@ -36,28 +36,28 @@ func (o *TaiwanTripBusAPIRealTimeNearStop2Reader) ReadResponse(response runtime. } } -// NewTaiwanTripBusAPIRealTimeNearStop2OK creates a TaiwanTripBusAPIRealTimeNearStop2OK with default headers values -func NewTaiwanTripBusAPIRealTimeNearStop2OK() *TaiwanTripBusAPIRealTimeNearStop2OK { - return &TaiwanTripBusAPIRealTimeNearStop2OK{} +// NewTaiwanTripBusAPIRealTimeNearStop1OK creates a TaiwanTripBusAPIRealTimeNearStop1OK with default headers values +func NewTaiwanTripBusAPIRealTimeNearStop1OK() *TaiwanTripBusAPIRealTimeNearStop1OK { + return &TaiwanTripBusAPIRealTimeNearStop1OK{} } -/*TaiwanTripBusAPIRealTimeNearStop2OK handles this case with default header values. +/*TaiwanTripBusAPIRealTimeNearStop1OK handles this case with default header values. OK */ -type TaiwanTripBusAPIRealTimeNearStop2OK struct { +type TaiwanTripBusAPIRealTimeNearStop1OK struct { Payload []*models.ServiceDTOVersion2TaiwanTripBusBusA2Data } -func (o *TaiwanTripBusAPIRealTimeNearStop2OK) Error() string { - return fmt.Sprintf("[GET /v2/Tourism/Bus/RealTimeNearStop/TaiwanTrip/{TaiwanTripName}][%d] taiwanTripBusApiRealTimeNearStop2OK %+v", 200, o.Payload) +func (o *TaiwanTripBusAPIRealTimeNearStop1OK) Error() string { + return fmt.Sprintf("[GET /v2/Tourism/Bus/RealTimeNearStop/TaiwanTrip/{TaiwanTripName}][%d] taiwanTripBusApiRealTimeNearStop1OK %+v", 200, o.Payload) } -func (o *TaiwanTripBusAPIRealTimeNearStop2OK) GetPayload() []*models.ServiceDTOVersion2TaiwanTripBusBusA2Data { +func (o *TaiwanTripBusAPIRealTimeNearStop1OK) GetPayload() []*models.ServiceDTOVersion2TaiwanTripBusBusA2Data { return o.Payload } -func (o *TaiwanTripBusAPIRealTimeNearStop2OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { +func (o *TaiwanTripBusAPIRealTimeNearStop1OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { // response payload if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { diff --git a/tourism/v2/client/tourism/tourism_client.go b/tourism/v2/client/tourism/tourism_client.go index 9f24b997..6162641a 100644 --- a/tourism/v2/client/tourism/tourism_client.go +++ b/tourism/v2/client/tourism/tourism_client.go @@ -171,38 +171,38 @@ func (a *Client) TaiwanTripBusAPIRealTimeByFrequency(params *TaiwanTripBusAPIRea } /* -TaiwanTripBusAPIRealTimeByFrequency2 取得指定s 路線名稱 的台灣好行公車的動態定時資料 a1 +TaiwanTripBusAPIRealTimeByFrequency1 取得指定s 路線名稱 的台灣好行公車的動態定時資料 a1 取得指定[路線名稱]的台灣好行公車的動態定時資料(A1) */ -func (a *Client) TaiwanTripBusAPIRealTimeByFrequency2(params *TaiwanTripBusAPIRealTimeByFrequency2Params) (*TaiwanTripBusAPIRealTimeByFrequency2OK, error) { +func (a *Client) TaiwanTripBusAPIRealTimeByFrequency1(params *TaiwanTripBusAPIRealTimeByFrequency1Params) (*TaiwanTripBusAPIRealTimeByFrequency1OK, error) { // TODO: Validate the params before sending if params == nil { - params = NewTaiwanTripBusAPIRealTimeByFrequency2Params() + params = NewTaiwanTripBusAPIRealTimeByFrequency1Params() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "TaiwanTripBusApi_RealTimeByFrequency_2", + ID: "TaiwanTripBusApi_RealTimeByFrequency_1", Method: "GET", PathPattern: "/v2/Tourism/Bus/RealTimeByFrequency/TaiwanTrip/{TaiwanTripName}", ProducesMediaTypes: []string{"application/json", "text/json"}, ConsumesMediaTypes: []string{""}, Schemes: []string{"https"}, Params: params, - Reader: &TaiwanTripBusAPIRealTimeByFrequency2Reader{formats: a.formats}, + Reader: &TaiwanTripBusAPIRealTimeByFrequency1Reader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, }) if err != nil { return nil, err } - success, ok := result.(*TaiwanTripBusAPIRealTimeByFrequency2OK) + success, ok := result.(*TaiwanTripBusAPIRealTimeByFrequency1OK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for TaiwanTripBusApi_RealTimeByFrequency_2: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for TaiwanTripBusApi_RealTimeByFrequency_1: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } @@ -243,38 +243,38 @@ func (a *Client) TaiwanTripBusAPIRealTimeNearStop(params *TaiwanTripBusAPIRealTi } /* -TaiwanTripBusAPIRealTimeNearStop2 取得指定s 路線名稱 的台灣好行公車的動態定點資料 a2 +TaiwanTripBusAPIRealTimeNearStop1 取得指定s 路線名稱 的台灣好行公車的動態定點資料 a2 取得指定[路線名稱]的台灣好行公車的動態定點資料(A2) */ -func (a *Client) TaiwanTripBusAPIRealTimeNearStop2(params *TaiwanTripBusAPIRealTimeNearStop2Params) (*TaiwanTripBusAPIRealTimeNearStop2OK, error) { +func (a *Client) TaiwanTripBusAPIRealTimeNearStop1(params *TaiwanTripBusAPIRealTimeNearStop1Params) (*TaiwanTripBusAPIRealTimeNearStop1OK, error) { // TODO: Validate the params before sending if params == nil { - params = NewTaiwanTripBusAPIRealTimeNearStop2Params() + params = NewTaiwanTripBusAPIRealTimeNearStop1Params() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "TaiwanTripBusApi_RealTimeNearStop_2", + ID: "TaiwanTripBusApi_RealTimeNearStop_1", Method: "GET", PathPattern: "/v2/Tourism/Bus/RealTimeNearStop/TaiwanTrip/{TaiwanTripName}", ProducesMediaTypes: []string{"application/json", "text/json"}, ConsumesMediaTypes: []string{""}, Schemes: []string{"https"}, Params: params, - Reader: &TaiwanTripBusAPIRealTimeNearStop2Reader{formats: a.formats}, + Reader: &TaiwanTripBusAPIRealTimeNearStop1Reader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, }) if err != nil { return nil, err } - success, ok := result.(*TaiwanTripBusAPIRealTimeNearStop2OK) + success, ok := result.(*TaiwanTripBusAPIRealTimeNearStop1OK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for TaiwanTripBusApi_RealTimeNearStop_2: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for TaiwanTripBusApi_RealTimeNearStop_1: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } diff --git a/tourism/v2/models/service_d_t_o_version2_bus_stop.go b/tourism/v2/models/service_d_t_o_version2_bus_stop.go index 4bd0422a..2cecd11d 100644 --- a/tourism/v2/models/service_d_t_o_version2_bus_stop.go +++ b/tourism/v2/models/service_d_t_o_version2_bus_stop.go @@ -22,6 +22,10 @@ type ServiceDTOVersion2BusStop struct { // 站牌位置縣市之代碼(國際ISO 3166-2 三碼城市代碼)[若為公路/國道客運路線則為空值] LocationCityCode string `json:"LocationCityCode,omitempty"` + // station group ID + // Required: true + StationGroupID *string `json:"StationGroupID"` + // 站牌所屬的站位ID StationID string `json:"StationID,omitempty"` @@ -63,6 +67,10 @@ type ServiceDTOVersion2BusStop struct { func (m *ServiceDTOVersion2BusStop) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateStationGroupID(formats); err != nil { + res = append(res, err) + } + if err := m.validateStationNameID(formats); err != nil { res = append(res, err) } @@ -93,6 +101,15 @@ func (m *ServiceDTOVersion2BusStop) Validate(formats strfmt.Registry) error { return nil } +func (m *ServiceDTOVersion2BusStop) validateStationGroupID(formats strfmt.Registry) error { + + if err := validate.Required("StationGroupID", "body", m.StationGroupID); err != nil { + return err + } + + return nil +} + func (m *ServiceDTOVersion2BusStop) validateStationNameID(formats strfmt.Registry) error { if err := validate.Required("StationNameID", "body", m.StationNameID); err != nil {