From 2b0b1bc62a3ef1fac3645b12f8395171d0eeeb2b Mon Sep 17 00:00:00 2001 From: Romain Le Cellier Date: Tue, 14 Mar 2023 17:17:20 +0100 Subject: [PATCH] [TO REMOVE] generate api client AFTER --- src/openApiClientJs/gen/index.ts | 6 +++ .../gen/models/EmptyResponse.ts | 7 ++++ .../gen/models/ErrorResponse.ts | 8 ++++ src/openApiClientJs/gen/models/Order.ts | 4 +- .../gen/models/OrderAbortBody.ts | 8 ++++ src/openApiClientJs/gen/models/OrderCreate.ts | 15 ++++++++ .../gen/models/OrderCreateResponse.ts | 38 +++++++++++++++++++ src/openApiClientJs/gen/models/Payment.ts | 11 ++++++ .../gen/services/CertificatesService.ts | 4 +- .../gen/services/OrdersService.ts | 24 ++++++++---- .../gen/services/ProductsService.ts | 5 +++ 11 files changed, 118 insertions(+), 12 deletions(-) create mode 100644 src/openApiClientJs/gen/models/EmptyResponse.ts create mode 100644 src/openApiClientJs/gen/models/ErrorResponse.ts create mode 100644 src/openApiClientJs/gen/models/OrderAbortBody.ts create mode 100644 src/openApiClientJs/gen/models/OrderCreate.ts create mode 100644 src/openApiClientJs/gen/models/OrderCreateResponse.ts create mode 100644 src/openApiClientJs/gen/models/Payment.ts diff --git a/src/openApiClientJs/gen/index.ts b/src/openApiClientJs/gen/index.ts index 1712c23e4..a2142199f 100644 --- a/src/openApiClientJs/gen/index.ts +++ b/src/openApiClientJs/gen/index.ts @@ -16,9 +16,15 @@ export type { CertificationDefinition } from './models/CertificationDefinition'; export type { Course } from './models/Course'; export type { CourseRun } from './models/CourseRun'; export type { CreditCard } from './models/CreditCard'; +export type { EmptyResponse } from './models/EmptyResponse'; export { Enrollment } from './models/Enrollment'; +export type { ErrorResponse } from './models/ErrorResponse'; export { Order } from './models/Order'; +export type { OrderAbortBody } from './models/OrderAbortBody'; +export type { OrderCreate } from './models/OrderCreate'; +export { OrderCreateResponse } from './models/OrderCreateResponse'; export type { Organization } from './models/Organization'; +export type { Payment } from './models/Payment'; export { Product } from './models/Product'; export { AddressesService } from './services/AddressesService'; diff --git a/src/openApiClientJs/gen/models/EmptyResponse.ts b/src/openApiClientJs/gen/models/EmptyResponse.ts new file mode 100644 index 000000000..f4e680967 --- /dev/null +++ b/src/openApiClientJs/gen/models/EmptyResponse.ts @@ -0,0 +1,7 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type EmptyResponse = { +}; + diff --git a/src/openApiClientJs/gen/models/ErrorResponse.ts b/src/openApiClientJs/gen/models/ErrorResponse.ts new file mode 100644 index 000000000..32f898c1b --- /dev/null +++ b/src/openApiClientJs/gen/models/ErrorResponse.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type ErrorResponse = { + details: string; +}; + diff --git a/src/openApiClientJs/gen/models/Order.ts b/src/openApiClientJs/gen/models/Order.ts index 972500d6d..ae5b8e619 100644 --- a/src/openApiClientJs/gen/models/Order.ts +++ b/src/openApiClientJs/gen/models/Order.ts @@ -10,10 +10,10 @@ export type Order = { readonly created_on?: string; readonly certificate?: string; readonly enrollments?: string; - readonly id?: string; + id: string; readonly main_invoice?: string; organization?: string; - readonly owner?: string; + owner: string; readonly total?: number; readonly total_currency?: string; product: string; diff --git a/src/openApiClientJs/gen/models/OrderAbortBody.ts b/src/openApiClientJs/gen/models/OrderAbortBody.ts new file mode 100644 index 000000000..65f8d6708 --- /dev/null +++ b/src/openApiClientJs/gen/models/OrderAbortBody.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type OrderAbortBody = { + payment_id: string; +}; + diff --git a/src/openApiClientJs/gen/models/OrderCreate.ts b/src/openApiClientJs/gen/models/OrderCreate.ts new file mode 100644 index 000000000..107a5c543 --- /dev/null +++ b/src/openApiClientJs/gen/models/OrderCreate.ts @@ -0,0 +1,15 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { Address } from './Address'; + +export type OrderCreate = { + credit_card_id?: string; + course: string; + organization?: string; + owner: string; + product: string; + billing_address?: Address; +}; + diff --git a/src/openApiClientJs/gen/models/OrderCreateResponse.ts b/src/openApiClientJs/gen/models/OrderCreateResponse.ts new file mode 100644 index 000000000..8fec4a574 --- /dev/null +++ b/src/openApiClientJs/gen/models/OrderCreateResponse.ts @@ -0,0 +1,38 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { Payment } from './Payment'; + +export type OrderCreateResponse = { + course: string; + /** + * date and time at which a record was created + */ + readonly created_on?: string; + readonly certificate?: string; + readonly enrollments?: string; + id: string; + readonly main_invoice?: string; + organization?: string; + owner: string; + readonly total?: number; + readonly total_currency?: string; + product: string; + readonly state?: OrderCreateResponse.state; + readonly target_courses?: string; + payment_info?: Payment; +}; + +export namespace OrderCreateResponse { + + export enum state { + PENDING = 'pending', + CANCELED = 'canceled', + FAILED = 'failed', + VALIDATED = 'validated', + } + + +} + diff --git a/src/openApiClientJs/gen/models/Payment.ts b/src/openApiClientJs/gen/models/Payment.ts new file mode 100644 index 000000000..29da59425 --- /dev/null +++ b/src/openApiClientJs/gen/models/Payment.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type Payment = { + payment_id: string; + provider: string; + url: string; + is_paid?: boolean; +}; + diff --git a/src/openApiClientJs/gen/services/CertificatesService.ts b/src/openApiClientJs/gen/services/CertificatesService.ts index a76f1887a..f371b40b0 100644 --- a/src/openApiClientJs/gen/services/CertificatesService.ts +++ b/src/openApiClientJs/gen/services/CertificatesService.ts @@ -76,14 +76,14 @@ export class CertificatesService { /** * Retrieve a certificate through its id if it is owned by the authenticated user. - * @returns Certificate + * @returns binary File Attachment * @throws ApiError */ public certificatesDownload({ id, }: { id: string, - }): CancelablePromise { + }): CancelablePromise { return this.httpRequest.request({ method: 'GET', url: '/certificates/{id}/download/', diff --git a/src/openApiClientJs/gen/services/OrdersService.ts b/src/openApiClientJs/gen/services/OrdersService.ts index e52e1c0fc..3ce2876e0 100644 --- a/src/openApiClientJs/gen/services/OrdersService.ts +++ b/src/openApiClientJs/gen/services/OrdersService.ts @@ -2,6 +2,9 @@ /* tslint:disable */ /* eslint-disable */ import type { Order } from '../models/Order'; +import type { OrderAbortBody } from '../models/OrderAbortBody'; +import type { OrderCreate } from '../models/OrderCreate'; +import type { OrderCreateResponse } from '../models/OrderCreateResponse'; import type { CancelablePromise } from '../core/CancelablePromise'; import type { BaseHttpRequest } from '../core/BaseHttpRequest'; @@ -62,14 +65,14 @@ export class OrdersService { /** * Try to create an order and a related payment if the payment is fee. - * @returns Order + * @returns OrderCreateResponse * @throws ApiError */ public ordersCreate({ data, }: { - data: Order, - }): CancelablePromise { + data: OrderCreate, + }): CancelablePromise { return this.httpRequest.request({ method: 'POST', url: '/orders/', @@ -106,7 +109,7 @@ export class OrdersService { /** * Abort a pending order and the related payment if there is one. - * @returns Order + * @returns void * @throws ApiError */ public ordersAbort({ @@ -114,8 +117,8 @@ export class OrdersService { data, }: { id: string, - data: Order, - }): CancelablePromise { + data: OrderAbortBody, + }): CancelablePromise { return this.httpRequest.request({ method: 'POST', url: '/orders/{id}/abort/', @@ -129,20 +132,25 @@ export class OrdersService { /** * Retrieve an invoice through its reference if it is related to * the order instance and owned by the authenticated user. - * @returns Order + * @returns binary File Attachment * @throws ApiError */ public ordersInvoice({ id, + reference, }: { id: string, - }): CancelablePromise { + reference: string, + }): CancelablePromise { return this.httpRequest.request({ method: 'GET', url: '/orders/{id}/invoice/', path: { 'id': id, }, + query: { + 'reference': reference, + }, }); } diff --git a/src/openApiClientJs/gen/services/ProductsService.ts b/src/openApiClientJs/gen/services/ProductsService.ts index 374f6dde4..90e4c4ea6 100644 --- a/src/openApiClientJs/gen/services/ProductsService.ts +++ b/src/openApiClientJs/gen/services/ProductsService.ts @@ -17,11 +17,13 @@ export class ProductsService { */ public productsRead({ id, + course, }: { /** * primary key for the record as UUID */ id: string, + course: string, }): CancelablePromise { return this.httpRequest.request({ method: 'GET', @@ -29,6 +31,9 @@ export class ProductsService { path: { 'id': id, }, + query: { + 'course': course, + }, }); }