Skip to content

Commit

Permalink
Move letter draw to TS
Browse files Browse the repository at this point in the history
  • Loading branch information
dnaranjo89 committed Aug 18, 2024
1 parent b517bd5 commit 55f4f8c
Show file tree
Hide file tree
Showing 8 changed files with 281 additions and 25 deletions.
3 changes: 3 additions & 0 deletions sdk/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,19 @@ src/models/BaseResult.ts
src/models/Coin.ts
src/models/CoinResult.ts
src/models/CreateGroupsPayload.ts
src/models/CreateLetterPayload.ts
src/models/DrawMetadata.ts
src/models/DrawReTossPayload.ts
src/models/DrawTossPayload.ts
src/models/Groups.ts
src/models/GroupsFields.ts
src/models/GroupsResult.ts
src/models/Instagram.ts
src/models/InstagramResult.ts
src/models/InstagramResultAllOfComment.ts
src/models/InstagramResultAllOfValue.ts
src/models/Letter.ts
src/models/LetterFields.ts
src/models/LetterResult.ts
src/models/Link.ts
src/models/LinkResult.ts
Expand Down
15 changes: 9 additions & 6 deletions sdk/src/apis/LetterApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@

import * as runtime from '../runtime';
import type {
CreateLetterPayload,
DrawTossPayload,
Letter,
LetterResult,
} from '../models/index';
import {
CreateLetterPayloadFromJSON,
CreateLetterPayloadToJSON,
DrawTossPayloadFromJSON,
DrawTossPayloadToJSON,
LetterFromJSON,
Expand All @@ -29,7 +32,7 @@ import {
} from '../models/index';

export interface LetterCreateRequest {
letter: Letter;
createLetterPayload: CreateLetterPayload;
}

export interface LetterReadRequest {
Expand All @@ -50,7 +53,7 @@ export interface LetterTossRequest {
export interface LetterApiInterface {
/**
*
* @param {Letter} letter
* @param {CreateLetterPayload} createLetterPayload
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof LetterApiInterface
Expand Down Expand Up @@ -98,10 +101,10 @@ export class LetterApi extends runtime.BaseAPI implements LetterApiInterface {
/**
*/
async letterCreateRaw(requestParameters: LetterCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Letter>> {
if (requestParameters['letter'] == null) {
if (requestParameters['createLetterPayload'] == null) {
throw new runtime.RequiredError(
'letter',
'Required parameter "letter" was null or undefined when calling letterCreate().'
'createLetterPayload',
'Required parameter "createLetterPayload" was null or undefined when calling letterCreate().'
);
}

Expand All @@ -116,7 +119,7 @@ export class LetterApi extends runtime.BaseAPI implements LetterApiInterface {
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: LetterToJSON(requestParameters['letter']),
body: CreateLetterPayloadToJSON(requestParameters['createLetterPayload']),
}, initOverrides);

return new runtime.JSONApiResponse(response, (jsonValue) => LetterFromJSON(jsonValue));
Expand Down
85 changes: 85 additions & 0 deletions sdk/src/models/CreateLetterPayload.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/* 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 CreateLetterPayload
*/
export interface CreateLetterPayload extends BaseFields {
/**
*
* @type {number}
* @memberof CreateLetterPayload
*/
numberOfResults: number;
/**
*
* @type {boolean}
* @memberof CreateLetterPayload
*/
allowRepeatedResults: boolean;
}



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

export function CreateLetterPayloadFromJSON(json: any): CreateLetterPayload {
return CreateLetterPayloadFromJSONTyped(json, false);
}

export function CreateLetterPayloadFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateLetterPayload {
if (json == null) {
return json;
}
return {
...BaseFieldsFromJSONTyped(json, ignoreDiscriminator),
'numberOfResults': json['number_of_results'],
'allowRepeatedResults': json['allow_repeated_results'],
};
}

export function CreateLetterPayloadToJSON(value?: CreateLetterPayload | null): any {
if (value == null) {
return value;
}
return {
...BaseFieldsToJSON(value),
'number_of_results': value['numberOfResults'],
'allow_repeated_results': value['allowRepeatedResults'],
};
}

77 changes: 77 additions & 0 deletions sdk/src/models/GroupsFields.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/* 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 { Participant } from './Participant';
import {
ParticipantFromJSON,
ParticipantFromJSONTyped,
ParticipantToJSON,
} from './Participant';

/**
*
* @export
* @interface GroupsFields
*/
export interface GroupsFields {
/**
*
* @type {Array<Participant>}
* @memberof GroupsFields
*/
participants: Array<Participant>;
/**
*
* @type {number}
* @memberof GroupsFields
*/
numberOfGroups: number;
}

/**
* Check if a given object implements the GroupsFields interface.
*/
export function instanceOfGroupsFields(value: object): value is GroupsFields {
if (!('participants' in value) || value['participants'] === undefined) return false;
if (!('numberOfGroups' in value) || value['numberOfGroups'] === undefined) return false;
return true;
}

export function GroupsFieldsFromJSON(json: any): GroupsFields {
return GroupsFieldsFromJSONTyped(json, false);
}

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

'participants': ((json['participants'] as Array<any>).map(ParticipantFromJSON)),
'numberOfGroups': json['number_of_groups'],
};
}

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

'participants': ((value['participants'] as Array<any>).map(ParticipantToJSON)),
'number_of_groups': value['numberOfGroups'],
};
}

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


Expand All @@ -64,6 +64,9 @@ export interface Letter extends BaseDraw {
* Check if a given object implements the Letter interface.
*/
export function instanceOfLetter(value: object): value is Letter {
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 @@ -77,9 +80,9 @@ export function LetterFromJSONTyped(json: any, ignoreDiscriminator: boolean): Le
}
return {
...BaseDrawFromJSONTyped(json, ignoreDiscriminator),
'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(LetterResultFromJSON)),
'numberOfResults': json['number_of_results'],
'allowRepeatedResults': json['allow_repeated_results'],
'results': ((json['results'] as Array<any>).map(LetterResultFromJSON)),
};
}

Expand Down
70 changes: 70 additions & 0 deletions sdk/src/models/LetterFields.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/* 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 LetterFields
*/
export interface LetterFields {
/**
*
* @type {number}
* @memberof LetterFields
*/
numberOfResults: number;
/**
*
* @type {boolean}
* @memberof LetterFields
*/
allowRepeatedResults: boolean;
}

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

export function LetterFieldsFromJSON(json: any): LetterFields {
return LetterFieldsFromJSONTyped(json, false);
}

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

'numberOfResults': json['number_of_results'],
'allowRepeatedResults': json['allow_repeated_results'],
};
}

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

'number_of_results': value['numberOfResults'],
'allow_repeated_results': value['allowRepeatedResults'],
};
}

3 changes: 3 additions & 0 deletions sdk/src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@ export * from './BaseResult';
export * from './Coin';
export * from './CoinResult';
export * from './CreateGroupsPayload';
export * from './CreateLetterPayload';
export * from './DrawMetadata';
export * from './DrawReTossPayload';
export * from './DrawTossPayload';
export * from './Groups';
export * from './GroupsFields';
export * from './GroupsResult';
export * from './Instagram';
export * from './InstagramResult';
export * from './InstagramResultAllOfComment';
export * from './InstagramResultAllOfValue';
export * from './Letter';
export * from './LetterFields';
export * from './LetterResult';
export * from './Link';
export * from './LinkResult';
Expand Down
Loading

0 comments on commit 55f4f8c

Please sign in to comment.