@@ -117,11 +117,147 @@ TAccountBalance = class
117117 // / </remarks>
118118 TAsynAccountBalance = TAsynCallBack<TAccountBalance>;
119119
120+ // / <summary>
121+ // / Provides methods to interact with user-related endpoints of the StabilityAI API.
122+ // / </summary>
123+ // / <remarks>
124+ // / This class offers synchronous and asynchronous methods for retrieving account details
125+ // / and account balance information associated with the provided API key. It is designed
126+ // / for both blocking and non-blocking workflows, making it suitable for various application requirements.
127+ // / </remarks>
120128 TUserRoute = class (TStabilityAIAPIRoute)
129+ // / <summary>
130+ // / Get information about the account associated with the provided API key
131+ // / <para>
132+ // / NOTE: This method is <c>synchronous</c>
133+ // / </para>
134+ // / </summary>
135+ // / <returns>
136+ // / Returns a <c>TAccountDetails</c> object that contains account informations.
137+ // / </returns>
138+ // / <exception cref="StabilityAIException">
139+ // / Thrown when there is an error in the communication with the API or other underlying issues in the API call.
140+ // / </exception>
141+ // / <exception cref="StabilityAIExceptionBadRequestError">
142+ // / Thrown when the request is invalid, such as when required parameters are missing or values exceed allowed limits.
143+ // / </exception>
144+ // / <remarks>
145+ // / <code>
146+ // / var Stability := TStabilityAIFactory.CreateInstance(BaererKey);
147+ // / var Data := Stability.Version1.User.AccountDetails;
148+ // / try
149+ // / for var Itel in Data.Result do
150+ // / //display details account informations
151+ // / finally
152+ // / Data.Free;
153+ // / end;
154+ // / </code>
155+ // / </remarks>
121156 function AccountDetails : TAccountDetails; overload;
157+ // / <summary>
158+ // / Get information about the account associated with the provided API key
159+ // / <para>
160+ // / NOTE: This method is <c>asynchronous</c>
161+ // / </para>
162+ // / </summary>
163+ // / <param name="CallBacks">
164+ // / A function that returns a record containing event handlers for asynchronous image creation, such as <c>onSuccess</c> and <c>onError</c>.
165+ // / </param>
166+ // / <exception cref="StabilityAIException">
167+ // / Thrown when there is an error in the communication with the API or other underlying issues in the API call.
168+ // / </exception>
169+ // / <exception cref="StabilityAIExceptionBadRequestError">
170+ // / Thrown when the request is invalid, such as when required parameters are missing or values exceed allowed limits.
171+ // / </exception>
172+ // / <remarks>
173+ // / <code>
174+ // / // WARNING - Move the following line to the main OnCreate method for maximum scope.
175+ // / // var Stability := TStabilityAIFactory.CreateInstance(BaererKey);
176+ // / Stability.Version1.User.AccountDetails(
177+ // / function : TAsynAccountDetails
178+ // / begin
179+ // / Result.Sender := my_obj; // Instance passed to callback parameter
180+ // /
181+ // / Result.OnStart := nil; // If nil then; Can be omitted
182+ // /
183+ // / Result.OnSuccess := procedure (Sender: TObject; Data: TAccountDetails)
184+ // / begin
185+ // / // Handle success operation
186+ // / end;
187+ // /
188+ // / Result.OnError := procedure (Sender: TObject; Error: string)
189+ // / begin
190+ // / // Handle error message
191+ // / end;
192+ // / end);
193+ // / </code>
194+ // / </remarks>
122195 procedure AccountDetails (CallBacks: TFunc<TAsynAccountDetails>); overload;
123-
196+ // / <summary>
197+ // / Get the credit balance of the account/organization associated with the API key
198+ // / <para>
199+ // / NOTE: This method is <c>synchronous</c>
200+ // / </para>
201+ // / </summary>
202+ // / <returns>
203+ // / Returns a <c>TAccountBalance</c> object that contains balance information.
204+ // / </returns>
205+ // / <exception cref="StabilityAIException">
206+ // / Thrown when there is an error in the communication with the API or other underlying issues in the API call.
207+ // / </exception>
208+ // / <exception cref="StabilityAIExceptionBadRequestError">
209+ // / Thrown when the request is invalid, such as when required parameters are missing or values exceed allowed limits.
210+ // / </exception>
211+ // / <remarks>
212+ // / <code>
213+ // / var Stability := TStabilityAIFactory.CreateInstance(BaererKey);
214+ // / var Data := Stability.Version1.User.AccountBalance;
215+ // / try
216+ // / //display balanceinformation
217+ // / finally
218+ // / Data.Free;
219+ // / end;
220+ // / </code>
221+ // / </remarks>
124222 function AccountBalance : TAccountBalance; overload;
223+ // / <summary>
224+ // / Get the credit balance of the account/organization associated with the API key
225+ // / <para>
226+ // / NOTE: This method is <c>asynchronous</c>
227+ // / </para>
228+ // / </summary>
229+ // / <param name="CallBacks">
230+ // / A function that returns a record containing event handlers for asynchronous image creation, such as <c>onSuccess</c> and <c>onError</c>.
231+ // / </param>
232+ // / <exception cref="StabilityAIException">
233+ // / Thrown when there is an error in the communication with the API or other underlying issues in the API call.
234+ // / </exception>
235+ // / <exception cref="StabilityAIExceptionBadRequestError">
236+ // / Thrown when the request is invalid, such as when required parameters are missing or values exceed allowed limits.
237+ // / </exception>
238+ // / <remarks>
239+ // / <code>
240+ // / // WARNING - Move the following line to the main OnCreate method for maximum scope.
241+ // / // var Stability := TStabilityAIFactory.CreateInstance(BaererKey);
242+ // / Stability.Version1.User.AccountBalance(
243+ // / function : TAsynAccountBalance
244+ // / begin
245+ // / Result.Sender := my_obj; // Instance passed to callback parameter
246+ // /
247+ // / Result.OnStart := nil; // If nil then; Can be omitted
248+ // /
249+ // / Result.OnSuccess := procedure (Sender: TObject; Data: TAccountBalance)
250+ // / begin
251+ // / // Handle success operation
252+ // / end;
253+ // /
254+ // / Result.OnError := procedure (Sender: TObject; Error: string)
255+ // / begin
256+ // / // Handle error message
257+ // / end;
258+ // / end);
259+ // / </code>
260+ // / </remarks>
125261 procedure AccountBalance (CallBacks: TFunc<TAsynAccountBalance>); overload;
126262 end ;
127263
@@ -141,6 +277,11 @@ destructor TAccountDetails.Destroy;
141277
142278{ TUserRoute }
143279
280+ function TUserRoute.AccountBalance : TAccountBalance;
281+ begin
282+ Result := API.Get<TAccountBalance>(' v1/user/balance' );
283+ end ;
284+
144285procedure TUserRoute.AccountBalance (CallBacks: TFunc<TAsynAccountBalance>);
145286begin
146287 with TAsynCallBackExec<TAsynAccountBalance, TAccountBalance>.Create(CallBacks) do
@@ -159,9 +300,9 @@ procedure TUserRoute.AccountBalance(CallBacks: TFunc<TAsynAccountBalance>);
159300 end ;
160301end ;
161302
162- function TUserRoute.AccountBalance : TAccountBalance ;
303+ function TUserRoute.AccountDetails : TAccountDetails ;
163304begin
164- Result := API.Get<TAccountBalance >(' v1/user/balance ' );
305+ Result := API.Get<TAccountDetails >(' v1/user/account ' );
165306end ;
166307
167308procedure TUserRoute.AccountDetails (CallBacks: TFunc<TAsynAccountDetails>);
@@ -182,9 +323,4 @@ procedure TUserRoute.AccountDetails(CallBacks: TFunc<TAsynAccountDetails>);
182323 end ;
183324end ;
184325
185- function TUserRoute.AccountDetails : TAccountDetails;
186- begin
187- Result := API.Get<TAccountDetails>(' v1/user/account' );
188- end ;
189-
190326end .
0 commit comments