text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Students
{
    class MainProgram
    {
        static void Main()
        {
            Student sampleStudent01 = new Student ("Nikolay", "Kostov", "111105", "02200300", "nikolay@abv.bg", new List<int>{3, 2, 4, 6}, 1);
            Student sampleStudent02 = new Student ("Doncho", "Minkov", "222205", "0888200300", "doncho@abv.bg", new List<int> { 4, 2, 2, 5 }, 2);
            Student sampleStudent03 = new Student("Ivaylo", "Kenov", "333306", "+35928200300", "ivaylo@gmail.com", new List<int> { 4, 5, 5, 6 }, 2);
            Student sampleStudent04 = new Student("Evlogi", "Hristov", "444406", "+359886200300", "evlogi@yahoo.com", new List<int> { 6, 5, 5, 6 }, 3);
            Student sampleStudent05 = new Student("Svetlin", "Nakov", "555504", "+359886300400", "evlogi@yahoo.com", new List<int> { 4, 6, 6, 6 }, 1);

            List<Student> sampleStudents =
                new List<Student> { sampleStudent01, sampleStudent02, sampleStudent03, sampleStudent04, sampleStudent05 };

            /*
             Problem 9. Student groups
             Create a class Student with properties FirstName, LastName, FN, Tel, Email, Marks (a List), GroupNumber.
             Create a List<Student> with sample students. Select only the students that are from group number 2.
             Use LINQ query. Order the students by FirstName.
            */
            #region Solving Problem 09
            //problem 9
            Console.WriteLine(new string('-', 30));
            Console.WriteLine("All students from group 2:");
            Console.WriteLine(new string('-', 30));
            var studentsFromGroup2 =
                                from student in sampleStudents
                                where student.GroupNumber == 2
                                select student;

            var orderedStudentsFromGroup2 =
                                from student in studentsFromGroup2
                                orderby student.FirstName
                                select student;

            foreach (var st in orderedStudentsFromGroup2)
            {
                Console.WriteLine(st);
                Console.WriteLine();
            }
            #endregion

            /*
             Problem 10. Student groups extensions
             Implement the previous using the same query expressed with extension methods.
            */
            #region Solving Problem 10
            //problem 10
            Console.WriteLine(new string('-', 30));
            Console.WriteLine("All students from group 2(using extension methods):");
            Console.WriteLine(new string('-', 30));

            var orderedStudents2 = sampleStudents.Where(x => x.GroupNumber == 2).OrderBy(x => x.FirstName);

            foreach (var st in orderedStudents2)
            {
                Console.WriteLine(st);
                Console.WriteLine();
            }
            #endregion

            /*
             Problem 11. Extract students by email
             Extract all students that have email in abv.bg.
             Use string methods and LINQ.
            */
            #region Solbing Problem 11
            //problem 11
            var studentsWithEmailsInAbv =
                                from student in sampleStudents
                                where student.Email.Contains("@abv.bg")
                                select student;

            Console.WriteLine(new string('-', 30));
            Console.WriteLine("All students with email in abv:");
            Console.WriteLine(new string('-', 30));

            foreach (var st in studentsWithEmailsInAbv)
            {
                Console.WriteLine(st);
                Console.WriteLine();
            }
            #endregion

            /*
             Problem 12. Extract students by phone
             Extract all students with phones in Sofia.
             Use LINQ.
            */
            #region Solbing Problem 12
            //problem 12
            var studentsWithPhonesInSofia =
                                from student in sampleStudents
                                where student.Tel.StartsWith("02") || student.Tel.StartsWith("+3592")
                                select student;

            Console.WriteLine(new string('-', 30));
            Console.WriteLine("All students with phone in Sofia:");
            Console.WriteLine(new string('-', 30));

            foreach (var st in studentsWithPhonesInSofia)
            {
                Console.WriteLine(st);
                Console.WriteLine();
            }
            #endregion

            /*
             Problem 13. Extract students by marks
             Select all students that have at least one mark Excellent (6) into a new anonymous class that has properties – FullName and Marks.
             Use LINQ.
            */
            #region Solving Problem 13
            var studentsWithExcellentMark =
                                from student in sampleStudents
                                where student.Marks.Contains(6)
                                select new
                                {
                                    FullName = student.FirstName + " " + student.LastName,
                                    MarksList = student.Marks
                                };

            Console.WriteLine(new string('-', 30));
            Console.WriteLine("All students with at least one excellent mark(6):");
            Console.WriteLine(new string('-', 30));

            foreach (var student in studentsWithExcellentMark)
            {
                Console.WriteLine("Full name: {0}", student.FullName);
                Console.WriteLine("Marks: {0}", string.Join(", ", student.MarksList));
                Console.WriteLine();
            }
            #endregion

            /*
             Problem 14. Extract students with two marks
             Write down a similar program that extracts the students with exactly two marks "2".
             Use extension methods.
            */
            #region Solving Problem 14
            var studentsWithTwoTwos = sampleStudents.Where(x => x.Marks.FindAll(y => y == 2).Count == 2).
                                                     Select(x => new
                                                     {
                                                         FullName = x.FirstName + " " + x.LastName,
                                                         MarksList = x.Marks
                                                     });

            Console.WriteLine(new string('-', 30));
            Console.WriteLine("All students with exactly two poor marks:");
            Console.WriteLine(new string('-', 30));

            foreach (var student in studentsWithTwoTwos)
            {
                Console.WriteLine("Full name: {0}", student.FullName);
                Console.WriteLine("Marks: {0}", string.Join(", ", student.MarksList));
                Console.WriteLine();
            }
            #endregion

            /*
             Problem 15. Extract marks
             Extract all Marks of the students that enrolled in 2006. (The students from 2006 have 06 as their 5-th and 6-th digit in the FN).
            */
            #region Solving Problem 15

            var studentsFrom2006 = sampleStudents.Where(x => x.FN[4] == '0' && x.FN[5] == '6');
            var allMarksFrom2006 = new List<int>();
            foreach (var student in studentsFrom2006)
            {
                allMarksFrom2006.AddRange(student.Marks);
            }

            Console.WriteLine(new string('-', 30));
            Console.WriteLine("All marks from 2006:");
            Console.WriteLine(new string('-', 30));

            Console.WriteLine("{0}", string.Join(", ", allMarksFrom2006));
            Console.WriteLine();
            #endregion

            /*
             Problem 16.* Groups
             Create a class Group with properties GroupNumber and DepartmentName.
             Introduce a property GroupNumber in the Student class.
             Extract all students from "Mathematics" department.
             Use the Join operator
            */
            #region Solving Problem 16

            Group group1 = new Group(1, "Mathematics");
            Group group2 = new Group(2, "Literature");
            Group group3 = new Group(3, "Computer Science");
            List<Group> departments = new List<Group> { group1, group2, group3 };

            var studentsFromMathDpt =
                                from someGroup in departments
                                where someGroup.GroupNumber == 1
                                join student in sampleStudents on someGroup.GroupNumber equals student.GroupNumber
                                select new
                                {
                                    Name = student.FirstName + " " + student.LastName,
                                    Department = someGroup.DepartmentName
                                };

            Console.WriteLine(new string('-', 30));
            Console.WriteLine("All students in Mathematics Department:");
            Console.WriteLine(new string('-', 30));

            foreach (var student in studentsFromMathDpt)
            {
                Console.WriteLine(student);
            }
            Console.WriteLine();
            #endregion

            /*
            Problem 18. Grouped by GroupNumber
            Create a program that extracts all students grouped by GroupNumber and then prints them to the console.
            Use LINQ.
            */
            #region Solving Problem 18

            var groupedStudents =
                                from student in sampleStudents
                                group student by student.GroupNumber
                                into groups
                                select new
                                {
                                    Group = groups.Key,
                                    Students = groups.ToList()
                                };

            Console.WriteLine(new string('-', 30));
            Console.WriteLine("All students sorted into groups:");
            Console.WriteLine(new string('-', 30));
            foreach (var grouped in groupedStudents)
            {
                Console.WriteLine("\nGroup: {0} Students:\n......................\n{1}", grouped.Group,
                string.Join("\r\n\r\n", grouped.Students));
            }
            Console.WriteLine();
            #endregion

            /*
            Problem 19. Grouped by GroupName extensions
            Rewrite the previous using extension methods.
            */
            #region Solving Problem 19
            var groupedStudents2 = sampleStudents.GroupBy(x => x.GroupNumber, (groupNumber, students) => new { Group = groupNumber, Students = students });

            Console.WriteLine(new string('-', 30));
            Console.WriteLine("All students sorted into groups(using extension methods):");
            Console.WriteLine(new string('-', 30));
            foreach (var grouped in groupedStudents2)
            {
                Console.WriteLine("\nGroup: {0} Students:\n......................\n{1}", grouped.Group,
                string.Join("\r\n\r\n", grouped.Students));
            }
            Console.WriteLine();
            #endregion

        }
    }
}


