<commit_before>package core

import (
	"bytes"

	"log"
	"net/http"

	"gopkg.in/simversity/gottp.v3/utils"

	"gopkg.in/bulletind/khabar.v1/db"
	"gopkg.in/bulletind/khabar.v1/dbapi/saved_item"
)

const PARSE_URL = "https://api.parse.com/1/push"

const PUSH_SOUND = "default"

func pushHandler(
	item *db.PendingItem,
	text string,
	settings map[string]interface{},
) {
	log.Println("Sending Push Notification...")

	application_id, ok := settings["parse_application_id"].(string)
	if !ok {
		log.Println("parse_application_id is a required parameter.")
		return
	}

	api_key, ok := settings["parse_rest_api_key"].(string)
	if !ok {
		log.Println("parse_rest_api_key is a required parameter.")
		return
	}

	subject, ok := item.Context["subject"].(string)
	if !ok || subject == "" {
		subject = item.Topic
	}

	body := map[string]interface{}{}
	body["alert"] = subject
	body["message"] = text
	body["entity"] = item.Entity
	body["organization"] = item.Organization
	body["app_name"] = item.AppName
	body["topic"] = item.Topic
	body["created_on"] = item.CreatedOn
<<<<<<< HEAD
	body["sound"] = "default"
=======
	body["sound"] = PUSH_SOUND
>>>>>>> 8d74c563395f926c80b280bff11133e0e04f525f

	data := map[string]interface{}{}
	data["data"] = body
	data["channels"] = []string{"USER_" + item.User}

	var jsonStr = utils.Encoder(&data)

	req, err := http.NewRequest("POST", PARSE_URL, bytes.NewBuffer(jsonStr))

	req.Header.Set("X-Parse-Application-Id", application_id)
	req.Header.Set("X-Parse-REST-API-Key", api_key)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		panic(err)<commit_msg>Fixing merge conflict 2<commit_after>package core

import (
	"bytes"

	"log"
	"net/http"

	"gopkg.in/simversity/gottp.v3/utils"

	"gopkg.in/bulletind/khabar.v1/db"
	"gopkg.in/bulletind/khabar.v1/dbapi/saved_item"
)

const PARSE_URL = "https://api.parse.com/1/push"

const PUSH_SOUND = "default"

func pushHandler(
	item *db.PendingItem,
	text string,
	settings map[string]interface{},
) {
	log.Println("Sending Push Notification...")

	application_id, ok := settings["parse_application_id"].(string)
	if !ok {
		log.Println("parse_application_id is a required parameter.")
		return
	}

	api_key, ok := settings["parse_rest_api_key"].(string)
	if !ok {
		log.Println("parse_rest_api_key is a required parameter.")
		return
	}

	subject, ok := item.Context["subject"].(string)
	if !ok || subject == "" {
		subject = item.Topic
	}

	body := map[string]interface{}{}
	body["alert"] = subject
	body["message"] = text
	body["entity"] = item.Entity
	body["organization"] = item.Organization
	body["app_name"] = item.AppName
	body["topic"] = item.Topic
	body["created_on"] = item.CreatedOn
	body["sound"] = PUSH_SOUND

	data := map[string]interface{}{}
	data["data"] = body
	data["channels"] = []string{"USER_" + item.User}

	var jsonStr = utils.Encoder(&data)

	req, err := http.NewRequest("POST", PARSE_URL, bytes.NewBuffer(jsonStr))

	req.Header.Set("X-Parse-Application-Id", application_id)
	req.Header.Set("X-Parse-REST-API-Key", api_key)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		panic(err)
{'fraction_non_alphanumeric': 0.17754407670893907, 'fraction_numerical': 0.011444478812248686, 'mean_word_length': 4.827027027027027, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6382753', 'n_tokens_mistral': 1271, 'n_tokens_neox': 1209, 'n_words': 214}