diff --git a/src/models/Field.ts b/src/models/Field.ts index a3ac7e9..fc57bf3 100644 --- a/src/models/Field.ts +++ b/src/models/Field.ts @@ -1,15 +1,58 @@ import { FieldStatus } from '../enums/FieldStatus'; import { FieldType } from '../enums/FieldType'; +/** + * @class Field - Represents a Field. + */ export class Field { + /** + * @property {number} id - The id of the Field. + */ public id: number; + + /** + * @property {number} appId - The id of the App that the Field belongs to. + */ public appId: number; + + /** + * @property {number} name - The name of the Field. + */ public name: string; + + /** + * @property {FieldType} type - The type of the Field. + */ public type: FieldType; + + /** + * @property {FieldStatus} status - The status of the Field. + */ public status: FieldStatus; + + /** + * @property {boolean} isRequired - Indicates whether or not the Field is required. + */ public isRequired: boolean; + + /** + * @property {boolean} isUnique - Indicates whether or not the Field is required to be unique. + */ public isUnique: boolean; + /** + * @constructor - Creates a new Field. + * @param {number} id - The id of the Field. + * @param {number} appId - The id of the App that the Field belongs to. + * @param {string} name - The name of the Field. + * @param {string} type - The type of the Field. + * @param {string} status - The status of the Field. + * @param {boolean} isRequired - Indicates whether or not the Field is required. + * @param {boolean} isUnique - Indicates whether or not the Field is required to be unique. + * @returns {Field} - A new Field. + * @throws {Error} - Throws an error if the type is not valid. + * @throws {Error} - Throws an error if the status is not valid. + */ public constructor( id: number, appId: number, diff --git a/src/models/OnspringClient.ts b/src/models/OnspringClient.ts index 2814b5f..bc6fa61 100644 --- a/src/models/OnspringClient.ts +++ b/src/models/OnspringClient.ts @@ -58,8 +58,8 @@ export class OnspringClient { /** * @method getApps - Gets a paged list of apps. - * @param pagingRequest - The paging request that will be used to get the apps. - * @returns - A promise that resolves to an ApiResponse of type GetPagedAppsResponse. + * @param {PagingRequest} pagingRequest - The paging request that will be used to get the apps. + * @returns {Promise>} - A promise that resolves to an ApiResponse of type GetPagedAppsResponse. */ public async getApps( pagingRequest: PagingRequest = new PagingRequest(1, 50) @@ -77,8 +77,8 @@ export class OnspringClient { /** * @method getAppById - Gets an app by its id. - * @param appId - The id of the app to get. - * @returns - A promise that resolves to an ApiResponse of type App. + * @param {number} appId - The id of the app to get. + * @returns {Promise>} - A promise that resolves to an ApiResponse of type App. */ public async getAppById(appId: number): Promise> { const endpoint = EndpointFactory.getAppByIdEndpoint(appId); @@ -94,14 +94,14 @@ export class OnspringClient { /** * @method getAppsByIds - Gets a list of apps by their ids. - * @param getAppsByIds - The ids of the apps to get. - * @returns - A promise that resolves to an ApiResponse of type CollectionResponse. + * @param {number[]} appIds - The ids of the apps to get. + * @returns {Promise>>} - A promise that resolves to an ApiResponse of type CollectionResponse. */ public async getAppsByIds( - getAppsByIds: number[] + appIds: number[] ): Promise>> { const endpoint = EndpointFactory.getAppsByIdsEndpoint(); - const apiResponse = await this.post(endpoint, getAppsByIds); + const apiResponse = await this.post(endpoint, appIds); if (apiResponse.isSuccessful === false) { return apiResponse; @@ -110,6 +110,11 @@ export class OnspringClient { return apiResponse.AsAppCollectionType(); } + /** + * @method getFields - Gets a paged list of fields. + * @param {PagingRequest} pagingRequest - The paging request that will be used to get the fields. + * @returns {Promise>} - A promise that resolves to an ApiResponse of type Field. + */ public async getFieldById(fieldId: number): Promise> { const endpoint = EndpointFactory.getFieldByIdEndpoint(fieldId); const apiResponse = await this.get(endpoint); @@ -137,11 +142,11 @@ export class OnspringClient { } /** - * - * @param endpoint - The endpoint that will be used to make the request. - * @param data - The data that will be sent with the request. - * @param config - The configuration that will be used to make the request. - * @returns - A promise that resolves to an ApiResponse of type T. + * @method post - Makes a POST request to the specified endpoint. + * @param {string} endpoint - The endpoint that will be used to make the request. + * @param {any} data - The data that will be sent with the request. + * @param {AxiosRequestConfig} config - The configuration that will be used to make the request. + * @returns {Promise>} - A promise that resolves to an ApiResponse of type T. */ private async post( endpoint: string,