text:
package com.matao;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

/**
 * Created by matao on 2018/8/24.
 */
public class Q03_DuplicationInArrayTest {
    private Q03_DuplicationInArray duplicationInArray;
    private int[] data1;
    private int[] data2;

    @BeforeEach
    void setUp() {
        duplicationInArray = new Q03_DuplicationInArray();
        data1 = new int[]{2, 3, 1, 0, 2, 5, 3};
        data2 = new int[]{2, 3, 1, 0, 4, 5, 5};
    }

    @Test
    void testFindDuplication1() {
        Assertions.assertEquals(2, duplicationInArray.findDuplication1(data1));
        Assertions.assertEquals(5, duplicationInArray.findDuplication1(data2));
    }

    @Test
    void testFindDuplication2() {
        Assertions.assertEquals(2, duplicationInArray.findDuplication2(data1));
        Assertions.assertEquals(5, duplicationInArray.findDuplication2(data2));
    }

    @Test
    void testFindDuplication3() {
        Assertions.assertEquals(2, duplicationInArray.findDuplication3(data1));
        Assertions.assertEquals(5, duplicationInArray.findDuplication3(data2));
    }

    @Test
    void testFindDuplication4() {
        Assertions.assertEquals(2, duplicationInArray.findDuplication4(data1));
        Assertions.assertEquals(5, duplicationInArray.findDuplication4(data2));
    }

