Reset sync daemon local state if the client version has changed
[pithos-macos] / pithos-macos / PithosAccount.h
index dafacf2..dea922f 100644 (file)
@@ -1,8 +1,8 @@
 //
-//  PithosNode.h
+//  PithosAccount.h
 //  pithos-macos
 //
-// Copyright 2011 GRNET S.A. All rights reserved.
+// Copyright 2012 GRNET S.A. All rights reserved.
 //
 // Redistribution and use in source and binary forms, with or
 // without modification, are permitted provided that the following
 // or implied, of GRNET S.A.
 
 #import <Foundation/Foundation.h>
+@class PithosSyncDaemon;
+@class ASIPithos;
+@class ASIPithosRequest;
+@class PithosAccountNode;
+@class PithosSharingAccountsNode;
 
-@interface PithosNode : NSObject {
-    NSArray *children;
-//    BOOL childrenDirty;
+@interface PithosAccount : NSObject <NSCoding> {
+    NSString *uniqueName;
+    BOOL active;
+    NSString *name;
+    NSString *clientVersion;
+    
+    BOOL syncActive;
+    NSString *syncDirectoryPath;
+    NSMutableDictionary *syncAccountsDictionary;
+    BOOL syncSkipHidden;
+    NSDate *syncLastCompleted;
+    PithosSyncDaemon *syncDaemon;
+        
+    // Base for all necessary URLs, default "https://pithos.okeanos.grnet.gr"
+    NSString *serverURL;
+    // Appended to serverURL to get storageURLPrefix and authURL, default "v1"
+    // Can be overriden by setting directly storageURLPrefix and authURL
+    NSString *versionResource;
+    // Appended to serverURL to get loginURLPrefix, default "login"
+    // Can be overriden by setting directly loginURLPrefix
+    NSString *loginResource;
+    // Appended to serverURL to get publicURLPrefix, default nil
+    // Can be overriden by setting directly publicURLPrefix
+    NSString *publicResource;
+    // Appended to serverURL to get userCatalogURL, default "user_catalogs"
+    // Can be overriden by setting directly userCatalogURL
+    NSString *userCatalogResource;
+
+    NSString *authUser;
+    NSString *authToken;
+    NSString *storageURLPrefix;
+    NSString *authURL;
+    NSString *publicURLPrefix;
+    NSString *loginURLPrefix;
+    NSString *userCatalogURL;
+    NSMutableDictionary *userCatalog;
+    
+    ASIPithos *pithos;
+    PithosAccountNode *accountNode;
+    PithosSharingAccountsNode *sharingAccountsNode;
+    
+    BOOL updatePithos;
+    BOOL resetSyncDaemonLocalState;
 }
 
-@property(readonly) NSArray *children;
+@property (nonatomic, strong) NSString *uniqueName;
+@property (assign) BOOL active;
+@property (nonatomic, strong) NSString *name;
+@property (nonatomic, strong) NSString *clientVersion;
+
+@property (nonatomic, assign) BOOL syncActive;
+@property (nonatomic, strong) NSString *syncDirectoryPath;
+@property (nonatomic, strong) NSMutableDictionary *syncAccountsDictionary;
+@property (nonatomic, assign) BOOL syncSkipHidden;
+@property (nonatomic, strong) NSDate *syncLastCompleted;
+@property (nonatomic, strong) PithosSyncDaemon *syncDaemon;
+
+@property (nonatomic, strong) NSString *serverURL;
+@property (nonatomic, strong) NSString *versionResource;
+@property (nonatomic, strong) NSString *loginResource;
+@property (strong) NSString *publicResource;
+@property (nonatomic, strong) NSString *userCatalogResource;
+
+@property (nonatomic, strong) NSString *authUser;
+@property (nonatomic, strong) NSString *authToken;
+@property (nonatomic, strong) NSString *storageURLPrefix;
+@property (nonatomic, strong) NSString *authURL;
+@property (nonatomic, strong) NSString *publicURLPrefix;
+@property (nonatomic, strong) NSString *loginURLPrefix;
+@property (nonatomic, strong) NSString *userCatalogURL;
+@property (nonatomic, strong) NSMutableDictionary *userCatalog;
+
+@property (strong, readonly) ASIPithos *pithos;
+@property (readonly) PithosAccountNode *accountNode;
+@property (readonly) PithosSharingAccountsNode *sharingAccountsNode;
+
++ (id)pithosAccount;
 
-//- (void)invalidateChildren;
+- (BOOL)urlIsValid:(NSString *)urlString;
+- (void)authenticateWithServerURL:(NSString *)aServerURL authUser:(NSString *)anAuthUser authToken:(NSString *)anAuthToken;
+- (void)loginWithServerURL:(NSString *)aServerURL;
+- (void)updateSyncWithSyncActive:(BOOL)aSyncActive 
+               syncDirectoryPath:(NSString *)aSyncDirectoryPath 
+          syncAccountsDictionary:(NSMutableDictionary *)aSyncAccountsDictionary 
+                  syncSkipHidden:(BOOL)aSyncSkipHidden;
+- (ASIPithosRequest *)updateUserCatalogForForDisplaynames:(NSArray *)displaynames UUIDs:(NSArray *)UUIDs;
+- (NSString *)displaynameForUUID:(NSString *)UUID safe:(BOOL)safe;
+- (NSString *)displaynameForUUID:(NSString *)UUID;
 
 @end