|
@@ -53,6 +53,10 @@ func (client *Client) InvokePostMethodJson(appID string, methodName string, json
|
|
|
return client.invokeMethodJson(appID, methodName, "post", jsonData)
|
|
|
}
|
|
|
|
|
|
+func (client *Client) InvokePostMethodMultipart(appID string, methodName string, data []byte) ([]byte, error) {
|
|
|
+ return client.invokeMethodWithContentType(appID, methodName, "post", "multipart/form-data", data)
|
|
|
+}
|
|
|
+
|
|
|
func (client *Client) InvokePutMethodJson(appID string, methodName string, jsonData []byte) ([]byte, error) {
|
|
|
return client.invokeMethodJson(appID, methodName, "put", jsonData)
|
|
|
}
|
|
@@ -86,6 +90,17 @@ func (client *Client) invokeMethodJson(appID string, methodName string, verb str
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+func (client *Client) invokeMethodWithContentType(appID string, methodName string, verb string, contentType string, data []byte) ([]byte, error) {
|
|
|
+ ctx, cancel := context.WithTimeout(context.Background(), time.Duration(client.timeoutSec)*time.Second)
|
|
|
+ defer cancel()
|
|
|
+
|
|
|
+ return client.client.InvokeMethodWithContent(ctx, appID, methodName, verb,
|
|
|
+ &dapr.DataContent{
|
|
|
+ Data: data,
|
|
|
+ ContentType: contentType,
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
func (client *Client) SaveState(stateStoreName string, key string, value []byte, meta map[string]string, so ...dapr.StateOption) error {
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(client.timeoutSec)*time.Second)
|
|
|
defer cancel()
|