    @Test
    void testFindDuplication5() {
        Assertions.assertEquals(2, duplicationInArray.findDuplication5(data1));
        Assertions.assertEquals(5, duplicationInArray.findDuplication5(data2));
    }
}

redpajama_set_name: RedPajamaGithub


text:
#ifndef LAMBERT
#define LAMBERT

#include <vector>

/**
 * Computes the initial velocity and final velocity for the orbit boundary value problem.
 * @param	grav_param	The gravitational parameter of the two-body system.
 * @param	r0	The initial position of the secondary body.
 * @param	rf	The final position of the secondary body.
 * @param	dt	The transfer time.
 * @param	long_way	Set to true if the long-way transfer is desired.
 * @returns	The initial velocity and final velocities packed into a single vector.
 */
std::vector<double> boundingVelocities(double grav_param, std::vector<double> r0,
	std::vector<double> rf, double dt, bool long_way);

#endif


text:
'use strict';

/*
 * Module Definition
 *
 */

import Locator from '../components/locator/index';

/*
 * Private Variables
 *
 */

const jdb = {};
jdb.locator = Locator();

/*
 * Module Export (Exposes 'jdb' container object to the global scope)
 *
 */

export default jdb;


text:
<?php

namespace Tekstove\SiteBundle\Model\Gateway\Tekstove\Client;

/**
 *
 * @author po_taka
 */
class Response
{
    private $body;

    public function __construct($body)
    {
        $this->body = $body;
    }

    public function getBody()
    {
        return $this->body;
    }
}


text:
package org.springframework.aop.config;

import java.lang.reflect.Method;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.util.StringUtils;

/**
 * {@link FactoryBean} implementation that locates a {@link Method} on a specified bean.
 *
 * @author Rob Harrop
 * @since 2.0
 */
public class MethodLocatingFactoryBean implements FactoryBean, BeanFactoryAware {

	private String targetBeanName;

	private String methodName;

	private Method method;

	/**
	 * Set the name of the bean to locate the {@link Method} on.
     *
This property is required.
     * @param targetBeanName the name of the bean to locate the {@link Method} on
	 */
	public void setTargetBeanName(String targetBeanName) {
		this.targetBeanName = targetBeanName;
	}

	/**
	 * Set the name of the {@link Method} to locate.
     *
This property is required.
     * @param methodName the name of the {@link Method} to locate
	 */
	public void setMethodName(String methodName) {
		this.methodName = methodName;
	}

