Enhance API structure and documentation: Added new tags for Account, Integration, Automation, Linker, Optimizer, and Publisher; updated billing endpoints for admin and customer; improved API reference documentation; fixed endpoint paths in frontend services.

This commit is contained in:
IGNY8 VPS (Salman)
2025-12-07 01:13:38 +00:00
parent dc9dba2c9e
commit 7a2b424237
15 changed files with 314 additions and 24 deletions

View File

@@ -109,6 +109,7 @@ const endpointGroups: EndpointGroup[] = [
{ path: "/v1/system/settings/account/", method: "GET", description: "Account settings" },
{ path: "/v1/billing/credits/balance/", method: "GET", description: "Credit balance" },
{ path: "/v1/billing/credits/usage/", method: "GET", description: "Usage logs" },
{ path: "/v1/billing/credits/transactions/", method: "GET", description: "Transactions" },
{ path: "/v1/billing/credits/usage/summary/", method: "GET", description: "Usage summary" },
{
path: "/v1/billing/credits/usage/limits/",
@@ -126,6 +127,36 @@ const endpointGroups: EndpointGroup[] = [
{ path: "/v1/billing/credits/transactions/", method: "GET", description: "Transactions" },
],
},
{
name: "Billing (Customer)",
endpoints: [
{ path: "/v1/billing/credit-packages/", method: "GET", description: "List credit packages" },
{ path: "/v1/billing/invoices/", method: "GET", description: "List invoices" },
{ path: "/v1/billing/payments/", method: "GET", description: "List payments" },
{ path: "/v1/billing/payment-methods/", method: "GET", description: "List payment methods" },
{ path: "/v1/billing/payment-methods/available/", method: "GET", description: "Available payment methods" },
{ path: "/v1/billing/payments/manual/", method: "POST", description: "Submit manual payment" },
{ path: "/v1/billing/payments/available_methods/", method: "GET", description: "Payment methods (available_methods)" },
{ path: "/v1/billing/payment-methods/1/set_default/", method: "POST", description: "Set default payment method (sample id)" },
{ path: "/v1/billing/payment-methods/1/", method: "PATCH", description: "Update payment method (sample id)" },
{ path: "/v1/billing/payment-methods/1/", method: "DELETE", description: "Delete payment method (sample id)" },
],
},
{
name: "Admin Billing",
endpoints: [
{ path: "/v1/admin/billing/stats/", method: "GET", description: "Admin billing stats" },
{ path: "/v1/admin/billing/invoices/", method: "GET", description: "Admin invoices" },
{ path: "/v1/admin/billing/payments/", method: "GET", description: "Admin payments" },
{ path: "/v1/admin/billing/pending_payments/", method: "GET", description: "Pending manual payments" },
{ path: "/v1/admin/billing/1/approve_payment/", method: "POST", description: "Approve manual payment (sample id)" },
{ path: "/v1/admin/billing/1/reject_payment/", method: "POST", description: "Reject manual payment (sample id)" },
{ path: "/v1/admin/credit-costs/", method: "GET", description: "Credit cost configs" },
{ path: "/v1/admin/credit-costs/", method: "POST", description: "Update credit cost configs" },
{ path: "/v1/admin/users/", method: "GET", description: "Admin users with credits" },
{ path: "/v1/admin/users/1/adjust-credits/", method: "POST", description: "Adjust credits (sample id)" },
],
},
{
name: "CRUD Operations - Planner",
endpoints: [

View File

@@ -193,7 +193,7 @@ export interface PendingPayment extends Payment {
export async function getCreditBalance(): Promise<CreditBalance> {
// Use business billing CreditTransactionViewSet.balance
return fetchAPI('/v1/billing/transactions/balance/');
return fetchAPI('/v1/billing/credits/balance/');
}
export async function getCreditTransactions(): Promise<{
@@ -268,7 +268,7 @@ export async function getCreditUsageLimits(): Promise<{
export async function getAdminBillingStats(): Promise<AdminBillingStats> {
// Admin billing dashboard metrics
// Use business billing stats endpoint to include revenue, accounts, credits, and recent payments
return fetchAPI('/v1/billing/admin/stats/');
return fetchAPI('/v1/admin/billing/stats/');
}
export async function getAdminInvoices(params?: { status?: string; account_id?: number; search?: string }): Promise<{
@@ -280,7 +280,7 @@ export async function getAdminInvoices(params?: { status?: string; account_id?:
if (params?.account_id) queryParams.append('account_id', String(params.account_id));
if (params?.search) queryParams.append('search', params.search);
const url = `/v1/billing/admin/invoices/${queryParams.toString() ? '?' + queryParams.toString() : ''}`;
const url = `/v1/admin/billing/invoices/${queryParams.toString() ? '?' + queryParams.toString() : ''}`;
return fetchAPI(url);
}
@@ -293,7 +293,7 @@ export async function getAdminPayments(params?: { status?: string; account_id?:
if (params?.account_id) queryParams.append('account_id', String(params.account_id));
if (params?.payment_method) queryParams.append('payment_method', params.payment_method);
const url = `/v1/billing/admin/payments/${queryParams.toString() ? '?' + queryParams.toString() : ''}`;
const url = `/v1/admin/billing/payments/${queryParams.toString() ? '?' + queryParams.toString() : ''}`;
return fetchAPI(url);
}
@@ -624,7 +624,7 @@ export async function getPendingPayments(): Promise<{
results: PendingPayment[];
count: number;
}> {
return fetchAPI('/v1/billing/admin/pending_payments/');
return fetchAPI('/v1/admin/billing/pending_payments/');
}
export async function approvePayment(paymentId: number, data?: {
@@ -633,7 +633,7 @@ export async function approvePayment(paymentId: number, data?: {
message: string;
payment: Payment;
}> {
return fetchAPI(`/v1/billing/admin/${paymentId}/approve_payment/`, {
return fetchAPI(`/v1/admin/billing/${paymentId}/approve_payment/`, {
method: 'POST',
body: JSON.stringify(data || {}),
});
@@ -646,7 +646,7 @@ export async function rejectPayment(paymentId: number, data: {
message: string;
payment: Payment;
}> {
return fetchAPI(`/v1/billing/admin/${paymentId}/reject_payment/`, {
return fetchAPI(`/v1/admin/billing/${paymentId}/reject_payment/`, {
method: 'POST',
body: JSON.stringify(data),
});