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

static Snippet createSnippet(Snippet s) {
  s.id = createSnippet(s.text, s.title, parseSnippetType(s.type));
  ret s;
}

sS createSnippet(S text, S title, int type, bool isPublic default true) {
  ret createSnippet(text, title, type, standardCredentialsUser(), standardCredentialsPass(), isPublic);
}

sS createSnippet(S text, S title, int type, S user, S pass, bool isPublic default true) {
  S addURL = tb_mainServer() + "/tb-int/add_snippet.php";
  Map query = litmap("type", type,
    "high", 1,
    "public", isPublic ? 1 : 0,
    "text", text,
    "name", title,
    "_user", user,
    "_pass", pass);
  S answer = doPost(query, addURL);
  if (!isSnippetID(answer)) fail(answer);
  print("Snippet created. " + formatSnippetID(answer));
  ret formatSnippetID(answer);
}

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: 782 / 1107
Version history: 4 change(s)
Referenced in: [show references]