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,97 @@
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 FulfillmentRequest < 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
+ @fulfillment_order_id = T.let(nil, T.nilable(Integer))
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: :post, operation: :accept, ids: [:fulfillment_order_id], path: "fulfillment_orders/<fulfillment_order_id>/fulfillment_request/accept.json"},
26
+ {http_method: :post, operation: :post, ids: [:fulfillment_order_id], path: "fulfillment_orders/<fulfillment_order_id>/fulfillment_request.json"},
27
+ {http_method: :post, operation: :reject, ids: [:fulfillment_order_id], path: "fulfillment_orders/<fulfillment_order_id>/fulfillment_request/reject.json"}
28
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
29
+
30
+ sig { returns(T.nilable(Integer)) }
31
+ attr_reader :fulfillment_order_id
32
+
33
+ class << self
34
+ sig do
35
+ returns(T::Array[String])
36
+ end
37
+ def json_response_body_names()
38
+ [
39
+ "submitted_fulfillment_order",
40
+ "fulfillment_order"
41
+ ]
42
+ end
43
+
44
+ end
45
+
46
+ sig do
47
+ params(
48
+ message: T.untyped,
49
+ body: T.untyped,
50
+ kwargs: T.untyped
51
+ ).returns(T.untyped)
52
+ end
53
+ def accept(
54
+ message: nil,
55
+ body: nil,
56
+ **kwargs
57
+ )
58
+ self.class.request(
59
+ http_method: :post,
60
+ operation: :accept,
61
+ session: @session,
62
+ ids: {fulfillment_order_id: @fulfillment_order_id},
63
+ params: {message: message}.merge(kwargs).compact,
64
+ body: body,
65
+ entity: self,
66
+ )
67
+ end
68
+
69
+ sig do
70
+ params(
71
+ message: T.untyped,
72
+ reason: T.untyped,
73
+ line_items: T.untyped,
74
+ body: T.untyped,
75
+ kwargs: T.untyped
76
+ ).returns(T.untyped)
77
+ end
78
+ def reject(
79
+ message: nil,
80
+ reason: nil,
81
+ line_items: nil,
82
+ body: nil,
83
+ **kwargs
84
+ )
85
+ self.class.request(
86
+ http_method: :post,
87
+ operation: :reject,
88
+ session: @session,
89
+ ids: {fulfillment_order_id: @fulfillment_order_id},
90
+ params: {message: message, reason: reason, line_items: line_items}.merge(kwargs).compact,
91
+ body: body,
92
+ entity: self,
93
+ )
94
+ end
95
+
96
+ end
97
+ end
@@ -0,0 +1,130 @@
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 FulfillmentService < 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
+ @admin_graphql_api_id = T.let(nil, T.nilable(String))
20
+ @callback_url = T.let(nil, T.nilable(String))
21
+ @fulfillment_orders_opt_in = T.let(nil, T.nilable(T::Boolean))
22
+ @handle = T.let(nil, T.nilable(String))
23
+ @id = T.let(nil, T.nilable(Integer))
24
+ @inventory_management = T.let(nil, T.nilable(T::Boolean))
25
+ @location_id = T.let(nil, T.nilable(Integer))
26
+ @name = T.let(nil, T.nilable(String))
27
+ @permits_sku_sharing = T.let(nil, T.nilable(T::Boolean))
28
+ @provider_id = T.let(nil, T.nilable(String))
29
+ @requires_shipping_method = T.let(nil, T.nilable(T::Boolean))
30
+ @tracking_support = T.let(nil, T.nilable(T::Boolean))
31
+ end
32
+
33
+ @has_one = T.let({}, T::Hash[Symbol, Class])
34
+ @has_many = T.let({}, T::Hash[Symbol, Class])
35
+ @paths = T.let([
36
+ {http_method: :delete, operation: :delete, ids: [:id], path: "fulfillment_services/<id>.json"},
37
+ {http_method: :get, operation: :get, ids: [], path: "fulfillment_services.json"},
38
+ {http_method: :get, operation: :get, ids: [:id], path: "fulfillment_services/<id>.json"},
39
+ {http_method: :post, operation: :post, ids: [], path: "fulfillment_services.json"},
40
+ {http_method: :put, operation: :put, ids: [:id], path: "fulfillment_services/<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 :admin_graphql_api_id
45
+ sig { returns(T.nilable(String)) }
46
+ attr_reader :callback_url
47
+ sig { returns(T.nilable(T::Boolean)) }
48
+ attr_reader :fulfillment_orders_opt_in
49
+ sig { returns(T.nilable(String)) }
50
+ attr_reader :handle
51
+ sig { returns(T.nilable(Integer)) }
52
+ attr_reader :id
53
+ sig { returns(T.nilable(T::Boolean)) }
54
+ attr_reader :inventory_management
55
+ sig { returns(T.nilable(Integer)) }
56
+ attr_reader :location_id
57
+ sig { returns(T.nilable(String)) }
58
+ attr_reader :name
59
+ sig { returns(T.nilable(T::Boolean)) }
60
+ attr_reader :permits_sku_sharing
61
+ sig { returns(T.nilable(String)) }
62
+ attr_reader :provider_id
63
+ sig { returns(T.nilable(T::Boolean)) }
64
+ attr_reader :requires_shipping_method
65
+ sig { returns(T.nilable(T::Boolean)) }
66
+ attr_reader :tracking_support
67
+
68
+ class << self
69
+ sig do
70
+ params(
71
+ id: T.any(Integer, String),
72
+ session: Auth::Session
73
+ ).returns(T.nilable(FulfillmentService))
74
+ end
75
+ def find(
76
+ id:,
77
+ session: ShopifyAPI::Context.active_session
78
+ )
79
+ result = base_find(
80
+ session: session,
81
+ ids: {id: id},
82
+ params: {},
83
+ )
84
+ T.cast(result[0], T.nilable(FulfillmentService))
85
+ end
86
+
87
+ sig do
88
+ params(
89
+ id: T.any(Integer, String),
90
+ session: Auth::Session
91
+ ).returns(T.untyped)
92
+ end
93
+ def delete(
94
+ id:,
95
+ session: ShopifyAPI::Context.active_session
96
+ )
97
+ request(
98
+ http_method: :delete,
99
+ operation: :delete,
100
+ session: session,
101
+ ids: {id: id},
102
+ params: {},
103
+ )
104
+ end
105
+
106
+ sig do
107
+ params(
108
+ scope: T.untyped,
109
+ session: Auth::Session,
110
+ kwargs: T.untyped
111
+ ).returns(T::Array[FulfillmentService])
112
+ end
113
+ def all(
114
+ scope: nil,
115
+ session: ShopifyAPI::Context.active_session,
116
+ **kwargs
117
+ )
118
+ response = base_find(
119
+ session: session,
120
+ ids: {},
121
+ params: {scope: scope}.merge(kwargs).compact,
122
+ )
123
+
124
+ T.cast(response, T::Array[FulfillmentService])
125
+ end
126
+
127
+ end
128
+
129
+ end
130
+ end
@@ -0,0 +1,218 @@
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 GiftCard < 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
+ @api_client_id = T.let(nil, T.nilable(Integer))
20
+ @balance = T.let(nil, T.nilable(Balance))
21
+ @code = T.let(nil, T.nilable(String))
22
+ @created_at = T.let(nil, T.nilable(String))
23
+ @currency = T.let(nil, T.nilable(Currency))
24
+ @customer_id = T.let(nil, T.nilable(Integer))
25
+ @disabled_at = T.let(nil, T.nilable(String))
26
+ @expires_on = T.let(nil, T.nilable(String))
27
+ @id = T.let(nil, T.nilable(Integer))
28
+ @initial_value = T.let(nil, T.nilable(String))
29
+ @last_characters = T.let(nil, T.nilable(String))
30
+ @line_item_id = T.let(nil, T.nilable(Integer))
31
+ @note = T.let(nil, T.nilable(String))
32
+ @order_id = T.let(nil, T.nilable(Integer))
33
+ @template_suffix = T.let(nil, T.nilable(String))
34
+ @updated_at = T.let(nil, T.nilable(String))
35
+ @user_id = T.let(nil, T.nilable(Integer))
36
+ end
37
+
38
+ @has_one = T.let({
39
+ balance: Balance,
40
+ currency: Currency
41
+ }, T::Hash[Symbol, Class])
42
+ @has_many = T.let({}, T::Hash[Symbol, Class])
43
+ @paths = T.let([
44
+ {http_method: :get, operation: :count, ids: [], path: "gift_cards/count.json"},
45
+ {http_method: :get, operation: :get, ids: [], path: "gift_cards.json"},
46
+ {http_method: :get, operation: :get, ids: [:id], path: "gift_cards/<id>.json"},
47
+ {http_method: :get, operation: :search, ids: [], path: "gift_cards/search.json"},
48
+ {http_method: :post, operation: :disable, ids: [:id], path: "gift_cards/<id>/disable.json"},
49
+ {http_method: :post, operation: :post, ids: [], path: "gift_cards.json"},
50
+ {http_method: :put, operation: :put, ids: [:id], path: "gift_cards/<id>.json"}
51
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
52
+
53
+ sig { returns(T.nilable(Integer)) }
54
+ attr_reader :api_client_id
55
+ sig { returns(T.nilable(Balance)) }
56
+ attr_reader :balance
57
+ sig { returns(T.nilable(String)) }
58
+ attr_reader :code
59
+ sig { returns(T.nilable(String)) }
60
+ attr_reader :created_at
61
+ sig { returns(T.nilable(Currency)) }
62
+ attr_reader :currency
63
+ sig { returns(T.nilable(Integer)) }
64
+ attr_reader :customer_id
65
+ sig { returns(T.nilable(String)) }
66
+ attr_reader :disabled_at
67
+ sig { returns(T.nilable(String)) }
68
+ attr_reader :expires_on
69
+ sig { returns(T.nilable(Integer)) }
70
+ attr_reader :id
71
+ sig { returns(T.nilable(String)) }
72
+ attr_reader :initial_value
73
+ sig { returns(T.nilable(String)) }
74
+ attr_reader :last_characters
75
+ sig { returns(T.nilable(Integer)) }
76
+ attr_reader :line_item_id
77
+ sig { returns(T.nilable(String)) }
78
+ attr_reader :note
79
+ sig { returns(T.nilable(Integer)) }
80
+ attr_reader :order_id
81
+ sig { returns(T.nilable(String)) }
82
+ attr_reader :template_suffix
83
+ sig { returns(T.nilable(String)) }
84
+ attr_reader :updated_at
85
+ sig { returns(T.nilable(Integer)) }
86
+ attr_reader :user_id
87
+
88
+ class << self
89
+ sig do
90
+ params(
91
+ id: T.any(Integer, String),
92
+ session: Auth::Session
93
+ ).returns(T.nilable(GiftCard))
94
+ end
95
+ def find(
96
+ id:,
97
+ session: ShopifyAPI::Context.active_session
98
+ )
99
+ result = base_find(
100
+ session: session,
101
+ ids: {id: id},
102
+ params: {},
103
+ )
104
+ T.cast(result[0], T.nilable(GiftCard))
105
+ end
106
+
107
+ sig do
108
+ params(
109
+ status: T.untyped,
110
+ limit: T.untyped,
111
+ since_id: T.untyped,
112
+ fields: T.untyped,
113
+ session: Auth::Session,
114
+ kwargs: T.untyped
115
+ ).returns(T::Array[GiftCard])
116
+ end
117
+ def all(
118
+ status: nil,
119
+ limit: nil,
120
+ since_id: nil,
121
+ fields: nil,
122
+ session: ShopifyAPI::Context.active_session,
123
+ **kwargs
124
+ )
125
+ response = base_find(
126
+ session: session,
127
+ ids: {},
128
+ params: {status: status, limit: limit, since_id: since_id, fields: fields}.merge(kwargs).compact,
129
+ )
130
+
131
+ T.cast(response, T::Array[GiftCard])
132
+ end
133
+
134
+ sig do
135
+ params(
136
+ status: T.untyped,
137
+ session: Auth::Session,
138
+ kwargs: T.untyped
139
+ ).returns(T.untyped)
140
+ end
141
+ def count(
142
+ status: nil,
143
+ session: ShopifyAPI::Context.active_session,
144
+ **kwargs
145
+ )
146
+ request(
147
+ http_method: :get,
148
+ operation: :count,
149
+ session: session,
150
+ ids: {},
151
+ params: {status: status}.merge(kwargs).compact,
152
+ body: {},
153
+ entity: nil,
154
+ )
155
+ end
156
+
157
+ sig do
158
+ params(
159
+ order: T.untyped,
160
+ query: T.untyped,
161
+ limit: T.untyped,
162
+ fields: T.untyped,
163
+ created_at_min: T.untyped,
164
+ created_at_max: T.untyped,
165
+ updated_at_min: T.untyped,
166
+ updated_at_max: T.untyped,
167
+ session: Auth::Session,
168
+ kwargs: T.untyped
169
+ ).returns(T.untyped)
170
+ end
171
+ def search(
172
+ order: nil,
173
+ query: nil,
174
+ limit: nil,
175
+ fields: nil,
176
+ created_at_min: nil,
177
+ created_at_max: nil,
178
+ updated_at_min: nil,
179
+ updated_at_max: nil,
180
+ session: ShopifyAPI::Context.active_session,
181
+ **kwargs
182
+ )
183
+ request(
184
+ http_method: :get,
185
+ operation: :search,
186
+ session: session,
187
+ ids: {},
188
+ params: {order: order, query: query, limit: limit, fields: fields, created_at_min: created_at_min, created_at_max: created_at_max, updated_at_min: updated_at_min, updated_at_max: updated_at_max}.merge(kwargs).compact,
189
+ body: {},
190
+ entity: nil,
191
+ )
192
+ end
193
+
194
+ end
195
+
196
+ sig do
197
+ params(
198
+ body: T.untyped,
199
+ kwargs: T.untyped
200
+ ).returns(T.untyped)
201
+ end
202
+ def disable(
203
+ body: nil,
204
+ **kwargs
205
+ )
206
+ self.class.request(
207
+ http_method: :post,
208
+ operation: :disable,
209
+ session: @session,
210
+ ids: {id: @id},
211
+ params: {}.merge(kwargs).compact,
212
+ body: body,
213
+ entity: self,
214
+ )
215
+ end
216
+
217
+ end
218
+ end
@@ -0,0 +1,118 @@
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 GiftCardAdjustment < 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(Float))
20
+ @api_client_id = T.let(nil, T.nilable(Integer))
21
+ @created_at = T.let(nil, T.nilable(String))
22
+ @gift_card_id = T.let(nil, T.nilable(Integer))
23
+ @id = T.let(nil, T.nilable(Integer))
24
+ @note = T.let(nil, T.nilable(String))
25
+ @number = T.let(nil, T.nilable(Integer))
26
+ @order_transaction_id = T.let(nil, T.nilable(Integer))
27
+ @processed_at = T.let(nil, T.nilable(String))
28
+ @remote_transaction_ref = T.let(nil, T.nilable(String))
29
+ @remote_transaction_url = T.let(nil, T.nilable(String))
30
+ @user_id = T.let(nil, T.nilable(Integer))
31
+ end
32
+
33
+ @has_one = T.let({}, T::Hash[Symbol, Class])
34
+ @has_many = T.let({}, T::Hash[Symbol, Class])
35
+ @paths = T.let([
36
+ {http_method: :get, operation: :get, ids: [:gift_card_id], path: "gift_cards/<gift_card_id>/adjustments.json"},
37
+ {http_method: :get, operation: :get, ids: [:gift_card_id, :id], path: "gift_cards/<gift_card_id>/adjustments/<id>.json"},
38
+ {http_method: :post, operation: :post, ids: [:gift_card_id], path: "gift_cards/<gift_card_id>/adjustments.json"}
39
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
40
+
41
+ sig { returns(T.nilable(Float)) }
42
+ attr_reader :amount
43
+ sig { returns(T.nilable(Integer)) }
44
+ attr_reader :api_client_id
45
+ sig { returns(T.nilable(String)) }
46
+ attr_reader :created_at
47
+ sig { returns(T.nilable(Integer)) }
48
+ attr_reader :gift_card_id
49
+ sig { returns(T.nilable(Integer)) }
50
+ attr_reader :id
51
+ sig { returns(T.nilable(String)) }
52
+ attr_reader :note
53
+ sig { returns(T.nilable(Integer)) }
54
+ attr_reader :number
55
+ sig { returns(T.nilable(Integer)) }
56
+ attr_reader :order_transaction_id
57
+ sig { returns(T.nilable(String)) }
58
+ attr_reader :processed_at
59
+ sig { returns(T.nilable(String)) }
60
+ attr_reader :remote_transaction_ref
61
+ sig { returns(T.nilable(String)) }
62
+ attr_reader :remote_transaction_url
63
+ sig { returns(T.nilable(Integer)) }
64
+ attr_reader :user_id
65
+
66
+ class << self
67
+ sig do
68
+ returns(String)
69
+ end
70
+ def json_body_name()
71
+ "adjustment"
72
+ end
73
+
74
+ sig do
75
+ params(
76
+ id: T.any(Integer, String),
77
+ gift_card_id: T.nilable(T.any(Integer, String)),
78
+ session: Auth::Session
79
+ ).returns(T.nilable(GiftCardAdjustment))
80
+ end
81
+ def find(
82
+ id:,
83
+ gift_card_id: nil,
84
+ session: ShopifyAPI::Context.active_session
85
+ )
86
+ result = base_find(
87
+ session: session,
88
+ ids: {id: id, gift_card_id: gift_card_id},
89
+ params: {},
90
+ )
91
+ T.cast(result[0], T.nilable(GiftCardAdjustment))
92
+ end
93
+
94
+ sig do
95
+ params(
96
+ gift_card_id: T.nilable(T.any(Integer, String)),
97
+ session: Auth::Session,
98
+ kwargs: T.untyped
99
+ ).returns(T::Array[GiftCardAdjustment])
100
+ end
101
+ def all(
102
+ gift_card_id: nil,
103
+ session: ShopifyAPI::Context.active_session,
104
+ **kwargs
105
+ )
106
+ response = base_find(
107
+ session: session,
108
+ ids: {gift_card_id: gift_card_id},
109
+ params: {}.merge(kwargs).compact,
110
+ )
111
+
112
+ T.cast(response, T::Array[GiftCardAdjustment])
113
+ end
114
+
115
+ end
116
+
117
+ end
118
+ end