grim/youtrack-import
Clone
Summary
Browse
Changes
Graph
Use the built in mime stuff to figure out the content type for attachments
2020-01-14, Gary Kramlich
4763018b25c8
Use the built in mime stuff to figure out the content type for attachments
package
youtrack
import
(
"net/http"
)
type
Project
struct
{
ID
string
Name
string
LeadLogin
string
Users
[]
*
User
Subsystems
[]
string
Versions
[]
string
Issues
[]
*
Issue
}
func
(
c
*
Client
)
CreateProject
(
p
*
Project
)
error
{
req
,
err
:=
http
.
NewRequest
(
http
.
MethodPut
,
c
.
uri
+
"/admin/project/"
+
p
.
ID
,
nil
,
)
if
err
!=
nil
{
return
err
}
q
:=
req
.
URL
.
Query
()
q
.
Add
(
"projectName"
,
p
.
Name
)
q
.
Add
(
"projectLeadLogin"
,
p
.
LeadLogin
)
req
.
URL
.
RawQuery
=
q
.
Encode
()
req
.
Header
.
Set
(
"Content-Length"
,
"0"
)
resp
,
err
:=
c
.
client
.
Do
(
req
)
if
err
!=
nil
{
return
err
}
defer
resp
.
Body
.
Close
()
if
err
:=
c
.
checkStatus
(
resp
,
http
.
StatusCreated
);
err
!=
nil
{
return
err
}
return
nil
}