terminal-shop 0.1.0.pre.alpha.14 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/lib/terminal-shop/base_client.rb +38 -58
  3. data/lib/terminal-shop/base_model.rb +9 -0
  4. data/lib/terminal-shop/base_page.rb +2 -2
  5. data/lib/terminal-shop/client.rb +1 -1
  6. data/lib/terminal-shop/errors.rb +3 -2
  7. data/lib/terminal-shop/models/address_get_params.rb +18 -0
  8. data/lib/terminal-shop/models/address_get_response.rb +20 -0
  9. data/lib/terminal-shop/models/app_create_params.rb +14 -2
  10. data/lib/terminal-shop/models/card_get_params.rb +18 -0
  11. data/lib/terminal-shop/models/card_get_response.rb +20 -0
  12. data/lib/terminal-shop/models/product.rb +63 -42
  13. data/lib/terminal-shop/models/product_get_params.rb +18 -0
  14. data/lib/terminal-shop/models/product_get_response.rb +20 -0
  15. data/lib/terminal-shop/models/profile_update_params.rb +7 -9
  16. data/lib/terminal-shop/models/subscription.rb +0 -10
  17. data/lib/terminal-shop/models/subscription_get_params.rb +18 -0
  18. data/lib/terminal-shop/models/subscription_get_response.rb +20 -0
  19. data/lib/terminal-shop/pooled_net_requester.rb +14 -9
  20. data/lib/terminal-shop/resources/address.rb +19 -0
  21. data/lib/terminal-shop/resources/app.rb +2 -6
  22. data/lib/terminal-shop/resources/card.rb +19 -0
  23. data/lib/terminal-shop/resources/product.rb +19 -0
  24. data/lib/terminal-shop/resources/profile.rb +3 -3
  25. data/lib/terminal-shop/resources/subscription.rb +19 -0
  26. data/lib/terminal-shop/util.rb +143 -3
  27. data/lib/terminal-shop/version.rb +1 -1
  28. data/lib/terminal-shop.rb +9 -1
  29. data/rbi/lib/terminal-shop/base_client.rbi +28 -17
  30. data/rbi/lib/terminal-shop/base_page.rbi +2 -2
  31. data/rbi/lib/terminal-shop/errors.rbi +3 -2
  32. data/rbi/lib/terminal-shop/models/address_get_params.rbi +18 -0
  33. data/rbi/lib/terminal-shop/models/address_get_response.rbi +23 -0
  34. data/rbi/lib/terminal-shop/models/app_create_params.rbi +29 -4
  35. data/rbi/lib/terminal-shop/models/card_get_params.rbi +18 -0
  36. data/rbi/lib/terminal-shop/models/card_get_response.rbi +23 -0
  37. data/rbi/lib/terminal-shop/models/product.rbi +70 -24
  38. data/rbi/lib/terminal-shop/models/product_get_params.rbi +18 -0
  39. data/rbi/lib/terminal-shop/models/product_get_response.rbi +23 -0
  40. data/rbi/lib/terminal-shop/models/profile_update_params.rbi +8 -13
  41. data/rbi/lib/terminal-shop/models/subscription_get_params.rbi +18 -0
  42. data/rbi/lib/terminal-shop/models/subscription_get_response.rbi +23 -0
  43. data/rbi/lib/terminal-shop/resources/address.rbi +10 -0
  44. data/rbi/lib/terminal-shop/resources/app.rbi +1 -3
  45. data/rbi/lib/terminal-shop/resources/card.rbi +10 -0
  46. data/rbi/lib/terminal-shop/resources/product.rbi +10 -0
  47. data/rbi/lib/terminal-shop/resources/profile.rbi +3 -3
  48. data/rbi/lib/terminal-shop/resources/subscription.rbi +10 -0
  49. data/rbi/lib/terminal-shop/util.rbi +33 -1
  50. data/rbi/lib/terminal-shop/version.rbi +1 -1
  51. data/sig/terminal-shop/base_client.rbs +12 -10
  52. data/sig/terminal-shop/base_page.rbs +1 -1
  53. data/sig/terminal-shop/errors.rbs +2 -1
  54. data/sig/terminal-shop/models/address_get_params.rbs +19 -0
  55. data/sig/terminal-shop/models/address_get_response.rbs +18 -0
  56. data/sig/terminal-shop/models/app_create_params.rbs +12 -3
  57. data/sig/terminal-shop/models/card_get_params.rbs +18 -0
  58. data/sig/terminal-shop/models/card_get_response.rbs +18 -0
  59. data/sig/terminal-shop/models/product.rbs +52 -17
  60. data/sig/terminal-shop/models/product_get_params.rbs +19 -0
  61. data/sig/terminal-shop/models/product_get_response.rbs +18 -0
  62. data/sig/terminal-shop/models/profile_update_params.rbs +5 -5
  63. data/sig/terminal-shop/models/subscription_get_params.rbs +19 -0
  64. data/sig/terminal-shop/models/subscription_get_response.rbs +19 -0
  65. data/sig/terminal-shop/resources/address.rbs +10 -0
  66. data/sig/terminal-shop/resources/app.rbs +0 -2
  67. data/sig/terminal-shop/resources/card.rbs +10 -0
  68. data/sig/terminal-shop/resources/product.rbs +10 -0
  69. data/sig/terminal-shop/resources/profile.rbs +3 -4
  70. data/sig/terminal-shop/resources/subscription.rbs +11 -0
  71. data/sig/terminal-shop/util.rbs +22 -1
  72. data/sig/terminal-shop/version.rbs +1 -1
  73. metadata +28 -4
