sgp-sdk 1.2.0 → 2.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/COMPATIBILITY.md +151 -0
  3. package/MIGRATION.md +283 -0
  4. package/README.md +422 -265
  5. package/dist/address.d.ts +46 -0
  6. package/dist/annotation-selection.d.ts +32 -0
  7. package/dist/budget.d.ts +29 -0
  8. package/dist/classify.d.ts +15 -0
  9. package/dist/client.d.ts +661 -165
  10. package/dist/config.d.ts +115 -0
  11. package/dist/constants.d.ts +72 -0
  12. package/dist/effect.d.ts +22 -0
  13. package/dist/executor.d.ts +9 -0
  14. package/dist/exposure.d.ts +21 -0
  15. package/dist/guards.d.ts +2 -0
  16. package/dist/hooks.d.ts +16 -0
  17. package/dist/ids.d.ts +19 -0
  18. package/dist/index.d.ts +45 -49
  19. package/dist/index.js +2947 -1292
  20. package/dist/operation-sensitivity.d.ts +496 -0
  21. package/dist/operation.d.ts +139 -0
  22. package/dist/operations/catalogs-list-billing-profiles.d.ts +16 -0
  23. package/dist/operations/catalogs-list-nas.d.ts +25 -0
  24. package/dist/operations/catalogs-list-pops.d.ts +14 -0
  25. package/dist/operations/contracts-list-status-reasons.d.ts +15 -0
  26. package/dist/operations/contracts-list.d.ts +52 -0
  27. package/dist/operations/contracts-update-status.d.ts +41 -0
  28. package/dist/operations/contracts-update.d.ts +39 -0
  29. package/dist/operations/coverage-check.d.ts +42 -0
  30. package/dist/operations/crm-contracts-create-by-cpf-cnpj.d.ts +97 -0
  31. package/dist/operations/crm-contracts-create.d.ts +221 -0
  32. package/dist/operations/crm-contracts-list.d.ts +50 -0
  33. package/dist/operations/crm-customers-create.d.ts +155 -0
  34. package/dist/operations/crm-customers-update-status.d.ts +41 -0
  35. package/dist/operations/customers-list.d.ts +98 -0
  36. package/dist/{endpoints/ura/lookup-customer.d.ts → operations/customers-search.d.ts} +56 -46
  37. package/dist/operations/documents-add.d.ts +29 -0
  38. package/dist/operations/documents-list.d.ts +31 -0
  39. package/dist/operations/experimental-annotations-list.d.ts +67 -0
  40. package/dist/operations/invoices-list.d.ts +142 -0
  41. package/dist/operations/occurrences-create.d.ts +116 -0
  42. package/dist/operations/occurrences-list-methods.d.ts +14 -0
  43. package/dist/operations/occurrences-list-types.d.ts +20 -0
  44. package/dist/{endpoints/ura/list-plans.d.ts → operations/plans-list.d.ts} +33 -23
  45. package/dist/operations/pre-registrations-create.d.ts +253 -0
  46. package/dist/operations/pre-registrations-list-due-days.d.ts +15 -0
  47. package/dist/operations/pre-registrations-list-plans.d.ts +24 -0
  48. package/dist/operations/pre-registrations-list-sellers.d.ts +16 -0
  49. package/dist/operations/services-add-tv.d.ts +47 -0
  50. package/dist/operations/services-change-plan.d.ts +40 -0
  51. package/dist/operations/services-remove-tv.d.ts +29 -0
  52. package/dist/operations/work-orders-list-reasons.d.ts +20 -0
  53. package/dist/operations/work-orders-list.d.ts +81 -0
  54. package/dist/path.d.ts +13 -0
  55. package/dist/raw-request.d.ts +26 -0
  56. package/dist/request.d.ts +28 -0
  57. package/dist/result.d.ts +111 -43
  58. package/dist/retry.d.ts +34 -0
  59. package/dist/sensitivity.d.ts +89 -4
  60. package/dist/tolerant.d.ts +21 -0
  61. package/dist/validation.d.ts +3 -0
  62. package/package.json +6 -3
  63. package/dist/endpoint.d.ts +0 -66
  64. package/dist/endpoints/crm/address.d.ts +0 -20
  65. package/dist/endpoints/crm/create-contract.d.ts +0 -109
  66. package/dist/endpoints/crm/create-customer.d.ts +0 -65
  67. package/dist/endpoints/crm/update-customer-status.d.ts +0 -43
  68. package/dist/endpoints/os/list-occurrence-reasons.d.ts +0 -24
  69. package/dist/endpoints/os/list-occurrence-types.d.ts +0 -25
  70. package/dist/endpoints/precadastro/list-due-days.d.ts +0 -19
  71. package/dist/endpoints/precadastro/list-sellers.d.ts +0 -21
  72. package/dist/endpoints/suporte/add-customer-document.d.ts +0 -24
  73. package/dist/endpoints/suporte/list-customer-documents.d.ts +0 -25
  74. package/dist/endpoints/ura/check-coverage.d.ts +0 -46
  75. package/dist/endpoints/ura/list-annotations.d.ts +0 -32
  76. package/dist/endpoints/ura/list-clients.d.ts +0 -58
  77. package/dist/endpoints/ura/list-contracts.d.ts +0 -45
  78. package/dist/endpoints/ura/list-invoices.d.ts +0 -107
  79. package/dist/endpoints/ura/list-nas.d.ts +0 -29
  80. package/dist/endpoints/ura/list-occurrence-methods.d.ts +0 -19
  81. package/dist/endpoints/ura/list-payment-carriers.d.ts +0 -20
  82. package/dist/endpoints/ura/list-pops.d.ts +0 -19
  83. package/dist/endpoints/ura/list-service-orders.d.ts +0 -64
  84. package/dist/endpoints/ura/open-ticket.d.ts +0 -81
  85. package/dist/errors.d.ts +0 -59
  86. package/dist/schema/parse.d.ts +0 -19
  87. package/dist/schema/paths.d.ts +0 -38
  88. package/dist/transport.d.ts +0 -65
