File

src/modules/http/builder/http-request-builder.intf.ts

Description

Stark Http Request Builder Builder to construct an StarkRequest that can be executed by the StarkHttpService

Index

Methods

Methods

create
create(item: T, params?: StarkHttpCreateRequestParams)

Gets an instance of a suitable builder to perform a Create request

Parameters :
Name Type Optional Description
item T No
  • Item to be sent in the Create request
params StarkHttpCreateRequestParams Yes
  • Object containing additional parameters to construct the request to be sent

StarkHttpCreateRequestBuilder instance

delete
delete(item: T, params?: StarkHttpDeleteRequestParams)

Gets an instance of a suitable builder to perform a Delete request

Parameters :
Name Type Optional Description
item T No
  • Item to be sent in the Delete request
params StarkHttpDeleteRequestParams Yes
  • Object containing additional parameters to construct the request to be sent

StarkHttpDeleteRequestBuilder instance

get
get(uuid: string, params?: StarkHttpGetRequestParams)

Gets an instance of a suitable builder to perform a Get request

Parameters :
Name Type Optional Description
uuid string No
  • UUID of the item to be fetched by the Get request
params StarkHttpGetRequestParams Yes
  • Object containing additional parameters to construct the request to be sent

StarkHttpGetRequestBuilder instance

getCollection
getCollection(limit: number, offset: number, params?: StarkHttpGetCollectionRequestParams)

Gets an instance of a suitable builder to perform a GetCollection request

Parameters :
Name Type Optional Description
limit number No
  • Maximum number of items to return
offset number No
  • Index at which to begin the extraction of the collection to be returned
params StarkHttpGetCollectionRequestParams Yes
  • Object containing additional parameters to construct the request to be sent

StarkHttpGetCollectionRequestBuilder instance

search
search(criteria: literal type | object, limit: number, offset: number, params?: StarkHttpSearchRequestParams)

Gets an instance of a suitable builder to perform a Search request. Similar to a GetCollection request but the search parameters are sent in the request body payload whereas in the GetCollection request they are sent as URL query parameters

Parameters :
Name Type Optional Description
criteria literal type | object No
  • Object containing the search criteria to be sent in the request body payload
limit number No
  • Maximum number of items to return
offset number No
  • Index at which to begin the extraction of the collection to be returned
params StarkHttpSearchRequestParams Yes
  • Object containing additional parameters to construct the request to be sent

StarkHttpSearchRequestBuilder instance

update
update(item: T, params?: StarkHttpUpdateRequestParams)

Gets an instance of a suitable builder to perform an Update request

Parameters :
Name Type Optional Description
item T No
  • Item to be sent in the Update request
params StarkHttpUpdateRequestParams Yes
  • Object containing additional parameters to construct the request to be sent

StarkHttpUpdateRequestBuilder instance

import { StarkHttpCreateRequestBuilder } from "./http-create-request-builder.intf";
import { StarkHttpDeleteRequestBuilder } from "./http-delete-request-builder.intf";
import { StarkHttpGetRequestBuilder } from "./http-get-request-builder.intf";
import { StarkHttpGetCollectionRequestBuilder } from "./http-get-collection-request-builder.intf";
import { StarkHttpSearchRequestBuilder } from "./http-search-request-builder.intf";
import { StarkHttpUpdateRequestBuilder } from "./http-update-request-builder.intf";
import {
	StarkHttpCreateRequestParams,
	StarkHttpDeleteRequestParams,
	StarkHttpGetCollectionRequestParams,
	StarkHttpGetRequestParams,
	StarkHttpSearchRequestParams,
	StarkHttpUpdateRequestParams
} from "./http-request-parameters.intf";
import { StarkResource } from "../entities/resource.entity.intf";

/**
 * Stark Http Request Builder
 * Builder to construct an StarkRequest that can be executed by the StarkHttpService
 */
export interface StarkHttpRequestBuilder<T extends StarkResource> {
	/**
	 * Gets an instance of a suitable builder to perform a Create request
	 * @param item - Item to be sent in the Create request
	 * @param params - Object containing additional parameters to construct the request to be sent
	 * @returns StarkHttpCreateRequestBuilder instance
	 */
	create(item: T, params?: StarkHttpCreateRequestParams): StarkHttpCreateRequestBuilder<T>;

	/**
	 * Gets an instance of a suitable builder to perform an Update request
	 * @param item - Item to be sent in the Update request
	 * @param params - Object containing additional parameters to construct the request to be sent
	 * @returns StarkHttpUpdateRequestBuilder instance
	 */
	update(item: T, params?: StarkHttpUpdateRequestParams): StarkHttpUpdateRequestBuilder<T>;

	/**
	 * Gets an instance of a suitable builder to perform a Delete request
	 * @param item - Item to be sent in the Delete request
	 * @param params - Object containing additional parameters to construct the request to be sent
	 * @returns StarkHttpDeleteRequestBuilder instance
	 */
	delete(item: T, params?: StarkHttpDeleteRequestParams): StarkHttpDeleteRequestBuilder<T>;

	/**
	 * Gets an instance of a suitable builder to perform a Get request
	 * @param uuid - UUID of the item to be fetched by the Get request
	 * @param params - Object containing additional parameters to construct the request to be sent
	 * @returns StarkHttpGetRequestBuilder instance
	 */
	get(uuid: string, params?: StarkHttpGetRequestParams): StarkHttpGetRequestBuilder<T>;

	/**
	 * Gets an instance of a suitable builder to perform a GetCollection request
	 * @param limit - Maximum number of items to return
	 * @param offset - Index at which to begin the extraction of the collection to be returned
	 * @param params - Object containing additional parameters to construct the request to be sent
	 * @returns StarkHttpGetCollectionRequestBuilder instance
	 */
	getCollection(limit: number, offset: number, params?: StarkHttpGetCollectionRequestParams): StarkHttpGetCollectionRequestBuilder<T>;

	/**
	 * Gets an instance of a suitable builder to perform a Search request. Similar to a GetCollection request but the search
	 * parameters are sent in the request body payload whereas in the GetCollection request they are sent as URL query parameters
	 * @param criteria - Object containing the search criteria to be sent in the request body payload
	 * @param limit - Maximum number of items to return
	 * @param offset - Index at which to begin the extraction of the collection to be returned
	 * @param params - Object containing additional parameters to construct the request to be sent
	 * @returns StarkHttpSearchRequestBuilder instance
	 */
	search(
		criteria: { [param: string]: string } | object,
		limit: number,
		offset: number,
		params?: StarkHttpSearchRequestParams
	): StarkHttpSearchRequestBuilder<T>;
}

results matching ""

    No results matching ""