Skip to content

Commit

Permalink
v0.2.0: rename giin πŸ¦„ to hera πŸ‘©πŸΌ (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuong Duy Nguyen authored Jul 13, 2020
1 parent bb1f215 commit cb8c638
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 40 deletions.
33 changes: 15 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
# giin
# hera

πŸ¦„ Simple and lightweight GraphQL client.
πŸ‘©πŸΌβ€πŸ’» Simple and lightweight GraphQL client.

[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg)](#contributors)
[![Build Status](https://travis-ci.com/103cuong/giin.svg?branch=master)](https://travis-ci.com/103cuong/giin)
![npm](https://img.shields.io/npm/v/giin.svg)
![david](https://img.shields.io/david/103cuong/giin.svg)
[![Hits-of-Code](https://hitsofcode.com/github/103cuong/giin)](https://hitsofcode.com/view/github/103cuong/giin)
[![GitHub](https://img.shields.io/github/license/103cuong/giin.svg)](https://github.com/103cuong/giin/blob/master/LICENSE)
[![Build Status](https://travis-ci.com/103cuong/hera.svg?branch=master)](https://travis-ci.com/103cuong/hera)
![npm](https://img.shields.io/npm/v/hera-js.svg)
![david](https://img.shields.io/david/103cuong/hera.svg)
[![Hits-of-Code](https://hitsofcode.com/github/103cuong/hera)](https://hitsofcode.com/view/github/103cuong/hera)
[![GitHub](https://img.shields.io/github/license/103cuong/hera.svg)](https://github.com/103cuong/hera/blob/master/LICENSE)

## Installation

```sh
yarn add giin
# or
npm install -s giin
yarn add hera-js
```

## Usage

```ts
import { giin } from 'giin';
// const { giin } = require('giin');
import { hera } from 'hera-js';

giin({
hera({
option: {
url: 'https://example.com'
},
Expand All @@ -44,10 +41,10 @@ giin({

## πŸ‘» Special 🚧

giin allows passing parameters as objects.
hera allows passing parameters as objects.

```ts
giin({
hera({
option: {
url: 'https://example.com'
},
Expand All @@ -65,7 +62,7 @@ giin({
variables: {
info: {
name: 'Cuong Duy Nguyen',
age: 21,
age: 22,
address: 'Ho Chi Minh',
job: 'Software Engineer'
}
Expand All @@ -83,7 +80,7 @@ giin({
url: '/example',
// `headers` are custom headers to be sent
headers: {
token: 'e3ey3yeu3yeu3yeu3y',
token: 'Fv0761DZcunUr0dKBc4oo5k55jJchwqu',
'Content-Type': 'application/json'
}
}
Expand Down Expand Up @@ -151,7 +148,7 @@ variables: {

## Contributors

[![](https://sourcerer.io/fame/103cuong/103cuong/giin/images/0)](https://sourcerer.io/fame/103cuong/103cuong/giin/links/0)[![](https://sourcerer.io/fame/103cuong/103cuong/giin/images/1)](https://sourcerer.io/fame/103cuong/103cuong/giin/links/1)[![](https://sourcerer.io/fame/103cuong/103cuong/giin/images/2)](https://sourcerer.io/fame/103cuong/103cuong/giin/links/2)[![](https://sourcerer.io/fame/103cuong/103cuong/giin/images/3)](https://sourcerer.io/fame/103cuong/103cuong/giin/links/3)[![](https://sourcerer.io/fame/103cuong/103cuong/giin/images/4)](https://sourcerer.io/fame/103cuong/103cuong/giin/links/4)[![](https://sourcerer.io/fame/103cuong/103cuong/giin/images/5)](https://sourcerer.io/fame/103cuong/103cuong/giin/links/5)[![](https://sourcerer.io/fame/103cuong/103cuong/giin/images/6)](https://sourcerer.io/fame/103cuong/103cuong/giin/links/6)[![](https://sourcerer.io/fame/103cuong/103cuong/giin/images/7)](https://sourcerer.io/fame/103cuong/103cuong/giin/links/7)
[![](https://sourcerer.io/fame/103cuong/103cuong/hera/images/0)](https://sourcerer.io/fame/103cuong/103cuong/hera/links/0)[![](https://sourcerer.io/fame/103cuong/103cuong/hera/images/1)](https://sourcerer.io/fame/103cuong/103cuong/hera/links/1)[![](https://sourcerer.io/fame/103cuong/103cuong/hera/images/2)](https://sourcerer.io/fame/103cuong/103cuong/hera/links/2)[![](https://sourcerer.io/fame/103cuong/103cuong/hera/images/3)](https://sourcerer.io/fame/103cuong/103cuong/hera/links/3)[![](https://sourcerer.io/fame/103cuong/103cuong/hera/images/4)](https://sourcerer.io/fame/103cuong/103cuong/hera/links/4)[![](https://sourcerer.io/fame/103cuong/103cuong/hera/images/5)](https://sourcerer.io/fame/103cuong/103cuong/hera/links/5)[![](https://sourcerer.io/fame/103cuong/103cuong/hera/images/6)](https://sourcerer.io/fame/103cuong/103cuong/hera/links/6)[![](https://sourcerer.io/fame/103cuong/103cuong/hera/images/7)](https://sourcerer.io/fame/103cuong/103cuong/hera/links/7)

## License

Expand Down
6 changes: 3 additions & 3 deletions __tests__/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { giin } from '../src';
import { hera } from '../src';

test('giin Test', async() => {
const data = await giin({
test('hera test', async() => {
const data = await hera({
option: {
url: 'https://graphqlzero.almansi.me/api'
},
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "giin",
"version": "0.1.3",
"description": "πŸ¦„ Simple and lightweight GraphQL client.",
"name": "hera-js",
"version": "0.2.0",
"description": "πŸ‘©πŸΌβ€πŸ’» Simple and lightweight GraphQL client.",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"repository": "https://github.com/103cuong/giin.git",
"repository": "https://github.com/103cuong/hera.git",
"author": "Cuong Duy Nguyen",
"keywords": [
"giin",
"hera",
"hera-js",
"graphql-client",
"graphql-request",
"graphql"
Expand Down
26 changes: 13 additions & 13 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// tslint:disable
import axios, { AxiosResponse, AxiosRequestConfig } from 'axios';

function formatVariables(variables: any): any {
Expand All @@ -20,22 +19,23 @@ interface Option {
headers?: AxiosRequestConfig['headers'];
}

export function giin({
const hera = ({
query,
variables,
option,
}: {
query: string;
variables?: any;
option: Option;
}): Promise<any> {
return axios.post(
option.url,
{
query: formatQuery(query, variables),
},
{
headers: option.headers,
},
).then((res: AxiosResponse) => res.data.data);
}
}): Promise<any> => axios.post(
option.url,
{
query: formatQuery(query, variables),
},
{
headers: option.headers,
},
)
.then((res: AxiosResponse) => res.data.data);

export { hera };
5 changes: 4 additions & 1 deletion tslint.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"extends": ["tslint:recommended", "tslint-config-prettier"],
"rules": {
"no-console": false
"no-console": false,
"ordered-imports": false,
"forin": false,
"interface-name": [true, "never-prefix"]
}
}

0 comments on commit cb8c638

Please sign in to comment.