shopify_api 13.1.0 → 13.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/BREAKING_CHANGES_FOR_V10.md +231 -0
  3. data/CHANGELOG.md +8 -1
  4. data/Gemfile.lock +5 -5
  5. data/README.md +10 -34
  6. data/docs/README.md +0 -1
  7. data/docs/getting_started.md +20 -3
  8. data/docs/usage/custom_apps.md +75 -0
  9. data/docs/usage/graphql.md +63 -18
  10. data/docs/usage/oauth.md +160 -27
  11. data/docs/usage/rest.md +204 -62
  12. data/docs/usage/webhooks.md +22 -4
  13. data/lib/shopify_api/admin_versions.rb +2 -1
  14. data/lib/shopify_api/context.rb +5 -3
  15. data/lib/shopify_api/rest/base.rb +22 -14
  16. data/lib/shopify_api/rest/resources/2022_10/assigned_fulfillment_order.rb +5 -3
  17. data/lib/shopify_api/rest/resources/2022_10/customer_address.rb +10 -0
  18. data/lib/shopify_api/rest/resources/2022_10/fulfillment_request.rb +10 -0
  19. data/lib/shopify_api/rest/resources/2022_10/order_risk.rb +5 -3
  20. data/lib/shopify_api/rest/resources/2023_01/assigned_fulfillment_order.rb +5 -3
  21. data/lib/shopify_api/rest/resources/2023_01/balance.rb +4 -0
  22. data/lib/shopify_api/rest/resources/2023_01/customer_address.rb +10 -0
  23. data/lib/shopify_api/rest/resources/2023_01/fulfillment_request.rb +10 -0
  24. data/lib/shopify_api/rest/resources/2023_01/order.rb +3 -0
  25. data/lib/shopify_api/rest/resources/2023_01/order_risk.rb +5 -3
  26. data/lib/shopify_api/rest/resources/2023_01/shop.rb +0 -3
  27. data/lib/shopify_api/rest/resources/2023_01/variant.rb +1 -5
  28. data/lib/shopify_api/rest/resources/2023_04/assigned_fulfillment_order.rb +5 -3
  29. data/lib/shopify_api/rest/resources/2023_04/balance.rb +4 -0
  30. data/lib/shopify_api/rest/resources/2023_04/customer_address.rb +10 -0
  31. data/lib/shopify_api/rest/resources/2023_04/fulfillment_request.rb +10 -0
  32. data/lib/shopify_api/rest/resources/2023_04/order.rb +3 -0
  33. data/lib/shopify_api/rest/resources/2023_04/order_risk.rb +5 -3
  34. data/lib/shopify_api/rest/resources/2023_04/shop.rb +0 -3
  35. data/lib/shopify_api/rest/resources/2023_04/variant.rb +1 -5
  36. data/lib/shopify_api/rest/resources/2023_07/assigned_fulfillment_order.rb +5 -3
  37. data/lib/shopify_api/rest/resources/2023_07/balance.rb +4 -0
  38. data/lib/shopify_api/rest/resources/2023_07/customer_address.rb +10 -0
  39. data/lib/shopify_api/rest/resources/2023_07/fulfillment_request.rb +10 -0
  40. data/lib/shopify_api/rest/resources/2023_07/order.rb +3 -0
  41. data/lib/shopify_api/rest/resources/2023_07/order_risk.rb +5 -3
  42. data/lib/shopify_api/rest/resources/2023_07/report.rb +121 -0
  43. data/lib/shopify_api/rest/resources/2023_07/shop.rb +0 -3
  44. data/lib/shopify_api/rest/resources/2023_07/variant.rb +1 -5
  45. data/lib/shopify_api/rest/resources/2023_10/abandoned_checkout.rb +190 -0
  46. data/lib/shopify_api/rest/resources/2023_10/access_scope.rb +58 -0
  47. data/lib/shopify_api/rest/resources/2023_10/apple_pay_certificate.rb +105 -0
  48. data/lib/shopify_api/rest/resources/2023_10/application_charge.rb +109 -0
  49. data/lib/shopify_api/rest/resources/2023_10/application_credit.rb +91 -0
  50. data/lib/shopify_api/rest/resources/2023_10/article.rb +265 -0
  51. data/lib/shopify_api/rest/resources/2023_10/asset.rb +118 -0
  52. data/lib/shopify_api/rest/resources/2023_10/assigned_fulfillment_order.rb +88 -0
  53. data/lib/shopify_api/rest/resources/2023_10/balance.rb +54 -0
  54. data/lib/shopify_api/rest/resources/2023_10/blog.rb +162 -0
  55. data/lib/shopify_api/rest/resources/2023_10/cancellation_request.rb +83 -0
  56. data/lib/shopify_api/rest/resources/2023_10/carrier_service.rb +116 -0
  57. data/lib/shopify_api/rest/resources/2023_10/checkout.rb +209 -0
  58. data/lib/shopify_api/rest/resources/2023_10/collect.rb +142 -0
  59. data/lib/shopify_api/rest/resources/2023_10/collection.rb +110 -0
  60. data/lib/shopify_api/rest/resources/2023_10/collection_listing.rb +155 -0
  61. data/lib/shopify_api/rest/resources/2023_10/comment.rb +283 -0
  62. data/lib/shopify_api/rest/resources/2023_10/country.rb +137 -0
  63. data/lib/shopify_api/rest/resources/2023_10/currency.rb +57 -0
  64. data/lib/shopify_api/rest/resources/2023_10/custom_collection.rb +187 -0
  65. data/lib/shopify_api/rest/resources/2023_10/customer.rb +329 -0
  66. data/lib/shopify_api/rest/resources/2023_10/customer_address.rb +211 -0
  67. data/lib/shopify_api/rest/resources/2023_10/deprecated_api_call.rb +57 -0
  68. data/lib/shopify_api/rest/resources/2023_10/discount_code.rb +222 -0
  69. data/lib/shopify_api/rest/resources/2023_10/dispute.rb +111 -0
  70. data/lib/shopify_api/rest/resources/2023_10/dispute_evidence.rb +117 -0
  71. data/lib/shopify_api/rest/resources/2023_10/dispute_file_upload.rb +81 -0
  72. data/lib/shopify_api/rest/resources/2023_10/draft_order.rb +275 -0
  73. data/lib/shopify_api/rest/resources/2023_10/event.rb +148 -0
  74. data/lib/shopify_api/rest/resources/2023_10/fulfillment.rb +231 -0
  75. data/lib/shopify_api/rest/resources/2023_10/fulfillment_event.rb +166 -0
  76. data/lib/shopify_api/rest/resources/2023_10/fulfillment_order.rb +312 -0
  77. data/lib/shopify_api/rest/resources/2023_10/fulfillment_request.rb +97 -0
  78. data/lib/shopify_api/rest/resources/2023_10/fulfillment_service.rb +130 -0
  79. data/lib/shopify_api/rest/resources/2023_10/gift_card.rb +218 -0
  80. data/lib/shopify_api/rest/resources/2023_10/gift_card_adjustment.rb +118 -0
  81. data/lib/shopify_api/rest/resources/2023_10/image.rb +157 -0
  82. data/lib/shopify_api/rest/resources/2023_10/inventory_item.rb +108 -0
  83. data/lib/shopify_api/rest/resources/2023_10/inventory_level.rb +179 -0
  84. data/lib/shopify_api/rest/resources/2023_10/location.rb +167 -0
  85. data/lib/shopify_api/rest/resources/2023_10/locations_for_move.rb +56 -0
  86. data/lib/shopify_api/rest/resources/2023_10/marketing_event.rb +209 -0
  87. data/lib/shopify_api/rest/resources/2023_10/metafield.rb +344 -0
  88. data/lib/shopify_api/rest/resources/2023_10/mobile_platform_application.rb +110 -0
  89. data/lib/shopify_api/rest/resources/2023_10/order.rb +491 -0
  90. data/lib/shopify_api/rest/resources/2023_10/order_risk.rb +144 -0
  91. data/lib/shopify_api/rest/resources/2023_10/page.rb +194 -0
  92. data/lib/shopify_api/rest/resources/2023_10/payment.rb +140 -0
  93. data/lib/shopify_api/rest/resources/2023_10/payment_gateway.rb +143 -0
  94. data/lib/shopify_api/rest/resources/2023_10/payment_transaction.rb +107 -0
  95. data/lib/shopify_api/rest/resources/2023_10/payout.rb +97 -0
  96. data/lib/shopify_api/rest/resources/2023_10/policy.rb +69 -0
  97. data/lib/shopify_api/rest/resources/2023_10/price_rule.rb +223 -0
  98. data/lib/shopify_api/rest/resources/2023_10/product.rb +223 -0
  99. data/lib/shopify_api/rest/resources/2023_10/product_listing.rb +196 -0
  100. data/lib/shopify_api/rest/resources/2023_10/product_resource_feedback.rb +88 -0
  101. data/lib/shopify_api/rest/resources/2023_10/province.rb +132 -0
  102. data/lib/shopify_api/rest/resources/2023_10/recurring_application_charge.rb +172 -0
  103. data/lib/shopify_api/rest/resources/2023_10/redirect.rb +139 -0
  104. data/lib/shopify_api/rest/resources/2023_10/refund.rb +151 -0
  105. data/lib/shopify_api/rest/resources/2023_10/report.rb +121 -0
  106. data/lib/shopify_api/rest/resources/2023_10/resource_feedback.rb +73 -0
  107. data/lib/shopify_api/rest/resources/2023_10/script_tag.rb +155 -0
  108. data/lib/shopify_api/rest/resources/2023_10/shipping_zone.rb +83 -0
  109. data/lib/shopify_api/rest/resources/2023_10/shop.rb +218 -0
  110. data/lib/shopify_api/rest/resources/2023_10/smart_collection.rb +216 -0
  111. data/lib/shopify_api/rest/resources/2023_10/storefront_access_token.rb +87 -0
  112. data/lib/shopify_api/rest/resources/2023_10/tender_transaction.rb +93 -0
  113. data/lib/shopify_api/rest/resources/2023_10/theme.rb +123 -0
  114. data/lib/shopify_api/rest/resources/2023_10/transaction.rb +184 -0
  115. data/lib/shopify_api/rest/resources/2023_10/usage_charge.rb +102 -0
  116. data/lib/shopify_api/rest/resources/2023_10/user.rb +138 -0
  117. data/lib/shopify_api/rest/resources/2023_10/variant.rb +208 -0
  118. data/lib/shopify_api/rest/resources/2023_10/webhook.rb +168 -0
  119. data/lib/shopify_api/version.rb +1 -1
  120. data/lib/shopify_api/webhooks/registration.rb +19 -4
  121. data/lib/shopify_api/webhooks/registrations/event_bridge.rb +1 -1
  122. data/lib/shopify_api/webhooks/registrations/http.rb +1 -1
  123. data/lib/shopify_api/webhooks/registrations/pub_sub.rb +2 -1
  124. data/lib/shopify_api/webhooks/registry.rb +9 -5
  125. metadata +80 -6
  126. data/.github/workflows/stale.yml +0 -43
  127. data/docs/issues.md +0 -39
  128. data/docs/usage/session_storage.md +0 -46