@@ -131,16 +131,23 @@ module TerminalShop
131
131
  req = self.class.build_request(request)
132
132
 
133
133
  eof = false
134
+ finished = false
134
135
  enum = Enumerator.new do |y|
135
136
  with_pool(url) do |conn|
137
+ next if finished
138
+
136
139
  self.class.calibrate_socket_timeout(conn, deadline)
137
140
  conn.start unless conn.started?
138
141
 
139
142
  self.class.calibrate_socket_timeout(conn, deadline)
140
143
  conn.request(req) do |rsp|
141
144
  y << [conn, rsp]
145
+ break if finished
146
+
142
147
  rsp.read_body do |bytes|
143
148
  y << bytes
149
+ break if finished
150
+
144
151
  self.class.calibrate_socket_timeout(conn, deadline)
145
152
  end
146
153
  eof = true
@@ -148,16 +155,14 @@ module TerminalShop
148
155
  end
149
156
  end
150
157
 
151
- # need to protect the `Enumerator` against `#.rewind`
152
- fused = false
153
158
  conn, response = enum.next
154
- body = Enumerator.new do |y|
155
- next if fused
156
-
157
- fused = true
158
- loop { y << enum.next }
159
- ensure
160
- conn.finish if !eof && conn.started?
159
+ body = TerminalShop::Util.fused_enum(enum) do
160
+ finished = true
161
+ tap do
162
+ enum.next
163
+ rescue StopIteration
164
+ end
165
+ conn.finish if !eof && conn&.started?
161
166
  end
162
167
  [response, (response.body = body)]
163
168
  end
@@ -74,6 +74,25 @@ module TerminalShop
74
74
  )
75
75
  end
76
76
 
77
+ # Get the shipping address with the given ID.
78
+ #
79
+ # @param id [String] ID of the shipping address to get.
80
+ #
81
+ # @param params [TerminalShop::Models::AddressGetParams, Hash{Symbol=>Object}] .
82
+ #
83
+ # @option params [TerminalShop::RequestOptions, Hash{Symbol=>Object}, nil] :request_options
84
+ #
85
+ # @return [TerminalShop::Models::AddressGetResponse]
86
+ #
87
+ def get(id, params = {})
88
+ @client.request(
89
+ method: :get,
90
+ path: ["address/%0s", id],
91
+ model: TerminalShop::Models::AddressGetResponse,
92
+ options: params[:request_options]
93
+ )
94
+ end
95
+
77
96
  # @param client [TerminalShop::Client]
78
97
  #
79
98
  def initialize(client:)
@@ -7,13 +7,9 @@ module TerminalShop
7
7
  #
8
8
  # @param params [TerminalShop::Models::AppCreateParams, Hash{Symbol=>Object}] .
9
9
  #
10
- # @option params [String] :id Unique object identifier. The format and length of IDs may change over time.
10
+ # @option params [String] :name
11
11
  #
12
- # @option params [String] :name Name of the app.
13
- #
14
- # @option params [String] :redirect_uri Redirect URI of the app.
15
- #
16
- # @option params [String] :secret OAuth 2.0 client secret of the app (obfuscated).
12
+ # @option params [String] :redirect_uri
17
13
  #
