
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@nestia/fetcher
Advanced tools
npm install --save @nestia/fetcher
@nestia/fetcher
is a fetcher library of Nestia SDK.
When you build an SDK (Software Development Kit) library interacting with remote HTTP server through the @nestia/sdk
, the SDK library would be dependent on this @nestia/fetcher
. Therefore, if you publish the SDK library on the NPM module, you have to add this @nestia/fetcher
in the dependencies
field of the package.json
.
Also, if you're a client developer who've installed an SDK library which has been generated by the @nestia/sdk
, you also need to install this @nestia/fetcher
module. With the IConnection
and HttpError
instances provided by this @nestia/fetcher
, you can enjoy the SDK library much conveniently.
package.json
When you build an SDK library who've been generated by the @nestia/sdk
, you have to add this @nestia/fetcher
in the dependencies
field of the package.json
. If your project had installed the @nestia/sdk
, you can write the dependencies
' property by writing the npx nestia dependencies
command on your console.
{
"name": "payments-server-api",
"dependencies": {
"typia": "^3.4.9",
"@nestia/fetcher": "^1.0.0"
}
}
When you open a source file generated by the @nestia/sdk
, you can find the SDK library is importing this @nestia/fetcher
module in every functional
files. Therefore, I repeat that you have to put this @nestia/fetcher
down into the dependencies
field of the package.json
.
import { Fetcher, IConnection, Primitive } from "@nestia/fetcher";
/**
* 결제 내역 발행하기.
*
* @param connection connection information
* @param input 결제 내역 입력 정보
* @returns 결제 내역
*
* @nestia Generated by Nestia - https://github.com/samchon/nestia
* @controller PaymentHistoriesController.store()
* @path POST /histories
*/
export function store
(
connection: IConnection,
input: Primitive<store.Input>
): Promise<store.Output>
{
return Fetcher.fetch
(
connection,
store.CONFIG,
store.METHOD,
store.path(),
input
);
}
export namespace store
{
export type Input = Primitive<IPaymentHistory.IStore>;
export type Output = Primitive<IPaymentHistory>;
export const METHOD = "POST" as const;
export const PATH: string = "/histories";
export const CONFIG: IConnection.IEncrypted = {
input_encrypted: true,
output_encrypted: true,
};
export function path(): string
{
return `/histories`;
}
}
After you've published the SDK library and let client developers to install the SDK library, the client developers would import this @nestia/fetcher
module, too. They would utilize the IConnection
and HttpError
instances like below.
import payments from "payments-server-api";
import { IPaymentHistory } from "payments-server-api/lib/structures/IPaymentHistory";
import { IConnection, HttpError } from "@nestia/fetcher";
export async function main(): Promise<void>
{
// CONNECTION INFO OF THE REMOTE HTTP SERVER
const connection: IConnection = {
host: "http://payments.somewhere.com",
encryption: {
key: "SqwHmmXm1fZteI3URPtoyBWFJDMQ7FBQ",
iv: "9eSfjygAClnE1JJs"
}
};
try
{
const input: IPaymentHistory.IStore = { ...SOME_DATA };
const history: IPaymentHistory = await payments.functional.histories.store
(
connection,
input
);
}
catch (exp)
{
// HTTP-ERRROR
if (exp instanceof HttpError)
console.log(exp);
}
}
FAQs
Fetcher library of Nestia SDK
The npm package @nestia/fetcher receives a total of 9,006 weekly downloads. As such, @nestia/fetcher popularity was classified as popular.
We found that @nestia/fetcher demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.