@@ -0,0 +1,211 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ ########################################################################################################################
5
+ # This file is auto-generated. If you have an issue, please create a GitHub issue. #
6
+ ########################################################################################################################
7
+
8
+ module ShopifyAPI
9
+ class CustomerAddress < ShopifyAPI::Rest::Base
10
+ extend T::Sig
11
+
12
+ @prev_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
13
+ @next_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
14
+
15
+ sig { params(session: T.nilable(ShopifyAPI::Auth::Session)).void }
16
+ def initialize(session: ShopifyAPI::Context.active_session)
17
+ super(session: session)
18
+
19
+ @address1 = T.let(nil, T.nilable(String))
20
+ @address2 = T.let(nil, T.nilable(String))
21
+ @city = T.let(nil, T.nilable(String))
22
+ @company = T.let(nil, T.nilable(String))
23
+ @country = T.let(nil, T.nilable(String))
24
+ @country_code = T.let(nil, T.nilable(String))
25
+ @country_name = T.let(nil, T.nilable(String))
26
+ @customer_id = T.let(nil, T.nilable(Integer))
27
+ @first_name = T.let(nil, T.nilable(String))
28
+ @id = T.let(nil, T.nilable(Integer))
29
+ @last_name = T.let(nil, T.nilable(String))
30
+ @name = T.let(nil, T.nilable(String))
31
+ @phone = T.let(nil, T.nilable(String))
32
+ @province = T.let(nil, T.nilable(String))
33
+ @province_code = T.let(nil, T.nilable(String))
34
+ @zip = T.let(nil, T.nilable(String))
35
+ end
36
+
37
+ @has_one = T.let({}, T::Hash[Symbol, Class])
38
+ @has_many = T.let({}, T::Hash[Symbol, Class])
39
+ @paths = T.let([
40
+ {http_method: :delete, operation: :delete, ids: [:customer_id, :id], path: "customers/<customer_id>/addresses/<id>.json"},
41
+ {http_method: :get, operation: :get, ids: [:customer_id], path: "customers/<customer_id>/addresses.json"},
42
+ {http_method: :get, operation: :get, ids: [:customer_id, :id], path: "customers/<customer_id>/addresses/<id>.json"},
43
+ {http_method: :post, operation: :post, ids: [:customer_id], path: "customers/<customer_id>/addresses.json"},
44
+ {http_method: :put, operation: :default, ids: [:customer_id, :id], path: "customers/<customer_id>/addresses/<id>/default.json"},
45
+ {http_method: :put, operation: :put, ids: [:customer_id, :id], path: "customers/<customer_id>/addresses/<id>.json"},
46
+ {http_method: :put, operation: :set, ids: [:customer_id], path: "customers/<customer_id>/addresses/set.json"}
47
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
48
+
49
+ sig { returns(T.nilable(String)) }
50
+ attr_reader :address1
51
+ sig { returns(T.nilable(String)) }
52
+ attr_reader :address2
53
+ sig { returns(T.nilable(String)) }
54
+ attr_reader :city
55
+ sig { returns(T.nilable(String)) }
56
+ attr_reader :company
57
+ sig { returns(T.nilable(String)) }
58
+ attr_reader :country
59
+ sig { returns(T.nilable(String)) }
60
+ attr_reader :country_code
61
+ sig { returns(T.nilable(String)) }
62
+ attr_reader :country_name
63
+ sig { returns(T.nilable(Integer)) }
64
+ attr_reader :customer_id
65
+ sig { returns(T.nilable(String)) }
66
+ attr_reader :first_name
67
+ sig { returns(T.nilable(Integer)) }
68
+ attr_reader :id
69
+ sig { returns(T.nilable(String)) }
70
+ attr_reader :last_name
71
+ sig { returns(T.nilable(String)) }
72
+ attr_reader :name
73
+ sig { returns(T.nilable(String)) }
74
+ attr_reader :phone
75
+ sig { returns(T.nilable(String)) }
76
+ attr_reader :province
77
+ sig { returns(T.nilable(String)) }
78
+ attr_reader :province_code
79
+ sig { returns(T.nilable(String)) }
80
+ attr_reader :zip
81
+
82
+ class << self
83
+ sig do
84
+ returns(String)
85
+ end
86
+ def json_body_name()
87
+ "address"
88
+ end
89
+
90
+ sig do
91
+ returns(T::Array[String])
92
+ end
93
+ def json_response_body_names()
94
+ [
95
+ "customer_address",
96
+ "address"
97
+ ]
98
+ end
99
+
100
+ sig do
101
+ params(
102
+ id: T.any(Integer, String),
103
+ customer_id: T.nilable(T.any(Integer, String)),
104
+ session: Auth::Session
105
+ ).returns(T.nilable(CustomerAddress))
106
+ end
107
+ def find(
108
+ id:,
109
+ customer_id: nil,
110
+ session: ShopifyAPI::Context.active_session
111
+ )
112
+ result = base_find(
113
+ session: session,
114
+ ids: {id: id, customer_id: customer_id},
115
+ params: {},
116
+ )
117
+ T.cast(result[0], T.nilable(CustomerAddress))
118
+ end
119
+
120
+ sig do
121
+ params(
122
+ id: T.any(Integer, String),
123
+ customer_id: T.nilable(T.any(Integer, String)),
124
+ session: Auth::Session
125
+ ).returns(T.untyped)
126
+ end
127
+ def delete(
128
+ id:,
129
+ customer_id: nil,
130
+ session: ShopifyAPI::Context.active_session
131
+ )
132
+ request(
133
+ http_method: :delete,
134
+ operation: :delete,
135
+ session: session,
136
+ ids: {id: id, customer_id: customer_id},
137
+ params: {},
138
+ )
139
+ end
140
+
141
+ sig do
142
+ params(
143
+ customer_id: T.nilable(T.any(Integer, String)),
144
+ session: Auth::Session,
145
+ kwargs: T.untyped
146
+ ).returns(T::Array[CustomerAddress])
147
+ end
148
+ def all(
149
+ customer_id: nil,
150
+ session: ShopifyAPI::Context.active_session,
151
+ **kwargs
152
+ )
153
+ response = base_find(
154
+ session: session,
155
+ ids: {customer_id: customer_id},
156
+ params: {}.merge(kwargs).compact,
157
+ )
158
+
159
+ T.cast(response, T::Array[CustomerAddress])
160
+ end
161
+
162
+ end
163
+
164
+ sig do
165
+ params(
166
+ body: T.untyped,
167
+ kwargs: T.untyped
168
+ ).returns(T.untyped)
169
+ end
170
+ def default(
171
+ body: nil,
172
+ **kwargs
173
+ )
174
+ self.class.request(
175
+ http_method: :put,
176
+ operation: :default,
177
+ session: @session,
178
+ ids: {id: @id, customer_id: @customer_id},
179
+ params: {}.merge(kwargs).compact,
180
+ body: body,
181
+ entity: self,
182
+ )
183
+ end
184
+
185
+ sig do
186
+ params(
187
+ address_ids: T.nilable(T.any(T::Array[T.untyped], Integer, String)),
188
+ operation: T.untyped,
189
+ body: T.untyped,
190
+ kwargs: T.untyped
191
+ ).returns(T.untyped)
192
+ end
193
+ def set(
194
+ address_ids: nil,
195
+ operation: nil,
196
+ body: nil,
197
+ **kwargs
198
+ )
199
+ self.class.request(
200
+ http_method: :put,
201
+ operation: :set,
202
+ session: @session,
203
+ ids: {customer_id: @customer_id},
204
+ params: {address_ids: address_ids, operation: operation}.merge(kwargs).compact,
205
+ body: body,
206
+ entity: self,
207
+ )
208
+ end
209
+
210
+ end
211
+ end
@@ -0,0 +1,57 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ ########################################################################################################################
5
+ # This file is auto-generated. If you have an issue, please create a GitHub issue. #
6
+ ########################################################################################################################
7
+
8
+ module ShopifyAPI
9
+ class DeprecatedApiCall < ShopifyAPI::Rest::Base
10
+ extend T::Sig
11
+
12
+ @prev_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
13
+ @next_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
14
+
15
+ sig { params(session: T.nilable(ShopifyAPI::Auth::Session)).void }
16
+ def initialize(session: ShopifyAPI::Context.active_session)
17
+ super(session: session)
18
+
19
+ @data_updated_at = T.let(nil, T.nilable(String))
20
+ @deprecated_api_calls = T.let(nil, T.nilable(T::Array[T.untyped]))
21
+ end
22
+
23
+ @has_one = T.let({}, T::Hash[Symbol, Class])
24
+ @has_many = T.let({}, T::Hash[Symbol, Class])
25
+ @paths = T.let([
26
+ {http_method: :get, operation: :get, ids: [], path: "deprecated_api_calls.json"}
27
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
28
+
29
+ sig { returns(T.nilable(String)) }
30
+ attr_reader :data_updated_at
31
+ sig { returns(T.nilable(T::Array[T::Hash[T.untyped, T.untyped]])) }
32
+ attr_reader :deprecated_api_calls
33
+
34
+ class << self
35
+ sig do
36
+ params(
37
+ session: Auth::Session,
38
+ kwargs: T.untyped
39
+ ).returns(T::Array[DeprecatedApiCall])
40
+ end
41
+ def all(
42
+ session: ShopifyAPI::Context.active_session,
43
+ **kwargs
44
+ )
45
+ response = base_find(
46
+ session: session,
47
+ ids: {},
48
+ params: {}.merge(kwargs).compact,
49
+ )
50
+
51
+ T.cast(response, T::Array[DeprecatedApiCall])
52
+ end
53
+
54
+ end
55
+
56
+ end
57
+ end
@@ -0,0 +1,222 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ ########################################################################################################################
5
+ # This file is auto-generated. If you have an issue, please create a GitHub issue. #
6
+ ########################################################################################################################
7
+
8
+ module ShopifyAPI
9
+ class DiscountCode < ShopifyAPI::Rest::Base
10
+ extend T::Sig
11
+
12
+ @prev_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
13
+ @next_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
14
+
15
+ sig { params(session: T.nilable(ShopifyAPI::Auth::Session)).void }
16
+ def initialize(session: ShopifyAPI::Context.active_session)
17
+ super(session: session)
18
+
19
+ @code = T.let(nil, T.nilable(String))
20
+ @created_at = T.let(nil, T.nilable(String))
21
+ @errors = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
22
+ @id = T.let(nil, T.nilable(Integer))
23
+ @price_rule_id = T.let(nil, T.nilable(Integer))
24
+ @updated_at = T.let(nil, T.nilable(String))
25
+ @usage_count = T.let(nil, T.nilable(Integer))
26
+ end
27
+
28
+ @has_one = T.let({}, T::Hash[Symbol, Class])
29
+ @has_many = T.let({}, T::Hash[Symbol, Class])
30
+ @paths = T.let([
31
+ {http_method: :delete, operation: :delete, ids: [:price_rule_id, :id], path: "price_rules/<price_rule_id>/discount_codes/<id>.json"},
32
+ {http_method: :get, operation: :count, ids: [], path: "discount_codes/count.json"},
33
+ {http_method: :get, operation: :get, ids: [:price_rule_id, :batch_id], path: "price_rules/<price_rule_id>/batch/<batch_id>/discount_codes.json"},
34
+ {http_method: :get, operation: :get, ids: [:price_rule_id], path: "price_rules/<price_rule_id>/discount_codes.json"},
35
+ {http_method: :get, operation: :get, ids: [:price_rule_id, :id], path: "price_rules/<price_rule_id>/discount_codes/<id>.json"},
36
+ {http_method: :get, operation: :get_all, ids: [:price_rule_id, :batch_id], path: "price_rules/<price_rule_id>/batch/<batch_id>.json"},
37
+ {http_method: :get, operation: :lookup, ids: [], path: "discount_codes/lookup.json"},
38
+ {http_method: :post, operation: :batch, ids: [:price_rule_id], path: "price_rules/<price_rule_id>/batch.json"},
39
+ {http_method: :post, operation: :post, ids: [:price_rule_id], path: "price_rules/<price_rule_id>/discount_codes.json"},
40
+ {http_method: :put, operation: :put, ids: [:price_rule_id, :id], path: "price_rules/<price_rule_id>/discount_codes/<id>.json"}
41
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
42
+
43
+ sig { returns(T.nilable(String)) }
44
+ attr_reader :code
45
+ sig { returns(T.nilable(String)) }
46
+ attr_reader :created_at
47
+ sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
48
+ attr_reader :errors
49
+ sig { returns(T.nilable(Integer)) }
50
+ attr_reader :id
51
+ sig { returns(T.nilable(Integer)) }
52
+ attr_reader :price_rule_id
53
+ sig { returns(T.nilable(String)) }
54
+ attr_reader :updated_at
55
+ sig { returns(T.nilable(Integer)) }
56
+ attr_reader :usage_count
57
+
58
+ class << self
59
+ sig do
60
+ params(
61
+ id: T.any(Integer, String),
62
+ price_rule_id: T.nilable(T.any(Integer, String)),
63
+ session: Auth::Session
64
+ ).returns(T.nilable(DiscountCode))
65
+ end
66
+ def find(
67
+ id:,
68
+ price_rule_id: nil,
69
+ session: ShopifyAPI::Context.active_session
70
+ )
71
+ result = base_find(
72
+ session: session,
73
+ ids: {id: id, price_rule_id: price_rule_id},
74
+ params: {},
75
+ )
76
+ T.cast(result[0], T.nilable(DiscountCode))
77
+ end
78
+
79
+ sig do
80
+ params(
81
+ id: T.any(Integer, String),
82
+ price_rule_id: T.nilable(T.any(Integer, String)),
83
+ session: Auth::Session
84
+ ).returns(T.untyped)
85
+ end
86
+ def delete(
87
+ id:,
88
+ price_rule_id: nil,
89
+ session: ShopifyAPI::Context.active_session
90
+ )
91
+ request(
92
+ http_method: :delete,
93
+ operation: :delete,
94
+ session: session,
95
+ ids: {id: id, price_rule_id: price_rule_id},
96
+ params: {},
97
+ )
98
+ end
99
+
100
+ sig do
101
+ params(
102
+ price_rule_id: T.nilable(T.any(Integer, String)),
103
+ batch_id: T.nilable(T.any(Integer, String)),
104
+ session: Auth::Session,
105
+ kwargs: T.untyped
106
+ ).returns(T::Array[DiscountCode])
107
+ end
108
+ def all(
109
+ price_rule_id: nil,
110
+ batch_id: nil,
111
+ session: ShopifyAPI::Context.active_session,
112
+ **kwargs
113
+ )
114
+ response = base_find(
115
+ session: session,
116
+ ids: {price_rule_id: price_rule_id, batch_id: batch_id},
117
+ params: {}.merge(kwargs).compact,
118
+ )
119
+
120
+ T.cast(response, T::Array[DiscountCode])
121
+ end
122
+
123
+ sig do
124
+ params(
125
+ times_used: T.untyped,
126
+ times_used_min: T.untyped,
127
+ times_used_max: T.untyped,
128
+ session: Auth::Session,
129
+ kwargs: T.untyped
130
+ ).returns(T.untyped)
131
+ end
132
+ def count(
133
+ times_used: nil,
134
+ times_used_min: nil,
135
+ times_used_max: nil,
136
+ session: ShopifyAPI::Context.active_session,
137
+ **kwargs
138
+ )
139
+ request(
140
+ http_method: :get,
141
+ operation: :count,
142
+ session: session,
143
+ ids: {},
144
+ params: {times_used: times_used, times_used_min: times_used_min, times_used_max: times_used_max}.merge(kwargs).compact,
145
+ body: {},
146
+ entity: nil,
147
+ )
148
+ end
149
+
150
+ sig do
151
+ params(
152
+ price_rule_id: T.nilable(T.any(Integer, String)),
153
+ batch_id: T.nilable(T.any(Integer, String)),
154
+ session: Auth::Session,
155
+ kwargs: T.untyped
156
+ ).returns(T.untyped)
157
+ end
158
+ def get_all(
159
+ price_rule_id: nil,
160
+ batch_id: nil,
161
+ session: ShopifyAPI::Context.active_session,
162
+ **kwargs
163
+ )
164
+ request(
165
+ http_method: :get,
166
+ operation: :get_all,
167
+ session: session,
168
+ ids: {price_rule_id: price_rule_id, batch_id: batch_id},
169
+ params: {}.merge(kwargs).compact,
170
+ body: {},
171
+ entity: nil,
172
+ )
173
+ end
174
+
175
+ sig do
176
+ params(
177
+ code: T.untyped,
178
+ session: Auth::Session,
179
+ kwargs: T.untyped
180
+ ).returns(T.untyped)
181
+ end
182
+ def lookup(
183
+ code: nil,
184
+ session: ShopifyAPI::Context.active_session,
185
+ **kwargs
186
+ )
187
+ request(
188
+ http_method: :get,
189
+ operation: :lookup,
190
+ session: session,
191
+ ids: {},
192
+ params: {code: code}.merge(kwargs).compact,
193
+ body: {},
194
+ entity: nil,
195
+ )
196
+ end
197
+
198
+ end
199
+
200
+ sig do
201
+ params(
202
+ body: T.untyped,
203
+ kwargs: T.untyped
204
+ ).returns(T.untyped)
205
+ end
206
+ def batch(
207
+ body: nil,
208
+ **kwargs
209
+ )
210
+ self.class.request(
211
+ http_method: :post,
212
+ operation: :batch,
213
+ session: @session,
214
+ ids: {price_rule_id: @price_rule_id},
215
+ params: {}.merge(kwargs).compact,
216
+ body: body,
217
+ entity: self,
218
+ )
219
+ end
220
+
221
+ end
222
+ end
@@ -0,0 +1,111 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ ########################################################################################################################
5
+ # This file is auto-generated. If you have an issue, please create a GitHub issue. #
6
+ ########################################################################################################################
7
+
8
+ module ShopifyAPI
9
+ class Dispute < ShopifyAPI::Rest::Base
10
+ extend T::Sig
11
+
12
+ @prev_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
13
+ @next_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
14
+
15
+ sig { params(session: T.nilable(ShopifyAPI::Auth::Session)).void }
16
+ def initialize(session: ShopifyAPI::Context.active_session)
17
+ super(session: session)
18
+
19
+ @amount = T.let(nil, T.nilable(String))
20
+ @currency = T.let(nil, T.nilable(String))
21
+ @evidence_due_by = T.let(nil, T.nilable(String))
22
+ @evidence_sent_on = T.let(nil, T.nilable(String))
23
+ @finalized_on = T.let(nil, T.nilable(String))
24
+ @id = T.let(nil, T.nilable(Integer))
25
+ @network_reason_code = T.let(nil, T.nilable(String))
26
+ @order_id = T.let(nil, T.nilable(Integer))
27
+ @reason = T.let(nil, T.nilable(String))
28
+ @status = T.let(nil, T.nilable(String))
29
+ @type = T.let(nil, T.nilable(String))
30
+ end
31
+
32
+ @has_one = T.let({}, T::Hash[Symbol, Class])
33
+ @has_many = T.let({}, T::Hash[Symbol, Class])
34
+ @paths = T.let([
35
+ {http_method: :get, operation: :get, ids: [], path: "shopify_payments/disputes.json"},
36
+ {http_method: :get, operation: :get, ids: [:id], path: "shopify_payments/disputes/<id>.json"}
37
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
38
+
39
+ sig { returns(T.nilable(String)) }
40
+ attr_reader :amount
41
+ sig { returns(T.nilable(String)) }
42
+ attr_reader :currency
43
+ sig { returns(T.nilable(String)) }
44
+ attr_reader :evidence_due_by
45
+ sig { returns(T.nilable(String)) }
46
+ attr_reader :evidence_sent_on
47
+ sig { returns(T.nilable(String)) }
48
+ attr_reader :finalized_on
49
+ sig { returns(T.nilable(Integer)) }
50
+ attr_reader :id
51
+ sig { returns(T.nilable(String)) }
52
+ attr_reader :network_reason_code
53
+ sig { returns(T.nilable(Integer)) }
54
+ attr_reader :order_id
55
+ sig { returns(T.nilable(String)) }
56
+ attr_reader :reason
57
+ sig { returns(T.nilable(String)) }
58
+ attr_reader :status
59
+ sig { returns(T.nilable(String)) }
60
+ attr_reader :type
61
+
62
+ class << self
63
+ sig do
64
+ params(
65
+ id: T.any(Integer, String),
66
+ session: Auth::Session
67
+ ).returns(T.nilable(Dispute))
68
+ end
69
+ def find(
70
+ id:,
71
+ session: ShopifyAPI::Context.active_session
72
+ )
73
+ result = base_find(
74
+ session: session,
75
+ ids: {id: id},
76
+ params: {},
77
+ )
78
+ T.cast(result[0], T.nilable(Dispute))
79
+ end
80
+
81
+ sig do
82
+ params(
83
+ since_id: T.untyped,
84
+ last_id: T.untyped,
85
+ status: T.untyped,
86
+ initiated_at: T.untyped,
87
+ session: Auth::Session,
88
+ kwargs: T.untyped
89
+ ).returns(T::Array[Dispute])
90
+ end
91
+ def all(
92
+ since_id: nil,
93
+ last_id: nil,
94
+ status: nil,
95
+ initiated_at: nil,
96
+ session: ShopifyAPI::Context.active_session,
97
+ **kwargs
98
+ )
99
+ response = base_find(
100
+ session: session,
101
+ ids: {},
102
+ params: {since_id: since_id, last_id: last_id, status: status, initiated_at: initiated_at}.merge(kwargs).compact,
103
+ )
104
+
105
+ T.cast(response, T::Array[Dispute])
106
+ end
107
+
108
+ end
109
+
110
+ end
111
+ end