Skip to content

Commit 182e255

Browse files
feat(api): api update
1 parent 717bc2e commit 182e255

File tree

8 files changed

+113
-37
lines changed

8 files changed

+113
-37
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 118
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-b070c1d97a6e3b400f43d2bce36c22ed89d432345b26374728c55dd0a20f0afa.yml
3-
openapi_spec_hash: dba4ff52c381cda6159fc56d8b77eb32
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-15e42bc01739abea4a925894a1a7de447de40b003a3433461952e8e06919588b.yml
3+
openapi_spec_hash: 8a0bc5b6ab417f7256cbf83d70c459a3
44
config_hash: 1f73a949b649ecfe6ec68ba1bb459dc2

lib/orb/models/invoice_line_item_create_params.rb

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@ class InvoiceLineItemCreateParams < Orb::Internal::Type::BaseModel
2525
# @return [String]
2626
required :invoice_id, String
2727

28-
# @!attribute name
29-
# The item name associated with this line item. If an item with the same name
30-
# exists in Orb, that item will be associated with the line item.
31-
#
32-
# @return [String]
33-
required :name, String
34-
3528
# @!attribute quantity
3629
# The number of units on the line item
3730
#
@@ -44,7 +37,27 @@ class InvoiceLineItemCreateParams < Orb::Internal::Type::BaseModel
4437
# @return [Date]
4538
required :start_date, Date
4639

47-
# @!method initialize(amount:, end_date:, invoice_id:, name:, quantity:, start_date:, request_options: {})
40+
# @!attribute item_id
41+
# The id of the item to associate with this line item. If provided without `name`,
42+
# the item's name will be used for the price/line item. If provided with `name`,
43+
# the item will be associated but `name` will be used for the line item. At least
44+
# one of `name` or `item_id` must be provided.
45+
#
46+
# @return [String, nil]
47+
optional :item_id, String, nil?: true
48+
49+
# @!attribute name
50+
# The name to use for the line item. If `item_id` is not provided, Orb will search
51+
# for an item with this name. If found, that item will be associated with the line
52+
# item. If not found, a new item will be created with this name. If `item_id` is
53+
# provided, this name will be used for the line item, but the item association
54+
# will be based on `item_id`. At least one of `name` or `item_id` must be
55+
# provided.
56+
#
57+
# @return [String, nil]
58+
optional :name, String, nil?: true
59+
60+
# @!method initialize(amount:, end_date:, invoice_id:, quantity:, start_date:, item_id: nil, name: nil, request_options: {})
4861
# Some parameter documentations has been truncated, see
4962
# {Orb::Models::InvoiceLineItemCreateParams} for more details.
5063
#
@@ -54,12 +67,14 @@ class InvoiceLineItemCreateParams < Orb::Internal::Type::BaseModel
5467
#
5568
# @param invoice_id [String] The id of the Invoice to add this line item.
5669
#
57-
# @param name [String] The item name associated with this line item. If an item with the same name exis
58-
#
5970
# @param quantity [Float] The number of units on the line item
6071
#
6172
# @param start_date [Date] A date string to specify the line item's start date in the customer's timezone.
6273
#
74+
# @param item_id [String, nil] The id of the item to associate with this line item. If provided without `name`,
75+
#
76+
# @param name [String, nil] The name to use for the line item. If `item_id` is not provided, Orb will search
77+
#
6378
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}]
6479
end
6580
end