18
14
  # @option params [TerminalShop::RequestOptions, Hash{Symbol=>Object}, nil] :request_options
19
15
  #
@@ -79,6 +79,25 @@ module TerminalShop
79
79
  )
80
80
  end
81
81
 
82
+ # Get a credit card by ID associated with the current user.
83
+ #
84
+ # @param id [String] ID of the card to get.
85
+ #
86
+ # @param params [TerminalShop::Models::CardGetParams, Hash{Symbol=>Object}] .
87
+ #
88
+ # @option params [TerminalShop::RequestOptions, Hash{Symbol=>Object}, nil] :request_options
89
+ #
90
+ # @return [TerminalShop::Models::CardGetResponse]
91
+ #
92
+ def get(id, params = {})
93
+ @client.request(
94
+ method: :get,
95
+ path: ["card/%0s", id],
96
+ model: TerminalShop::Models::CardGetResponse,
97
+ options: params[:request_options]
98
+ )
99
+ end
100
+
82
101
  # @param client [TerminalShop::Client]
83
102
  #
84
103
  def initialize(client:)
@@ -20,6 +20,25 @@ module TerminalShop
20
20
  )
21
21
  end
22
22
 
23
+ # Get a product by ID from the Terminal shop.
24
+ #
25
+ # @param id [String] ID of the product to get.
26
+ #
27
+ # @param params [TerminalShop::Models::ProductGetParams, Hash{Symbol=>Object}] .
28
+ #
29
+ # @option params [TerminalShop::RequestOptions, Hash{Symbol=>Object}, nil] :request_options
30
+ #
31
+ # @return [TerminalShop::Models::ProductGetResponse]
32
+ #
33
+ def get(id, params = {})
34
+ @client.request(
35
+ method: :get,
36
+ path: ["product/%0s", id],
37
+ model: TerminalShop::Models::ProductGetResponse,
38
+ options: params[:request_options]
39
+ )
40
+ end
41
+
23
42
  # @param client [TerminalShop::Client]
24
43
  #
25
44
  def initialize(client:)
@@ -7,15 +7,15 @@ module TerminalShop
7
7
  #
8
8
  # @param params [TerminalShop::Models::ProfileUpdateParams, Hash{Symbol=>Object}] .
9
9
  #
10
- # @option params [String, nil] :email Email address of the user.
10
+ # @option params [String] :email
11
11
  #
12
- # @option params [String, nil] :name Name of the user.
12
+ # @option params [String] :name
13
13
  #
14
14
  # @option params [TerminalShop::RequestOptions, Hash{Symbol=>Object}, nil] :request_options
15
15
  #
16
16
  # @return [TerminalShop::Models::ProfileUpdateResponse]
17
17
  #
18
- def update(params = {})
18
+ def update(params)
19
19
  parsed, options = TerminalShop::Models::ProfileUpdateParams.dump_request(params)
20
20
  @client.request(
21
21
  method: :put,
@@ -72,6 +72,25 @@ module TerminalShop
72
72
  )
73
73
  end
74
74
 
75
+ # Get the subscription with the given ID.
76
+ #
77
+ # @param id [String] ID of the subscription to get.
78
+ #
79
+ # @param params [TerminalShop::Models::SubscriptionGetParams, Hash{Symbol=>Object}] .
80
+ #
81
+ # @option params [TerminalShop::RequestOptions, Hash{Symbol=>Object}, nil] :request_options
82
+ #
83
+ # @return [TerminalShop::Models::SubscriptionGetResponse]
84
+ #
85
+ def get(id, params = {})
86
+ @client.request(
87
+ method: :get,
88
+ path: ["subscription/%0s", id],
89
+ model: TerminalShop::Models::SubscriptionGetResponse,
90
+ options: params[:request_options]
91
+ )
92
+ end
93
+
75
94
  # @param client [TerminalShop::Client]
76
95
  #
77
96
  def initialize(client:)
@@ -382,13 +382,19 @@ module TerminalShop
382
382
  class << self
383
383
  # @private
384
384
  #
385
- # @param headers [Array<Hash{String=>String, Integer, nil}>]
385
+ # @param headers [Hash{String=>String, Integer, Array<String, Integer, nil>, nil}]
386
386
  #
387
387
  # @return [Hash{String=>String}]
388
388
  #
389
389
  def normalized_headers(*headers)
390
390
  {}.merge(*headers.compact).to_h do |key, val|
