Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update api version #1027

Merged
merged 2 commits into from
Oct 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions lib/shopify_api/admin_versions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ module ShopifyAPI
module AdminVersions
SUPPORTED_ADMIN_VERSIONS = T.let([
"unstable",
"2022-10",
"2022-07",
"2022-04",
"2022-01",
"2021-10",
], T::Array[String])

LATEST_SUPPORTED_ADMIN_VERSION = T.let("2022-07", String)
LATEST_SUPPORTED_ADMIN_VERSION = T.let("2022-10", String)
end

SUPPORTED_ADMIN_VERSIONS = ShopifyAPI::AdminVersions::SUPPORTED_ADMIN_VERSIONS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def initialize(session: ShopifyAPI::Context.active_session)
discount_codes: DiscountCode
}, T::Hash[Symbol, Class])
@paths = T.let([
{http_method: :get, operation: :checkouts, ids: [], path: "checkouts.json"},
{http_method: :get, operation: :checkouts, ids: [], path: "checkouts.json"}
], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])

Expand Down Expand Up @@ -150,25 +151,25 @@ def initialize(session: ShopifyAPI::Context.active_session)
class << self
sig do
params(
limit: T.untyped,
since_id: T.untyped,
created_at_min: T.untyped,
created_at_max: T.untyped,
updated_at_min: T.untyped,
updated_at_max: T.untyped,
status: T.untyped,
limit: T.untyped,
session: Auth::Session,
kwargs: T.untyped
).returns(T.untyped)
end
def checkouts(
limit: nil,
since_id: nil,
created_at_min: nil,
created_at_max: nil,
updated_at_min: nil,
updated_at_max: nil,
status: nil,
limit: nil,
session: ShopifyAPI::Context.active_session,
**kwargs
)
Expand All @@ -177,7 +178,7 @@ def checkouts(
operation: :checkouts,
session: session,
ids: {},
params: {limit: limit, since_id: since_id, created_at_min: created_at_min, created_at_max: created_at_max, updated_at_min: updated_at_min, updated_at_max: updated_at_max, status: status}.merge(kwargs).compact,
params: {since_id: since_id, created_at_min: created_at_min, created_at_max: created_at_max, updated_at_min: updated_at_min, updated_at_max: updated_at_max, status: status, limit: limit}.merge(kwargs).compact,
body: {},
entity: nil,
)
Expand Down
26 changes: 26 additions & 0 deletions lib/shopify_api/rest/resources/2022_01/customer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def initialize(session: ShopifyAPI::Context.active_session)
@multipass_identifier = T.let(nil, T.nilable(String))
@note = T.let(nil, T.nilable(String))
@orders_count = T.let(nil, T.nilable(Integer))
@password = T.let(nil, T.nilable(String))
@password_confirmation = T.let(nil, T.nilable(String))
@phone = T.let(nil, T.nilable(String))
@sms_marketing_consent = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
@state = T.let(nil, T.nilable(String))
Expand All @@ -49,6 +51,7 @@ def initialize(session: ShopifyAPI::Context.active_session)
}, T::Hash[Symbol, Class])
@has_many = T.let({}, T::Hash[Symbol, Class])
@paths = T.let([
{http_method: :delete, operation: :delete, ids: [:id], path: "customers/<id>.json"},
{http_method: :get, operation: :count, ids: [], path: "customers/count.json"},
{http_method: :get, operation: :get, ids: [], path: "customers.json"},
{http_method: :get, operation: :get, ids: [:id], path: "customers/<id>.json"},
Expand Down Expand Up @@ -95,6 +98,10 @@ def initialize(session: ShopifyAPI::Context.active_session)
sig { returns(T.nilable(Integer)) }
attr_reader :orders_count
sig { returns(T.nilable(String)) }
attr_reader :password
sig { returns(T.nilable(String)) }
attr_reader :password_confirmation
sig { returns(T.nilable(String)) }
attr_reader :phone
sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
attr_reader :sms_marketing_consent
Expand Down Expand Up @@ -134,6 +141,25 @@ def find(
T.cast(result[0], T.nilable(Customer))
end

sig do
params(
id: T.any(Integer, String),
session: Auth::Session
).returns(T.untyped)
end
def delete(
id:,
session: ShopifyAPI::Context.active_session
)
request(
http_method: :delete,
operation: :delete,
session: session,
ids: {id: id},
params: {},
)
end

sig do
params(
ids: T.untyped,
Expand Down
4 changes: 3 additions & 1 deletion lib/shopify_api/rest/resources/2022_01/draft_order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,14 @@ def send_invoice(

sig do
params(
payment_gateway_id: T.untyped,
payment_pending: T.untyped,
body: T.untyped,
kwargs: T.untyped
).returns(T.untyped)
end
def complete(
payment_gateway_id: nil,
payment_pending: nil,
body: nil,
**kwargs
Expand All @@ -263,7 +265,7 @@ def complete(
operation: :complete,
session: @session,
ids: {id: @id},
params: {payment_pending: payment_pending}.merge(kwargs).compact,
params: {payment_gateway_id: payment_gateway_id, payment_pending: payment_pending}.merge(kwargs).compact,
body: body,
entity: self,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,16 @@ def accept(
sig do
params(
message: T.untyped,
reason: T.untyped,
line_items: T.untyped,
body: T.untyped,
kwargs: T.untyped
).returns(T.untyped)
end
def reject(
message: nil,
reason: nil,
line_items: nil,
body: nil,
**kwargs
)
Expand All @@ -73,7 +77,7 @@ def reject(
operation: :reject,
session: @session,
ids: {fulfillment_order_id: @fulfillment_order_id},
params: {message: message}.merge(kwargs).compact,
params: {message: message, reason: reason, line_items: line_items}.merge(kwargs).compact,
body: body,
entity: self,
)
Expand Down
10 changes: 9 additions & 1 deletion lib/shopify_api/rest/resources/2022_01/gift_card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ def count(
query: T.untyped,
limit: T.untyped,
fields: T.untyped,
created_at_min: T.untyped,
created_at_max: T.untyped,
updated_at_min: T.untyped,
updated_at_max: T.untyped,
session: Auth::Session,
kwargs: T.untyped
).returns(T.untyped)
Expand All @@ -166,6 +170,10 @@ def search(
query: nil,
limit: nil,
fields: nil,
created_at_min: nil,
created_at_max: nil,
updated_at_min: nil,
updated_at_max: nil,
session: ShopifyAPI::Context.active_session,
**kwargs
)
Expand All @@ -174,7 +182,7 @@ def search(
operation: :search,
session: session,
ids: {},
params: {order: order, query: query, limit: limit, fields: fields}.merge(kwargs).compact,
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,
body: {},
entity: nil,
)
Expand Down
17 changes: 12 additions & 5 deletions lib/shopify_api/rest/resources/2022_01/metafield.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def initialize(session: ShopifyAPI::Context.active_session)
{http_method: :delete, operation: :delete, ids: [:order_id, :id], path: "orders/<order_id>/metafields/<id>.json"},
{http_method: :delete, operation: :delete, ids: [:page_id, :id], path: "pages/<page_id>/metafields/<id>.json"},
{http_method: :delete, operation: :delete, ids: [:product_image_id, :id], path: "product_images/<product_image_id>/metafields/<id>.json"},
{http_method: :delete, operation: :delete, ids: [:product_image_id, :id], path: "product_images/<product_image_id>/metafields/<id>.json"},
{http_method: :delete, operation: :delete, ids: [:product_id, :id], path: "products/<product_id>/metafields/<id>.json"},
{http_method: :delete, operation: :delete, ids: [:variant_id, :id], path: "variants/<variant_id>/metafields/<id>.json"},
{http_method: :get, operation: :count, ids: [:article_id], path: "articles/<article_id>/metafields/count.json"},
Expand All @@ -61,6 +62,7 @@ def initialize(session: ShopifyAPI::Context.active_session)
{http_method: :get, operation: :count, ids: [], path: "metafields/count.json"},
{http_method: :get, operation: :count, ids: [:order_id], path: "orders/<order_id>/metafields/count.json"},
{http_method: :get, operation: :count, ids: [:page_id], path: "pages/<page_id>/metafields/count.json"},
{http_method: :get, operation: :count, ids: [:page_id], path: "pages/<page_id>/metafields/count.json"},
{http_method: :get, operation: :count, ids: [:product_image_id], path: "product_images/<product_image_id>/metafields/count.json"},
{http_method: :get, operation: :count, ids: [:product_id], path: "products/<product_id>/metafields/count.json"},
{http_method: :get, operation: :count, ids: [:variant_id], path: "variants/<variant_id>/metafields/count.json"},
Expand All @@ -73,16 +75,17 @@ def initialize(session: ShopifyAPI::Context.active_session)
{http_method: :get, operation: :get, ids: [:customer_id], path: "customers/<customer_id>/metafields.json"},
{http_method: :get, operation: :get, ids: [:customer_id, :id], path: "customers/<customer_id>/metafields/<id>.json"},
{http_method: :get, operation: :get, ids: [:draft_order_id], path: "draft_orders/<draft_order_id>/metafields.json"},
{http_method: :get, operation: :get, ids: [:draft_order_id], path: "draft_orders/<draft_order_id>/metafields.json"},
{http_method: :get, operation: :get, ids: [:draft_order_id, :id], path: "draft_orders/<draft_order_id>/metafields/<id>.json"},
{http_method: :get, operation: :get, ids: [], path: "metafields.json"},
{http_method: :get, operation: :get, ids: [], path: "metafields.json"},
{http_method: :get, operation: :get, ids: [:id], path: "metafields/<id>.json"},
{http_method: :get, operation: :get, ids: [:order_id], path: "orders/<order_id>/metafields.json"},
{http_method: :get, operation: :get, ids: [:order_id, :id], path: "orders/<order_id>/metafields/<id>.json"},
{http_method: :get, operation: :get, ids: [:page_id], path: "pages/<page_id>/metafields.json"},
{http_method: :get, operation: :get, ids: [:page_id, :id], path: "pages/<page_id>/metafields/<id>.json"},
{http_method: :get, operation: :get, ids: [:product_image_id], path: "product_images/<product_image_id>/metafields.json"},
{http_method: :get, operation: :get, ids: [:product_image_id, :id], path: "product_images/<product_image_id>/metafields/<id>.json"},
{http_method: :get, operation: :get, ids: [:product_image_id, :id], path: "product_images/<product_image_id>/metafields/<id>.json"},
{http_method: :get, operation: :get, ids: [:product_id], path: "products/<product_id>/metafields.json"},
{http_method: :get, operation: :get, ids: [:product_id, :id], path: "products/<product_id>/metafields/<id>.json"},
{http_method: :get, operation: :get, ids: [:variant_id], path: "variants/<variant_id>/metafields.json"},
Expand All @@ -94,12 +97,14 @@ def initialize(session: ShopifyAPI::Context.active_session)
{http_method: :post, operation: :post, ids: [:draft_order_id], path: "draft_orders/<draft_order_id>/metafields.json"},
{http_method: :post, operation: :post, ids: [], path: "metafields.json"},
{http_method: :post, operation: :post, ids: [:order_id], path: "orders/<order_id>/metafields.json"},
{http_method: :post, operation: :post, ids: [:order_id], path: "orders/<order_id>/metafields.json"},
{http_method: :post, operation: :post, ids: [:page_id], path: "pages/<page_id>/metafields.json"},
{http_method: :post, operation: :post, ids: [:product_image_id], path: "product_images/<product_image_id>/metafields.json"},
{http_method: :post, operation: :post, ids: [:product_id], path: "products/<product_id>/metafields.json"},
{http_method: :post, operation: :post, ids: [:variant_id], path: "variants/<variant_id>/metafields.json"},
{http_method: :put, operation: :put, ids: [:article_id, :id], path: "articles/<article_id>/metafields/<id>.json"},
{http_method: :put, operation: :put, ids: [:blog_id, :id], path: "blogs/<blog_id>/metafields/<id>.json"},
{http_method: :put, operation: :put, ids: [:blog_id, :id], path: "blogs/<blog_id>/metafields/<id>.json"},
{http_method: :put, operation: :put, ids: [:collection_id, :id], path: "collections/<collection_id>/metafields/<id>.json"},
{http_method: :put, operation: :put, ids: [:customer_id, :id], path: "customers/<customer_id>/metafields/<id>.json"},
{http_method: :put, operation: :put, ids: [:draft_order_id, :id], path: "draft_orders/<draft_order_id>/metafields/<id>.json"},
Expand Down Expand Up @@ -168,6 +173,7 @@ class << self
product_image_id: T.nilable(T.any(Integer, String)),
product_id: T.nilable(T.any(Integer, String)),
variant_id: T.nilable(T.any(Integer, String)),
fields: T.untyped,
session: Auth::Session
).returns(T.nilable(Metafield))
end
Expand All @@ -183,12 +189,13 @@ def find(
product_image_id: nil,
product_id: nil,
variant_id: nil,
fields: nil,
session: ShopifyAPI::Context.active_session
)
result = base_find(
session: session,
ids: {id: id, article_id: article_id, blog_id: blog_id, collection_id: collection_id, customer_id: customer_id, draft_order_id: draft_order_id, order_id: order_id, page_id: page_id, product_image_id: product_image_id, product_id: product_id, variant_id: variant_id},
params: {},
params: {fields: fields},
)
T.cast(result[0], T.nilable(Metafield))
end
Expand Down Expand Up @@ -252,8 +259,8 @@ def delete(
updated_at_max: T.untyped,
namespace: T.untyped,
key: T.untyped,
type: T.untyped,
value_type: T.untyped,
type: T.untyped,
fields: T.untyped,
metafield: T.nilable(T::Hash[T.untyped, T.untyped]),
session: Auth::Session,
Expand All @@ -279,8 +286,8 @@ def all(
updated_at_max: nil,
namespace: nil,
key: nil,
type: nil,
value_type: nil,
type: nil,
fields: nil,
metafield: nil,
session: ShopifyAPI::Context.active_session,
Expand All @@ -289,7 +296,7 @@ def all(
response = base_find(
session: session,
ids: {article_id: article_id, blog_id: blog_id, collection_id: collection_id, customer_id: customer_id, draft_order_id: draft_order_id, order_id: order_id, page_id: page_id, product_image_id: product_image_id, product_id: product_id, variant_id: variant_id},
params: {limit: limit, since_id: since_id, created_at_min: created_at_min, created_at_max: created_at_max, updated_at_min: updated_at_min, updated_at_max: updated_at_max, namespace: namespace, key: key, type: type, value_type: value_type, fields: fields, metafield: metafield}.merge(kwargs).compact,
params: {limit: limit, since_id: since_id, created_at_min: created_at_min, created_at_max: created_at_max, updated_at_min: updated_at_min, updated_at_max: updated_at_max, namespace: namespace, key: key, value_type: value_type, type: type, fields: fields, metafield: metafield}.merge(kwargs).compact,
)

T.cast(response, T::Array[Metafield])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def initialize(session: ShopifyAPI::Context.active_session)
discount_codes: DiscountCode
}, T::Hash[Symbol, Class])
@paths = T.let([
{http_method: :get, operation: :checkouts, ids: [], path: "checkouts.json"},
{http_method: :get, operation: :checkouts, ids: [], path: "checkouts.json"}
], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])

Expand Down Expand Up @@ -150,25 +151,25 @@ def initialize(session: ShopifyAPI::Context.active_session)
class << self
sig do
params(
limit: T.untyped,
since_id: T.untyped,
created_at_min: T.untyped,
created_at_max: T.untyped,
updated_at_min: T.untyped,
updated_at_max: T.untyped,
status: T.untyped,
limit: T.untyped,
session: Auth::Session,
kwargs: T.untyped
).returns(T.untyped)
end
def checkouts(
limit: nil,
since_id: nil,
created_at_min: nil,
created_at_max: nil,
updated_at_min: nil,
updated_at_max: nil,
status: nil,
limit: nil,
session: ShopifyAPI::Context.active_session,
**kwargs
)
Expand All @@ -177,7 +178,7 @@ def checkouts(
operation: :checkouts,
session: session,
ids: {},
params: {limit: limit, since_id: since_id, created_at_min: created_at_min, created_at_max: created_at_max, updated_at_min: updated_at_min, updated_at_max: updated_at_max, status: status}.merge(kwargs).compact,
params: {since_id: since_id, created_at_min: created_at_min, created_at_max: created_at_max, updated_at_min: updated_at_min, updated_at_max: updated_at_max, status: status, limit: limit}.merge(kwargs).compact,
body: {},
entity: nil,
)
Expand Down
26 changes: 26 additions & 0 deletions lib/shopify_api/rest/resources/2022_04/customer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def initialize(session: ShopifyAPI::Context.active_session)
@multipass_identifier = T.let(nil, T.nilable(String))
@note = T.let(nil, T.nilable(String))
@orders_count = T.let(nil, T.nilable(Integer))
@password = T.let(nil, T.nilable(String))
@password_confirmation = T.let(nil, T.nilable(String))
@phone = T.let(nil, T.nilable(String))
@sms_marketing_consent = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
@state = T.let(nil, T.nilable(String))
Expand All @@ -50,6 +52,7 @@ def initialize(session: ShopifyAPI::Context.active_session)
}, T::Hash[Symbol, Class])
@has_many = T.let({}, T::Hash[Symbol, Class])
@paths = T.let([
{http_method: :delete, operation: :delete, ids: [:id], path: "customers/<id>.json"},
{http_method: :get, operation: :count, ids: [], path: "customers/count.json"},
{http_method: :get, operation: :get, ids: [], path: "customers.json"},
{http_method: :get, operation: :get, ids: [:id], path: "customers/<id>.json"},
Expand Down Expand Up @@ -98,6 +101,10 @@ def initialize(session: ShopifyAPI::Context.active_session)
sig { returns(T.nilable(Integer)) }
attr_reader :orders_count
sig { returns(T.nilable(String)) }
attr_reader :password
sig { returns(T.nilable(String)) }
attr_reader :password_confirmation
sig { returns(T.nilable(String)) }
attr_reader :phone
sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
attr_reader :sms_marketing_consent
Expand Down Expand Up @@ -137,6 +144,25 @@ def find(
T.cast(result[0], T.nilable(Customer))
end

sig do
params(
id: T.any(Integer, String),
session: Auth::Session
).returns(T.untyped)
end
def delete(
id:,
session: ShopifyAPI::Context.active_session
)
request(
http_method: :delete,
operation: :delete,
session: session,
ids: {id: id},
params: {},
)
end

sig do
params(
ids: T.untyped,
Expand Down
Loading