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