	public void setBeanFactory(BeanFactory beanFactory) {
		if (!StringUtils.hasText(this.targetBeanName)) {
			throw new IllegalArgumentException("Property 'targetBeanName' is required");
		}
		if (!StringUtils.hasText(this.methodName)) {
			throw new IllegalArgumentException("Property 'methodName' is required");
		}

		Class beanClass = beanFactory.getType(this.targetBeanName);
		if (beanClass == null) {
			throw new IllegalArgumentException("Can't determine type of bean with name '" + this.targetBeanName + "'");
		}
		this.method = BeanUtils.resolveSignature(this.methodName, beanClass);

		if (this.method == null) {
			throw new IllegalArgumentException("Unable to locate method [" + this.methodName +
					"] on bean [" + this.targetBeanName + "]");
		}
	}

	public Object getObject() throws Exception {
		return this.method;
	}

	public Class getObjectType() {
		return Method.class;
	}

	public boolean isSingleton() {
		return true;
	}

}


text:
<?php

namespace restlt;
/**
 *
 * @author Vo
 *
 */
interface ResponseInterface {
	public function send();
	public function setStatus($status);
	public function addHeader($name, $value);
}


text:
package scheduler

import (
	"fmt"
	"math/rand"
	"strings"
	"sync"

	"github.com/golang/glog"
	"k8s.io/kubernetes/pkg/api"
	"k8s.io/kubernetes/pkg/util/sets"
	"k8s.io/kubernetes/plugin/pkg/scheduler/algorithm"
	"k8s.io/kubernetes/plugin/pkg/scheduler/algorithm/predicates"
)

type FailedPredicateMap map[string]sets.String

type FitError struct {
	Pod              *api.Pod
	FailedPredicates FailedPredicateMap
}

var ErrNoNodesAvailable = fmt.Errorf("no nodes available to schedule pods")

// implementation of the error interface
func (f *FitError) Error() string {
	var reason string
	// We iterate over all nodes for logging purposes, even though we only return one reason from one node
	for node, predicateList := range f.FailedPredicates {
		glog.Infof("Failed to find fit for pod %v on node %s: %s", f.Pod.Name, node, strings.Join(predicateList.List(), ","))
		if len(reason) == 0 {
			reason, _ = predicateList.PopAny()
		}
	}
	return fmt.Sprintf("Failed for reason %s and possibly others", reason)
}

type genericScheduler struct {
	predicates   map[string]algorithm.FitPredicate
	prioritizers []algorithm.PriorityConfig
	pods         algorithm.PodLister
	random       *rand.Rand
	randomLock   sync.Mutex
}

func (g *genericScheduler) Schedule(pod *api.Pod, nodeLister algorithm.NodeLister) (string, error) {
	nodes, err := nodeLister.List()
	if err != nil {
		return "", err
	}
	if len(nodes.Items) == 0 {
		return "", ErrNoNodesAvailable
	}

	filteredNodes, failedPredicateMap, err := findNodesThatFit(pod, g.pods, g.predicates, nodes)
	if err != nil {
		return "", err
	}

	priorityList, err := PrioritizeNodes(pod, g.pods, g.prioritizers, algorithm.FakeNodeLister(filteredNodes))
	if err != nil {
		return "", err
	}
	if len(priorityList) == 0 {
		return "", &FitError{
			Pod:              pod,
			FailedPredicates: failedPredicateMap,
		}
	}

	return g.selectHost(priorityList)
}

// This method takes a prioritized list of nodes, shuffles those with the highest scores to the
// front of the list, and then picks one randomly from the nodes that had the highest score.
func (g *genericScheduler) selectHost(priorityList algorithm.HostPriorityList) (string, error) {
	if len(priorityList) == 0 {
		return "", fmt.Errorf("empty priorityList")
	}
	max := priorityList[0].Score
	n := 0
	for i, hostEntry := range priorityList {
		if hostEntry.Score < max {
			continue
		}
		if hostEntry.Score > max {
			max = hostEntry.Score
			n = 0
		}
		priorityList[i], priorityList[n] = priorityList[n], priorityList[i]
		n++
	}
	if n == 1 {
		return priorityList[0].Host, nil
	}

	g.randomLock.Lock()
	defer g.randomLock.Unlock()
	return priorityList[g.random.Intn(n)].Host, nil
}

