mirror of
https://github.com/jdalrymple/gitbeaker.git
synced 2026-01-18 15:55:30 +00:00
Handle position arguments correctly (#2423)
This commit is contained in:
parent
36cb7857a9
commit
0bf87da2a9
@ -81,15 +81,25 @@ export class ResourceDiscussions<C extends boolean = false> extends BaseResource
|
||||
resourceId: string | number,
|
||||
resource2Id: string | number,
|
||||
body: string,
|
||||
options?: BaseRequestOptions,
|
||||
{ position, ...options }: { position?: Record<string, unknown> } & BaseRequestOptions = {},
|
||||
) {
|
||||
const opts = { ...options };
|
||||
|
||||
if (position) {
|
||||
opts.isForm = true;
|
||||
opts.body = body;
|
||||
|
||||
Object.entries(position).forEach(([k, v]) => {
|
||||
opts[`position[${k}]`] = v;
|
||||
});
|
||||
} else {
|
||||
opts.query = { body };
|
||||
}
|
||||
|
||||
return RequestHelper.post<DiscussionSchema>()(
|
||||
this,
|
||||
endpoint`${resourceId}/${this.resource2Type}/${resource2Id}/discussions`,
|
||||
{
|
||||
query: { body },
|
||||
...options,
|
||||
},
|
||||
opts,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user