Sha256: 1f72e451687e4564059d98adc73d5d16dbb23b58e3b7d312f771249dffd8617f
Contents?: true
Size: 1.15 KB
Versions: 57
Compression:
Stored size: 1.15 KB
Contents
require "shopify_cli" module ShopifyCLI module Tasks class CreateApiClient < ShopifyCLI::Task VALID_APP_TYPES = %w(public custom) DEFAULT_APP_URL = "https://shopify.github.io/shopify-cli/help/start-app/" 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: [IdentityAuth::REDIRECT_HOST] ) unless resp ctx.abort("Error - empty response") end errors = resp.dig("errors") if !errors.nil? && errors.any? ctx.abort(errors.map { |err| "#{err["field"]} #{err["message"]}" }.join(", ")) end user_errors = resp.dig("data", "appCreate", "userErrors") if !user_errors.nil? && user_errors.any? ctx.abort(user_errors.map { |err| "#{err["field"]} #{err["message"]}" }.join(", ")) end ShopifyCLI::Core::Monorail.metadata[:api_key] = resp.dig("data", "appCreate", "app", "apiKey") resp.dig("data", "appCreate", "app") end end end end
Version data entries
57 entries across 57 versions & 1 rubygems