391
- [key.downcase, val&.to_s&.strip]
391
+ case val
392
+ in Array
393
+ val.map { _1.to_s.strip }.join(", ")
394
+ else
395
+ val&.to_s&.strip
396
+ end
397
+ [key.downcase, val]
392
398
  end
393
399
  end
394
400
  end
@@ -490,7 +496,7 @@ module TerminalShop
490
496
  #
491
497
  def decode_content(headers, stream:, suppress_error: false)
492
498
  case headers["content-type"]
493
- in %r{^application/json}
499
+ in %r{^application/(?:vnd\.api\+)?json}
494
500
  json = stream.to_a.join
495
501
  begin
496
502
  JSON.parse(json, symbolize_names: true)
@@ -498,6 +504,11 @@ module TerminalShop
498
504
  raise e unless suppress_error
499
505
  json
500
506
  end
507
+ in %r{^text/event-stream}
508
+ lines = enum_lines(stream)
509
+ parse_sse(lines)
510
+ in %r{^application/(?:x-)?jsonl}
511
+ enum_lines(stream)
501
512
  in %r{^text/}
502
513
  stream.to_a.join
503
514
  else
@@ -506,6 +517,135 @@ module TerminalShop
506
517
  end
507
518
  end
508
519
  end
520
+
521
+ class << self
522
+ # @private
523
+ #
524
+ # https://doc.rust-lang.org/std/iter/trait.FusedIterator.html
525
+ #
526
+ # @param enum [Enumerable]
527
+ # @param close [Proc]
528
+ #
529
+ # @return [Enumerable]
530
+ #
531
+ def fused_enum(enum, &close)
532
+ fused = false
533
+ iter = Enumerator.new do |y|
534
+ next if fused
535
+
536
+ fused = true
537
+ loop { y << enum.next }
538
+ ensure
539
+ close&.call
540
+ close = nil
541
+ end
542
+
543
+ iter.define_singleton_method(:rewind) do
544
+ fused = true
545
+ self
546
+ end
547
+ iter
548
+ end
549
+
550
+ # @private
551
+ #
552
+ # @param enum [Enumerable, nil]
553
+ #
554
+ def close_fused!(enum)
555
+ return unless enum.is_a?(Enumerator)
556
+
557
+ # rubocop:disable Lint/UnreachableLoop
558
+ enum.rewind.each { break }
559
+ # rubocop:enable Lint/UnreachableLoop
560
+ end
561
+
562
+ # @private
563
+ #
564
+ # @param enum [Enumerable, nil]
565
+ # @param blk [Proc]
566
+ #
567
+ def chain_fused(enum, &blk)
568
+ iter = Enumerator.new { blk.call(_1) }
569
+ fused_enum(iter) { close_fused!(enum) }
570
+ end
571
+ end
572
+
573
+ class << self
574
+ # @private
575
+ #
576
+ # @param enum [Enumerable]
577
+ #
578
+ # @return [Enumerable]
579
+ #
580
+ def decode_lines(enum)
581
+ re = /(\r\n|\r|\n)/
582
+ buffer = String.new.b
583
+ cr_seen = nil
584
+
585
+ chain_fused(enum) do |y|
586
+ enum.each do |row|
587
+ buffer << row
588
+ while (match = re.match(buffer, cr_seen.to_i))
589
+ case [match.captures.first, cr_seen]
590
+ in ["\r", nil]
591
+ cr_seen = match.end(1)
592
+ next
593
+ in ["\r" | "\r\n", Integer]
594
+ y << buffer.slice!(..(cr_seen.pred))
595
+ else
596
+ y << buffer.slice!(..(match.end(1).pred))
597
+ end
598
+ cr_seen = nil
599
+ end
600
+ end
601
+
602
+ y << buffer.slice!(..(cr_seen.pred)) unless cr_seen.nil?
603
+ y << buffer unless buffer.empty?
604
+ end
605
+ end
606
+
607
+ # @private
608
+ #
609
+ # https://html.spec.whatwg.org/multipage/server-sent-events.html#parsing-an-event-stream
610
+ #
611
+ # @param lines [Enumerable]
612
+ #
613
+ # @return [Hash{Symbol=>Object}]
614
+ #
615
+ def decode_sse(lines)
616
+ chain_fused(lines) do |y|
617
+ blank = {event: nil, data: nil, id: nil, retry: nil}
618
+ current = {}
619
+
620
+ lines.each do |line|
621
+ case line.sub(/\R$/, "")
622
+ in ""
623
+ next if current.empty?
624
+ y << {**blank, **current}
625
+ current = {}
626
+ in /^:/
627
+ next
628
+ in /^([^:]+):\s?(.*)$/
629
+ field, value = Regexp.last_match.captures
630
+ case field
631
+ in "event"
632
+ current.merge!(event: value)
633
+ in "data"
634
+ (current[:data] ||= String.new.b) << value << "\n"
635
+ in "id" unless value.include?("\0")
636
+ current.merge!(id: value)
637
+ in "retry" if /^\d+$/ =~ value
638
+ current.merge!(retry: Integer(value))
639
+ else
640
+ end
641
+ else
642
+ end
643
+ end
644
+
645
+ y << {**blank, **current} unless current.empty?
646
+ end
647
+ end
648
+ end
509
649
  end
