@@ -49,6 +49,11 @@ public struct GitHubCopilotCodeSuggestion: Codable, Equatable {
4949 public var displayText : String
5050}
5151
52+ enum GitHubCopilotChatSource : String , Codable {
53+ case panel
54+ case inline
55+ }
56+
5257enum GitHubCopilotRequest {
5358 struct SetEditorInfo : GitHubCopilotRequestType {
5459 struct Response : Codable { }
@@ -330,5 +335,126 @@ enum GitHubCopilotRequest {
330335 ] ) )
331336 }
332337 }
338+
339+ struct ConversationCreate : GitHubCopilotRequestType {
340+ struct Response : Codable {
341+ var conversationId : String
342+ var turnId : String
343+ }
344+
345+ struct RequestBody : Codable {
346+ var workDoneToken : String
347+ var turns : [ Turn ] ; struct Turn : Codable {
348+ var request : String
349+ var response : String ?
350+ }
351+
352+ var capabilities : [ Capabilities ] ; struct Capabilities : Codable {
353+ var allSkills : Bool ?
354+ var skills : [ String ]
355+ }
356+
357+ var options : [ String : String ] ?
358+ var doc : GitHubCopilotDoc ?
359+ var computeSuggestions : Bool ?
360+ var references : [ Reference ] ? ; struct Reference : Codable {
361+ var uri : String
362+ var position : Position ?
363+ var visibleRange : CursorRange ?
364+ var selectionRange : CursorRange ?
365+ var openedAt : Date ?
366+ var activatedAt : Date ?
367+ }
368+
369+ var source : GitHubCopilotChatSource ? // inline or panel
370+ var workspaceFolder : String ?
371+ }
372+
373+ let requestBody : RequestBody
374+
375+ var request : ClientRequest {
376+ let data = ( try ? JSONEncoder ( ) . encode ( requestBody) ) ?? Data ( )
377+ let dict = ( try ? JSONDecoder ( ) . decode ( JSONValue . self, from: data) ) ?? . hash( [ : ] )
378+ return . custom( " conversation/create " , . hash( [
379+ " doc " : dict,
380+ ] ) )
381+ }
382+ }
383+
384+ struct ConversationTurn : GitHubCopilotRequestType {
385+ struct Response : Codable { }
386+
387+ struct RequestBody : Codable {
388+ var workDoneToken : String
389+ var conversationId : String
390+ var message : String
391+ var followUp : FollowUp ? ; struct FollowUp : Codable {
392+ var id : String
393+ var type : String
394+ }
395+
396+ var options : [ String : String ] ?
397+ var doc : GitHubCopilotDoc ?
398+ var computeSuggestions : Bool ?
399+ var references : [ Reference ] ? ; struct Reference : Codable {
400+ var uri : String
401+ var position : Position ?
402+ var visibleRange : CursorRange ?
403+ var selectionRange : CursorRange ?
404+ var openedAt : Date ?
405+ var activatedAt : Date ?
406+ }
407+
408+ var workspaceFolder : String ?
409+ }
410+
411+ let requestBody : RequestBody
412+
413+ var request : ClientRequest {
414+ let data = ( try ? JSONEncoder ( ) . encode ( requestBody) ) ?? Data ( )
415+ let dict = ( try ? JSONDecoder ( ) . decode ( JSONValue . self, from: data) ) ?? . hash( [ : ] )
416+ return . custom( " conversation/turn " , . hash( [
417+ " doc " : dict,
418+ ] ) )
419+ }
420+ }
421+
422+ struct ConversationTurnDelete : GitHubCopilotRequestType {
423+ struct Response : Codable { }
424+
425+ struct RequestBody : Codable {
426+ var conversationId : String
427+ var turnId : String
428+ var options : [ String : String ] ?
429+ var source : GitHubCopilotChatSource ?
430+ }
431+
432+ let requestBody : RequestBody
433+
434+ var request : ClientRequest {
435+ let data = ( try ? JSONEncoder ( ) . encode ( requestBody) ) ?? Data ( )
436+ let dict = ( try ? JSONDecoder ( ) . decode ( JSONValue . self, from: data) ) ?? . hash( [ : ] )
437+ return . custom( " conversation/turnDelete " , . hash( [
438+ " doc " : dict,
439+ ] ) )
440+ }
441+ }
442+
443+ struct ConversationDestroy : GitHubCopilotRequestType {
444+ struct Response : Codable { }
445+
446+ struct RequestBody : Codable {
447+ var conversationId : String
448+ var options : [ String : String ] ?
449+ }
450+
451+ let requestBody : RequestBody
452+
453+ var request : ClientRequest {
454+ let data = ( try ? JSONEncoder ( ) . encode ( requestBody) ) ?? Data ( )
455+ let dict = ( try ? JSONDecoder ( ) . decode ( JSONValue . self, from: data) ) ?? . hash( [ : ] )
456+ return . custom( " conversation/destroy " , dict)
457+ }
458+ }
333459}
334460
0 commit comments