1
1
<div align =" center " >
2
2
<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 >
4
4
<br >
5
5
<p >
6
6
:cloud: Node.js bindings for the Field Control API - <a target="_blank" href="https://developers.fieldcontrol.com.br/">https://developers.fieldcontrol.com.br/</a>
7
7
</p >
8
+ <div ><code >npm install fieldcontrol --save</code ></div >
8
9
<p >
9
10
10
11
![ Field Control ♥] ( https://img.shields.io/badge/Field%20Control-%20%20%20%20%20%20♥-blue.svg )
14
15
15
16
</p >
16
17
<small >
17
- Built with ❤ by
18
+ Built with 💙 by
18
19
<a href="https://github.com/FieldControl">FieldControl</a> and
19
20
<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>
20
21
</small >
21
22
</div >
22
23
23
24
---
24
25
25
- ## Installation
26
+ ## Instalação
26
27
27
28
This client is intended for server side use only.
28
29
29
30
```
30
- npm install FieldControl --save
31
+ npm install fieldcontrol --save
31
32
```
32
33
33
34
<div align =" center " >💙</div >
34
35
35
- ## Usage
36
+ ## Uso
36
37
37
38
``` js
38
- const FieldControl = require (' FieldControl ' )
39
+ const FieldControl = require (' fieldcontrol ' )
39
40
const client = new FieldControl ({
40
41
apiKey: ' ssssssssssshhhhhhhhhhhh:x~'
41
42
})
@@ -44,64 +45,171 @@ const client = new FieldControl({
44
45
<div align =" center " >💙</div >
45
46
46
47
### 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
+ ```
50
78
51
- ### Employees
79
+ ``` js
80
+ // Recuperar um cliente por id
81
+ const response = await client .customers .get (' MTY0MTU6MjI5MTU=' )
82
+ ```
52
83
53
84
``` 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
55
108
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
- // }
64
109
```
65
110
66
111
``` js
67
- // List employees
112
+ // Listar colaboradores
68
113
const response = await client .employees .list ({
69
- pagination: {
70
- limit: 10 ,
71
- offset: 0
72
- }
114
+ pagination: {
115
+ limit: 10 ,
116
+ offset: 0
117
+ }
73
118
})
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
- // }
98
119
```
99
120
<div align =" right " >
100
121
<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 >
101
122
</div >
102
123
103
124
<div align =" center " >💙</div >
104
125
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
+
105
213
## Pull Requests
106
214
107
215
- ** Add tests!** Your patch won't be accepted if it doesn't have tests.
0 commit comments