shopify_api 14.3.0 → 14.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/BREAKING_CHANGES_FOR_V15.md +42 -0
  3. data/CHANGELOG.md +12 -0
  4. data/Gemfile.lock +2 -2
  5. data/README.md +3 -0
  6. data/docs/usage/oauth.md +88 -16
  7. data/lib/shopify_api/admin_versions.rb +2 -1
  8. data/lib/shopify_api/clients/graphql/client.rb +3 -2
  9. data/lib/shopify_api/clients/graphql/storefront.rb +4 -2
  10. data/lib/shopify_api/rest/resources/2022_04/shop.rb +2 -2
  11. data/lib/shopify_api/rest/resources/2022_07/shop.rb +2 -2
  12. data/lib/shopify_api/rest/resources/2022_10/shop.rb +2 -2
  13. data/lib/shopify_api/rest/resources/2023_01/shop.rb +2 -2
  14. data/lib/shopify_api/rest/resources/2023_04/shop.rb +2 -2
  15. data/lib/shopify_api/rest/resources/2023_07/shop.rb +2 -2
  16. data/lib/shopify_api/rest/resources/2023_10/shop.rb +2 -2
  17. data/lib/shopify_api/rest/resources/2024_01/shop.rb +2 -2
  18. data/lib/shopify_api/rest/resources/2024_04/shop.rb +2 -2
  19. data/lib/shopify_api/rest/resources/2024_07/abandoned_checkout.rb +194 -0
  20. data/lib/shopify_api/rest/resources/2024_07/access_scope.rb +62 -0
  21. data/lib/shopify_api/rest/resources/2024_07/apple_pay_certificate.rb +109 -0
  22. data/lib/shopify_api/rest/resources/2024_07/application_charge.rb +113 -0
  23. data/lib/shopify_api/rest/resources/2024_07/application_credit.rb +95 -0
  24. data/lib/shopify_api/rest/resources/2024_07/article.rb +269 -0
  25. data/lib/shopify_api/rest/resources/2024_07/asset.rb +122 -0
  26. data/lib/shopify_api/rest/resources/2024_07/assigned_fulfillment_order.rb +92 -0
  27. data/lib/shopify_api/rest/resources/2024_07/balance.rb +58 -0
  28. data/lib/shopify_api/rest/resources/2024_07/blog.rb +166 -0
  29. data/lib/shopify_api/rest/resources/2024_07/cancellation_request.rb +87 -0
  30. data/lib/shopify_api/rest/resources/2024_07/carrier_service.rb +120 -0
  31. data/lib/shopify_api/rest/resources/2024_07/checkout.rb +213 -0
  32. data/lib/shopify_api/rest/resources/2024_07/collect.rb +146 -0
  33. data/lib/shopify_api/rest/resources/2024_07/collection.rb +114 -0
  34. data/lib/shopify_api/rest/resources/2024_07/collection_listing.rb +159 -0
  35. data/lib/shopify_api/rest/resources/2024_07/comment.rb +287 -0
  36. data/lib/shopify_api/rest/resources/2024_07/country.rb +141 -0
  37. data/lib/shopify_api/rest/resources/2024_07/currency.rb +61 -0
  38. data/lib/shopify_api/rest/resources/2024_07/custom_collection.rb +191 -0
  39. data/lib/shopify_api/rest/resources/2024_07/customer.rb +333 -0
  40. data/lib/shopify_api/rest/resources/2024_07/customer_address.rb +215 -0
  41. data/lib/shopify_api/rest/resources/2024_07/deprecated_api_call.rb +61 -0
  42. data/lib/shopify_api/rest/resources/2024_07/discount_code.rb +226 -0
  43. data/lib/shopify_api/rest/resources/2024_07/dispute.rb +115 -0
  44. data/lib/shopify_api/rest/resources/2024_07/dispute_evidence.rb +121 -0
  45. data/lib/shopify_api/rest/resources/2024_07/dispute_file_upload.rb +85 -0
  46. data/lib/shopify_api/rest/resources/2024_07/draft_order.rb +279 -0
  47. data/lib/shopify_api/rest/resources/2024_07/event.rb +152 -0
  48. data/lib/shopify_api/rest/resources/2024_07/fulfillment.rb +235 -0
  49. data/lib/shopify_api/rest/resources/2024_07/fulfillment_event.rb +167 -0
  50. data/lib/shopify_api/rest/resources/2024_07/fulfillment_order.rb +326 -0
  51. data/lib/shopify_api/rest/resources/2024_07/fulfillment_request.rb +101 -0
  52. data/lib/shopify_api/rest/resources/2024_07/fulfillment_service.rb +134 -0
  53. data/lib/shopify_api/rest/resources/2024_07/gift_card.rb +222 -0
  54. data/lib/shopify_api/rest/resources/2024_07/gift_card_adjustment.rb +122 -0
  55. data/lib/shopify_api/rest/resources/2024_07/image.rb +161 -0
  56. data/lib/shopify_api/rest/resources/2024_07/inventory_item.rb +112 -0
  57. data/lib/shopify_api/rest/resources/2024_07/inventory_level.rb +183 -0
  58. data/lib/shopify_api/rest/resources/2024_07/location.rb +171 -0
  59. data/lib/shopify_api/rest/resources/2024_07/locations_for_move.rb +60 -0
  60. data/lib/shopify_api/rest/resources/2024_07/marketing_event.rb +213 -0
  61. data/lib/shopify_api/rest/resources/2024_07/metafield.rb +348 -0
  62. data/lib/shopify_api/rest/resources/2024_07/mobile_platform_application.rb +114 -0
  63. data/lib/shopify_api/rest/resources/2024_07/order.rb +489 -0
  64. data/lib/shopify_api/rest/resources/2024_07/order_risk.rb +148 -0
  65. data/lib/shopify_api/rest/resources/2024_07/page.rb +198 -0
  66. data/lib/shopify_api/rest/resources/2024_07/payment.rb +144 -0
  67. data/lib/shopify_api/rest/resources/2024_07/payment_gateway.rb +147 -0
  68. data/lib/shopify_api/rest/resources/2024_07/payment_transaction.rb +114 -0
  69. data/lib/shopify_api/rest/resources/2024_07/payout.rb +101 -0
  70. data/lib/shopify_api/rest/resources/2024_07/policy.rb +73 -0
  71. data/lib/shopify_api/rest/resources/2024_07/price_rule.rb +227 -0
  72. data/lib/shopify_api/rest/resources/2024_07/product.rb +227 -0
  73. data/lib/shopify_api/rest/resources/2024_07/product_listing.rb +200 -0
  74. data/lib/shopify_api/rest/resources/2024_07/product_resource_feedback.rb +92 -0
  75. data/lib/shopify_api/rest/resources/2024_07/province.rb +136 -0
  76. data/lib/shopify_api/rest/resources/2024_07/recurring_application_charge.rb +176 -0
  77. data/lib/shopify_api/rest/resources/2024_07/redirect.rb +143 -0
  78. data/lib/shopify_api/rest/resources/2024_07/refund.rb +155 -0
  79. data/lib/shopify_api/rest/resources/2024_07/resource_feedback.rb +77 -0
  80. data/lib/shopify_api/rest/resources/2024_07/script_tag.rb +159 -0
  81. data/lib/shopify_api/rest/resources/2024_07/shipping_zone.rb +87 -0
  82. data/lib/shopify_api/rest/resources/2024_07/shop.rb +222 -0
  83. data/lib/shopify_api/rest/resources/2024_07/smart_collection.rb +220 -0
  84. data/lib/shopify_api/rest/resources/2024_07/storefront_access_token.rb +91 -0
  85. data/lib/shopify_api/rest/resources/2024_07/tender_transaction.rb +97 -0
  86. data/lib/shopify_api/rest/resources/2024_07/theme.rb +127 -0
  87. data/lib/shopify_api/rest/resources/2024_07/transaction.rb +188 -0
  88. data/lib/shopify_api/rest/resources/2024_07/usage_charge.rb +106 -0
  89. data/lib/shopify_api/rest/resources/2024_07/user.rb +142 -0
  90. data/lib/shopify_api/rest/resources/2024_07/variant.rb +212 -0
  91. data/lib/shopify_api/rest/resources/2024_07/webhook.rb +172 -0
  92. data/lib/shopify_api/version.rb +1 -1
  93. data/lib/shopify_api/webhooks/registry.rb +5 -4
  94. metadata +80 -6
