Skip to content

Commit

Permalink
fix: codegen breaking changes in api spec
Browse files Browse the repository at this point in the history
  • Loading branch information
yordis committed Feb 5, 2024
1 parent 73faf6d commit 0631040
Show file tree
Hide file tree
Showing 77 changed files with 4,813 additions and 4,843 deletions.
2 changes: 1 addition & 1 deletion .latest-tag-stripe-openapi-sdk
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v755
v756
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ gen-changelog:
npx auto-changelog --unreleased

run-all:
@$(eval LATEST_TAG=$(shell curl -s https://api.github.com/repos/stripe/openapi/releases/latest | jq -r '.tag_name'))
# @$(eval LATEST_TAG=$(shell curl -s https://api.github.com/repos/stripe/openapi/releases/latest | jq -r '.tag_name'))
@$(eval LATEST_TAG="v756")
@echo "Latest tag: $(LATEST_TAG)"
@echo "Downloading https://raw.githubusercontent.com/stripe/openapi/$(LATEST_TAG)/openapi/spec3.sdk.json to ./priv/openapi/spec3.sdk.json"
@curl -o ./priv/openapi/spec3.sdk.json https://raw.githubusercontent.com/stripe/openapi/$(LATEST_TAG)/openapi/spec3.sdk.json
@echo "${LATEST_TAG}" > .latest-tag-stripe-openapi-sdk
mix stripe.generate
mix format
SKIP_STRIPE_MOCK_RUN=true mix test
mix docs
258 changes: 127 additions & 131 deletions lib/generated/account.ex

Large diffs are not rendered by default.

98 changes: 49 additions & 49 deletions lib/generated/apple_pay_domain.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,37 @@ defmodule Stripe.ApplePayDomain do
(
nil

@doc "<p>List apple pay domains.</p>\n\n#### Details\n\n * Method: `get`\n * Path: `/v1/apple_pay/domains`\n"
@doc "<p>Delete an apple pay domain.</p>\n\n#### Details\n\n * Method: `delete`\n * Path: `/v1/apple_pay/domains/{domain}`\n"
(
@spec list(
params :: %{
optional(:domain_name) => binary,
optional(:ending_before) => binary,
optional(:expand) => list(binary),
optional(:limit) => integer,
optional(:starting_after) => binary
},
opts :: Keyword.t()
) ::
{:ok, Stripe.List.t(Stripe.ApplePayDomain.t())}
@spec delete(domain :: binary(), opts :: Keyword.t()) ::
{:ok, Stripe.DeletedApplePayDomain.t()}
| {:error, Stripe.ApiErrors.t()}
| {:error, term()}
def list(params \\ %{}, opts \\ []) do
path = Stripe.OpenApi.Path.replace_path_params("/v1/apple_pay/domains", [], [])
def delete(domain, opts \\ []) do
path =
Stripe.OpenApi.Path.replace_path_params(
"/v1/apple_pay/domains/{domain}",
[
%OpenApiGen.Blueprint.Parameter{
in: "path",
name: "domain",
required: true,
schema: %OpenApiGen.Blueprint.Parameter.Schema{
name: "domain",
title: nil,
type: "string",
items: [],
properties: [],
any_of: []
}
}
],
[domain]
)

Stripe.Request.new_request(opts)
|> Stripe.Request.put_endpoint(path)
|> Stripe.Request.put_params(params)
|> Stripe.Request.put_method(:get)
|> Stripe.Request.put_method(:delete)
|> Stripe.Request.make_request()
end
)
Expand All @@ -47,20 +56,28 @@ defmodule Stripe.ApplePayDomain do
(
nil

@doc "<p>Create an apple pay domain.</p>\n\n#### Details\n\n * Method: `post`\n * Path: `/v1/apple_pay/domains`\n"
@doc "<p>List apple pay domains.</p>\n\n#### Details\n\n * Method: `get`\n * Path: `/v1/apple_pay/domains`\n"
(
@spec create(
params :: %{optional(:domain_name) => binary, optional(:expand) => list(binary)},
@spec list(
params :: %{
optional(:domain_name) => binary,
optional(:ending_before) => binary,
optional(:expand) => list(binary),
optional(:limit) => integer,
optional(:starting_after) => binary
},
opts :: Keyword.t()
) ::
{:ok, Stripe.ApplePayDomain.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
def create(params \\ %{}, opts \\ []) do
{:ok, Stripe.List.t(Stripe.ApplePayDomain.t())}
| {:error, Stripe.ApiErrors.t()}
| {:error, term()}
def list(params \\ %{}, opts \\ []) do
path = Stripe.OpenApi.Path.replace_path_params("/v1/apple_pay/domains", [], [])

Stripe.Request.new_request(opts)
|> Stripe.Request.put_endpoint(path)
|> Stripe.Request.put_params(params)
|> Stripe.Request.put_method(:post)
|> Stripe.Request.put_method(:get)
|> Stripe.Request.make_request()
end
)
Expand Down Expand Up @@ -111,37 +128,20 @@ defmodule Stripe.ApplePayDomain do
(
nil

@doc "<p>Delete an apple pay domain.</p>\n\n#### Details\n\n * Method: `delete`\n * Path: `/v1/apple_pay/domains/{domain}`\n"
@doc "<p>Create an apple pay domain.</p>\n\n#### Details\n\n * Method: `post`\n * Path: `/v1/apple_pay/domains`\n"
(
@spec delete(domain :: binary(), opts :: Keyword.t()) ::
{:ok, Stripe.DeletedApplePayDomain.t()}
| {:error, Stripe.ApiErrors.t()}
| {:error, term()}
def delete(domain, opts \\ []) do
path =
Stripe.OpenApi.Path.replace_path_params(
"/v1/apple_pay/domains/{domain}",
[
%OpenApiGen.Blueprint.Parameter{
in: "path",
name: "domain",
required: true,
schema: %OpenApiGen.Blueprint.Parameter.Schema{
name: "domain",
title: nil,
type: "string",
items: [],
properties: [],
any_of: []
}
}
],
[domain]
)
@spec create(
params :: %{optional(:domain_name) => binary, optional(:expand) => list(binary)},
opts :: Keyword.t()
) ::
{:ok, Stripe.ApplePayDomain.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
def create(params \\ %{}, opts \\ []) do
path = Stripe.OpenApi.Path.replace_path_params("/v1/apple_pay/domains", [], [])

Stripe.Request.new_request(opts)
|> Stripe.Request.put_endpoint(path)
|> Stripe.Request.put_method(:delete)
|> Stripe.Request.put_params(params)
|> Stripe.Request.put_method(:post)
|> Stripe.Request.make_request()
end
)
Expand Down
60 changes: 30 additions & 30 deletions lib/generated/apps__secret.ex
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,36 @@ defmodule Stripe.Apps.Secret do
@type scope :: %{optional(:type) => :account | :user, optional(:user) => binary}
)

(
nil

@doc "<p>List all secrets stored on the given scope.</p>\n\n#### Details\n\n * Method: `get`\n * Path: `/v1/apps/secrets`\n"
(
@spec list(
params :: %{
optional(:ending_before) => binary,
optional(:expand) => list(binary),
optional(:limit) => integer,
optional(:scope) => scope,
optional(:starting_after) => binary
},
opts :: Keyword.t()
) ::
{:ok, Stripe.List.t(Stripe.Apps.Secret.t())}
| {:error, Stripe.ApiErrors.t()}
| {:error, term()}
def list(params \\ %{}, opts \\ []) do
path = Stripe.OpenApi.Path.replace_path_params("/v1/apps/secrets", [], [])

Stripe.Request.new_request(opts)
|> Stripe.Request.put_endpoint(path)
|> Stripe.Request.put_params(params)
|> Stripe.Request.put_method(:get)
|> Stripe.Request.make_request()
end
)
)

(
nil

Expand Down Expand Up @@ -100,34 +130,4 @@ defmodule Stripe.Apps.Secret do
end
)
)

(
nil

@doc "<p>List all secrets stored on the given scope.</p>\n\n#### Details\n\n * Method: `get`\n * Path: `/v1/apps/secrets`\n"
(
@spec list(
params :: %{
optional(:ending_before) => binary,
optional(:expand) => list(binary),
optional(:limit) => integer,
optional(:scope) => scope,
optional(:starting_after) => binary
},
opts :: Keyword.t()
) ::
{:ok, Stripe.List.t(Stripe.Apps.Secret.t())}
| {:error, Stripe.ApiErrors.t()}
| {:error, term()}
def list(params \\ %{}, opts \\ []) do
path = Stripe.OpenApi.Path.replace_path_params("/v1/apps/secrets", [], [])

Stripe.Request.new_request(opts)
|> Stripe.Request.put_endpoint(path)
|> Stripe.Request.put_params(params)
|> Stripe.Request.put_method(:get)
|> Stripe.Request.make_request()
end
)
)
end
98 changes: 42 additions & 56 deletions lib/generated/bank_account.ex
Original file line number Diff line number Diff line change
Expand Up @@ -50,67 +50,37 @@ defmodule Stripe.BankAccount do
)

(
@typedoc "Owner's address."
@type address :: %{
optional(:city) => binary,
optional(:country) => binary,
optional(:line1) => binary,
optional(:line2) => binary,
optional(:postal_code) => binary,
optional(:state) => binary
}
@typedoc "One or more documents that support the [Bank account ownership verification](https://support.stripe.com/questions/bank-account-ownership-verification) requirement. Must be a document associated with the bank account that displays the last 4 digits of the account number, either a statement or a voided check."
@type bank_account_ownership_verification :: %{optional(:files) => list(binary)}
)

(
@typedoc nil
@type owner :: %{
optional(:address) => address,
optional(:email) => binary,
optional(:name) => binary,
optional(:phone) => binary
@typedoc "Documents that may be submitted to satisfy various informational requests."
@type documents :: %{
optional(:bank_account_ownership_verification) => bank_account_ownership_verification
}
)

(
nil

@doc "<p>Update a specified source for a given customer.</p>\n\n#### Details\n\n * Method: `post`\n * Path: `/v1/customers/{customer}/sources/{id}`\n"
@doc "<p>Delete a specified external account for a given account.</p>\n\n#### Details\n\n * Method: `delete`\n * Path: `/v1/accounts/{account}/external_accounts/{id}`\n"
(
@spec update(
customer :: binary(),
id :: binary(),
params :: %{
optional(:account_holder_name) => binary,
optional(:account_holder_type) => :company | :individual,
optional(:address_city) => binary,
optional(:address_country) => binary,
optional(:address_line1) => binary,
optional(:address_line2) => binary,
optional(:address_state) => binary,
optional(:address_zip) => binary,
optional(:exp_month) => binary,
optional(:exp_year) => binary,
optional(:expand) => list(binary),
optional(:metadata) => %{optional(binary) => binary} | binary,
optional(:name) => binary,
optional(:owner) => owner
},
opts :: Keyword.t()
) ::
{:ok, Stripe.Card.t() | Stripe.BankAccount.t() | Stripe.Source.t()}
@spec delete(account :: binary(), id :: binary(), opts :: Keyword.t()) ::
{:ok, Stripe.DeletedExternalAccount.t()}
| {:error, Stripe.ApiErrors.t()}
| {:error, term()}
def update(customer, id, params \\ %{}, opts \\ []) do
def delete(account, id, opts \\ []) do
path =
Stripe.OpenApi.Path.replace_path_params(
"/v1/customers/{customer}/sources/{id}",
"/v1/accounts/{account}/external_accounts/{id}",
[
%OpenApiGen.Blueprint.Parameter{
in: "path",
name: "customer",
name: "account",
required: true,
schema: %OpenApiGen.Blueprint.Parameter.Schema{
name: "customer",
name: "account",
title: nil,
type: "string",
items: [],
Expand All @@ -132,13 +102,12 @@ defmodule Stripe.BankAccount do
}
}
],
[customer, id]
[account, id]
)

Stripe.Request.new_request(opts)
|> Stripe.Request.put_endpoint(path)
|> Stripe.Request.put_params(params)
|> Stripe.Request.put_method(:post)
|> Stripe.Request.put_method(:delete)
|> Stripe.Request.make_request()
end
)
Expand All @@ -147,28 +116,45 @@ defmodule Stripe.BankAccount do
(
nil

@doc "<p>Delete a specified source for a given customer.</p>\n\n#### Details\n\n * Method: `delete`\n * Path: `/v1/customers/{customer}/sources/{id}`\n"
@doc "<p>Updates the metadata, account holder name, account holder type of a bank account belonging to a <a href=\"/docs/connect/custom-accounts\">Custom account</a>, and optionally sets it as the default for its currency. Other bank account details are not editable by design.</p>\n\n<p>You can re-enable a disabled bank account by performing an update call without providing any arguments or changes.</p>\n\n#### Details\n\n * Method: `post`\n * Path: `/v1/accounts/{account}/external_accounts/{id}`\n"
(
@spec delete(
customer :: binary(),
@spec update(
account :: binary(),
id :: binary(),
params :: %{optional(:expand) => list(binary)},
params :: %{
optional(:account_holder_name) => binary,
optional(:account_holder_type) => :company | :individual,
optional(:account_type) => :checking | :futsu | :savings | :toza,
optional(:address_city) => binary,
optional(:address_country) => binary,
optional(:address_line1) => binary,
optional(:address_line2) => binary,
optional(:address_state) => binary,
optional(:address_zip) => binary,
optional(:default_for_currency) => boolean,
optional(:documents) => documents,
optional(:exp_month) => binary,
optional(:exp_year) => binary,
optional(:expand) => list(binary),
optional(:metadata) => %{optional(binary) => binary} | binary,
optional(:name) => binary
},
opts :: Keyword.t()
) ::
{:ok, Stripe.PaymentSource.t() | Stripe.DeletedPaymentSource.t()}
{:ok, Stripe.ExternalAccount.t()}
| {:error, Stripe.ApiErrors.t()}
| {:error, term()}
def delete(customer, id, params \\ %{}, opts \\ []) do
def update(account, id, params \\ %{}, opts \\ []) do
path =
Stripe.OpenApi.Path.replace_path_params(
"/v1/customers/{customer}/sources/{id}",
"/v1/accounts/{account}/external_accounts/{id}",
[
%OpenApiGen.Blueprint.Parameter{
in: "path",
name: "customer",
name: "account",
required: true,
schema: %OpenApiGen.Blueprint.Parameter.Schema{
name: "customer",
name: "account",
title: nil,
type: "string",
items: [],
Expand All @@ -190,13 +176,13 @@ defmodule Stripe.BankAccount do
}
}
],
[customer, id]
[account, id]
)

Stripe.Request.new_request(opts)
|> Stripe.Request.put_endpoint(path)
|> Stripe.Request.put_params(params)
|> Stripe.Request.put_method(:delete)
|> Stripe.Request.put_method(:post)
|> Stripe.Request.make_request()
end
)
Expand Down
Loading

0 comments on commit 0631040

Please sign in to comment.