@@ -0,0 +1,142 @@
1
+ import { z } from "zod";
2
+ import { type CustomerId } from "../ids.js";
3
+ import type { OperationDefinition } from "../operation.js";
4
+ declare const pageSchema: z.ZodObject<{
5
+ paginacao: z.ZodObject<{
6
+ offset: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
7
+ limit: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
8
+ parcial: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
9
+ total: z.ZodNumber;
10
+ }, z.core.$loose>;
11
+ titulos: z.ZodArray<z.ZodObject<{
12
+ id: z.ZodNumber;
13
+ status: z.ZodNullable<z.ZodOptional<z.ZodString>>;
14
+ valor: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
15
+ dataVencimento: z.ZodNullable<z.ZodOptional<z.ZodString>>;
16
+ clienteNome: z.ZodNullable<z.ZodOptional<z.ZodString>>;
17
+ clienteCpfcnpj: z.ZodNullable<z.ZodOptional<z.ZodString>>;
18
+ clienteContrato: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
19
+ portador: z.ZodNullable<z.ZodOptional<z.ZodString>>;
20
+ numeroDocumento: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
21
+ nossoNumero: z.ZodNullable<z.ZodOptional<z.ZodString>>;
22
+ link: z.ZodNullable<z.ZodOptional<z.ZodString>>;
23
+ link_cobranca: z.ZodNullable<z.ZodOptional<z.ZodString>>;
24
+ valorDesconto: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
25
+ valorCorrigido: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
26
+ valorPago: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
27
+ valorPagoParcial: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
28
+ codigoBarras: z.ZodNullable<z.ZodOptional<z.ZodString>>;
29
+ linhaDigitavel: z.ZodNullable<z.ZodOptional<z.ZodString>>;
30
+ codigoPix: z.ZodNullable<z.ZodOptional<z.ZodString>>;
31
+ dataEmissao: z.ZodNullable<z.ZodOptional<z.ZodString>>;
32
+ dataPagamento: z.ZodNullable<z.ZodOptional<z.ZodString>>;
33
+ dataCancelamento: z.ZodNullable<z.ZodOptional<z.ZodString>>;
34
+ demonstrativo: z.ZodNullable<z.ZodOptional<z.ZodString>>;
35
+ acordoPagamento: z.ZodNullable<z.ZodOptional<z.ZodObject<{
36
+ acordados: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodUnknown>>>;
37
+ cobrados: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodUnknown>>>;
38
+ }, z.core.$loose>>>;
39
+ formaPagamento: z.ZodNullable<z.ZodOptional<z.ZodString>>;
40
+ usuario_baixa: z.ZodNullable<z.ZodOptional<z.ZodString>>;
41
+ }, z.core.$loose>>;
42
+ }, z.core.$loose>;
43
+ /**
44
+ * One page of `POST /api/ura/titulos/`, with SGP's own `paginacao`, returned as received:
45
+ *
46
+ * - `offset`: index of the first invoice of the page (SGP starts at 0);
47
+ * - `limit`: page size SGP applied, which may differ from the one requested (SGP caps it);
48
+ * - `parcial`: how many invoices this page holds (observed equal to `titulos.length`);
49
+ * - `total`: how many invoices match the filters in all, across every page.
50
+ *
51
+ * `total` is SGP's and never computed by the SDK: a page without a numeric `total` is
52
+ * `INVALID_RESPONSE`. Nothing here fetches the next page: ask for it with `offset`.
53
+ */
54
+ export type InvoicesListData = z.output<typeof pageSchema>;
55
+ /**
56
+ * Filters, paging and ordering of `invoices.list`, named as SGP names them (the choices are those
57
+ * of SGP's public collection). All optional; SGP decides how filters combine.
58
+ */
59
+ export interface InvoicesListInput {
60
+ /** Index of the first invoice of the page; SGP starts at 0. Non-negative integer. */
61
+ offset?: number;
62
+ /** Invoices per page. Non-negative integer; SGP documents a maximum of 250 and caps larger values. */
63
+ limit?: number;
64
+ /** Only the invoice with this id. */
65
+ titulo_id?: number;
66
+ /** Only invoices of the customer with this id, a `CustomerId` (never the id of a contract). */
67
+ cliente_id?: CustomerId;
68
+ /** Only invoices of the customer with this CPF/CNPJ. */
69
+ cpfcnpj?: string;
70
+ /** Only invoices of this contract. */
71
+ contrato?: number;
72
+ /** Only open (`abertos`), paid (`pagos`) or cancelled (`cancelados`) invoices. */
73
+ status?: "abertos" | "pagos" | "cancelados";
74
+ /** Only invoices issued through this billing profile (portador) id. */
75
+ portador?: number;
76
+ /** Field the invoices are ordered by. */
77
+ ordenar?: "data_documento" | "data_vencimento" | "data_pagamento";
78
+ /** Ascending or descending order. */
79
+ ordenar_ordem?: "asc" | "desc";
80
+ /** CNPJ of the company that issued the invoices; several allowed, separated by comma. */
81
+ empresa_cnpj?: string;
82
+ /** Person type: F (individual), J (company), E (foreign individual), EJ (foreign company). */
83
+ tipo_pessoa?: "F" | "J" | "E" | "EJ";
84
+ /** Initial due date, `AAAA-MM-DD`; SGP requires it when `data_vencimento_fim` is sent. */
85
+ data_vencimento_inicio?: string;
86
+ /** Final due date, `AAAA-MM-DD`. */
87
+ data_vencimento_fim?: string;
88
+ /** Initial payment date, `AAAA-MM-DD`; SGP requires it when `data_pagamento_fim` is sent. */
89
+ data_pagamento_inicio?: string;
90
+ /** Final payment date, `AAAA-MM-DD`. */
91
+ data_pagamento_fim?: string;
92
+ /** Initial cancellation date, `AAAA-MM-DD`; alone, SGP matches invoices cancelled that day. */
93
+ data_cancelamento_inicio?: string;
94
+ /** Final cancellation date, `AAAA-MM-DD`; use with the initial one. */
95
+ data_cancelamento_fim?: string;
96
+ /** Initial date payment-agreement invoices were generated, `AAAA-MM-DD`; alone, matches that day. */
97
+ data_acordo_inicio?: string;
98
+ /** Final date payment-agreement invoices were generated, `AAAA-MM-DD`. */
99
+ data_acordo_fim?: string;
100
+ }
101
+ /** INTERNAL. Validation of the input, exported so a test can check its keys are classified. */
102
+ export declare const invoicesListInputSchema: z.ZodObject<{
103
+ offset: z.ZodOptional<z.ZodNumber>;
104
+ limit: z.ZodOptional<z.ZodNumber>;
105
+ titulo_id: z.ZodOptional<z.ZodNumber>;
106
+ cliente_id: z.ZodOptional<z.core.$ZodBranded<z.ZodNumber, "CustomerId", "out">>;
107
+ cpfcnpj: z.ZodOptional<z.ZodString>;
108
+ contrato: z.ZodOptional<z.ZodNumber>;
109
+ status: z.ZodOptional<z.ZodEnum<{
110
+ abertos: "abertos";
111
+ cancelados: "cancelados";
112
+ pagos: "pagos";
113
+ }>>;
114
+ portador: z.ZodOptional<z.ZodNumber>;
115
+ ordenar: z.ZodOptional<z.ZodEnum<{
116
+ data_documento: "data_documento";
117
+ data_pagamento: "data_pagamento";
118
+ data_vencimento: "data_vencimento";
119
+ }>>;
120
+ ordenar_ordem: z.ZodOptional<z.ZodEnum<{
121
+ asc: "asc";
122
+ desc: "desc";
123
+ }>>;
124
+ empresa_cnpj: z.ZodOptional<z.ZodString>;
125
+ tipo_pessoa: z.ZodOptional<z.ZodEnum<{
126
+ E: "E";
127
+ EJ: "EJ";
128
+ F: "F";
129
+ J: "J";
130
+ }>>;
131
+ data_vencimento_inicio: z.ZodOptional<z.ZodString>;
132
+ data_vencimento_fim: z.ZodOptional<z.ZodString>;
133
+ data_pagamento_inicio: z.ZodOptional<z.ZodString>;
134
+ data_pagamento_fim: z.ZodOptional<z.ZodString>;
135
+ data_cancelamento_inicio: z.ZodOptional<z.ZodString>;
136
+ data_cancelamento_fim: z.ZodOptional<z.ZodString>;
137
+ data_acordo_inicio: z.ZodOptional<z.ZodString>;
138
+ data_acordo_fim: z.ZodOptional<z.ZodString>;
139
+ }, z.core.$strict>;
140
+ /** INTERNAL definition of `invoices.list`. */
141
+ export declare const invoicesList: OperationDefinition<InvoicesListData, "invoices.list">;
142
+ export {};
@@ -0,0 +1,116 @@
1
+ import { z } from "zod";
2
+ import type { OperationDefinition } from "../operation.js";
3
+ /**
4
+ * Input of `occurrences.create`, named as SGP names the fields. An occurrence (SGP "chamado" or
5
+ * "ocorrência") is the support ticket; SGP opens a work order (OS) with it unless told not to
6
+ * (`desativa_os`). Only `contrato` is required.
7
+ */
8
+ export interface OccurrenceCreateInput {
9
+ /** ID of the contract. Required. */
10
+ contrato: number;
11
+ /** Content of the occurrence and of the work order. Free text: personal data. */
12
+ conteudo?: string;
13
+ /** `1` removes SGP's default opening message ("via URA"). */
14
+ conteudolimpo?: 0 | 1;
15
+ /** Free text: personal data. */
16
+ observacao?: string;
17
+ /**
18
+ * Occurrence type code (SGP's default is 5): the `codigo` of `occurrences.listTypes`, not its
19
+ * `id`.
20
+ */
21
+ ocorrenciatipo?: number;
22
+ /** IDs of the classifications linked to the occurrence. */
23
+ tipoclassificacoes?: number[];
24
+ /** Occurrence method code: the `codigo` of `occurrences.listMethods`. */
25
+ metodo?: number;
26
+ /** Sector ID. */
27
+ setor?: number;
28
+ /** Username shown as who opened the occurrence. Staff username: personal data. */
29
+ usuario?: string;
30
+ /** Username of the occurrence's responsible. Staff username: personal data. */
31
+ responsaveloc?: string;
32
+ /** Contact name. Personal data. */
33
+ contato_nome?: string;
34
+ /** Contact phone. Personal data. */
35
+ contato_telefone?: string;
36
+ /** `1` opens no work order. */
37
+ desativa_os?: 0 | 1;
38
+ /** `1` creates the occurrence and the work order already closed. */
39
+ status_encerrado?: 0 | 1;
40
+ /** `1` notifies the customer of the closing, when created already closed. */
41
+ notificar_cliente?: 0 | 1;
42
+ /**
43
+ * Work-order reason code: the `codigo` of `workOrders.listReasons` (not its `id`; live, 10 was
44
+ * the reason whose `codigo` is 10 and `id` 1). Each SGP instance has its own: read them there,
45
+ * never assume a value.
46
+ */
47
+ motivoos?: number;
48
+ /** IDs of the classifications linked to the work order. */
49
+ motivoclassificacoes?: number[];
50
+ /** Username of the work order's responsible technician. Staff username: personal data. */
51
+ responsavel?: string;
52
+ /** Usernames of the auxiliary technicians. Staff usernames: personal data. */
53
+ tecnicos?: string[];
54
+ /** Schedules the occurrence and the work order: `AAAA-MM-DD HH:MM`. */
55
+ data_hora_agendamento?: string;
56
+ /** `1` warns the responsible technician; needs `data_hora_agendamento` and a messaging gateway in SGP. */
57
+ sms_tecnico?: 0 | 1;
58
+ /** With `servico_id`, links a service of the contract to the occurrence. */
59
+ tipo_servico?: "internet" | "telefonia" | "tv" | "multimidia" | "generico";
60
+ /** ID of the contract's service; use with `tipo_servico`. */
61
+ servico_id?: number;
62
+ /** ID of the company to link. */
63
+ empresa_id?: number;
64
+ }
65
+ /** INTERNAL. Validation of the input, exported so a test can check it against the public type. */
66
+ export declare const occurrencesCreateInputSchema: z.ZodObject<{
67
+ contrato: z.ZodNumber;
68
+ conteudo: z.ZodOptional<z.ZodString>;
69
+ conteudolimpo: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
70
+ observacao: z.ZodOptional<z.ZodString>;
71
+ ocorrenciatipo: z.ZodOptional<z.ZodNumber>;
72
+ tipoclassificacoes: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
73
+ metodo: z.ZodOptional<z.ZodNumber>;
74
+ setor: z.ZodOptional<z.ZodNumber>;
75
+ usuario: z.ZodOptional<z.ZodString>;
76
+ responsaveloc: z.ZodOptional<z.ZodString>;
77
+ contato_nome: z.ZodOptional<z.ZodString>;
78
+ contato_telefone: z.ZodOptional<z.ZodString>;
79
+ desativa_os: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
80
+ status_encerrado: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
81
+ notificar_cliente: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
82
+ motivoos: z.ZodOptional<z.ZodNumber>;
83
+ motivoclassificacoes: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
84
+ responsavel: z.ZodOptional<z.ZodString>;
85
+ tecnicos: z.ZodOptional<z.ZodArray<z.ZodString>>;
86
+ data_hora_agendamento: z.ZodOptional<z.ZodString>;
87
+ sms_tecnico: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
88
+ tipo_servico: z.ZodOptional<z.ZodEnum<{
89
+ generico: "generico";
90
+ internet: "internet";
91
+ multimidia: "multimidia";
92
+ telefonia: "telefonia";
93
+ tv: "tv";
94
+ }>>;
95
+ servico_id: z.ZodOptional<z.ZodNumber>;
96
+ empresa_id: z.ZodOptional<z.ZodNumber>;
97
+ }, z.core.$strict>;
98
+ /**
99
+ * Success body of `POST /api/ura/chamado/`: `status` 1, the ticket's `protocolo` and `id`, plus the
100
+ * contract and the customer SGP echoes back. `id` is the ID of the OCCURRENCE: a work order, when
101
+ * one is opened, has another ID that this body does not carry. Other keys SGP may add are kept.
102
+ */
103
+ declare const openedSchema: z.ZodObject<{
104
+ status: z.ZodLiteral<1>;
105
+ protocolo: z.ZodString;
106
+ id: z.ZodNumber;
107
+ contratoId: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
108
+ razaoSocial: z.ZodNullable<z.ZodOptional<z.ZodString>>;
109
+ cpfCnpj: z.ZodNullable<z.ZodOptional<z.ZodString>>;
110
+ msg: z.ZodNullable<z.ZodOptional<z.ZodString>>;
111
+ }, z.core.$loose>;
112
+ /** Response of `occurrences.create`. */
113
+ export type OccurrenceCreateData = z.output<typeof openedSchema>;
114
+ /** INTERNAL definition of `occurrences.create`. */
115
+ export declare const occurrencesCreate: OperationDefinition<OccurrenceCreateData, "occurrences.create">;
116
+ export {};
@@ -0,0 +1,14 @@
1
+ import { z } from "zod";
2
+ import type { OperationDefinition } from "../operation.js";
3
+ declare const occurrenceMethodsSchema: z.ZodArray<z.ZodObject<{
4
+ codigo: z.ZodNumber;
5
+ descricao: z.ZodNullable<z.ZodOptional<z.ZodString>>;
6
+ }, z.core.$loose>>;
7
+ /**
8
+ * The response of `GET /api/ura/ocorrencia/metodo/list/`, in SGP's own shape: a bare array with one
9
+ * entry per occurrence method. The route is not paginated, so there is no envelope and no total.
10
+ */
11
+ export type OccurrencesListMethodsData = z.output<typeof occurrenceMethodsSchema>;
12
+ /** INTERNAL definition of `occurrences.listMethods`. */
13
+ export declare const occurrencesListMethods: OperationDefinition<OccurrencesListMethodsData, "occurrences.listMethods">;
14
+ export {};
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ import type { OperationDefinition } from "../operation.js";
3
+ declare const occurrenceTypesSchema: z.ZodArray<z.ZodObject<{
4
+ id: z.ZodNumber;
5
+ codigo: z.ZodNumber;
6
+ descricao: z.ZodNullable<z.ZodOptional<z.ZodString>>;
7
+ ativo: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
8
+ classificacoes: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodUnknown>>>;
9
+ classificacoes_obrigatorio: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
10
+ setores: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodUnknown>>>;
11
+ classificacoes_obrigatorio_encerramento: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
12
+ }, z.core.$loose>>;
13
+ /**
14
+ * The response of `GET /api/os/ocorrencia/tipo/list/`, in SGP's own shape: a bare array with one
15
+ * entry per occurrence type. The route is not paginated, so there is no envelope and no total.
16
+ */
17
+ export type OccurrencesListTypesData = z.output<typeof occurrenceTypesSchema>;
18
+ /** INTERNAL definition of `occurrences.listTypes`. */
19
+ export declare const occurrencesListTypes: OperationDefinition<OccurrencesListTypesData, "occurrences.listTypes">;
20
+ export {};
@@ -1,12 +1,25 @@
1
1
  import { z } from "zod";
