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).

sclass BitGetCredentials {
  settable S name;
  settable S apiKey;
  settable S passphrase;
  settable S secretKey;
  
  toString {
    ret joinNempties(" with ",
      spaceCombine(shortClassName(this), quoteOrEmpty(name)),
      commaCombine(
        nempty(apiKey) ? "apiKey " + roundBracket(nCharacters(apiKey)) : null,
        nempty(passphrase) ? "passphrase " + roundBracket(nCharacters(passphrase)) : null,
        nempty(secretKey) ? "secretKey " + roundBracket(nCharacters(secretKey)) : null));
  }
  
  static BitGetCredentials fromFile(File f) {
    var credMap = parseColonPropertyCIMap(loadTextFile(f));
    ret new BitGetCredentials()
      .apiKey(credMap.get("API-Key"))
      .passphrase(credMap.get("Passphrase"))
      .secretKey(credMap.get("SecretKey"))
      .name(credMap.get("Name"));
  }
  
  void save(File f) {
    saveTextFile(f, formatColonProperties(litorderedmap(
      "API-Key" := apiKey,
      "Passphrase" := passphrase,
      "SecretKey" := secretKey,
      "Name" := name
    )));
  }
  
  bool complete() {
    ret nempty(apiKey) && nempty(passphrase) && nempty(secretKey);
  }
}

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: 183 / 296
Version history: 12 change(s)
Referenced in: #1003674 - Standard Classes + Interfaces (LIVE continued in #1034167)
#1036192 - GazAICredentials