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

23
LINES

< > BotCompany Repo | #1002336 // createSnippet

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

Libraryless. Click here for Pure Java version (4058L/29K).

1  
static Snippet createSnippet(Snippet s) {
2  
  s.id = createSnippet(s.text, s.title, parseSnippetType(s.type));
3  
  ret s;
4  
}
5  
6  
sS createSnippet(S text, S title, int type, bool isPublic default true) {
7  
  ret createSnippet(text, title, type, standardCredentialsUser(), standardCredentialsPass(), isPublic);
8  
}
9  
10  
sS createSnippet(S text, S title, int type, S user, S pass, bool isPublic default true) {
11  
  S addURL = tb_mainServer() + "/tb-int/add_snippet.php";
12  
  Map query = litmap("type", type,
13  
    "high", 1,
14  
    "public", isPublic ? 1 : 0,
15  
    "text", text,
16  
    "name", title,
17  
    "_user", user,
18  
    "_pass", pass);
19  
  S answer = doPost(query, addURL);
20  
  if (!isSnippetID(answer)) fail(answer);
21  
  print("Snippet created. " + formatSnippetID(answer));
22  
  ret formatSnippetID(answer);
23  
}

Author comment

Began life as a copy of #1001631

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1002336
Snippet name: createSnippet
Eternal ID of this version: #1002336/5
Text MD5: d360f2403e8f3f35427fab9688021e5f
Transpilation MD5: e5186abbf355a8aa6a3b9b7d66ca9e5c
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-09-16 11:53:49
Source code size: 796 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 784 / 1109
Version history: 4 change(s)
Referenced in: [show references]