Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

37
LINES

< > BotCompany Repo | #1036019 // BitGetCredentials

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (11357L/63K).

1  
sclass BitGetCredentials {
2  
  settable S name;
3  
  settable S apiKey;
4  
  settable S passphrase;
5  
  settable S secretKey;
6  
  
7  
  toString {
8  
    ret joinNempties(" with ",
9  
      spaceCombine(shortClassName(this), quoteOrEmpty(name)),
10  
      commaCombine(
11  
        nempty(apiKey) ? "apiKey " + roundBracket(nCharacters(apiKey)) : null,
12  
        nempty(passphrase) ? "passphrase " + roundBracket(nCharacters(passphrase)) : null,
13  
        nempty(secretKey) ? "secretKey " + roundBracket(nCharacters(secretKey)) : null));
14  
  }
15  
  
16  
  static BitGetCredentials fromFile(File f) {
17  
    var credMap = parseColonPropertyCIMap(loadTextFile(f));
18  
    ret new BitGetCredentials()
19  
      .apiKey(credMap.get("API-Key"))
20  
      .passphrase(credMap.get("Passphrase"))
21  
      .secretKey(credMap.get("SecretKey"))
22  
      .name(credMap.get("Name"));
23  
  }
24  
  
25  
  void save(File f) {
26  
    saveTextFile(f, formatColonProperties(litorderedmap(
27  
      "API-Key" := apiKey,
28  
      "Passphrase" := passphrase,
29  
      "SecretKey" := secretKey,
30  
      "Name" := name
31  
    )));
32  
  }
33  
  
34  
  bool complete() {
35  
    ret nempty(apiKey) && nempty(passphrase) && nempty(secretKey);
36  
  }
37  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): elmgxqgtpvxh, mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1036019
Snippet name: BitGetCredentials
Eternal ID of this version: #1036019/13
Text MD5: fb7f1011bc7e74f6947ba919ad3ff5f3
Transpilation MD5: ac7c736dde6aa090cc47acbe2a694a78
Author: stefan
Category: javax / networking
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2023-08-21 15:55:04
Source code size: 1154 bytes / 37 lines
Pitched / IR pitched: No / No
Views / Downloads: 184 / 297
Version history: 12 change(s)
Referenced in: [show references]