-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDataModelZoho.swift
138 lines (118 loc) · 3.86 KB
/
DataModelZoho.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
//
// DataModel.swift
// testing API Zoho
//
// Created by Alvar Arias on 2022-10-11.
//
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
//import OAuth2
var autCode: String = ""
struct responseZoho: Codable {
let access_token: String
let api_domain: String
let token_type: String
let expires_in: Int
enum CodingKeys: String, CodingKey {
case access_token = "access_token"
case api_domain = "api_domain"
case token_type = "token_type"
case expires_in = "expires_in"
}
}
// Create Model
import Foundation
// MARK: - Welcome1
struct SaveEstimate {
let customer_id: Int
let contact_persons: [String]
let template_id, estimate_number, reference_number, date: String
let expiry_date: String
let discount: Int
let is_discount_before_tax: Bool
let discount_type, custom_body, custom_subject, salesperson_name: String
let custom_fields: [CustomField]
let line_items: [LineItem]
let notes, terms: String
let shipping_charge, adjustment: Int
let adjustment_description, tax_id, item_id: String
let line_item_id: Int
let name, description: String
let rate: Int
let unit: String
let quantity, project_id: Int
enum CodingKeys: String, CodingKey {
case customer_id = "customer_id"
case contact_persons = "contact_persons"
case template_id = "template_id"
case estimate_number = "estimate_number"
case reference_number = "reference_number"
case date = "date"
case expiry_date = "expiry_date"
case discount = "discount"
case is_iscount_before_tax = "is_discount_before_tax"
case discount_type = "discount_type"
case custom_body = "custom_body"
case custom_subject = "custom_subject"
case salesperson_name = "salesperson_name"
case notes = "notes"
case terms = "terms"
case shipping_charge = "shipping_charge"
case adjustment = "adjustment"
case adjustment_description = "adjustment_description"
case tax_id = "tax_id"
case item_id = "item_id"
case line_item_id = "line_item_id"
case name = "name"
case welcome_description = "description"
case rate = "rate"
case unit = "unit"
case quantity = "quantity"
case project_id = "project_id"
}
}
// MARK: - CustomField
struct CustomField {
let index: Int
let value: String
enum CodingKeys: String, CodingKey {
case index = "index"
case value = "value"
}
}
// MARK: - LineItem
struct LineItem {
let item_id: String
let line_item_id: Int
let name, line_item_description, product_type: String
let item_order, bcy_rate, rate: Int
let quantity: Int
let unit: String
let discount_amount, discount: Int
let tax_id, tax_name, tax_type: String
let tax_percentage: Double
let tax_treatment_code: String
let item_total: Int
enum CodingKeys: String, CodingKey {
case item_id = "item_id"
case line_item_id = "line_item_id"
case name = "name"
case welcome_description = "description"
case product_type = "product_type"
case item_order = "item_order"
case bcy_rate = "bcy_rate"
case rate = "rate"
case quantity = "quantity"
case unit = "unit"
case discount_amount = "discount_amount"
case discount = "discount"
case tax_id = "tax_id"
case tax_name = "tax_name"
case tax_type = "tax_type"
case tax_percentage = "tax_percentage"
case tax_treatment_code = "tax_treatment_code"
case item_total = "item_total"
}
}