lib/orb/resources/invoice_line_items.rb

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,33 @@ class InvoiceLineItems
99
# This creates a one-off fixed fee invoice line item on an Invoice. This can only
1010
# be done for invoices that are in a `draft` status.
1111
#
12-
# @overload create(amount:, end_date:, invoice_id:, name:, quantity:, start_date:, request_options: {})
12+
# The behavior depends on which parameters are provided:
13+
#
14+
# - If `item_id` is provided without `name`: The item is looked up by ID, and the
15+
# item's name is used for the line item.
16+
# - If `name` is provided without `item_id`: An item with the given name is
17+
# searched for in the account. If found, that item is used. If not found, a new
18+
# item is created with that name. The new item's name is used for the line item.
19+
# - If both `item_id` and `name` are provided: The item is looked up by ID for
20+
# association, but the provided `name` is used for the line item (not the item's
21+
# name).
22+
#
23+
# @overload create(amount:, end_date:, invoice_id:, quantity:, start_date:, item_id: nil, name: nil, request_options: {})
1324
#
1425
# @param amount [String] The total amount in the invoice's currency to add to the line item.
1526
#
1627
# @param end_date [Date] A date string to specify the line item's end date in the customer's timezone.
1728
#
1829
# @param invoice_id [String] The id of the Invoice to add this line item.
1930
#
20-
# @param name [String] The item name associated with this line item. If an item with the same name exis
21-
#
2231
# @param quantity [Float] The number of units on the line item
2332
#
2433
# @param start_date [Date] A date string to specify the line item's start date in the customer's timezone.
2534
#
35+
# @param item_id [String, nil] The id of the item to associate with this line item. If provided without `name`,
36+
#
37+
# @param name [String, nil] The name to use for the line item. If `item_id` is not provided, Orb will search
38+
#
2639
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
2740
#
2841
# @return [Orb::Models::InvoiceLineItemCreateResponse]

rbi/orb/models/invoice_line_item_create_params.rbi

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ module Orb
2323
sig { returns(String) }
2424
attr_accessor :invoice_id
2525

26-
# The item name associated with this line item. If an item with the same name
27-
# exists in Orb, that item will be associated with the line item.
28-
sig { returns(String) }
29-
attr_accessor :name
30-
3126
# The number of units on the line item
3227
sig { returns(Float) }
3328
attr_accessor :quantity
@@ -36,14 +31,31 @@ module Orb
3631
sig { returns(Date) }
3732
attr_accessor :start_date
3833

34+
# The id of the item to associate with this line item. If provided without `name`,
35+
# the item's name will be used for the price/line item. If provided with `name`,
36+
# the item will be associated but `name` will be used for the line item. At least
37+
# one of `name` or `item_id` must be provided.
38+
sig { returns(T.nilable(String)) }
39+
attr_accessor :item_id
40+
41+
# The name to use for the line item. If `item_id` is not provided, Orb will search
42+
# for an item with this name. If found, that item will be associated with the line
43+
# item. If not found, a new item will be created with this name. If `item_id` is
44+
# provided, this name will be used for the line item, but the item association
45+
# will be based on `item_id`. At least one of `name` or `item_id` must be
46+
# provided.
47+
sig { returns(T.nilable(String)) }
48+
attr_accessor :name
49+
3950
sig do
4051
params(
4152
amount: String,
4253
end_date: Date,
4354
invoice_id: String,
44-
name: String,
4555
quantity: Float,
4656
start_date: Date,
57+
item_id: T.nilable(String),
58+
name: T.nilable(String),
4759
request_options: Orb::RequestOptions::OrHash
4860
).returns(T.attached_class)
4961
end
@@ -54,13 +66,22 @@ module Orb
5466
end_date:,
5567
# The id of the Invoice to add this line item.
5668
invoice_id:,
57-
# The item name associated with this line item. If an item with the same name
58-
# exists in Orb, that item will be associated with the line item.
59-
name:,
6069
# The number of units on the line item
6170
quantity:,
6271
# A date string to specify the line item's start date in the customer's timezone.
6372
start_date:,
73+
# The id of the item to associate with this line item. If provided without `name`,
74+
# the item's name will be used for the price/line item. If provided with `name`,
75+
# the item will be associated but `name` will be used for the line item. At least
76+
# one of `name` or `item_id` must be provided.
77+
item_id: nil,
78+
# The name to use for the line item. If `item_id` is not provided, Orb will search
79+
# for an item with this name. If found, that item will be associated with the line
80+
# item. If not found, a new item will be created with this name. If `item_id` is
81+
# provided, this name will be used for the line item, but the item association
82+
# will be based on `item_id`. At least one of `name` or `item_id` must be
83+
# provided.
84+
name: nil,
6485
request_options: {}
6586
)
6687
end
@@ -71,9 +92,10 @@ module Orb
7192
amount: String,
7293
end_date: Date,
7394
invoice_id: String,
74-
name: String,
7595
quantity: Float,
7696
start_date: Date,
97+
item_id: T.nilable(String),
98+
name: T.nilable(String),
7799
request_options: Orb::RequestOptions
78100
}
79101
)

