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
//! Version Management Service client.
use crateArcGISClient;
use instrument;
/// Client for interacting with an ArcGIS Version Management Service.
///
/// The Version Management Service provides operations for working with versioned
/// geodatabases, including edit sessions, version creation, and reconciliation.
///
/// # Edit Sessions
///
/// Edit sessions are required when working with branch-versioned geodatabases.
/// They provide write locks and transaction semantics for multi-request workflows:
///
/// 1. Start an edit session with [`start_editing`](Self::start_editing)
/// 2. Perform edits (add, update, delete features)
/// 3. Stop the session with [`stop_editing`](Self::stop_editing)
///
/// # Example
///
/// ```no_run
/// use arcgis::{ArcGISClient, ClientCredentialsAuth, VersionManagementClient, SessionId};
/// use uuid::Uuid;
///
/// # async fn example() -> arcgis::Result<()> {
/// let auth = ClientCredentialsAuth::new(
/// "client_id".to_string(),
/// "client_secret".to_string(),
/// ).expect("Valid credentials");
/// let client = ArcGISClient::new(auth);
///
/// let vm_client = VersionManagementClient::new(
/// "https://services.arcgis.com/org/arcgis/rest/services/MyService/VersionManagementServer",
/// &client,
/// );
///
/// // Start an edit session
/// let version_guid = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")
/// .expect("Valid UUID");
/// let session_id = SessionId::new();
///
/// let start_response = vm_client
/// .start_editing(version_guid.into(), session_id)
/// .await?;
///
/// if *start_response.success() {
/// println!("Edit session started");
///
/// // Perform edits here...
///
/// // Save changes
/// let stop_response = vm_client
/// .stop_editing(version_guid.into(), session_id, true)
/// .await?;
///
/// if *stop_response.success() {
/// println!("Changes saved");
/// }
/// }
/// # Ok(())
/// # }
/// ```