2
- import type { EndpointDefinition } from "../../endpoint.js";
3
- /** Response of `GET /api/ura/consultaplano/`: the plan catalog with its totals. */
4
- export declare const listPlansSchema: z.ZodObject<{
2
+ import type { OperationDefinition } from "../operation.js";
3
+ /**
4
+ * Identifier of a plan (SGP "plano") in the URA catalog `plans.list` reads (`GET
5
+ * /api/ura/consultaplano/`).
6
+ *
7
+ * This is the ID space of the operations on existing services and contracts: the `plano` filter of
8
+ * `contracts.list`, `plano_id` of `services.changePlan` and `planobase_id` of `services.addTv`. It
9
+ * is what `customers.list` returns as `servicos[].plano.id` too. It is NOT the ID space of the
10
+ * pré-cadastro catalog (`preRegistrations.listPlans`, used by `preRegistrations.create`), typed as
11
+ * `PreRegistrationPlanId`: the same commercial plan may carry another id there, and the live
12
+ * evidence shows an id accepted by one route refused by the other. The two brands make the
13
+ * compiler refuse one where the other belongs, and a plain number where either belongs. They are
14
+ * type-only: on the wire and at runtime an id is a plain number.
15
+ */
16
+ export type PlanId = number & z.core.$brand<"PlanId">;
17
+ declare const catalogSchema: z.ZodObject<{
5
18
  planos: z.ZodArray<z.ZodObject<{
6
- id: z.ZodNumber;
7
- descricao: z.ZodString;
8
- preco: z.ZodNumber;
9
- ativo: z.ZodBoolean;
19
+ id: z.core.$ZodBranded<z.ZodNumber, "PlanId", "out">;
20
+ descricao: z.ZodNullable<z.ZodOptional<z.ZodString>>;
21
+ preco: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
22
+ ativo: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
10
23
  grupo: z.ZodNullable<z.ZodOptional<z.ZodString>>;
11
24
  tipo: z.ZodNullable<z.ZodOptional<z.ZodString>>;
12
25
  pos_pago: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
@@ -30,7 +43,7 @@ export declare const listPlansSchema: z.ZodObject<{
30
43
  id: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
31
44
  uf: z.ZodNullable<z.ZodOptional<z.ZodString>>;
32
45
  pop: z.ZodNullable<z.ZodOptional<z.ZodString>>;
33
- }, z.core.$strip>>>>;
46
+ }, z.core.$loose>>>>;
34
47
  auto_bloqueio: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
35
48
  dias_bloqueio_pos_venc: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
36
49
  dias_bloqueio_aviso: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
@@ -50,21 +63,18 @@ export declare const listPlansSchema: z.ZodObject<{
50
63
  modo_velocidade_red_franquia: z.ZodNullable<z.ZodOptional<z.ZodString>>;
51
64
  download_red_franquia: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
52
65
  upload_red_franquia: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
53
- combo: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{}, z.core.$strip>>>>;
66
+ combo: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodUnknown>>>;
54
67
  qtd_servicos: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
55
- }, z.core.$strip>>;
68
+ }, z.core.$loose>>;
56
69
  total_planos: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
57
70
  total_qtd_servicos: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
58
- }, z.core.$strip>;
59
- /** Key fields of `ura/consultaplano`: required and strict; any mismatch is `SCHEMA_MISMATCH`. */
60
- export declare const listPlansKeyFields: readonly ["planos", "planos[].id", "planos[].descricao", "planos[].preco", "planos[].ativo"];
61
- /** Normalized path of each plan in the `ura/consultaplano` response. */
62
- export declare const planItemPath = "planos[]";
63
- /** Keys of a plan holding secrets (none in `ura/consultaplano`). */
64
- export declare const planSecretKeys: readonly [];
65
- /** Keys of a plan holding personal data (none in `ura/consultaplano`). */
66
- export declare const planPersonalKeys: readonly [];
67
- /** Parsed response of `GET /api/ura/consultaplano/`. */
68
- export type ListPlansResponse = z.output<typeof listPlansSchema>;
69
- /** Definition of `GET /api/ura/consultaplano/`. */
70
- export declare const listPlansDefinition: EndpointDefinition<typeof listPlansSchema>;
71
+ }, z.core.$loose>;
72
+ /**
73
+ * The whole plan catalog of `GET /api/ura/consultaplano/`, in SGP's own shape. The route is not
74
+ * paginated: there is no `paginacao`, and `total_planos` / `total_qtd_servicos` are SGP's own
75
+ * totals of the catalog, returned as received.
76
+ */
77
+ export type PlansListData = z.output<typeof catalogSchema>;
78
+ /** INTERNAL definition of `plans.list`. */
79
+ export declare const plansList: OperationDefinition<PlansListData, "plans.list">;
80
+ export {};
@@ -0,0 +1,253 @@
1
+ import { z } from "zod";
2
+ import { type SgpAddress } from "../address.js";
3
+ import type { AcquisitionMode } from "../constants.js";
4
+ import type { OperationDefinition } from "../operation.js";
5
+ /**
6
+ * Identifier of a plan (SGP "plano") in the pré-cadastro catalog (`preRegistrations.listPlans`,
7
+ * `POST /api/precadastro/plano/list`), the one `preRegistrations.create` takes `plano_id` from.
8
+ *
9
+ * It is NOT a `PlanId` (the URA catalog of `plans.list`): the same commercial plan may carry another
10
+ * id here. The brand is type-only; on the wire an id is a plain number. `preRegistrations.listPlans`
11
+ * returns this type: take the id from there.
12
+ */
13
+ export type PreRegistrationPlanId = number & z.core.$brand<"PreRegistrationPlanId">;
14
+ /**
15
+ * The address fields of a pré-cadastro, loose at the top level of the input with SGP's own names.
16
+ * `logradouro`, `numero`, `bairro`, `cidade`, `uf` and `cep` are Exercised; the other keys are
17
+ * Documented. Only `logradouro` is required (the vendor's documentation marks no other).
18
+ */
19
+ interface PreRegistrationAddress extends SgpAddress {
20
+ logradouro: string;
21
+ }
22
+ /** Fields common to both person types. Money is a number of reais; ids are SGP's own. */
23
+ interface PreRegistrationCreateCommon extends PreRegistrationAddress {
24
+ /** Exercised. Customer name; for a company, its corporate name. Required by SGP. */
25
+ nome: string;
26
+ /** Exercised. CPF (`F`) or CNPJ (`J`), in the format SGP stores it. */
27
+ cpfcnpj?: string;
28
+ /** Exercised. Contact e-mail. */
29
+ email?: string;
30
+ /** Documented. Contact phone. */
31
+ celular?: string;
32
+ /** Documented. `AAAA-MM-DD`: birth date of a person, foundation date of a company. */
33
+ datanasc?: string;
34
+ /** Exercised. Free-text note. */
35
+ observacao?: string;
36
+ /** Documented. User responsible for the pré-cadastro. */
37
+ usuariocad_id?: number;
38
+ /**
39
+ * Exercised with `1`. Turns the pré-cadastro into a definitive customer. Omit it to leave only
40
+ * the pré-cadastro. The domain beyond `1` is undocumented, so the SDK sends only `1`.
41
+ */
42
+ precadastro_ativar?: 1;
43
+ /** Exercised. POP ID. */
44
+ pop_id?: number;
45
+ /** Exercised. Billing profile (portador) ID. */
46
+ portador_id?: number;
47
+ /** Exercised. NAS ID. */
48
+ nas_id?: number;
49
+ /**
50
+ * Exercised. Plan ID of the pré-cadastro catalog (`preRegistrations.listPlans`), typed
51
+ * `PreRegistrationPlanId`; not a `PlanId` of `plans.list`: the same commercial plan has another ID
52
+ * here.
53
+ */
54
+ plano_id?: PreRegistrationPlanId;
55
+ /** Exercised. Due-day ID. */
56
+ vencimento_id?: number;
57
+ /**
58
+ * Exercised with `1`. Billing-method code (`BILLING_METHOD`: 1 boleto, 2 automatic debit, 3
59
+ * booklet, 4 recurring charge, 6 PIX); any number is sent as given.
60
+ */
61
+ formacobranca_id?: number;
62
+ /** Documented. Loyalty (fidelidade) ID. */
63
+ fidelidade_id?: number;
64
+ /** Exercised. Secret (PPPoE credential); may be an e-mail. Never log it. */
65
+ login?: string;
66
+ /** Exercised. Password of the contract. Secret: never log it. */
67
+ senha?: string;
68
+ /** Exercised. Password of the customer's central. Secret: never log it. */
69
+ central_senha?: string;
70
+ /** Exercised with `1`. Equipment situation: `ACQUISITION_MODE` (0 owned, 1 loan). */
71
+ modoaquisicao?: AcquisitionMode;
72
+ /** Documented. Details of the requested service. */
73
+ servicodesc?: string;
74
+ /** Documented. "How did you hear about us" ID. */
75
+ midia_id?: number;
76
+ /** Documented. Seller ID. */
77
+ vendedor_id?: number;
78
+ /** Documented. Technician ID for the installation. */
79
+ tecnico_id?: number;
80
+ /** Documented. Send `1` to generate the installation work order. */
81
+ os_instalacao?: 1;
82
+ /** Exercised with `0`. Installation price. */
83
+ instalacao_preco?: number;
84
+ /** Documented. Discount over the installation price. */
85
+ instalacao_desconto?: number;
86
+ /** Documented. Down payment of the installation. */
87
+ instalacao_entrada?: number;
88
+ /** Documented. Number of installments of the installation. */
89
+ instalacao_quantidade_parcelas?: number;
90
+ /** Exercised with `1`. Payment form of the down payment; SGP's documentation lists the values. */
91
+ instalacao_entrada_forma?: number;
92
+ /** Exercised with `1`. Payment form of the installments; SGP's documentation lists the values. */
93
+ instalacao_parcela_forma?: number;
94
+ }
95
+ /** `POST /api/precadastro/F`: a natural person. Only this route was exercised against SGP. */
96
+ export interface PreRegistrationCreateIndividualInput extends PreRegistrationCreateCommon {
97
+ /** Selects the route `/F`; not sent as a field. */
98
+ personType: "F";
99
+ /** Documented. Identity document number. */
100
+ rg?: string;
101
+ /** Documented. Issuer of the identity document. */
102
+ rg_emissor?: string;
103
+ /** Documented. Father's name. */
104
+ nomepai?: string;
105
+ /** Documented. Mother's name. */
106
+ nomemae?: string;
107
+ /** Documented. Nationality. */
108
+ nacionalidade?: string;
109
+ /** Documented. Place of birth. */
110
+ naturalidade?: string;
111
+ /** Documented. `S` single, `C` married, `D` divorced, `V` widowed. */
112
+ estadocivil?: "S" | "C" | "D" | "V";
113
+ /** Documented. `M` male, `F` female. */
114
+ sexo?: "M" | "F";
115
+ /** Documented. Occupation. */
116
+ profissao?: string;
117
+ }
118
+ /** `POST /api/precadastro/J`: a company. Documented only: never exercised against SGP. */
119
+ export interface PreRegistrationCreateCompanyInput extends PreRegistrationCreateCommon {
120
+ /** Selects the route `/J`; not sent as a field. */
121
+ personType: "J";
122
+ /** Documented. Trade name. */
123
+ nomefantasia?: string;
124
+ /** Documented. Name of the person responsible for the company. */
125
+ respempresa?: string;
126
+ /** Documented. CPF of the person responsible for the company. */
127
+ respcpf?: string;
128
+ }
129
+ /**
130
+ * Input of `preRegistrations.create`. `personType` picks the route (`F` or `J`) and is not sent as a
131
+ * field; every other key is sent under its own name, absent ones omitted. Unknown keys are refused.
132
+ */
133
+ export type PreRegistrationCreateInput = PreRegistrationCreateIndividualInput | PreRegistrationCreateCompanyInput;
134
+ /** INTERNAL. Validation of the input, exported so a test can check it against the public types. */
135
+ export declare const preRegistrationsCreateInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
136
+ numero: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
137
+ complemento: z.ZodOptional<z.ZodString>;
138
+ bairro: z.ZodOptional<z.ZodString>;
139
+ cidade: z.ZodOptional<z.ZodString>;
140
+ cep: z.ZodOptional<z.ZodString>;
141
+ uf: z.ZodOptional<z.ZodString>;
142
+ pais: z.ZodOptional<z.ZodString>;
143
+ pontoreferencia: z.ZodOptional<z.ZodString>;
144
+ map_ll: z.ZodOptional<z.ZodString>;
145
+ condominio: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
146
+ nome: z.ZodString;
147
+ cpfcnpj: z.ZodOptional<z.ZodString>;
148
+ logradouro: z.ZodString;
149
+ email: z.ZodOptional<z.ZodString>;
150
+ celular: z.ZodOptional<z.ZodString>;
151
+ datanasc: z.ZodOptional<z.ZodString>;
152
+ observacao: z.ZodOptional<z.ZodString>;
153
+ usuariocad_id: z.ZodOptional<z.ZodNumber>;
154
+ precadastro_ativar: z.ZodOptional<z.ZodLiteral<1>>;
155
+ pop_id: z.ZodOptional<z.ZodNumber>;
156
+ portador_id: z.ZodOptional<z.ZodNumber>;
157
+ nas_id: z.ZodOptional<z.ZodNumber>;
158
+ plano_id: z.ZodOptional<z.core.$ZodBranded<z.ZodNumber, "PreRegistrationPlanId", "out">>;
159
+ vencimento_id: z.ZodOptional<z.ZodNumber>;
160
+ formacobranca_id: z.ZodOptional<z.ZodNumber>;
161
+ fidelidade_id: z.ZodOptional<z.ZodNumber>;
162
+ login: z.ZodOptional<z.ZodString>;
163
+ senha: z.ZodOptional<z.ZodString>;
164
+ central_senha: z.ZodOptional<z.ZodString>;
165
+ modoaquisicao: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
166
+ servicodesc: z.ZodOptional<z.ZodString>;
167
+ midia_id: z.ZodOptional<z.ZodNumber>;
168
+ vendedor_id: z.ZodOptional<z.ZodNumber>;
169
+ tecnico_id: z.ZodOptional<z.ZodNumber>;
170
+ os_instalacao: z.ZodOptional<z.ZodLiteral<1>>;
171
+ instalacao_preco: z.ZodOptional<z.ZodNumber>;
172
+ instalacao_desconto: z.ZodOptional<z.ZodNumber>;
173
+ instalacao_entrada: z.ZodOptional<z.ZodNumber>;
174
+ instalacao_quantidade_parcelas: z.ZodOptional<z.ZodNumber>;
175
+ instalacao_entrada_forma: z.ZodOptional<z.ZodNumber>;
176
+ instalacao_parcela_forma: z.ZodOptional<z.ZodNumber>;
177
+ personType: z.ZodLiteral<"F">;
178
+ rg: z.ZodOptional<z.ZodString>;
179
+ rg_emissor: z.ZodOptional<z.ZodString>;
180
+ nomepai: z.ZodOptional<z.ZodString>;
181
+ nomemae: z.ZodOptional<z.ZodString>;
182
+ nacionalidade: z.ZodOptional<z.ZodString>;
183
+ naturalidade: z.ZodOptional<z.ZodString>;
184
+ estadocivil: z.ZodOptional<z.ZodEnum<{
185
+ C: "C";
186
+ D: "D";
187
+ S: "S";
188
+ V: "V";
189
+ }>>;
190
+ sexo: z.ZodOptional<z.ZodEnum<{
191
+ F: "F";
192
+ M: "M";
193
+ }>>;
194
+ profissao: z.ZodOptional<z.ZodString>;
195
+ }, z.core.$strict>, z.ZodObject<{
196
+ numero: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
197
+ complemento: z.ZodOptional<z.ZodString>;
198
+ bairro: z.ZodOptional<z.ZodString>;
199
+ cidade: z.ZodOptional<z.ZodString>;
200
+ cep: z.ZodOptional<z.ZodString>;
201
+ uf: z.ZodOptional<z.ZodString>;
202
+ pais: z.ZodOptional<z.ZodString>;
203
+ pontoreferencia: z.ZodOptional<z.ZodString>;
204
+ map_ll: z.ZodOptional<z.ZodString>;
205
+ condominio: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
206
+ nome: z.ZodString;
207
+ cpfcnpj: z.ZodOptional<z.ZodString>;
208
+ logradouro: z.ZodString;
209
+ email: z.ZodOptional<z.ZodString>;
210
+ celular: z.ZodOptional<z.ZodString>;
211
+ datanasc: z.ZodOptional<z.ZodString>;
212
+ observacao: z.ZodOptional<z.ZodString>;
213
+ usuariocad_id: z.ZodOptional<z.ZodNumber>;
214
+ precadastro_ativar: z.ZodOptional<z.ZodLiteral<1>>;
215
+ pop_id: z.ZodOptional<z.ZodNumber>;
216
+ portador_id: z.ZodOptional<z.ZodNumber>;
217
+ nas_id: z.ZodOptional<z.ZodNumber>;
218
+ plano_id: z.ZodOptional<z.core.$ZodBranded<z.ZodNumber, "PreRegistrationPlanId", "out">>;
219
+ vencimento_id: z.ZodOptional<z.ZodNumber>;
220
+ formacobranca_id: z.ZodOptional<z.ZodNumber>;
221
+ fidelidade_id: z.ZodOptional<z.ZodNumber>;
222
+ login: z.ZodOptional<z.ZodString>;
223
+ senha: z.ZodOptional<z.ZodString>;
224
+ central_senha: z.ZodOptional<z.ZodString>;
225
+ modoaquisicao: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
226
+ servicodesc: z.ZodOptional<z.ZodString>;
227
+ midia_id: z.ZodOptional<z.ZodNumber>;
228
+ vendedor_id: z.ZodOptional<z.ZodNumber>;
229
+ tecnico_id: z.ZodOptional<z.ZodNumber>;
230
+ os_instalacao: z.ZodOptional<z.ZodLiteral<1>>;
231
+ instalacao_preco: z.ZodOptional<z.ZodNumber>;
232
+ instalacao_desconto: z.ZodOptional<z.ZodNumber>;
233
+ instalacao_entrada: z.ZodOptional<z.ZodNumber>;
234
+ instalacao_quantidade_parcelas: z.ZodOptional<z.ZodNumber>;
235
+ instalacao_entrada_forma: z.ZodOptional<z.ZodNumber>;
236
+ instalacao_parcela_forma: z.ZodOptional<z.ZodNumber>;
237
+ personType: z.ZodLiteral<"J">;
238
+ nomefantasia: z.ZodOptional<z.ZodString>;
239
+ respempresa: z.ZodOptional<z.ZodString>;
240
+ respcpf: z.ZodOptional<z.ZodString>;
241
+ }, z.core.$strict>], "personType">;
242
+ /**
243
+ * Success body of `POST /api/precadastro/{F|J}`: SGP's `message`. It carries no ID of the customer,
244
+ * the contract or the pré-cadastro. Other keys SGP may add are kept.
245
+ */
246
+ declare const createdSchema: z.ZodObject<{
247
+ message: z.ZodString;
248
+ }, z.core.$loose>;
249
+ /** Response of `preRegistrations.create`. */
250
+ export type PreRegistrationCreateData = z.output<typeof createdSchema>;
251
+ /** INTERNAL definition of `preRegistrations.create`. */
252
+ export declare const preRegistrationsCreate: OperationDefinition<PreRegistrationCreateData, "preRegistrations.create">;
253
+ export {};
@@ -0,0 +1,15 @@
1
+ import { z } from "zod";
2
+ import type { OperationDefinition } from "../operation.js";
3
+ declare const dueDaysSchema: z.ZodArray<z.ZodObject<{
4
+ id: z.ZodNumber;
5
+ dia: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
6
+ }, z.core.$loose>>;
7
+ /**
8
+ * The response of `POST /api/precadastro/vencimento/list`, in SGP's own shape: a bare array with
9
+ * one entry per due day, `id` plus the `dia` it stands for. The route is not paginated, so there is
10
+ * no envelope and no total.
11
+ */
12
+ export type PreRegistrationsListDueDaysData = z.output<typeof dueDaysSchema>;
13
+ /** INTERNAL definition of `preRegistrations.listDueDays`. */
14
+ export declare const preRegistrationsListDueDays: OperationDefinition<PreRegistrationsListDueDaysData, "preRegistrations.listDueDays">;
15
+ export {};