510
650
 
511
651
  # rubocop:enable Metrics/ModuleLength
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TerminalShop
4
- VERSION = "0.1.0-alpha.14"
4
+ VERSION = "1.0.0"
5
5
  end
data/lib/terminal-shop.rb CHANGED
@@ -28,15 +28,17 @@ require_relative "terminal-shop/errors"
28
28
  require_relative "terminal-shop/base_client"
29
29
  require_relative "terminal-shop/pooled_net_requester"
30
30
  require_relative "terminal-shop/client"
31
- require_relative "terminal-shop/models/app"
32
31
  require_relative "terminal-shop/models/subscription"
33
32
  require_relative "terminal-shop/models/address"
34
33
  require_relative "terminal-shop/models/address_create_params"
35
34
  require_relative "terminal-shop/models/address_create_response"
36
35
  require_relative "terminal-shop/models/address_delete_params"
37
36
  require_relative "terminal-shop/models/address_delete_response"
37
+ require_relative "terminal-shop/models/address_get_params"
38
+ require_relative "terminal-shop/models/address_get_response"
38
39
  require_relative "terminal-shop/models/address_list_params"
39
40
  require_relative "terminal-shop/models/address_list_response"
41
+ require_relative "terminal-shop/models/app"
40
42
  require_relative "terminal-shop/models/app_create_params"
41
43
  require_relative "terminal-shop/models/app_create_response"
42
44
  require_relative "terminal-shop/models/app_delete_params"
@@ -52,6 +54,8 @@ require_relative "terminal-shop/models/card_create_params"
52
54
  require_relative "terminal-shop/models/card_create_response"
53
55
  require_relative "terminal-shop/models/card_delete_params"
54
56
  require_relative "terminal-shop/models/card_delete_response"
57
+ require_relative "terminal-shop/models/card_get_params"
58
+ require_relative "terminal-shop/models/card_get_response"
55
59
  require_relative "terminal-shop/models/card_list_params"
56
60
  require_relative "terminal-shop/models/card_list_response"
57
61
  require_relative "terminal-shop/models/cart"
@@ -75,6 +79,8 @@ require_relative "terminal-shop/models/order_get_response"
75
79
  require_relative "terminal-shop/models/order_list_params"
76
80
  require_relative "terminal-shop/models/order_list_response"
77
81
  require_relative "terminal-shop/models/product"
82
+ require_relative "terminal-shop/models/product_get_params"
83
+ require_relative "terminal-shop/models/product_get_response"
78
84
  require_relative "terminal-shop/models/product_list_params"
79
85
  require_relative "terminal-shop/models/product_list_response"
80
86
  require_relative "terminal-shop/models/product_variant"
@@ -87,6 +93,8 @@ require_relative "terminal-shop/models/subscription_create_params"
87
93
  require_relative "terminal-shop/models/subscription_create_response"
88
94
  require_relative "terminal-shop/models/subscription_delete_params"
89
95
  require_relative "terminal-shop/models/subscription_delete_response"
96
+ require_relative "terminal-shop/models/subscription_get_params"
97
+ require_relative "terminal-shop/models/subscription_get_response"
90
98
  require_relative "terminal-shop/models/subscription_list_params"
91
99
  require_relative "terminal-shop/models/subscription_list_response"
92
100
  require_relative "terminal-shop/models/token"
@@ -9,10 +9,20 @@ module TerminalShop
9
9
  method: Symbol,
10
10
  path: T.any(String, T::Array[String]),
