9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/shopify-cli/tasks/create_api_client.rb', line 9
def call(ctx, org_id:, title:, type:)
resp = ShopifyCli::PartnersAPI.query(
ctx,
'create_app',
org: org_id.to_i,
title: title,
type: type,
app_url: DEFAULT_APP_URL,
redir: [OAuth::REDIRECT_HOST]
)
user_errors = resp["data"]["appCreate"]["userErrors"]
if !user_errors.nil? && user_errors.any?
ctx.abort(user_errors.map { |err| "#{err['field']} #{err['message']}" }.join(", "))
end
resp["data"]["appCreate"]["app"]
end
|