Skip to content

Commit 764fc15

Browse files
committed
📝 Rascunho do README
1 parent 03f7920 commit 764fc15

File tree

2 files changed

+166
-48
lines changed

2 files changed

+166
-48
lines changed

README.md

Lines changed: 156 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<div align="center">
22
<a target="_blank" href="https://fieldcontrol.com.br/"><img src=".github/static/cover.jpg" alt="FieldControl Cover" height="400px"></a>
3-
<div><code>npm install FieldControl --save</code></div>
3+
<br>
44
<br>
55
<p>
66
:cloud: Node.js bindings for the Field Control API - <a target="_blank" href="https://developers.fieldcontrol.com.br/">https://developers.fieldcontrol.com.br/</a>
77
</p>
8+
<div><code>npm install fieldcontrol --save</code></div>
89
<p>
910

1011
![Field Control ♥](https://img.shields.io/badge/Field%20Control-%20%20%20%20%20%20♥-blue.svg)
@@ -14,28 +15,28 @@
1415

1516
</p>
1617
<small>
17-
Built with by
18+
Built with 💙 by
1819
<a href="https://github.com/FieldControl">FieldControl</a> and
1920
<a href="https://github.com/FieldControl/contaazul/graphs/contributors">contributors</a> - <a href="https://fieldcontrol.com.br/vaga-para-desenvolvedor.html?utm_source=github&utm_medium=opensource&utm_campaign=carchost-node">Estamos contratando!</a>
2021
</small>
2122
</div>
2223

2324
---
2425

25-
## Installation
26+
## Instalação
2627

2728
This client is intended for server side use only.
2829

2930
```
30-
npm install FieldControl --save
31+
npm install fieldcontrol --save
3132
```
3233

3334
<div align="center">💙</div>
3435

35-
## Usage
36+
## Uso
3637

3738
```js
38-
const FieldControl = require('FieldControl')
39+
const FieldControl = require('fieldcontrol')
3940
const client = new FieldControl({
4041
apiKey: 'ssssssssssshhhhhhhhhhhh:x~'
4142
})
@@ -44,64 +45,171 @@ const client = new FieldControl({
4445
<div align="center">💙</div>
4546

4647
### Resources
47-
- [Employees](#employees)
48-
- [Services](#services)
49-
- [Tickets](#tickets)
48+
- [Clientes](#clientes)
49+
- [Colaboradores](#colaboradores)
50+
- [Tipos de atividades](#tipos-de-atividade)
51+
- [Solicitação de serviço](#solicita--o-de-servi-o)
52+
53+
### Clientes
54+
55+
Clientes (customers) são os consumidores finais dos serviços prestados (tipos de atividades), seja ele uma pessoa física ou jurídica.
56+
57+
```js
58+
// Criar um novo cliente
59+
const response = await client.customers.create({
60+
name: 'Luiz Freneda',
61+
code: '05e67c054594',
62+
documentNumber: '27032236881',
63+
address: {
64+
zipCode: '15085480',
65+
street: 'Rua dos Pinheiros',
66+
number: '383',
67+
neighborhood: 'Pinheiros',
68+
complement: 'Edificio Alamac',
69+
city: 'São Paulo',
70+
state: 'SP',
71+
coords: {
72+
latitude: -23.565249,
73+
longitude: -46.681838
74+
}
75+
}
76+
})
77+
```
5078

51-
### Employees
79+
```js
80+
// Recuperar um cliente por id
81+
const response = await client.customers.get('MTY0MTU6MjI5MTU=')
82+
```
5283

5384
```js
54-
// Get an employee
85+
// Listar clientes
86+
const response = await client.customers.list({
87+
filter: {
88+
name: 'Luiz'
89+
},
90+
pagination: {
91+
limit: 1,
92+
offset: 2
93+
}
94+
})
95+
```
96+
<div align="right">
97+
<a href="https://github.com/FieldControl/carchost-node/blob/master/test/resources/customer.spec.js" target="_blank">see tests</a> - <a href="https://developers.fieldcontrol.com.br/#clientes" target="_blank">see docs</a>
98+
</div>
99+
100+
<div align="center">💙</div>
101+
102+
### Colaboradores
103+
104+
Colaboradores (employees) são os profissionais que trabalham externamente usando o app Field Control.
105+
106+
```js
107+
// Recuperar um colaborador por id
55108
const response = await client.employees.get('MTY1NDk6MjI5MTU=')
56-
// {
57-
// "status": 200,
58-
// "data": {
59-
// "id": "MTY0MTU6MjI5MTU=",
60-
// "name": "Mauro Garcia",
61-
// "avatarUrl": null
62-
// }
63-
// }
64109
```
65110

66111
```js
67-
// List employees
112+
// Listar colaboradores
68113
const response = await client.employees.list({
69-
pagination: {
70-
limit: 10,
71-
offset: 0
72-
}
114+
pagination: {
115+
limit: 10,
116+
offset: 0
117+
}
73118
})
74-
// {
75-
// "status": 200,
76-
// "data": {
77-
// "items": [
78-
// {
79-
// "id": "MTY0MTU6MjI5MTU=",
80-
// "name": "Mauro Garcia",
81-
// "avatarUrl": null
82-
// },
83-
// {
84-
// "id": "MTY1NDk6MjI5MTU=",
85-
// "name": "Renan Valentin",
86-
// "avatarUrl": null
87-
// },
88-
// {
89-
// "id": "MTY1NTU6MjI5MTU=",
90-
// "name": "Felipe Zini",
91-
// "avatarUrl": null
92-
// }
93-
// ],
94-
// "totalCount": 3
95-
// }
96-
// }
97-
// }
98119
```
99120
<div align="right">
100121
<a href="https://github.com/FieldControl/carchost-node/blob/master/test/resources/employee.spec.js" target="_blank">see tests</a> - <a href="https://developers.fieldcontrol.com.br/#colaboradores" target="_blank">see docs</a>
101122
</div>
102123

103124
<div align="center">💙</div>
104125

126+
### Tipos de atividades
127+
128+
Tipos de atividades (services) são serviços prestados pela empresa. Exemplos: instalação, manutenção, reparo, etc..
129+
130+
```js
131+
// Recuperar tipo de atividade por id
132+
const response = await client.services.get('MzUxMzE6MjI5MTU=')
133+
```
134+
135+
```js
136+
// Criar um novo tipo de atividade
137+
const response = await client.services.create({
138+
name: 'Instalação',
139+
duration: 120
140+
})
141+
```
142+
143+
```js
144+
// Atualizar um tipo de atividade
145+
const response = await client.services.update('MzA0ODY6MjI5MTU=', {
146+
id: 'MzA0ODY6MjI5MTU=',
147+
name: 'Manutenção',
148+
duration: 60
149+
})
150+
```
151+
152+
```js
153+
// Listar tipos de atividade
154+
const response = await client.services.list()
155+
```
156+
157+
<div align="right">
158+
<a href="https://github.com/FieldControl/carchost-node/blob/master/test/resources/service.spec.js" target="_blank">see tests</a> - <a href="https://developers.fieldcontrol.com.br/#tipos-de-atividades" target="_blank">see docs</a>
159+
</div>
160+
161+
<div align="center">💙</div>
162+
163+
164+
### Solicitação de serviço
165+
166+
Uma solicitação de serviço é, basicamente, um pedido de atendimento, ele pode ser um novo negócio, um problema de um cliente já existente e entre outras utilizações.
167+
168+
```js
169+
// Criar uma nova solicitação de serviço
170+
const response = await client.tickets.create({
171+
name: 'Luiz Freneda',
172+
message: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas posuere eget tellus vitae malesuada. Duis consequat pulvinar tincidunt. Aenean in enim tincidunt, auctor mauris a, tincidunt turpis.',
173+
subject: 'Manutenção preventiva',
174+
contact: {
175+
176+
phone: '11963427191'
177+
}
178+
})
179+
```
180+
181+
```js
182+
// Atualizar uma solicitação de serviço existente
183+
const response = await client.tickets.update('M2JlYTAyNDctODAyNC00Mzc5LTkwNWQtYTM5ZWRhYWMzM2NmOjE=', {
184+
name: 'Luiz Freneda',
185+
message: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas posuere eget tellus vitae malesuada. Duis consequat pulvinar tincidunt. Aenean in enim tincidunt, auctor mauris a, tincidunt turpis.',
186+
subject: 'Manutenção preventiva',
187+
contact: {
188+
189+
phone: '11963427191'
190+
}
191+
})
192+
```
193+
194+
```js
195+
// Listar solicitações de serviço por nome e com configurações de paginação
196+
const response = await client.tickets.list({
197+
filter: {
198+
name: 'Freneda'
199+
},
200+
pagination: {
201+
limit: 10,
202+
offset: 1
203+
}
204+
})
205+
```
206+
207+
<div align="right">
208+
<a href="https://github.com/FieldControl/carchost-node/blob/master/test/resources/ticket.spec.js" target="_blank">see tests</a> - <a href="https://developers.fieldcontrol.com.br/#solicita--o-de-servi-o" target="_blank">see docs</a>
209+
</div>
210+
211+
<div align="center">💙</div>
212+
105213
## Pull Requests
106214

107215
- **Add tests!** Your patch won't be accepted if it doesn't have tests.

bin/playground.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const FieldControl = require('./../src/index')
2+
const client = new FieldControl({
3+
apiKey: 'ssssssssssshhhhhhhhhhhh:x~'
4+
})
5+
6+
const run = async () => {
7+
console.log(client)
8+
}
9+
10+
run()

0 commit comments

Comments
 (0)