@@ -0,0 +1,183 @@
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 InventoryLevel < 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
+ @api_call_limit = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
16
+ @retry_request_after = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
17
+
18
+ sig { params(session: T.nilable(ShopifyAPI::Auth::Session), from_hash: T.nilable(T::Hash[T.untyped, T.untyped])).void }
19
+ def initialize(session: ShopifyAPI::Context.active_session, from_hash: nil)
20
+
21
+ @available = T.let(nil, T.nilable(Integer))
22
+ @inventory_item_id = T.let(nil, T.nilable(Integer))
23
+ @location_id = T.let(nil, T.nilable(Integer))
24
+ @updated_at = T.let(nil, T.nilable(String))
25
+
26
+ super(session: session, from_hash: from_hash)
27
+ end
28
+
29
+ @has_one = T.let({}, T::Hash[Symbol, Class])
30
+ @has_many = T.let({}, T::Hash[Symbol, Class])
31
+ @paths = T.let([
32
+ {http_method: :delete, operation: :delete, ids: [], path: "inventory_levels.json"},
33
+ {http_method: :get, operation: :get, ids: [], path: "inventory_levels.json"},
34
+ {http_method: :post, operation: :adjust, ids: [], path: "inventory_levels/adjust.json"},
35
+ {http_method: :post, operation: :connect, ids: [], path: "inventory_levels/connect.json"},
36
+ {http_method: :post, operation: :set, ids: [], path: "inventory_levels/set.json"}
37
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
38
+
39
+ sig { returns(T.nilable(Integer)) }
40
+ attr_reader :available
41
+ sig { returns(T.nilable(Integer)) }
42
+ attr_reader :inventory_item_id
43
+ sig { returns(T.nilable(Integer)) }
44
+ attr_reader :location_id
45
+ sig { returns(T.nilable(String)) }
46
+ attr_reader :updated_at
47
+
48
+ class << self
49
+ sig do
50
+ params(
51
+ inventory_item_id: T.untyped,
52
+ location_id: T.untyped,
53
+ session: Auth::Session
54
+ ).returns(T.untyped)
55
+ end
56
+ def delete(
57
+ inventory_item_id: nil,
58
+ location_id: nil,
59
+ session: ShopifyAPI::Context.active_session
60
+ )
61
+ request(
62
+ http_method: :delete,
63
+ operation: :delete,
64
+ session: session,
65
+ ids: {},
66
+ params: {inventory_item_id: inventory_item_id, location_id: location_id},
67
+ )
68
+ end
69
+
70
+ sig do
71
+ params(
72
+ inventory_item_ids: T.untyped,
73
+ location_ids: T.untyped,
74
+ limit: T.untyped,
75
+ updated_at_min: T.untyped,
76
+ session: Auth::Session,
77
+ kwargs: T.untyped
78
+ ).returns(T::Array[InventoryLevel])
79
+ end
80
+ def all(
81
+ inventory_item_ids: nil,
82
+ location_ids: nil,
83
+ limit: nil,
84
+ updated_at_min: nil,
85
+ session: ShopifyAPI::Context.active_session,
86
+ **kwargs
87
+ )
88
+ response = base_find(
89
+ session: session,
90
+ ids: {},
91
+ params: {inventory_item_ids: inventory_item_ids, location_ids: location_ids, limit: limit, updated_at_min: updated_at_min}.merge(kwargs).compact,
92
+ )
93
+
94
+ T.cast(response, T::Array[InventoryLevel])
95
+ end
96
+
97
+ end
98
+
99
+ sig do
100
+ params(
101
+ inventory_item_id: T.untyped,
102
+ location_id: T.untyped,
103
+ available_adjustment: T.untyped,
104
+ body: T.untyped,
105
+ kwargs: T.untyped
106
+ ).returns(T.untyped)
107
+ end
108
+ def adjust(
109
+ inventory_item_id: nil,
110
+ location_id: nil,
111
+ available_adjustment: nil,
112
+ body: nil,
113
+ **kwargs
114
+ )
115
+ self.class.request(
116
+ http_method: :post,
117
+ operation: :adjust,
118
+ session: @session,
119
+ ids: {},
120
+ params: {inventory_item_id: inventory_item_id, location_id: location_id, available_adjustment: available_adjustment}.merge(kwargs).compact,
121
+ body: body,
122
+ entity: self,
123
+ )
124
+ end
125
+
126
+ sig do
127
+ params(
128
+ inventory_item_id: T.untyped,
129
+ location_id: T.untyped,
130
+ relocate_if_necessary: T.untyped,
131
+ body: T.untyped,
132
+ kwargs: T.untyped
133
+ ).returns(T.untyped)
134
+ end
135
+ def connect(
136
+ inventory_item_id: nil,
137
+ location_id: nil,
138
+ relocate_if_necessary: nil,
139
+ body: nil,
140
+ **kwargs
141
+ )
142
+ self.class.request(
143
+ http_method: :post,
144
+ operation: :connect,
145
+ session: @session,
146
+ ids: {},
147
+ params: {inventory_item_id: inventory_item_id, location_id: location_id, relocate_if_necessary: relocate_if_necessary}.merge(kwargs).compact,
148
+ body: body,
149
+ entity: self,
150
+ )
151
+ end
152
+
153
+ sig do
154
+ params(
155
+ inventory_item_id: T.untyped,
156
+ location_id: T.untyped,
157
+ available: T.untyped,
158
+ disconnect_if_necessary: T.untyped,
159
+ body: T.untyped,
160
+ kwargs: T.untyped
161
+ ).returns(T.untyped)
162
+ end
163
+ def set(
164
+ inventory_item_id: nil,
165
+ location_id: nil,
166
+ available: nil,
167
+ disconnect_if_necessary: nil,
168
+ body: nil,
169
+ **kwargs
170
+ )
171
+ self.class.request(
172
+ http_method: :post,
173
+ operation: :set,
174
+ session: @session,
175
+ ids: {},
176
+ params: {inventory_item_id: inventory_item_id, location_id: location_id, available: available, disconnect_if_necessary: disconnect_if_necessary}.merge(kwargs).compact,
177
+ body: body,
178
+ entity: self,
179
+ )
180
+ end
181
+
182
+ end
183
+ end
@@ -0,0 +1,171 @@
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 Location < 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
+ @api_call_limit = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
16
+ @retry_request_after = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
17
+
18
+ sig { params(session: T.nilable(ShopifyAPI::Auth::Session), from_hash: T.nilable(T::Hash[T.untyped, T.untyped])).void }
19
+ def initialize(session: ShopifyAPI::Context.active_session, from_hash: nil)
20
+
21
+ @active = T.let(nil, T.nilable(T::Boolean))
22
+ @address1 = T.let(nil, T.nilable(String))
23
+ @address2 = T.let(nil, T.nilable(String))
24
+ @city = T.let(nil, T.nilable(String))
25
+ @country = T.let(nil, T.nilable(String))
26
+ @country_code = T.let(nil, T.nilable(String))
27
+ @created_at = T.let(nil, T.nilable(String))
28
+ @id = T.let(nil, T.nilable(Integer))
29
+ @legacy = T.let(nil, T.nilable(T::Boolean))
30
+ @localized_country_name = T.let(nil, T.nilable(String))
31
+ @localized_province_name = T.let(nil, T.nilable(String))
32
+ @name = T.let(nil, T.nilable(String))
33
+ @phone = T.let(nil, T.nilable(String))
34
+ @province = T.let(nil, T.nilable(String))
35
+ @province_code = T.let(nil, T.nilable(String))
36
+ @updated_at = T.let(nil, T.nilable(String))
37
+ @zip = T.let(nil, T.nilable(String))
38
+
39
+ super(session: session, from_hash: from_hash)
40
+ end
41
+
42
+ @has_one = T.let({}, T::Hash[Symbol, Class])
43
+ @has_many = T.let({}, T::Hash[Symbol, Class])
44
+ @paths = T.let([
45
+ {http_method: :get, operation: :count, ids: [], path: "locations/count.json"},
46
+ {http_method: :get, operation: :get, ids: [], path: "locations.json"},
47
+ {http_method: :get, operation: :get, ids: [:id], path: "locations/<id>.json"},
48
+ {http_method: :get, operation: :inventory_levels, ids: [:id], path: "locations/<id>/inventory_levels.json"}
49
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
50
+
51
+ sig { returns(T.nilable(T::Boolean)) }
52
+ attr_reader :active
53
+ sig { returns(T.nilable(String)) }
54
+ attr_reader :address1
55
+ sig { returns(T.nilable(String)) }
56
+ attr_reader :address2
57
+ sig { returns(T.nilable(String)) }
58
+ attr_reader :city
59
+ sig { returns(T.nilable(String)) }
60
+ attr_reader :country
61
+ sig { returns(T.nilable(String)) }
62
+ attr_reader :country_code
63
+ sig { returns(T.nilable(String)) }
64
+ attr_reader :created_at
65
+ sig { returns(T.nilable(Integer)) }
66
+ attr_reader :id
67
+ sig { returns(T.nilable(T::Boolean)) }
68
+ attr_reader :legacy
69
+ sig { returns(T.nilable(String)) }
70
+ attr_reader :localized_country_name
71
+ sig { returns(T.nilable(String)) }
72
+ attr_reader :localized_province_name
73
+ sig { returns(T.nilable(String)) }
74
+ attr_reader :name
75
+ sig { returns(T.nilable(String)) }
76
+ attr_reader :phone
77
+ sig { returns(T.nilable(String)) }
78
+ attr_reader :province
79
+ sig { returns(T.nilable(String)) }
80
+ attr_reader :province_code
81
+ sig { returns(T.nilable(String)) }
82
+ attr_reader :updated_at
83
+ sig { returns(T.nilable(String)) }
84
+ attr_reader :zip
85
+
86
+ class << self
87
+ sig do
88
+ params(
89
+ id: T.any(Integer, String),
90
+ session: Auth::Session
91
+ ).returns(T.nilable(Location))
92
+ end
93
+ def find(
94
+ id:,
95
+ session: ShopifyAPI::Context.active_session
96
+ )
97
+ result = base_find(
98
+ session: session,
99
+ ids: {id: id},
100
+ params: {},
101
+ )
102
+ T.cast(result[0], T.nilable(Location))
103
+ end
104
+
105
+ sig do
106
+ params(
107
+ session: Auth::Session,
108
+ kwargs: T.untyped
109
+ ).returns(T::Array[Location])
110
+ end
111
+ def all(
112
+ session: ShopifyAPI::Context.active_session,
113
+ **kwargs
114
+ )
115
+ response = base_find(
116
+ session: session,
117
+ ids: {},
118
+ params: {}.merge(kwargs).compact,
119
+ )
120
+
121
+ T.cast(response, T::Array[Location])
122
+ end
123
+
124
+ sig do
125
+ params(
126
+ session: Auth::Session,
127
+ kwargs: T.untyped
128
+ ).returns(T.untyped)
129
+ end
130
+ def count(
131
+ session: ShopifyAPI::Context.active_session,
132
+ **kwargs
133
+ )
134
+ request(
135
+ http_method: :get,
136
+ operation: :count,
137
+ session: session,
138
+ ids: {},
139
+ params: {}.merge(kwargs).compact,
140
+ body: {},
141
+ entity: nil,
142
+ )
143
+ end
144
+
145
+ sig do
146
+ params(
147
+ id: T.any(Integer, String),
148
+ session: Auth::Session,
149
+ kwargs: T.untyped
150
+ ).returns(T.untyped)
151
+ end
152
+ def inventory_levels(
153
+ id:,
154
+ session: ShopifyAPI::Context.active_session,
155
+ **kwargs
156
+ )
157
+ request(
158
+ http_method: :get,
159
+ operation: :inventory_levels,
160
+ session: session,
161
+ ids: {id: id},
162
+ params: {}.merge(kwargs).compact,
163
+ body: {},
164
+ entity: nil,
165
+ )
166
+ end
167
+
168
+ end
169
+
170
+ end
171
+ end
@@ -0,0 +1,60 @@
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 LocationsForMove < 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
+ @api_call_limit = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
16
+ @retry_request_after = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
17
+
18
+ sig { params(session: T.nilable(ShopifyAPI::Auth::Session), from_hash: T.nilable(T::Hash[T.untyped, T.untyped])).void }
19
+ def initialize(session: ShopifyAPI::Context.active_session, from_hash: nil)
20
+
21
+ @locations_for_move = T.let(nil, T.nilable(T::Array[T.untyped]))
22
+
23
+ super(session: session, from_hash: from_hash)
24
+ end
25
+
26
+ @has_one = T.let({}, T::Hash[Symbol, Class])
27
+ @has_many = T.let({}, T::Hash[Symbol, Class])
28
+ @paths = T.let([
29
+ {http_method: :get, operation: :get, ids: [:fulfillment_order_id], path: "fulfillment_orders/<fulfillment_order_id>/locations_for_move.json"}
30
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
31
+
32
+ sig { returns(T.nilable(T::Array[T::Hash[T.untyped, T.untyped]])) }
33
+ attr_reader :locations_for_move
34
+
35
+ class << self
36
+ sig do
37
+ params(
38
+ fulfillment_order_id: T.nilable(T.any(Integer, String)),
39
+ session: Auth::Session,
40
+ kwargs: T.untyped
41
+ ).returns(T::Array[LocationsForMove])
42
+ end
43
+ def all(
44
+ fulfillment_order_id: nil,
45
+ session: ShopifyAPI::Context.active_session,
46
+ **kwargs
47
+ )
48
+ response = base_find(
49
+ session: session,
50
+ ids: {fulfillment_order_id: fulfillment_order_id},
51
+ params: {}.merge(kwargs).compact,
52
+ )
53
+
54
+ T.cast(response, T::Array[LocationsForMove])
55
+ end
56
+
57
+ end
58
+
59
+ end
60
+ end
@@ -0,0 +1,213 @@
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 MarketingEvent < 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
+ @api_call_limit = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
16
+ @retry_request_after = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
17
+
18
+ sig { params(session: T.nilable(ShopifyAPI::Auth::Session), from_hash: T.nilable(T::Hash[T.untyped, T.untyped])).void }
19
+ def initialize(session: ShopifyAPI::Context.active_session, from_hash: nil)
20
+
21
+ @event_type = T.let(nil, T.nilable(String))
22
+ @marketing_channel = T.let(nil, T.nilable(String))
23
+ @paid = T.let(nil, T.nilable(T::Boolean))
24
+ @started_at = T.let(nil, T.nilable(String))
25
+ @UTM_parameters = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
26
+ @budget = T.let(nil, T.nilable(String))
27
+ @budget_type = T.let(nil, T.nilable(String))
28
+ @currency = T.let(nil, T.nilable(String))
29
+ @description = T.let(nil, T.nilable(String))
30
+ @ended_at = T.let(nil, T.nilable(String))
31
+ @id = T.let(nil, T.nilable(Integer))
32
+ @manage_url = T.let(nil, T.nilable(String))
33
+ @marketed_resources = T.let(nil, T.nilable(T::Array[T.untyped]))
34
+ @preview_url = T.let(nil, T.nilable(String))
35
+ @referring_domain = T.let(nil, T.nilable(String))
36
+ @remote_id = T.let(nil, T.nilable(String))
37
+ @scheduled_to_end_at = T.let(nil, T.nilable(String))
38
+
39
+ super(session: session, from_hash: from_hash)
40
+ end
41
+
42
+ @has_one = T.let({}, T::Hash[Symbol, Class])
43
+ @has_many = T.let({}, T::Hash[Symbol, Class])
44
+ @paths = T.let([
45
+ {http_method: :delete, operation: :delete, ids: [:id], path: "marketing_events/<id>.json"},
46
+ {http_method: :get, operation: :count, ids: [], path: "marketing_events/count.json"},
47
+ {http_method: :get, operation: :get, ids: [], path: "marketing_events.json"},
48
+ {http_method: :get, operation: :get, ids: [:id], path: "marketing_events/<id>.json"},
49
+ {http_method: :post, operation: :engagements, ids: [:id], path: "marketing_events/<id>/engagements.json"},
50
+ {http_method: :post, operation: :post, ids: [], path: "marketing_events.json"},
51
+ {http_method: :put, operation: :put, ids: [:id], path: "marketing_events/<id>.json"}
52
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
53
+
54
+ sig { returns(T.nilable(String)) }
55
+ attr_reader :event_type
56
+ sig { returns(T.nilable(String)) }
57
+ attr_reader :marketing_channel
58
+ sig { returns(T.nilable(T::Boolean)) }
59
+ attr_reader :paid
60
+ sig { returns(T.nilable(String)) }
61
+ attr_reader :started_at
62
+ sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
63
+ attr_reader :UTM_parameters
64
+ sig { returns(T.nilable(String)) }
65
+ attr_reader :budget
66
+ sig { returns(T.nilable(String)) }
67
+ attr_reader :budget_type
68
+ sig { returns(T.nilable(String)) }
69
+ attr_reader :currency
70
+ sig { returns(T.nilable(String)) }
71
+ attr_reader :description
72
+ sig { returns(T.nilable(String)) }
73
+ attr_reader :ended_at
74
+ sig { returns(T.nilable(Integer)) }
75
+ attr_reader :id
76
+ sig { returns(T.nilable(String)) }
77
+ attr_reader :manage_url
78
+ sig { returns(T.nilable(T::Array[T::Hash[T.untyped, T.untyped]])) }
79
+ attr_reader :marketed_resources
80
+ sig { returns(T.nilable(String)) }
81
+ attr_reader :preview_url
82
+ sig { returns(T.nilable(String)) }
83
+ attr_reader :referring_domain
84
+ sig { returns(T.nilable(String)) }
85
+ attr_reader :remote_id
86
+ sig { returns(T.nilable(String)) }
87
+ attr_reader :scheduled_to_end_at
88
+
89
+ class << self
90
+ sig do
91
+ params(
92
+ id: T.any(Integer, String),
93
+ session: Auth::Session
94
+ ).returns(T.nilable(MarketingEvent))
95
+ end
96
+ def find(
97
+ id:,
98
+ session: ShopifyAPI::Context.active_session
99
+ )
100
+ result = base_find(
101
+ session: session,
102
+ ids: {id: id},
103
+ params: {},
104
+ )
105
+ T.cast(result[0], T.nilable(MarketingEvent))
106
+ end
107
+
108
+ sig do
109
+ params(
110
+ id: T.any(Integer, String),
111
+ session: Auth::Session
112
+ ).returns(T.untyped)
113
+ end
114
+ def delete(
115
+ id:,
116
+ session: ShopifyAPI::Context.active_session
117
+ )
118
+ request(
119
+ http_method: :delete,
120
+ operation: :delete,
121
+ session: session,
122
+ ids: {id: id},
123
+ params: {},
124
+ )
125
+ end
126
+
127
+ sig do
128
+ params(
129
+ limit: T.untyped,
130
+ offset: T.untyped,
131
+ session: Auth::Session,
132
+ kwargs: T.untyped
133
+ ).returns(T::Array[MarketingEvent])
134
+ end
135
+ def all(
136
+ limit: nil,
137
+ offset: nil,
138
+ session: ShopifyAPI::Context.active_session,
139
+ **kwargs
140
+ )
141
+ response = base_find(
142
+ session: session,
143
+ ids: {},
144
+ params: {limit: limit, offset: offset}.merge(kwargs).compact,
145
+ )
146
+
147
+ T.cast(response, T::Array[MarketingEvent])
148
+ end
149
+
150
+ sig do
151
+ params(
152
+ session: Auth::Session,
153
+ kwargs: T.untyped
154
+ ).returns(T.untyped)
155
+ end
156
+ def count(
157
+ session: ShopifyAPI::Context.active_session,
158
+ **kwargs
159
+ )
160
+ request(
161
+ http_method: :get,
162
+ operation: :count,
163
+ session: session,
164
+ ids: {},
165
+ params: {}.merge(kwargs).compact,
166
+ body: {},
167
+ entity: nil,
168
+ )
169
+ end
170
+
171
+ end
172
+
173
+ sig do
174
+ params(
175
+ occurred_on: T.untyped,
176
+ impressions_count: T.untyped,
177
+ views_count: T.untyped,
178
+ clicks_count: T.untyped,
179
+ shares_count: T.untyped,
180
+ favorites_count: T.untyped,
181
+ comments_count: T.untyped,
182
+ ad_spend: T.untyped,
183
+ is_cumulative: T.untyped,
184
+ body: T.untyped,
185
+ kwargs: T.untyped
186
+ ).returns(T.untyped)
187
+ end
188
+ def engagements(
189
+ occurred_on: nil,
190
+ impressions_count: nil,
191
+ views_count: nil,
192
+ clicks_count: nil,
193
+ shares_count: nil,
194
+ favorites_count: nil,
195
+ comments_count: nil,
196
+ ad_spend: nil,
197
+ is_cumulative: nil,
198
+ body: nil,
199
+ **kwargs
200
+ )
201
+ self.class.request(
202
+ http_method: :post,
203
+ operation: :engagements,
204
+ session: @session,
205
+ ids: {id: @id},
206
+ params: {occurred_on: occurred_on, impressions_count: impressions_count, views_count: views_count, clicks_count: clicks_count, shares_count: shares_count, favorites_count: favorites_count, comments_count: comments_count, ad_spend: ad_spend, is_cumulative: is_cumulative}.merge(kwargs).compact,
207
+ body: body,
208
+ entity: self,
209
+ )
210
+ end
211
+
212
+ end
213
+ end