Skip to content

Commit

Permalink
[TO REMOVE] generate api client AFTER
Browse files Browse the repository at this point in the history
  • Loading branch information
rlecellier committed Mar 15, 2023
1 parent 363a050 commit 41f977c
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 12 deletions.
6 changes: 6 additions & 0 deletions src/openApiClientJs/gen/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
7 changes: 7 additions & 0 deletions src/openApiClientJs/gen/models/EmptyResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

export type EmptyResponse = {
};

8 changes: 8 additions & 0 deletions src/openApiClientJs/gen/models/ErrorResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

export type ErrorResponse = {
details: string;
};

4 changes: 2 additions & 2 deletions src/openApiClientJs/gen/models/Order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions src/openApiClientJs/gen/models/OrderAbortBody.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

export type OrderAbortBody = {
payment_id: string;
};

15 changes: 15 additions & 0 deletions src/openApiClientJs/gen/models/OrderCreate.ts
Original file line number Diff line number Diff line change
@@ -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;
};

38 changes: 38 additions & 0 deletions src/openApiClientJs/gen/models/OrderCreateResponse.ts
Original file line number Diff line number Diff line change
@@ -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',
}


}

11 changes: 11 additions & 0 deletions src/openApiClientJs/gen/models/Payment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

export type Payment = {
payment_id: string;
provider: string;
url: string;
is_paid?: boolean;
};

4 changes: 2 additions & 2 deletions src/openApiClientJs/gen/services/CertificatesService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Certificate> {
}): CancelablePromise<Blob> {
return this.httpRequest.request({
method: 'GET',
url: '/certificates/{id}/download/',
Expand Down
24 changes: 16 additions & 8 deletions src/openApiClientJs/gen/services/OrdersService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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<Order> {
data: OrderCreate,
}): CancelablePromise<OrderCreateResponse> {
return this.httpRequest.request({
method: 'POST',
url: '/orders/',
Expand Down Expand Up @@ -106,16 +109,16 @@ export class OrdersService {

/**
* Abort a pending order and the related payment if there is one.
* @returns Order
* @returns void
* @throws ApiError
*/
public ordersAbort({
id,
data,
}: {
id: string,
data: Order,
}): CancelablePromise<Order> {
data: OrderAbortBody,
}): CancelablePromise<void> {
return this.httpRequest.request({
method: 'POST',
url: '/orders/{id}/abort/',
Expand All @@ -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<Order> {
reference: string,
}): CancelablePromise<Blob> {
return this.httpRequest.request({
method: 'GET',
url: '/orders/{id}/invoice/',
path: {
'id': id,
},
query: {
'reference': reference,
},
});
}

Expand Down
5 changes: 5 additions & 0 deletions src/openApiClientJs/gen/services/ProductsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,23 @@ export class ProductsService {
*/
public productsRead({
id,
course,
}: {
/**
* primary key for the record as UUID
*/
id: string,
course: string,
}): CancelablePromise<Product> {
return this.httpRequest.request({
method: 'GET',
url: '/products/{id}/',
path: {
'id': id,
},
query: {
'course': course,
},
});
}

Expand Down

0 comments on commit 41f977c

Please sign in to comment.