11
11
  query: T.nilable(T::Hash[String, T.nilable(T.any(T::Array[String], String))]),
12
- headers: T.nilable(T::Hash[String, T.nilable(String)]),
12
+ headers: T.nilable(
13
+ T::Hash[String,
14
+ T.nilable(
15
+ T.any(
16
+ String,
17
+ Integer,
18
+ T::Array[T.nilable(T.any(String, Integer))]
19
+ )
20
+ )]
21
+ ),
13
22
  body: T.nilable(T.anything),
14
23
  unwrap: T.nilable(Symbol),
15
- page: T.nilable(T::Class[TerminalShop::BaseModel]),
24
+ page: T.nilable(T::Class[TerminalShop::BasePage[TerminalShop::BaseModel]]),
25
+ stream: T.nilable(T::Class[T.anything]),
16
26
  model: T.nilable(TerminalShop::Converter::Input),
17
27
  options: T.nilable(T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything]))
18
28
  }
@@ -69,7 +79,8 @@ module TerminalShop
69
79
  max_retries: Integer,
70
80
  initial_retry_delay: Float,
71
81
  max_retry_delay: Float,
72
- headers: T::Hash[String, T.nilable(String)],
82
+ headers: T::Hash[String,
83
+ T.nilable(T.any(String, Integer, T::Array[T.nilable(T.any(String, Integer))]))],
73
84
  idempotency_header: T.nilable(String)
74
85
  )
75
86
  .void
@@ -112,31 +123,30 @@ module TerminalShop
112
123
  retry_count: Integer,
113
124
  send_retry_header: T::Boolean
114
125
  )
115
- .returns([Net::HTTPResponse, T::Enumerable[String]])
126
+ .returns([Integer, Net::HTTPResponse, T::Enumerable[String]])
116
127
  end
117
128
  private def send_request(request, redirect_count:, retry_count:, send_retry_header:)
118
129
  end
119
130
 
120
- sig do
121
- params(
122
- req: TerminalShop::BaseClient::RequestComponentsShape,
123
- headers: T.any(T::Hash[String, String], Net::HTTPHeader),
124
- stream: T::Enumerable[String]
125
- )
126
- .returns(T.anything)
127
- end
128
- private def parse_response(req, headers:, stream:)
129
- end
130
-
131
131
  sig do
132
132
  params(
133
133
  method: Symbol,
134
134
  path: T.any(String, T::Array[String]),
135
135
  query: T.nilable(T::Hash[String, T.nilable(T.any(T::Array[String], String))]),
136
- headers: T.nilable(T::Hash[String, T.nilable(String)]),
136
+ headers: T.nilable(
137
+ T::Hash[String,
138
+ T.nilable(
139
+ T.any(
140
+ String,
141
+ Integer,
142
+ T::Array[T.nilable(T.any(String, Integer))]
143
+ )
144
+ )]
145
+ ),
137
146
  body: T.nilable(T.anything),
138
147
  unwrap: T.nilable(Symbol),
139
- page: T.nilable(T::Class[TerminalShop::BaseModel]),
148
+ page: T.nilable(T::Class[TerminalShop::BasePage[TerminalShop::BaseModel]]),
149
+ stream: T.nilable(T::Class[T.anything]),
140
150
  model: T.nilable(TerminalShop::Converter::Input),
141
151
  options: T.nilable(T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything]))
142
152
  )
@@ -150,6 +160,7 @@ module TerminalShop
150
160
  body: nil,
151
161
  unwrap: nil,
152
162
  page: nil,
163
+ stream: nil,
153
164
  model: TerminalShop::Unknown,
154
165
  options: {}
155
166
  )
@@ -29,11 +29,11 @@ module TerminalShop
29
29
  client: TerminalShop::BaseClient,
30
30
  req: TerminalShop::BaseClient::RequestComponentsShape,
31
31
  headers: T.any(T::Hash[String, String], Net::HTTPHeader),
32
- unwrapped: T.anything
32
+ page_data: T.anything
33
33
  )
34
34
  .void
35
35
  end
36
- def initialize(client:, req:, headers:, unwrapped:)
36
+ def initialize(client:, req:, headers:, page_data:)
37
37
  end
38
38
  end
39
39
  end
@@ -85,11 +85,12 @@ module TerminalShop
85
85
  status: Integer,
86
86
  body: T.nilable(Object),
87
87
  request: NilClass,
