@@ -157,6 +157,31 @@ type InvoicesApi interface {
157
157
158
158
// Method available only for mocking purposes
159
159
ListPendingInvoicesExecute (r ListPendingInvoicesApiRequest ) (* PaginatedApiInvoice , * http.Response , error )
160
+
161
+ /*
162
+ QueryLineItemsFromSingleInvoice Query lineItems of the specified invoiceId
163
+
164
+ Query the lineItems of the specified invoice and return the result JSON. A unique 24-hexadecimal digit string identifies the invoice.
165
+
166
+ @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
167
+ @param orgId Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.
168
+ @param invoiceId Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.
169
+ @param apiPublicUsageDetailsQueryRequest Filter parameters for the lineItems query. Send a request with an empty JSON body to retrieve all line items for a given invoiceID without applying any filters.
170
+ @return QueryLineItemsFromSingleInvoiceApiRequest
171
+ */
172
+ QueryLineItemsFromSingleInvoice (ctx context.Context , orgId string , invoiceId string , apiPublicUsageDetailsQueryRequest * ApiPublicUsageDetailsQueryRequest ) QueryLineItemsFromSingleInvoiceApiRequest
173
+ /*
174
+ QueryLineItemsFromSingleInvoice Query lineItems of the specified invoiceId
175
+
176
+
177
+ @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
178
+ @param QueryLineItemsFromSingleInvoiceApiParams - Parameters for the request
179
+ @return QueryLineItemsFromSingleInvoiceApiRequest
180
+ */
181
+ QueryLineItemsFromSingleInvoiceWithParams (ctx context.Context , args * QueryLineItemsFromSingleInvoiceApiParams ) QueryLineItemsFromSingleInvoiceApiRequest
182
+
183
+ // Method available only for mocking purposes
184
+ QueryLineItemsFromSingleInvoiceExecute (r QueryLineItemsFromSingleInvoiceApiRequest ) (* PaginatedPublicApiUsageDetailsLineItem , * http.Response , error )
160
185
}
161
186
162
187
// InvoicesApiService InvoicesApi service
@@ -994,3 +1019,161 @@ func (a *InvoicesApiService) ListPendingInvoicesExecute(r ListPendingInvoicesApi
994
1019
995
1020
return localVarReturnValue , localVarHTTPResponse , nil
996
1021
}
1022
+
1023
+ type QueryLineItemsFromSingleInvoiceApiRequest struct {
1024
+ ctx context.Context
1025
+ ApiService InvoicesApi
1026
+ orgId string
1027
+ invoiceId string
1028
+ apiPublicUsageDetailsQueryRequest * ApiPublicUsageDetailsQueryRequest
1029
+ itemsPerPage * int
1030
+ pageNum * int
1031
+ }
1032
+
1033
+ type QueryLineItemsFromSingleInvoiceApiParams struct {
1034
+ OrgId string
1035
+ InvoiceId string
1036
+ ApiPublicUsageDetailsQueryRequest * ApiPublicUsageDetailsQueryRequest
1037
+ ItemsPerPage * int
1038
+ PageNum * int
1039
+ }
1040
+
1041
+ func (a * InvoicesApiService ) QueryLineItemsFromSingleInvoiceWithParams (ctx context.Context , args * QueryLineItemsFromSingleInvoiceApiParams ) QueryLineItemsFromSingleInvoiceApiRequest {
1042
+ return QueryLineItemsFromSingleInvoiceApiRequest {
1043
+ ApiService : a ,
1044
+ ctx : ctx ,
1045
+ orgId : args .OrgId ,
1046
+ invoiceId : args .InvoiceId ,
1047
+ apiPublicUsageDetailsQueryRequest : args .ApiPublicUsageDetailsQueryRequest ,
1048
+ itemsPerPage : args .ItemsPerPage ,
1049
+ pageNum : args .PageNum ,
1050
+ }
1051
+ }
1052
+
1053
+ // Number of items that the response returns per page.
1054
+ func (r QueryLineItemsFromSingleInvoiceApiRequest ) ItemsPerPage (itemsPerPage int ) QueryLineItemsFromSingleInvoiceApiRequest {
1055
+ r .itemsPerPage = & itemsPerPage
1056
+ return r
1057
+ }
1058
+
1059
+ // Number of the page that displays the current set of the total objects that the response returns.
1060
+ func (r QueryLineItemsFromSingleInvoiceApiRequest ) PageNum (pageNum int ) QueryLineItemsFromSingleInvoiceApiRequest {
1061
+ r .pageNum = & pageNum
1062
+ return r
1063
+ }
1064
+
1065
+ func (r QueryLineItemsFromSingleInvoiceApiRequest ) Execute () (* PaginatedPublicApiUsageDetailsLineItem , * http.Response , error ) {
1066
+ return r .ApiService .QueryLineItemsFromSingleInvoiceExecute (r )
1067
+ }
1068
+
1069
+ /*
1070
+ QueryLineItemsFromSingleInvoice Query lineItems of the specified invoiceId
1071
+
1072
+ Query the lineItems of the specified invoice and return the result JSON. A unique 24-hexadecimal digit string identifies the invoice.
1073
+
1074
+ @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
1075
+ @param orgId Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.
1076
+ @param invoiceId Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.
1077
+ @return QueryLineItemsFromSingleInvoiceApiRequest
1078
+ */
1079
+ func (a * InvoicesApiService ) QueryLineItemsFromSingleInvoice (ctx context.Context , orgId string , invoiceId string , apiPublicUsageDetailsQueryRequest * ApiPublicUsageDetailsQueryRequest ) QueryLineItemsFromSingleInvoiceApiRequest {
1080
+ return QueryLineItemsFromSingleInvoiceApiRequest {
1081
+ ApiService : a ,
1082
+ ctx : ctx ,
1083
+ orgId : orgId ,
1084
+ invoiceId : invoiceId ,
1085
+ apiPublicUsageDetailsQueryRequest : apiPublicUsageDetailsQueryRequest ,
1086
+ }
1087
+ }
1088
+
1089
+ // Execute executes the request
1090
+ //
1091
+ // @return PaginatedPublicApiUsageDetailsLineItem
1092
+ func (a * InvoicesApiService ) QueryLineItemsFromSingleInvoiceExecute (r QueryLineItemsFromSingleInvoiceApiRequest ) (* PaginatedPublicApiUsageDetailsLineItem , * http.Response , error ) {
1093
+ var (
1094
+ localVarHTTPMethod = http .MethodGet
1095
+ localVarPostBody interface {}
1096
+ formFiles []formFile
1097
+ localVarReturnValue * PaginatedPublicApiUsageDetailsLineItem
1098
+ )
1099
+
1100
+ localBasePath , err := a .client .cfg .ServerURLWithContext (r .ctx , "InvoicesApiService.QueryLineItemsFromSingleInvoice" )
1101
+ if err != nil {
1102
+ return localVarReturnValue , nil , & GenericOpenAPIError {error : err .Error ()}
1103
+ }
1104
+
1105
+ localVarPath := localBasePath + "/api/atlas/v2/orgs/{orgId}/invoices/{invoiceId}/lineItems/:search"
1106
+ localVarPath = strings .Replace (localVarPath , "{" + "orgId" + "}" , url .PathEscape (parameterValueToString (r .orgId , "orgId" )), - 1 )
1107
+ localVarPath = strings .Replace (localVarPath , "{" + "invoiceId" + "}" , url .PathEscape (parameterValueToString (r .invoiceId , "invoiceId" )), - 1 )
1108
+
1109
+ localVarHeaderParams := make (map [string ]string )
1110
+ localVarQueryParams := url.Values {}
1111
+ localVarFormParams := url.Values {}
1112
+ if r .apiPublicUsageDetailsQueryRequest == nil {
1113
+ return localVarReturnValue , nil , reportError ("apiPublicUsageDetailsQueryRequest is required and must be specified" )
1114
+ }
1115
+
1116
+ if r .itemsPerPage != nil {
1117
+ parameterAddToHeaderOrQuery (localVarQueryParams , "itemsPerPage" , r .itemsPerPage , "" )
1118
+ } else {
1119
+ var defaultValue int = 100
1120
+ r .itemsPerPage = & defaultValue
1121
+ parameterAddToHeaderOrQuery (localVarQueryParams , "itemsPerPage" , r .itemsPerPage , "" )
1122
+ }
1123
+ if r .pageNum != nil {
1124
+ parameterAddToHeaderOrQuery (localVarQueryParams , "pageNum" , r .pageNum , "" )
1125
+ } else {
1126
+ var defaultValue int = 1
1127
+ r .pageNum = & defaultValue
1128
+ parameterAddToHeaderOrQuery (localVarQueryParams , "pageNum" , r .pageNum , "" )
1129
+ }
1130
+ // to determine the Content-Type header
1131
+ localVarHTTPContentTypes := []string {"application/vnd.atlas.2024-08-05+json" }
1132
+
1133
+ // set Content-Type header
1134
+ localVarHTTPContentType := selectHeaderContentType (localVarHTTPContentTypes )
1135
+ if localVarHTTPContentType != "" {
1136
+ localVarHeaderParams ["Content-Type" ] = localVarHTTPContentType
1137
+ }
1138
+
1139
+ // to determine the Accept header
1140
+ localVarHTTPHeaderAccepts := []string {"application/vnd.atlas.2024-08-05+json" , "application/json" }
1141
+
1142
+ // set Accept header
1143
+ localVarHTTPHeaderAccept := selectHeaderAccept (localVarHTTPHeaderAccepts )
1144
+ if localVarHTTPHeaderAccept != "" {
1145
+ localVarHeaderParams ["Accept" ] = localVarHTTPHeaderAccept
1146
+ }
1147
+ // body params
1148
+ localVarPostBody = r .apiPublicUsageDetailsQueryRequest
1149
+ req , err := a .client .prepareRequest (r .ctx , localVarPath , localVarHTTPMethod , localVarPostBody , localVarHeaderParams , localVarQueryParams , localVarFormParams , formFiles )
1150
+ if err != nil {
1151
+ return localVarReturnValue , nil , err
1152
+ }
1153
+
1154
+ localVarHTTPResponse , err := a .client .callAPI (req )
1155
+ if err != nil || localVarHTTPResponse == nil {
1156
+ return localVarReturnValue , localVarHTTPResponse , err
1157
+ }
1158
+
1159
+ if localVarHTTPResponse .StatusCode >= 300 {
1160
+ newErr := a .client .makeApiError (localVarHTTPResponse , localVarHTTPMethod , localVarPath )
1161
+ return localVarReturnValue , localVarHTTPResponse , newErr
1162
+ }
1163
+
1164
+ err = a .client .decode (& localVarReturnValue , localVarHTTPResponse .Body , localVarHTTPResponse .Header .Get ("Content-Type" ))
1165
+ if err != nil {
1166
+ defer localVarHTTPResponse .Body .Close ()
1167
+ buf , readErr := io .ReadAll (localVarHTTPResponse .Body )
1168
+ if readErr != nil {
1169
+ err = readErr
1170
+ }
1171
+ newErr := & GenericOpenAPIError {
1172
+ body : buf ,
1173
+ error : err .Error (),
1174
+ }
1175
+ return localVarReturnValue , localVarHTTPResponse , newErr
1176
+ }
1177
+
1178
+ return localVarReturnValue , localVarHTTPResponse , nil
1179
+ }
0 commit comments