Skip to content

Commit

Permalink
Update RandomNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
dnaranjo89 committed Aug 28, 2024
1 parent bc6ddb6 commit 66f61cc
Show file tree
Hide file tree
Showing 7 changed files with 239 additions and 25 deletions.
2 changes: 2 additions & 0 deletions sdk/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ src/models/Coin.ts
src/models/CoinResult.ts
src/models/CreateGroupsPayload.ts
src/models/CreateLetterPayload.ts
src/models/CreateRandomNumberPayload.ts
src/models/DrawMetadata.ts
src/models/DrawReTossPayload.ts
src/models/DrawTossPayload.ts
Expand All @@ -53,6 +54,7 @@ src/models/Raffle.ts
src/models/RaffleResult.ts
src/models/RaffleResultAllOfValue.ts
src/models/RandomNumber.ts
src/models/RandomNumberFields.ts
src/models/RandomNumberResult.ts
src/models/RedeemPromoCode.ts
src/models/SecretSanta.ts
Expand Down
15 changes: 9 additions & 6 deletions sdk/src/apis/RandomNumberApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@

import * as runtime from '../runtime';
import type {
CreateRandomNumberPayload,
DrawTossPayload,
RandomNumber,
RandomNumberResult,
} from '../models/index';
import {
CreateRandomNumberPayloadFromJSON,
CreateRandomNumberPayloadToJSON,
DrawTossPayloadFromJSON,
DrawTossPayloadToJSON,
RandomNumberFromJSON,
Expand All @@ -29,7 +32,7 @@ import {
} from '../models/index';

export interface RandomNumberCreateRequest {
randomNumber: RandomNumber;
createRandomNumberPayload: CreateRandomNumberPayload;
}

export interface RandomNumberReadRequest {
Expand All @@ -50,7 +53,7 @@ export interface RandomNumberTossRequest {
export interface RandomNumberApiInterface {
/**
*
* @param {RandomNumber} randomNumber
* @param {CreateRandomNumberPayload} createRandomNumberPayload
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof RandomNumberApiInterface
Expand Down Expand Up @@ -98,10 +101,10 @@ export class RandomNumberApi extends runtime.BaseAPI implements RandomNumberApiI
/**
*/
async randomNumberCreateRaw(requestParameters: RandomNumberCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<RandomNumber>> {
if (requestParameters['randomNumber'] == null) {
if (requestParameters['createRandomNumberPayload'] == null) {
throw new runtime.RequiredError(
'randomNumber',
'Required parameter "randomNumber" was null or undefined when calling randomNumberCreate().'
'createRandomNumberPayload',
'Required parameter "createRandomNumberPayload" was null or undefined when calling randomNumberCreate().'
);
}

Expand All @@ -116,7 +119,7 @@ export class RandomNumberApi extends runtime.BaseAPI implements RandomNumberApiI
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: RandomNumberToJSON(requestParameters['randomNumber']),
body: CreateRandomNumberPayloadToJSON(requestParameters['createRandomNumberPayload']),
}, initOverrides);

return new runtime.JSONApiResponse(response, (jsonValue) => RandomNumberFromJSON(jsonValue));
Expand Down
103 changes: 103 additions & 0 deletions sdk/src/models/CreateRandomNumberPayload.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/* tslint:disable */
/* eslint-disable */
/**
* EAS API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { mapValues } from '../runtime';
import type { DrawMetadata } from './DrawMetadata';
import {
DrawMetadataFromJSON,
DrawMetadataFromJSONTyped,
DrawMetadataToJSON,
} from './DrawMetadata';
import type { BaseFields } from './BaseFields';
import {
BaseFieldsFromJSON,
BaseFieldsFromJSONTyped,
BaseFieldsToJSON,
} from './BaseFields';

/**
*
* @export
* @interface CreateRandomNumberPayload
*/
export interface CreateRandomNumberPayload extends BaseFields {
/**
*
* @type {number}
* @memberof CreateRandomNumberPayload
*/
rangeMin: number;
/**
*
* @type {number}
* @memberof CreateRandomNumberPayload
*/
rangeMax: number;
/**
*
* @type {number}
* @memberof CreateRandomNumberPayload
*/
numberOfResults: number;
/**
*
* @type {boolean}
* @memberof CreateRandomNumberPayload
*/
allowRepeatedResults: boolean;
}



/**
* Check if a given object implements the CreateRandomNumberPayload interface.
*/
export function instanceOfCreateRandomNumberPayload(value: object): value is CreateRandomNumberPayload {
if (!('rangeMin' in value) || value['rangeMin'] === undefined) return false;
if (!('rangeMax' in value) || value['rangeMax'] === undefined) return false;
if (!('numberOfResults' in value) || value['numberOfResults'] === undefined) return false;
if (!('allowRepeatedResults' in value) || value['allowRepeatedResults'] === undefined) return false;
return true;
}

export function CreateRandomNumberPayloadFromJSON(json: any): CreateRandomNumberPayload {
return CreateRandomNumberPayloadFromJSONTyped(json, false);
}

export function CreateRandomNumberPayloadFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateRandomNumberPayload {
if (json == null) {
return json;
}
return {
...BaseFieldsFromJSONTyped(json, ignoreDiscriminator),
'rangeMin': json['range_min'],
'rangeMax': json['range_max'],
'numberOfResults': json['number_of_results'],
'allowRepeatedResults': json['allow_repeated_results'],
};
}

export function CreateRandomNumberPayloadToJSON(value?: CreateRandomNumberPayload | null): any {
if (value == null) {
return value;
}
return {
...BaseFieldsToJSON(value),
'range_min': value['rangeMin'],
'range_max': value['rangeMax'],
'number_of_results': value['numberOfResults'],
'allow_repeated_results': value['allowRepeatedResults'],
};
}

15 changes: 9 additions & 6 deletions sdk/src/models/RandomNumber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,19 @@ export interface RandomNumber extends BaseDraw {
* @type {number}
* @memberof RandomNumber
*/
numberOfResults?: number;
numberOfResults: number;
/**
*
* @type {boolean}
* @memberof RandomNumber
*/
allowRepeatedResults?: boolean;
allowRepeatedResults: boolean;
/**
*
* @type {Array<RandomNumberResult>}
* @memberof RandomNumber
*/
readonly results?: Array<RandomNumberResult>;
readonly results: Array<RandomNumberResult>;
}


Expand All @@ -78,6 +78,9 @@ export interface RandomNumber extends BaseDraw {
export function instanceOfRandomNumber(value: object): value is RandomNumber {
if (!('rangeMin' in value) || value['rangeMin'] === undefined) return false;
if (!('rangeMax' in value) || value['rangeMax'] === undefined) return false;
if (!('numberOfResults' in value) || value['numberOfResults'] === undefined) return false;
if (!('allowRepeatedResults' in value) || value['allowRepeatedResults'] === undefined) return false;
if (!('results' in value) || value['results'] === undefined) return false;
return true;
}

Expand All @@ -93,9 +96,9 @@ export function RandomNumberFromJSONTyped(json: any, ignoreDiscriminator: boolea
...BaseDrawFromJSONTyped(json, ignoreDiscriminator),
'rangeMin': json['range_min'],
'rangeMax': json['range_max'],
'numberOfResults': json['number_of_results'] == null ? undefined : json['number_of_results'],
'allowRepeatedResults': json['allow_repeated_results'] == null ? undefined : json['allow_repeated_results'],
'results': json['results'] == null ? undefined : ((json['results'] as Array<any>).map(RandomNumberResultFromJSON)),
'numberOfResults': json['number_of_results'],
'allowRepeatedResults': json['allow_repeated_results'],
'results': ((json['results'] as Array<any>).map(RandomNumberResultFromJSON)),
};
}

Expand Down
88 changes: 88 additions & 0 deletions sdk/src/models/RandomNumberFields.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/* tslint:disable */
/* eslint-disable */
/**
* EAS API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { mapValues } from '../runtime';
/**
*
* @export
* @interface RandomNumberFields
*/
export interface RandomNumberFields {
/**
*
* @type {number}
* @memberof RandomNumberFields
*/
rangeMin: number;
/**
*
* @type {number}
* @memberof RandomNumberFields
*/
rangeMax: number;
/**
*
* @type {number}
* @memberof RandomNumberFields
*/
numberOfResults: number;
/**
*
* @type {boolean}
* @memberof RandomNumberFields
*/
allowRepeatedResults: boolean;
}

/**
* Check if a given object implements the RandomNumberFields interface.
*/
export function instanceOfRandomNumberFields(value: object): value is RandomNumberFields {
if (!('rangeMin' in value) || value['rangeMin'] === undefined) return false;
if (!('rangeMax' in value) || value['rangeMax'] === undefined) return false;
if (!('numberOfResults' in value) || value['numberOfResults'] === undefined) return false;
if (!('allowRepeatedResults' in value) || value['allowRepeatedResults'] === undefined) return false;
return true;
}

export function RandomNumberFieldsFromJSON(json: any): RandomNumberFields {
return RandomNumberFieldsFromJSONTyped(json, false);
}

export function RandomNumberFieldsFromJSONTyped(json: any, ignoreDiscriminator: boolean): RandomNumberFields {
if (json == null) {
return json;
}
return {

'rangeMin': json['range_min'],
'rangeMax': json['range_max'],
'numberOfResults': json['number_of_results'],
'allowRepeatedResults': json['allow_repeated_results'],
};
}

export function RandomNumberFieldsToJSON(value?: RandomNumberFields | null): any {
if (value == null) {
return value;
}
return {

'range_min': value['rangeMin'],
'range_max': value['rangeMax'],
'number_of_results': value['numberOfResults'],
'allow_repeated_results': value['allowRepeatedResults'],
};
}

2 changes: 2 additions & 0 deletions sdk/src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export * from './Coin';
export * from './CoinResult';
export * from './CreateGroupsPayload';
export * from './CreateLetterPayload';
export * from './CreateRandomNumberPayload';
export * from './DrawMetadata';
export * from './DrawReTossPayload';
export * from './DrawTossPayload';
Expand All @@ -34,6 +35,7 @@ export * from './Raffle';
export * from './RaffleResult';
export * from './RaffleResultAllOfValue';
export * from './RandomNumber';
export * from './RandomNumberFields';
export * from './RandomNumberResult';
export * from './RedeemPromoCode';
export * from './SecretSanta';
Expand Down
39 changes: 26 additions & 13 deletions swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/RandomNumber'
$ref: '#/components/schemas/CreateRandomNumberPayload'
required: true
parameters: []
'/random_number/{id}/':
Expand Down Expand Up @@ -1243,21 +1243,11 @@ components:
RandomNumber:
allOf:
- $ref: '#/components/schemas/BaseDraw'
- $ref: '#/components/schemas/RandomNumberFields'
- type: object
required:
- range_min
- range_max
- results
properties:
range_min:
type: integer
range_max:
type: integer
number_of_results:
type: integer
default: 1
allow_repeated_results:
type: boolean
default: true
results:
type: array
items:
Expand All @@ -1276,10 +1266,33 @@ components:
allow_repeated_results:
type: boolean
default: true
RandomNumberFields:
allOf:
- type: object
required:
- range_min
- range_max
- number_of_results
- allow_repeated_results
properties:
range_min:
type: integer
range_max:
type: integer
number_of_results:
type: integer
default: 1
allow_repeated_results:
type: boolean
default: true
CreateLetterPayload:
allOf:
- $ref: '#/components/schemas/BaseFields'
- $ref: '#/components/schemas/LetterFields'
CreateRandomNumberPayload:
allOf:
- $ref: '#/components/schemas/BaseFields'
- $ref: '#/components/schemas/RandomNumberFields'
Letter:
allOf:
- $ref: '#/components/schemas/BaseDraw'
Expand Down

0 comments on commit 66f61cc

Please sign in to comment.