// Filters the nodes to find the ones that fit based on the given predicate functions
// Each node is passed through the predicate functions to determine if it is a fit
func findNodesThatFit(pod *api.Pod, podLister algorithm.PodLister, predicateFuncs map[string]algorithm.FitPredicate, nodes api.NodeList) (api.NodeList, FailedPredicateMap, error) {
	filtered := []api.Node{}
	machineToPods, err := predicates.MapPodsToMachines(podLister)
	failedPredicateMap := FailedPredicateMap{}
	if err != nil {
		return api.NodeList{}, FailedPredicateMap{}, err
	}
	for _, node := range nodes.Items {
		fits := true
		for name, predicate := range predicateFuncs {
			predicates.FailedResourceType = ""
			fit, err := predicate(pod, machineToPods[node.Name], node.Name)
			if err != nil {
				return api.NodeList{}, FailedPredicateMap{}, err
			}
			if !fit {
				fits = false
				if _, found := failedPredicateMap[node.Name]; !found {
					failedPredicateMap[node.Name] = sets.String{}
				}
				if predicates.FailedResourceType != "" {
					failedPredicateMap[node.Name].Insert(predicates.FailedResourceType)
					break
				}
				failedPredicateMap[node.Name].Insert(name)
				break
			}
		}
		if fits {
			filtered = append(filtered, node)
		}
	}
	return api.NodeList{Items: filtered}, failedPredicateMap, nil
}

// Prioritizes the nodes by running the individual priority functions sequentially.
// Each priority function is expected to set a score of 0-10
// 0 is the lowest priority score (least preferred node) and 10 is the highest
// Each priority function can also have its own weight
// The node scores returned by the priority function are multiplied by the weights to get weighted scores
// All scores are finally combined (added) to get the total weighted scores of all nodes
func PrioritizeNodes(pod *api.Pod, podLister algorithm.PodLister, priorityConfigs []algorithm.PriorityConfig, nodeLister algorithm.NodeLister) (algorithm.HostPriorityList, error) {
	result := algorithm.HostPriorityList{}

	// If no priority configs are provided, then the EqualPriority function is applied
	// This is required to generate the priority list in the required format
	if len(priorityConfigs) == 0 {
		return EqualPriority(pod, podLister, nodeLister)
	}

	combinedScores := map[string]int{}
	for _, priorityConfig := range priorityConfigs {
		weight := priorityConfig.Weight
		// skip the priority function if the weight is specified as 0
		if weight == 0 {
			continue
		}
		priorityFunc := priorityConfig.Function
		prioritizedList, err := priorityFunc(pod, podLister, nodeLister)
		if err != nil {
			return algorithm.HostPriorityList{}, err
		}
		for _, hostEntry := range prioritizedList {
			combinedScores[hostEntry.Host] += hostEntry.Score * weight
		}
	}
	for host, score := range combinedScores {
		glog.V(10).Infof("Host %s Score %d", host, score)
		result = append(result, algorithm.HostPriority{Host: host, Score: score})
	}
	return result, nil
}

// EqualPriority is a prioritizer function that gives an equal weight of one to all nodes
func EqualPriority(_ *api.Pod, podLister algorithm.PodLister, nodeLister algorithm.NodeLister) (algorithm.HostPriorityList, error) {
	nodes, err := nodeLister.List()
	if err != nil {
		glog.Errorf("Failed to list nodes: %v", err)
		return []algorithm.HostPriority{}, err
	}

	result := []algorithm.HostPriority{}
	for _, node := range nodes.Items {
		result = append(result, algorithm.HostPriority{
			Host:  node.Name,
			Score: 1,
		})
	}
	return result, nil
}

func NewGenericScheduler(predicates map[string]algorithm.FitPredicate, prioritizers []algorithm.PriorityConfig, pods algorithm.PodLister, random *rand.Rand) algorithm.ScheduleAlgorithm {
	return &genericScheduler{
		predicates:   predicates,
		prioritizers: prioritizers,
		pods:         pods,
		random:       random,
	}
}


text:
<?php
class Gep_ReportController extends Zend_Controller_Action {

    public function init()
    {
     /* Initialize action controller here */
    	header('content-type: text/html; charset=utf8');
	}
	public function indexAction()
	{

	}
	public function rptExamDegreeAction()
	{
	}
	public function rptFinalExamsAction()
	{

	}

	public function rptStuidAction()
	{

	}
	public function rptFoundationAction()
	{

	}
	public function rptDropOutAction()
	{

	}
	public function rptTotalAttendanceAction()
	{

	}
	public function rptAmountStudentAction()
	{

	}

