// 2019 Rackspace, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"): you may // not use this file except in compliance with the License. You may obtain // a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the // License for the specific language governing permissions and limitations // under the License. package shared import ( "context" "crypto/tls" "fmt" "log" "net/http" "github.com/FabianWe/etherpadlite-golang" ) // PostToEtherPad will serve as the helper to create an etherpad with data // returned from a plugin. // TODO: This is not working yet. Currently etherpad is low on resources and in the process of being rebuilt. func PostToEtherPad() { pad := etherpadlite.NewEtherpadLite("") pad.BaseURL = "https://etherpad.rax.io/api" pad.APIVersion = "1" pad.Client = &http.Client{ Transport: &http.Transport{ //nolint:gosec TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, }, } response, err := pad.CreatePad(context.TODO(), "migration_client_test", "Test Etherpad") if err != nil { log.Fatal(err) } fmt.Println(response.Code, response.Message, response.Data) }