github.com/djarvur/go-swagger@v0.18.0/examples/task-tracker/client/tasks/tasks_client.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package tasks
     4  
     5  // This file was generated by the swagger tool.
     6  // Editing this file might prove futile when you re-run the swagger generate command
     7  
     8  import (
     9  	"github.com/go-openapi/runtime"
    10  
    11  	strfmt "github.com/go-openapi/strfmt"
    12  )
    13  
    14  // New creates a new tasks API client.
    15  func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
    16  	return &Client{transport: transport, formats: formats}
    17  }
    18  
    19  /*
    20  Client for tasks API
    21  */
    22  type Client struct {
    23  	transport runtime.ClientTransport
    24  	formats   strfmt.Registry
    25  }
    26  
    27  /*
    28  AddCommentToTask adds a comment to a task
    29  
    30  The comment can contain ___github markdown___ syntax.
    31  Fenced codeblocks etc are supported through pygments.
    32  
    33  */
    34  func (a *Client) AddCommentToTask(params *AddCommentToTaskParams, authInfo runtime.ClientAuthInfoWriter) (*AddCommentToTaskCreated, error) {
    35  	// TODO: Validate the params before sending
    36  	if params == nil {
    37  		params = NewAddCommentToTaskParams()
    38  	}
    39  
    40  	result, err := a.transport.Submit(&runtime.ClientOperation{
    41  		ID:                 "addCommentToTask",
    42  		Method:             "POST",
    43  		PathPattern:        "/tasks/{id}/comments",
    44  		ProducesMediaTypes: []string{"application/vnd.goswagger.examples.task-tracker.v1+json"},
    45  		ConsumesMediaTypes: []string{"application/vnd.goswagger.examples.task-tracker.v1+json"},
    46  		Schemes:            []string{"http", "https"},
    47  		Params:             params,
    48  		Reader:             &AddCommentToTaskReader{formats: a.formats},
    49  		AuthInfo:           authInfo,
    50  		Context:            params.Context,
    51  		Client:             params.HTTPClient,
    52  	})
    53  	if err != nil {
    54  		return nil, err
    55  	}
    56  	return result.(*AddCommentToTaskCreated), nil
    57  
    58  }
    59  
    60  /*
    61  CreateTask creates a task object
    62  
    63  Allows for creating a task.
    64  This operation requires authentication so that we know which user
    65  created the task.
    66  
    67  */
    68  func (a *Client) CreateTask(params *CreateTaskParams, authInfo runtime.ClientAuthInfoWriter) (*CreateTaskCreated, error) {
    69  	// TODO: Validate the params before sending
    70  	if params == nil {
    71  		params = NewCreateTaskParams()
    72  	}
    73  
    74  	result, err := a.transport.Submit(&runtime.ClientOperation{
    75  		ID:                 "createTask",
    76  		Method:             "POST",
    77  		PathPattern:        "/tasks",
    78  		ProducesMediaTypes: []string{"application/vnd.goswagger.examples.task-tracker.v1+json"},
    79  		ConsumesMediaTypes: []string{"application/vnd.goswagger.examples.task-tracker.v1+json"},
    80  		Schemes:            []string{"http", "https"},
    81  		Params:             params,
    82  		Reader:             &CreateTaskReader{formats: a.formats},
    83  		AuthInfo:           authInfo,
    84  		Context:            params.Context,
    85  		Client:             params.HTTPClient,
    86  	})
    87  	if err != nil {
    88  		return nil, err
    89  	}
    90  	return result.(*CreateTaskCreated), nil
    91  
    92  }
    93  
    94  /*
    95  DeleteTask deletes a task
    96  
    97  This is a soft delete and changes the task status to ignored.
    98  
    99  */
   100  func (a *Client) DeleteTask(params *DeleteTaskParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteTaskNoContent, error) {
   101  	// TODO: Validate the params before sending
   102  	if params == nil {
   103  		params = NewDeleteTaskParams()
   104  	}
   105  
   106  	result, err := a.transport.Submit(&runtime.ClientOperation{
   107  		ID:                 "deleteTask",
   108  		Method:             "DELETE",
   109  		PathPattern:        "/tasks/{id}",
   110  		ProducesMediaTypes: []string{"application/vnd.goswagger.examples.task-tracker.v1+json"},
   111  		ConsumesMediaTypes: []string{"application/vnd.goswagger.examples.task-tracker.v1+json"},
   112  		Schemes:            []string{"http", "https"},
   113  		Params:             params,
   114  		Reader:             &DeleteTaskReader{formats: a.formats},
   115  		AuthInfo:           authInfo,
   116  		Context:            params.Context,
   117  		Client:             params.HTTPClient,
   118  	})
   119  	if err != nil {
   120  		return nil, err
   121  	}
   122  	return result.(*DeleteTaskNoContent), nil
   123  
   124  }
   125  
   126  /*
   127  GetTaskComments gets the comments for a task
   128  
   129  The comments require a size parameter.
   130  
   131  */
   132  func (a *Client) GetTaskComments(params *GetTaskCommentsParams) (*GetTaskCommentsOK, error) {
   133  	// TODO: Validate the params before sending
   134  	if params == nil {
   135  		params = NewGetTaskCommentsParams()
   136  	}
   137  
   138  	result, err := a.transport.Submit(&runtime.ClientOperation{
   139  		ID:                 "getTaskComments",
   140  		Method:             "GET",
   141  		PathPattern:        "/tasks/{id}/comments",
   142  		ProducesMediaTypes: []string{"application/vnd.goswagger.examples.task-tracker.v1+json"},
   143  		ConsumesMediaTypes: []string{"application/vnd.goswagger.examples.task-tracker.v1+json"},
   144  		Schemes:            []string{"http", "https"},
   145  		Params:             params,
   146  		Reader:             &GetTaskCommentsReader{formats: a.formats},
   147  		Context:            params.Context,
   148  		Client:             params.HTTPClient,
   149  	})
   150  	if err != nil {
   151  		return nil, err
   152  	}
   153  	return result.(*GetTaskCommentsOK), nil
   154  
   155  }
   156  
   157  /*
   158  GetTaskDetails gets the details for a task
   159  
   160  The details view has more information than the card view.
   161  You can see who reported the issue and who last updated it when.
   162  
   163  There are also comments for each issue.
   164  
   165  */
   166  func (a *Client) GetTaskDetails(params *GetTaskDetailsParams) (*GetTaskDetailsOK, error) {
   167  	// TODO: Validate the params before sending
   168  	if params == nil {
   169  		params = NewGetTaskDetailsParams()
   170  	}
   171  
   172  	result, err := a.transport.Submit(&runtime.ClientOperation{
   173  		ID:                 "getTaskDetails",
   174  		Method:             "GET",
   175  		PathPattern:        "/tasks/{id}",
   176  		ProducesMediaTypes: []string{"application/vnd.goswagger.examples.task-tracker.v1+json"},
   177  		ConsumesMediaTypes: []string{"application/vnd.goswagger.examples.task-tracker.v1+json"},
   178  		Schemes:            []string{"http", "https"},
   179  		Params:             params,
   180  		Reader:             &GetTaskDetailsReader{formats: a.formats},
   181  		Context:            params.Context,
   182  		Client:             params.HTTPClient,
   183  	})
   184  	if err != nil {
   185  		return nil, err
   186  	}
   187  	return result.(*GetTaskDetailsOK), nil
   188  
   189  }
   190  
   191  /*
   192  ListTasks lists the tasks
   193  
   194  Allows for specifying a number of filter parameters to
   195  narrow down the results.
   196  Also allows for specifying a **sinceId** and **pageSize** parameter
   197  to page through large result sets.
   198  
   199  */
   200  func (a *Client) ListTasks(params *ListTasksParams) (*ListTasksOK, error) {
   201  	// TODO: Validate the params before sending
   202  	if params == nil {
   203  		params = NewListTasksParams()
   204  	}
   205  
   206  	result, err := a.transport.Submit(&runtime.ClientOperation{
   207  		ID:                 "listTasks",
   208  		Method:             "GET",
   209  		PathPattern:        "/tasks",
   210  		ProducesMediaTypes: []string{"application/vnd.goswagger.examples.task-tracker.v1+json"},
   211  		ConsumesMediaTypes: []string{"application/vnd.goswagger.examples.task-tracker.v1+json"},
   212  		Schemes:            []string{"http", "https"},
   213  		Params:             params,
   214  		Reader:             &ListTasksReader{formats: a.formats},
   215  		Context:            params.Context,
   216  		Client:             params.HTTPClient,
   217  	})
   218  	if err != nil {
   219  		return nil, err
   220  	}
   221  	return result.(*ListTasksOK), nil
   222  
   223  }
   224  
   225  /*
   226  UpdateTask updates the details for a task
   227  
   228  Allows for updating a task.
   229  This operation requires authentication so that we know which user
   230  last updated the task.
   231  
   232  */
   233  func (a *Client) UpdateTask(params *UpdateTaskParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateTaskOK, error) {
   234  	// TODO: Validate the params before sending
   235  	if params == nil {
   236  		params = NewUpdateTaskParams()
   237  	}
   238  
   239  	result, err := a.transport.Submit(&runtime.ClientOperation{
   240  		ID:                 "updateTask",
   241  		Method:             "PUT",
   242  		PathPattern:        "/tasks/{id}",
   243  		ProducesMediaTypes: []string{"application/vnd.goswagger.examples.task-tracker.v1+json"},
   244  		ConsumesMediaTypes: []string{"application/vnd.goswagger.examples.task-tracker.v1+json"},
   245  		Schemes:            []string{"http", "https"},
   246  		Params:             params,
   247  		Reader:             &UpdateTaskReader{formats: a.formats},
   248  		AuthInfo:           authInfo,
   249  		Context:            params.Context,
   250  		Client:             params.HTTPClient,
   251  	})
   252  	if err != nil {
   253  		return nil, err
   254  	}
   255  	return result.(*UpdateTaskOK), nil
   256  
   257  }
   258  
   259  /*
   260  UploadTaskFile adds a file to a task
   261  
   262  The file can't be larger than **5MB**
   263  */
   264  func (a *Client) UploadTaskFile(params *UploadTaskFileParams, authInfo runtime.ClientAuthInfoWriter) (*UploadTaskFileCreated, error) {
   265  	// TODO: Validate the params before sending
   266  	if params == nil {
   267  		params = NewUploadTaskFileParams()
   268  	}
   269  
   270  	result, err := a.transport.Submit(&runtime.ClientOperation{
   271  		ID:                 "uploadTaskFile",
   272  		Method:             "POST",
   273  		PathPattern:        "/tasks/{id}/files",
   274  		ProducesMediaTypes: []string{"application/vnd.goswagger.examples.task-tracker.v1+json"},
   275  		ConsumesMediaTypes: []string{"multipart/form-data"},
   276  		Schemes:            []string{"http", "https"},
   277  		Params:             params,
   278  		Reader:             &UploadTaskFileReader{formats: a.formats},
   279  		AuthInfo:           authInfo,
   280  		Context:            params.Context,
   281  		Client:             params.HTTPClient,
   282  	})
   283  	if err != nil {
   284  		return nil, err
   285  	}
   286  	return result.(*UploadTaskFileCreated), nil
   287  
   288  }
   289  
   290  // SetTransport changes the transport on the client
   291  func (a *Client) SetTransport(transport runtime.ClientTransport) {
   292  	a.transport = transport
   293  }