	public function rptScorelistAction()
	{

	}
	public function rptStudentAttendanceAction()
	{

	}
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Mycotaxon 7(1): 91 (1978)

#### Original name
Microascus inopinatus Udagawa & Furuya

### Remarks
null


text:
package org.intellij.plugins.markdown.lang.parser;

import com.intellij.openapi.util.Key;
import org.intellij.markdown.MarkdownElementTypes;
import org.intellij.markdown.ast.ASTNode;
import org.intellij.markdown.flavours.MarkdownFlavourDescriptor;
import org.intellij.markdown.parser.MarkdownParser;
import org.intellij.plugins.markdown.extensions.CodeFencePluginFlavourDescriptor;
import org.jetbrains.annotations.NotNull;

public class MarkdownParserManager {
  public static final Key<MarkdownFlavourDescriptor> FLAVOUR_DESCRIPTION = Key.create("Markdown.Flavour");

  public static final GFMCommentAwareFlavourDescriptor FLAVOUR = new GFMCommentAwareFlavourDescriptor();
  public static final CodeFencePluginFlavourDescriptor CODE_FENCE_PLUGIN_FLAVOUR = new CodeFencePluginFlavourDescriptor();

  private static final ThreadLocal<ParsingInfo> ourLastParsingResult = new ThreadLocal<>();

  public static ASTNode parseContent(@NotNull CharSequence buffer) {
    return parseContent(buffer, FLAVOUR);
  }

  public static ASTNode parseContent(@NotNull CharSequence buffer, @NotNull MarkdownFlavourDescriptor flavour) {
    final ParsingInfo info = ourLastParsingResult.get();
    if (info != null && info.myBufferHash == buffer.hashCode() && info.myBuffer.equals(buffer)) {
      return info.myParseResult;
    }

    final ASTNode parseResult = new MarkdownParser(flavour)
      .parse(MarkdownElementTypes.MARKDOWN_FILE, buffer.toString(), false);
    ourLastParsingResult.set(new ParsingInfo(buffer, parseResult));
    return parseResult;
  }

  private static class ParsingInfo {
    @NotNull
    final CharSequence myBuffer;
    final int myBufferHash;
    @NotNull
    final ASTNode myParseResult;

    ParsingInfo(@NotNull CharSequence buffer, @NotNull ASTNode parseResult) {
      myBuffer = buffer;
      myBufferHash = myBuffer.hashCode();
      myParseResult = parseResult;
    }
  }
}


text:
package bitbucket

import (
	"encoding/json"

	"github.com/mitchellh/mapstructure"
)

type DeployKeys struct {
	c *Client
}

type DeployKey struct {
	Id      int    `json:"id"`
	Label   string `json:"label"`
	Key     string `json:"key"`
	Comment string `json:"comment"`
}

func decodeDeployKey(response interface{}) (*DeployKey, error) {
	respMap := response.(map[string]interface{})

	if respMap["type"] == "error" {
		return nil, DecodeError(respMap)
	}

	var deployKey = new(DeployKey)
	err := mapstructure.Decode(respMap, deployKey)
	if err != nil {
		return nil, err
	}

	return deployKey, nil
}

func buildDeployKeysBody(opt *DeployKeyOptions) (string, error) {
	body := map[string]interface{}{}
	body["label"] = opt.Label
	body["key"] = opt.Key

	data, err := json.Marshal(body)
	if err != nil {
		return "", err
	}

	return string(data), nil
}

func (dk *DeployKeys) Create(opt *DeployKeyOptions) (*DeployKey, error) {
	data, err := buildDeployKeysBody(opt)
	if err != nil {
		return nil, err
	}
	urlStr := dk.c.requestUrl("/repositories/%s/%s/deploy-keys", opt.Owner, opt.RepoSlug)
	response, err := dk.c.execute("POST", urlStr, data)
	if err != nil {
		return nil, err
	}

	return decodeDeployKey(response)
}

func (dk *DeployKeys) Get(opt *DeployKeyOptions) (*DeployKey, error) {
	urlStr := dk.c.requestUrl("/repositories/%s/%s/deploy-keys/%d", opt.Owner, opt.RepoSlug, opt.Id)
	response, err := dk.c.execute("GET", urlStr, "")
	if err != nil {
		return nil, err
	}

	return decodeDeployKey(response)
}

func (dk *DeployKeys) Delete(opt *DeployKeyOptions) (interface{}, error) {
	urlStr := dk.c.requestUrl("/repositories/%s/%s/deploy-keys/%d", opt.Owner, opt.RepoSlug, opt.Id)
	return dk.c.execute("DELETE", urlStr, "")
}