88
- response: NilClass
88
+ response: NilClass,
89
+ message: T.nilable(String)
89
90
  )
90
91
  .returns(T.attached_class)
91
92
  end
92
- def self.for(url:, status:, body:, request:, response:)
93
+ def self.for(url:, status:, body:, request:, response:, message: nil)
93
94
  end
94
95
 
95
96
  sig { returns(Integer) }
@@ -0,0 +1,18 @@
1
+ # typed: strong
2
+
3
+ module TerminalShop
4
+ module Models
5
+ class AddressGetParams < TerminalShop::BaseModel
6
+ extend TerminalShop::RequestParameters::Converter
7
+ include TerminalShop::RequestParameters
8
+
9
+ sig { params(request_options: T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything])).void }
10
+ def initialize(request_options: {})
11
+ end
12
+
13
+ sig { override.returns({request_options: TerminalShop::RequestOptions}) }
14
+ def to_hash
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,23 @@
1
+ # typed: strong
2
+
3
+ module TerminalShop
4
+ module Models
5
+ class AddressGetResponse < TerminalShop::BaseModel
6
+ sig { returns(TerminalShop::Models::AddressAPI) }
7
+ def data
8
+ end
9
+
10
+ sig { params(_: TerminalShop::Models::AddressAPI).returns(TerminalShop::Models::AddressAPI) }
11
+ def data=(_)
12
+ end
13
+
14
+ sig { params(data: TerminalShop::Models::AddressAPI).void }
15
+ def initialize(data:)
16
+ end
17
+
18
+ sig { override.returns({data: TerminalShop::Models::AddressAPI}) }
19
+ def to_hash
20
+ end
21
+ end
22
+ end
23
+ end
@@ -2,15 +2,40 @@
2
2
 
3
3
  module TerminalShop
4
4
  module Models
5
- class AppCreateParams < TerminalShop::Models::AppAPI
5
+ class AppCreateParams < TerminalShop::BaseModel
6
6
  extend TerminalShop::RequestParameters::Converter
7
7
  include TerminalShop::RequestParameters
8
8
 
9
- sig { params(request_options: T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything])).void }
10
- def initialize(request_options: {})
9
+ sig { returns(String) }
10
+ def name
11
11
  end
12
12
 
13
- sig { override.returns({request_options: TerminalShop::RequestOptions}) }
13
+ sig { params(_: String).returns(String) }
14
+ def name=(_)
15
+ end
16
+
17
+ sig { returns(String) }
18
+ def redirect_uri
19
+ end
20
+
21
+ sig { params(_: String).returns(String) }
22
+ def redirect_uri=(_)
23
+ end
24
+
25
+ sig do
26
+ params(
27
+ name: String,
28
+ redirect_uri: String,
29
+ request_options: T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything])
30
+ )
31
+ .void
32
+ end
33
+ def initialize(name:, redirect_uri:, request_options: {})
34
+ end
35
+
36
+ sig do
37
+ override.returns({name: String, redirect_uri: String, request_options: TerminalShop::RequestOptions})
38
+ end
14
39
  def to_hash
15
40
  end
16
41
  end
@@ -0,0 +1,18 @@
1
+ # typed: strong
2
+
3
+ module TerminalShop
4
+ module Models
5
+ class CardGetParams < TerminalShop::BaseModel
6
+ extend TerminalShop::RequestParameters::Converter
7
+ include TerminalShop::RequestParameters
8
+
9
+ sig { params(request_options: T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything])).void }
10
+ def initialize(request_options: {})
11
+ end
12
+
13
+ sig { override.returns({request_options: TerminalShop::RequestOptions}) }
14
+ def to_hash
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,23 @@
1
+ # typed: strong
2
+
3
+ module TerminalShop
4
+ module Models
5
+ class CardGetResponse < TerminalShop::BaseModel
6
+ sig { returns(TerminalShop::Models::CardAPI) }
7
+ def data
8
+ end
9
+
10
+ sig { params(_: TerminalShop::Models::CardAPI).returns(TerminalShop::Models::CardAPI) }
11
+ def data=(_)
12
+ end
13
+
14
+ sig { params(data: TerminalShop::Models::CardAPI).void }
15
+ def initialize(data:)
16
+ end
17
+
18
+ sig { override.returns({data: TerminalShop::Models::CardAPI}) }
19
+ def to_hash
20
+ end
21
+ end
22
+ end
23
+ end