rbi/orb/resources/invoice_line_items.rbi

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,26 @@ module Orb
55
class InvoiceLineItems
66
# This creates a one-off fixed fee invoice line item on an Invoice. This can only
77
# be done for invoices that are in a `draft` status.
8+
#
9+
# The behavior depends on which parameters are provided:
10+
#
11+
# - If `item_id` is provided without `name`: The item is looked up by ID, and the
12+
# item's name is used for the line item.
13+
# - If `name` is provided without `item_id`: An item with the given name is
14+
# searched for in the account. If found, that item is used. If not found, a new
15+
# item is created with that name. The new item's name is used for the line item.
16+
# - If both `item_id` and `name` are provided: The item is looked up by ID for
17+
# association, but the provided `name` is used for the line item (not the item's
18+
# name).
819
sig do
920
params(
1021
amount: String,
1122
end_date: Date,
1223
invoice_id: String,
13-
name: String,
1424
quantity: Float,
1525
start_date: Date,
26+
item_id: T.nilable(String),
27+
name: T.nilable(String),
1628
request_options: Orb::RequestOptions::OrHash
1729
).returns(Orb::Models::InvoiceLineItemCreateResponse)
1830
end
@@ -23,13 +35,22 @@ module Orb
2335
end_date:,
2436
# The id of the Invoice to add this line item.
2537
invoice_id:,
26-
# The item name associated with this line item. If an item with the same name
27-
# exists in Orb, that item will be associated with the line item.
28-
name:,
2938
# The number of units on the line item
3039
quantity:,
3140
# A date string to specify the line item's start date in the customer's timezone.
3241
start_date:,
42+
# The id of the item to associate with this line item. If provided without `name`,
43+
# the item's name will be used for the price/line item. If provided with `name`,
44+
# the item will be associated but `name` will be used for the line item. At least
45+
# one of `name` or `item_id` must be provided.
46+
item_id: nil,
47+
# The name to use for the line item. If `item_id` is not provided, Orb will search
48+
# for an item with this name. If found, that item will be associated with the line
49+
# item. If not found, a new item will be created with this name. If `item_id` is
50+
# provided, this name will be used for the line item, but the item association
51+
# will be based on `item_id`. At least one of `name` or `item_id` must be
52+
# provided.
53+
name: nil,
3354
request_options: {}
3455
)
3556
end

sig/orb/models/invoice_line_item_create_params.rbs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ module Orb
55
amount: String,
66
end_date: Date,
77
invoice_id: String,
8-
name: String,
98
quantity: Float,
10-
start_date: Date
9+
start_date: Date,
10+
item_id: String?,
11+
name: String?
1112
}
1213
& Orb::Internal::Type::request_parameters
1314

@@ -21,29 +22,33 @@ module Orb
2122

2223
attr_accessor invoice_id: String
2324

24-
attr_accessor name: String
25-
2625
attr_accessor quantity: Float
2726

2827
attr_accessor start_date: Date
2928

29+
attr_accessor item_id: String?
30+
31+
attr_accessor name: String?
32+
3033
def initialize: (
3134
amount: String,
3235
end_date: Date,
3336
invoice_id: String,
34-
name: String,
3537
quantity: Float,
3638
start_date: Date,
39+
?item_id: String?,
40+
?name: String?,
3741
?request_options: Orb::request_opts
3842
) -> void
3943

4044
def to_hash: -> {
4145
amount: String,
4246
end_date: Date,
4347
invoice_id: String,
44-
name: String,
4548
quantity: Float,
4649
start_date: Date,
50+
item_id: String?,
51+
name: String?,
4752
request_options: Orb::RequestOptions
4853
}
4954
end

sig/orb/resources/invoice_line_items.rbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ module Orb
55
amount: String,
66
end_date: Date,
77
invoice_id: String,
8-
name: String,
98
quantity: Float,
109
start_date: Date,
10+
?item_id: String?,
11+
?name: String?,
1112
?request_options: Orb::request_opts
1213
) -> Orb::Models::InvoiceLineItemCreateResponse
1314

test/orb/resources/invoice_line_items_test.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ def test_create_required_params
99
amount: "12.00",
1010
end_date: "2023-09-22",
1111
invoice_id: "4khy3nwzktxv7",
12-
name: "Item Name",
1312
quantity: 1,
1413
start_date: "2023-09-22"
1514
)

0 commit comments

Comments
 (0)