Class: Vellum::AsyncWorkflowDeploymentsClient

Inherits:
Object
  • Object
show all
Defined in:
lib/vellum_ai/workflow_deployments/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ AsyncWorkflowDeploymentsClient

Parameters:



64
65
66
67
# File 'lib/vellum_ai/workflow_deployments/client.rb', line 64

def initialize(request_client:)
  # @type [AsyncRequestClient]
  @request_client = request_client
end

Instance Attribute Details

#request_clientObject (readonly)

Returns the value of attribute request_client.



60
61
62
# File 'lib/vellum_ai/workflow_deployments/client.rb', line 60

def request_client
  @request_client
end

Instance Method Details

#list(limit: nil, offset: nil, ordering: nil, status: nil, request_options: nil) ⇒ PaginatedSlimWorkflowDeploymentList

Parameters:

  • limit (Integer) (defaults to: nil)

    Number of results to return per page.

  • offset (Integer) (defaults to: nil)

    The initial index from which to return the results.

  • ordering (String) (defaults to: nil)

    Which field to use when ordering the results.

  • status (WORKFLOW_DEPLOYMENTS_LIST_REQUEST_STATUS) (defaults to: nil)

    status

  • request_options (RequestOptions) (defaults to: nil)

Returns:



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/vellum_ai/workflow_deployments/client.rb', line 75

def list(limit: nil, offset: nil, ordering: nil, status: nil, request_options: nil)
  Async do
    response = @request_client.conn.get do |req|
      req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
      req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
      req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
      req.params = {
        **(request_options&.additional_query_parameters || {}),
        "limit": limit,
        "offset": offset,
        "ordering": ordering,
        "status": status
      }.compact
      req.url "#{@request_client.default_environment[:Default]}/v1/workflow-deployments"
    end
    PaginatedSlimWorkflowDeploymentList.from_json(json_object: response.body)
  end
end

#retrieve(id:, request_options: nil) ⇒ WorkflowDeploymentRead

Used to retrieve a workflow deployment given its ID or name.

Parameters:

  • id (String)

    Either the Workflow Deployment’s ID or its unique name

  • request_options (RequestOptions) (defaults to: nil)

Returns:



99
100
101
102
103
104
105
106
107
108
109
# File 'lib/vellum_ai/workflow_deployments/client.rb', line 99

def retrieve(id:, request_options: nil)
  Async do
    response = @request_client.conn.get do |req|
      req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
      req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
      req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
      req.url "#{@request_client.default_environment[:Default]}/v1/workflow-deployments/#{id}"
    end
    WorkflowDeploymentRead.from_json(json_object: response.body)
  end
end