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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
use super::action_override::ActionOverride;
use crate::rest_api::responses::child_relationship::ChildRelationship;
use crate::rest_api::responses::field::Field;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::collections::HashMap;
/// Represents metadata returned by Salesforce for a described SObject.
///
/// This struct is used to deserialize JSON responses from the Salesforce
/// Describe SObject API. The response contains object-level metadata,
/// relationship metadata, field metadata, URL templates, permissions,
/// layout capabilities, record type information, and other sobject_basic_info details.
///
/// # See
/// <https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_describesobjects_describesobjectresult.htm>
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct DescribeSObjectResult {
/// Metadata for action overrides defined on the object.
///
/// Action overrides sobject_basic_info custom behavior for standard or custom actions,
/// such as overriding the default New, Edit, View, Tab, or List actions.
#[serde(default)]
pub action_overrides: Vec<ActionOverride>,
/// Reserved for future use.
///
/// Salesforce currently exposes this flag for compatibility and future
/// platform functionality.
#[serde(default)]
pub activateable: bool,
/// If the object is associated with a parent object,
/// the type of association it has to its parent, such as History.
/// Otherwise, its value is null.
pub associate_entity_type: Option<String>,
/// If the object is associated with a parent object,
/// the parent object it’s associated with. Otherwise, its value is null.
pub associate_parent_entity: Option<String>,
/// Metadata for child relationships from this object to other objects.
///
/// Each child relationship describes how another object relates back to this
/// object, including relationship names, child object names, cascade delete
/// behavior, and the field used for the relationship.
#[serde(default)]
pub child_relationships: Vec<ChildRelationship>,
/// Indicates whether the object can be used with compact layouts.
///
/// If `true`, compact layout metadata can be retrieved for this object.
#[serde(default)]
pub compact_layoutable: bool,
/// Indicates whether records of this object can be created.
///
/// This value depends on the object type and the current user's permissions.
#[serde(default)]
pub createable: bool,
/// Indicates whether this is a custom object.
///
/// Custom objects usually have API names ending in `__c`.
#[serde(default)]
pub custom: bool,
/// Indicates whether this object is a custom setting.
///
/// Custom settings are custom objects used to store application configuration data.
#[serde(default)]
pub custom_setting: bool,
/// Indicates whether records of this object can be deep-cloned.
///
/// Deep cloning copies a record and certain related records, depending on
/// Salesforce object support and user permissions.
#[serde(default)]
pub deep_cloneable: bool,
/// Indicates whether records of this object can be deleted.
///
/// This value depends on the object type and the current user's permissions.
#[serde(default)]
pub deletable: bool,
/// Indicates whether this object is deprecated and hidden.
///
/// Deprecated and hidden objects are retained for compatibility but should
/// generally not be used for new development.
#[serde(default)]
pub deprecated_and_hidden: bool,
/// Indicates whether Chatter feed tracking is enabled for this object.
///
/// If `true`, the object supports feed-related functionality.
#[serde(default)]
pub feed_enabled: bool,
/// Field metadata for this object.
///
/// Each entry describes a field on the object, including its name, label,
/// type, length, precision, relationship information, permission flags,
/// picklist values, and other field-level metadata.
#[serde(default)]
pub fields: Vec<Field>,
/// Indicates whether this object has subtypes.
///
/// Some Salesforce objects can act as base objects with specialized subtypes.
#[serde(default)]
pub has_subtypes: bool,
/// Indicates whether this object is an interface object.
///
/// Interface objects represent common metadata shared by multiple concrete
/// object implementations.
#[serde(default)]
pub is_interface: bool,
/// Indicates whether this object is a subtype of another object.
///
/// If `true`, the object represents a specialized subtype rather than a base object.
#[serde(default)]
pub is_subtype: bool,
/// The three-character key prefix used in record IDs for this object.
///
/// Standard and custom objects that have Salesforce record IDs generally have
/// a key prefix. Some objects may not expose one, so this value is optional.
#[serde(default)]
pub key_prefix: Option<String>,
/// The display label for this object.
///
/// This is the singular, user-facing label shown in the Salesforce UI.
#[serde(default)]
pub label: String,
/// The plural display label for this object.
///
/// This is the plural, user-facing label shown in the Salesforce UI.
#[serde(default)]
pub label_plural: String,
/// Indicates whether this object supports layouts.
///
/// If `true`, layout metadata can be retrieved for this object.
#[serde(default)]
pub layoutable: bool,
/// Indicates whether list views are supported for this object.
///
/// This value can be absent for some objects or API versions, so it is optional.
#[serde(default)]
pub listviewable: Option<bool>,
/// Indicates whether lookup layouts are supported for this object.
///
/// Lookup layouts control which fields appear when records of this object are
/// displayed in lookup dialogs.
#[serde(default)]
pub lookup_layoutable: Option<bool>,
/// Indicates whether records of this object can be merged.
///
/// This is typically available for selected standard objects such as Account,
/// Contact, and Lead, depending on permissions and configuration.
#[serde(default)]
pub mergeable: bool,
/// Indicates whether recently viewed records are tracked for this object.
///
/// If `true`, the object can appear in most-recently-used lists.
#[serde(default)]
pub mru_enabled: bool,
/// The API name of the object.
///
/// For custom objects, this usually ends in `__c`.
#[serde(default)]
pub name: String,
/// Metadata for named layouts associated with this object.
///
/// Named layout information identifies special layouts that can be retrieved
/// or referenced for the object.
#[serde(default)]
pub named_layout_infos: Vec<NamedLayoutInfo>,
/// The field used to scope this object in Salesforce communities or networks.
///
/// This value is only present for objects that support network scoping.
#[serde(default)]
pub network_scope_field_name: Option<String>,
/// Indicates whether this object can be queried using SOQL.
///
/// If `true`, records of this object can be queried by the current user.
#[serde(default)]
pub queryable: bool,
/// Record type metadata for this object.
///
/// Each entry describes a record type, including its ID, name, availability,
/// default mapping, master status, and other record type details.
#[serde(default)]
pub record_type_infos: Vec<Value>,
/// Indicates whether this object supports data replication calls.
///
/// If `true`, the object can be used with replication-oriented APIs such as
/// calls that retrieve updated or deleted records.
#[serde(default)]
pub replicateable: bool,
/// Indicates whether records of this object can be retrieved.
///
/// This value depends on object support and the current user's permissions.
#[serde(default)]
pub retrieveable: bool,
/// Indicates whether search layouts are supported for this object.
///
/// Search layouts determine which fields appear in search results and lookup
/// dialogs for supported objects.
#[serde(default)]
pub search_layoutable: Option<bool>,
/// Indicates whether this object can be searched.
///
/// If `true`, records of this object can be returned by Salesforce search.
#[serde(default)]
pub searchable: bool,
/// Scope metadata supported by this object.
///
/// Supported scopes sobject_basic_info filtering scopes that can be applied when
/// querying or viewing records, such as "all records" or user-specific scopes.
#[serde(default)]
pub supported_scopes: Vec<ScopeInfo>,
/// Indicates whether Apex triggers are supported for this object.
///
/// If `true`, triggers can be defined for this object.
#[serde(default)]
pub triggerable: bool,
/// Indicates whether deleted records of this object can be undeleted.
///
/// This depends on object support, recycle bin behavior, and user permissions.
#[serde(default)]
pub undeletable: bool,
/// Indicates whether records of this object can be updated.
///
/// This value depends on the object type and the current user's permissions.
#[serde(default)]
pub updateable: bool,
/// URL templates and related REST resource URLs for this object.
///
/// The map can include URLs for resources such as the object endpoint,
/// sobject_basic_info endpoint, row template, layouts, compact layouts, approval
/// layouts, list views, quick actions, and default values.
#[serde(default)]
pub urls: HashMap<String, String>,
}
#[derive(Deserialize, Serialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct NamedLayoutInfo {
/// Name of this layout.
name: String,
}
#[derive(Deserialize, Serialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct ScopeInfo {
/// UI label for this scope..
label: String,
/// Name of this scope.
name: String,
}